From 21f0d959f0b56aaf1016bffd830bccf3ce3a9ae0 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 29 Oct 2025 14:33:47 -0700 Subject: [PATCH] address comments --- weed/s3api/auth_signature_v4.go | 2 +- weed/s3api/auto_signature_v4_test.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/weed/s3api/auth_signature_v4.go b/weed/s3api/auth_signature_v4.go index c199e2ea2..769020e77 100644 --- a/weed/s3api/auth_signature_v4.go +++ b/weed/s3api/auth_signature_v4.go @@ -597,7 +597,7 @@ func extractHostHeader(r *http.Request) string { // If X-Forwarded-Host is set, use that as the host. // If X-Forwarded-Port is set, use that too to form the host. - // If X-Forwarded-Proto is set, check if is it default to omit the port. + // If X-Forwarded-Proto is set, check if it is default to omit the port. if forwardedHost != "" { extractedHost := forwardedHost host, port, err := net.SplitHostPort(extractedHost) diff --git a/weed/s3api/auto_signature_v4_test.go b/weed/s3api/auto_signature_v4_test.go index 99ed23ba5..b1c6259c8 100644 --- a/weed/s3api/auto_signature_v4_test.go +++ b/weed/s3api/auto_signature_v4_test.go @@ -419,7 +419,7 @@ func TestSignatureV4WithoutProxy(t *testing.T) { }, { name: "HTTPS with standard port", - host: "backend:433", + host: "backend:443", proto: "https", expectedHost: "backend", }, @@ -455,7 +455,7 @@ func TestSignatureV4WithoutProxy(t *testing.T) { }, { name: "IPv6 HTTPS with standard port", - host: "[::1]:433", + host: "[::1]:443", proto: "https", expectedHost: "::1", }, @@ -582,9 +582,9 @@ func TestSignatureV4WithForwardedPort(t *testing.T) { }, { name: "X-Forwarded-Host with standard https port already included (Traefik/HAProxy style)", - host: "backend:433", - forwardedHost: "127.0.0.1:433", - forwardedPort: "433", + host: "backend:443", + forwardedHost: "127.0.0.1:443", + forwardedPort: "443", forwardedProto: "https", expectedHost: "127.0.0.1", }, @@ -598,9 +598,9 @@ func TestSignatureV4WithForwardedPort(t *testing.T) { }, { name: "IPv6 X-Forwarded-Host with standard https port already included (Traefik/HAProxy style)", - host: "backend:433", - forwardedHost: "[::1]:433", - forwardedPort: "433", + host: "backend:443", + forwardedHost: "[::1]:443", + forwardedPort: "443", forwardedProto: "https", expectedHost: "::1", },