From 9baac198258899c8b1f6d112ec52a8180cedd153 Mon Sep 17 00:00:00 2001 From: XOF Date: Sun, 28 Dec 2025 14:59:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20main.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index caefd12..b9da6b3 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,8 @@ var client = &http.Client{ req.Header[key] = val } } - // S3 重定向时添加必要的头 + + // S3 重定向时添加必要的头 if strings.Contains(req.URL.Host, "amazonaws.com") { req.Header.Set("x-amz-content-sha256", "UNSIGNED-PAYLOAD") } @@ -514,6 +515,9 @@ func sendRequestWithContext(ctx context.Context, method, url string, headers htt } req.Header = headers + + // 为可能的 S3 重定向预先添加头 + req.Header.Set("x-amz-content-sha256", "UNSIGNED-PAYLOAD") startTime := time.Now() resp, err := client.Do(req)