更新 main.go
This commit is contained in:
6
main.go
6
main.go
@@ -38,7 +38,8 @@ var client = &http.Client{
|
|||||||
req.Header[key] = val
|
req.Header[key] = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// S3 重定向时添加必要的头
|
|
||||||
|
// S3 重定向时添加必要的头
|
||||||
if strings.Contains(req.URL.Host, "amazonaws.com") {
|
if strings.Contains(req.URL.Host, "amazonaws.com") {
|
||||||
req.Header.Set("x-amz-content-sha256", "UNSIGNED-PAYLOAD")
|
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
|
req.Header = headers
|
||||||
|
|
||||||
|
// 为可能的 S3 重定向预先添加头
|
||||||
|
req.Header.Set("x-amz-content-sha256", "UNSIGNED-PAYLOAD")
|
||||||
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|||||||
Reference in New Issue
Block a user