Browse Source

Merge pull request #157 from agin719/cos-v4-dev

update auth signed header
master
agin719 3 years ago
committed by GitHub
parent
commit
179621e96b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      auth.go

8
auth.go

@ -29,7 +29,7 @@ var (
)
// 需要校验的 Headers 列表
var needSignHeaders = map[string]bool{
var NeedSignHeaders = map[string]bool{
"host": true,
"range": true,
"x-cos-acl": true,
@ -65,6 +65,10 @@ var ciParameters = map[string]bool{
"imageview2/": true,
}
func SetNeedSignHeaders(key string, val bool) {
NeedSignHeaders[key] = val
}
func safeURLEncode(s string) string {
s = encodeURIComponent(s)
s = strings.Replace(s, "!", "%21", -1)
@ -275,7 +279,7 @@ func isCIParameter(key string) bool {
}
func isSignHeader(key string) bool {
for k, v := range needSignHeaders {
for k, v := range NeedSignHeaders {
if key == k && v {
return true
}

Loading…
Cancel
Save