Skip to content

Commit 94500d5

Browse files
committed
as per review
Signed-off-by: Andrew Thornton <[email protected]>
1 parent b7843af commit 94500d5

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

cmd/web_https.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ import (
1717
)
1818

1919
func toTLSVersion(version string) uint16 {
20-
version = strings.TrimSpace(strings.ToLower(version))
21-
switch version {
22-
case "tls10":
20+
switch strings.TrimSpace(strings.ToLower(version)) {
21+
case "tlsv1.0":
2322
return tls.VersionTLS10
24-
case "tls11":
23+
case "tlsv1.1":
2524
return tls.VersionTLS11
26-
case "tls12":
25+
case "tlsv1.2":
2726
return tls.VersionTLS12
28-
case "tls13":
27+
case "tlsv1.3":
2928
return tls.VersionTLS13
3029
default:
3130
log.Warn("Unknown tls version: %s", version)
@@ -36,9 +35,8 @@ func toTLSVersion(version string) uint16 {
3635
func toCurvePreferences(preferences []string) []tls.CurveID {
3736
ids := make([]tls.CurveID, 0, len(preferences))
3837
for _, pref := range preferences {
39-
pref = strings.TrimSpace(strings.ToLower(pref))
4038
var id tls.CurveID
41-
switch pref {
39+
switch strings.TrimSpace(strings.ToLower(pref)) {
4240
case "x25519":
4341
id = tls.X25519
4442
case "p256":
@@ -60,9 +58,8 @@ func toCurvePreferences(preferences []string) []tls.CurveID {
6058
func toTLSCiphers(cipherStrings []string) []uint16 {
6159
ciphers := make([]uint16, 0, len(cipherStrings))
6260
for _, cipherString := range cipherStrings {
63-
cipherString = strings.TrimSpace(strings.ToLower(cipherString))
6461
var cipher uint16
65-
switch cipherString {
62+
switch strings.TrimSpace(strings.ToLower(cipherString)) {
6663
case "rsa_with_rc4_128_sha":
6764
cipher = tls.TLS_RSA_WITH_RC4_128_SHA
6865
case "rsa_with_3des_ede_cbc_sha":

0 commit comments

Comments
 (0)