@marcel91200 / caddy Mirror · read-only / commits / f74fed3f
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

v2: only compare TLS protocol versions if both are set (#3005)

Mohammed Al Sahaf committed Feb 3, 2020 at 19:25 UTC f74fed3f544651c1870d285011598d4fef5e205b
1 file changed +3 -3
modules/caddytls/connpolicy.go
+3 -3
@@ -222,15 +222,15 @@ func (p *ConnectionPolicy) buildStandardTLSConfig(ctx caddy.Context) error {
222 }
223
224 // min and max protocol versions
225 + if (p.ProtocolMin != "" && p.ProtocolMax != "") && p.ProtocolMin > p.ProtocolMax {
226 + return fmt.Errorf("protocol min (%x) cannot be greater than protocol max (%x)", p.ProtocolMin, p.ProtocolMax)
227 + }
228 if p.ProtocolMin != "" {
229 cfg.MinVersion = SupportedProtocols[p.ProtocolMin]
230 }
231 if p.ProtocolMax != "" {
232 cfg.MaxVersion = SupportedProtocols[p.ProtocolMax]
233 }
231 - if p.ProtocolMin > p.ProtocolMax {
232 - return fmt.Errorf("protocol min (%x) cannot be greater than protocol max (%x)", p.ProtocolMin, p.ProtocolMax)
233 - }
234
235 // client authentication
236 if p.ClientAuthentication != nil {