我正在尝试使用libCurl使用我的C / C ++应用程序上传文件(包含一行文本的简单文本文件)。
我注意到了一些事情。
首先......
DropBox API似乎需要'&'代替 '?'在参数列表之前。
第二......
目前还不清楚请求的正文是否需要包含在计算oauth_signature中。
最终,我从DropBox API获得了“身份验证失败”响应。
我已经包含了来自libCurl的调试跟踪以获取更多信息......
SSLv3, TLS alert, Client hello (1):
About to connect() to api-content.dropbox.com port 443 (#0)
Trying 107.22.243.22... Connected to api-content.dropbox.com (107.22.243.22) port 443 (#0)
SSLv3, TLS handshake, Client hello (1):
SSLv3, TLS handshake, Server hello (2):
SSLv3, TLS handshake, CERT (11):
SSLv3, TLS handshake, Server key exchange (12):
SSLv3, TLS handshake, Server finished (14):
SSLv3, TLS handshake, Client key exchange (16):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSLv3, TLS change cipher, Client hello (1):
SSLv3, TLS handshake, Finished (20):
SSL connection using DHE-RSA-AES256-SHA
Server certificate:
subject: C=US; ST=California; L=San Francisco; O=Dropbox, Inc.; OU=IT; CN=*.dropbox.com
start date: 2010-01-06 00:00:00 GMT
expire date: 2012-01-06 23:59:59 GMT
common name: *.dropbox.com (matched)
issuer: C=ZA; ST=Western Cape; L=Cape Town; O=Thawte Consulting cc; OU=Certification Services Division; CN=Thawte Premium Server CA; emailAddress=premium-server@thawte.com
SSL certificate verify ok.
PUT /1/files_put/dropbox/1&file=test%2Etxt&overwrite=true&oauth_consumer_key=asfewasdfas&oauth_nonce=1323293220d0&oauth_signature=asmoa4YE2c%2FuwjDKJRKFILpcn8%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1323293220&oauth_token=fafsesnj13iguxnh&oauth_version=1.0 HTTP/1.1
Host: api-content.dropbox.com
Accept: */*
Content-type: application/json
Content-Length: 24
Expect: 100-continue
HTTP/1.1 100 Continue
Test upload to DropBox.
HTTP/1.1 401 Unauthorized
Server: dbws
Date: Wed, 07 Dec 2011 21:27:00 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
22
{"error": "Authentication failed"}
0
答案 0 :(得分:0)