Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETag 和 签名算法的问题 #8

Closed
forsaken628 opened this issue Jun 20, 2017 · 5 comments
Closed

ETag 和 签名算法的问题 #8

forsaken628 opened this issue Jun 20, 2017 · 5 comments

Comments

@forsaken628
Copy link
Contributor

  1. 很无语,ETag,到底是什么算法?怎么调接口调着调着就从sha1变成md5了。。。。。如果是算法不确定文档里写清楚啊。然而sdk里的逻辑:
计算完分块的 ETag 值,以及获取到上传成功的文件分块的 ETag ,然后合并两者,更新需要上传的分块
  1. x-cos-content-sha1,貌似不校验?

  2. 签名算法urlencode更蛋疼。golang的实现空格转义为+,js的实现转义为%20;golang的实现/转义为%2F,js的实现转义为%2f,其他还有什么坑还不知道,难道我要把相关库重新实现一遍么?

@carsonxu
Copy link
Collaborator

carsonxu commented Jun 21, 2017

问题 3,如果把签名放在 header 里的 authorization 字段里就不需要 urlencode,也就没这个编码问题。
如果是要放在 url 的 sign 参数,这里不同语言不一致,再做一层转义替换就好。

问题 1 和 2 我们这边再确认下问题。

@mozillazg
Copy link

@forsaken628 关于 golang 的问题,我写了一个 golang sdk: https://github.com/mozillazg/go-cos
封装了所有的 XML API,可以供你参考。

@forsaken628
Copy link
Contributor Author

什么时候能把1.3.0版本发出来啊?等着用呢

@carsonxu
Copy link
Collaborator

carsonxu commented Jul 8, 2017

已发布 v2.0.0

@carsonxu carsonxu closed this as completed Jul 8, 2017
@carsonxu
Copy link
Collaborator

carsonxu commented Jul 12, 2017

@forsaken628 这边 url encode 可以按照以下这个标准:
encode 前(最前面的 xxx 后有个空格):
xxx "#$%&+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^`abcdefghijklmnopqrstuvwxyz{|}~xxx
encode 后:
xxx%20%22%23%24%25%26%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E
%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~xxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants