mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-05 08:38:26 +03:00
v2: only compare TLS protocol versions if both are set (#3005)
This commit is contained in:
parent
8b2ad61220
commit
f74fed3f54
1 changed files with 3 additions and 3 deletions
|
@ -222,15 +222,15 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// min and max protocol versions
|
// min and max protocol versions
|
||||||
|
if (p.ProtocolMin != "" && p.ProtocolMax != "") && p.ProtocolMin > p.ProtocolMax {
|
||||||
|
return fmt.Errorf("protocol min (%x) cannot be greater than protocol max (%x)", p.ProtocolMin, p.ProtocolMax)
|
||||||
|
}
|
||||||
if p.ProtocolMin != "" {
|
if p.ProtocolMin != "" {
|
||||||
cfg.MinVersion = SupportedProtocols[p.ProtocolMin]
|
cfg.MinVersion = SupportedProtocols[p.ProtocolMin]
|
||||||
}
|
}
|
||||||
if p.ProtocolMax != "" {
|
if p.ProtocolMax != "" {
|
||||||
cfg.MaxVersion = SupportedProtocols[p.ProtocolMax]
|
cfg.MaxVersion = SupportedProtocols[p.ProtocolMax]
|
||||||
}
|
}
|
||||||
if p.ProtocolMin > p.ProtocolMax {
|
|
||||||
return fmt.Errorf("protocol min (%x) cannot be greater than protocol max (%x)", p.ProtocolMin, p.ProtocolMax)
|
|
||||||
}
|
|
||||||
|
|
||||||
// client authentication
|
// client authentication
|
||||||
if p.ClientAuthentication != nil {
|
if p.ClientAuthentication != nil {
|
||||||
|
|
Loading…
Reference in a new issue