Skip to content

Commit 179621e

Browse files
authored
Merge pull request #157 from agin719/cos-v4-dev
update auth signed header
2 parents 0c9a029 + 2d8b119 commit 179621e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

auth.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var (
2929
)
3030

3131
// 需要校验的 Headers 列表
32-
var needSignHeaders = map[string]bool{
32+
var NeedSignHeaders = map[string]bool{
3333
"host": true,
3434
"range": true,
3535
"x-cos-acl": true,
@@ -65,6 +65,10 @@ var ciParameters = map[string]bool{
6565
"imageview2/": true,
6666
}
6767

68+
func SetNeedSignHeaders(key string, val bool) {
69+
NeedSignHeaders[key] = val
70+
}
71+
6872
func safeURLEncode(s string) string {
6973
s = encodeURIComponent(s)
7074
s = strings.Replace(s, "!", "%21", -1)
@@ -275,7 +279,7 @@ func isCIParameter(key string) bool {
275279
}
276280

277281
func isSignHeader(key string) bool {
278-
for k, v := range needSignHeaders {
282+
for k, v := range NeedSignHeaders {
279283
if key == k && v {
280284
return true
281285
}

0 commit comments

Comments
 (0)