Browse Source

idiomatic

pull/7398/head
chrislu 1 month ago
parent
commit
a70e43a887
  1. 2
      weed/s3api/auth_signature_v4.go

2
weed/s3api/auth_signature_v4.go

@ -602,7 +602,7 @@ func extractHostHeader(r *http.Request) string {
} }
// An IPv6 address literal must be enclosed in square brackets. // An IPv6 address literal must be enclosed in square brackets.
if strings.Contains(forwardedHost, ":") && !strings.HasPrefix(forwardedHost, "[") {
if ip := net.ParseIP(forwardedHost); ip != nil && ip.To4() == nil {
forwardedHost = "[" + forwardedHost + "]" forwardedHost = "[" + forwardedHost + "]"
} }

Loading…
Cancel
Save