七牛云存储使用api接口上传下载时随机性的401异常
使用api接口上传下载时随机性的401异常,同样的代码执行两次,第一次401,第二次就OK.时间time第一次跟第二次差几秒,deadline设置为1小时,排除时间同步问题。需要的话可以贴日志,两次请求,除一时间,其它参数一样。
----------以下为日志
11:52:53 009:DEBUG [main] net.bravehorse.http.HttpClient:86 http get:
http://bravehorse.qiniudn.com/test?e=1434603172&token=FE-EQycU67p3...
11:52:53 030:DEBUG [main] org.apache.http.client.protocol.RequestAddCookies:122 CookieSpec selected: best-match
11:52:53 042:DEBUG [main] org.apache.http.client.protocol.RequestAuthCache:75 Auth cache not set in the context
11:52:53 044:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:215 Connection request: [route: {}->
http://bravehorse.qiniudn.com:80][total
kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
11:52:53 067:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:246 Connection leased: [id: 0][route: {}->
http://bravehorse.qiniudn.com:80][total
kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
11:52:53 090:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:217 Opening connection {}->
http://bravehorse.qiniudn.com:80
11:52:53 131:DEBUG [main] org.apache.http.impl.conn.HttpClientConnectionOperator:113 Connecting to bravehorse.qiniudn.com/122.228.94.180:80
11:52:53 151:DEBUG [main] org.apache.http.impl.conn.HttpClientConnectionOperator:127 Connection established 192.168.54.53:50728122.228.94.180:80
11:52:53 152:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:238 Executing request GET /test?e=1434603172&token=FE-EQycU67p3hDrmkK72JPOYgoBlo6BKixliSs5k:H+1aaqPGdGckhIkSN9CW1LFqKRI= HTTP/1.1
11:52:53 152:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:243 Target auth state: UNCHALLENGED
11:52:53 152:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:249 Proxy auth state: UNCHALLENGED
11:52:53 155:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:124 http-outgoing-0 >> GET /test?e=1434603172&token=FE-EQycU67p3hDrmkK72JPOYgoBlo6BKixliSs5k:H+1aaqPGdGckhIkSN9CW1LFqKRI= HTTP/1.1
11:52:53 155:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> Host: bravehorse.qiniudn.com
11:52:53 155:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> Connection: Keep-Alive
11:52:53 155:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
11:52:53 156:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> Accept-Encoding: gzip,deflate
11:52:53 157:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "GET /test?e=1434603172&token=FE-EQycU67p3hDrmkK72JPOYgoBlo6BKixliSs5k:H+1aaqPGdGckhIkSN9CW1LFqKRI= HTTP/1.1[\r][\n]"
11:52:53 157:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "Host: bravehorse.qiniudn.com[\r][\n]"
11:52:53 157:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
11:52:53 158:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36[\r][\n]"
11:52:53 158:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
11:52:53 158:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "[\r][\n]"
11:52:53 219:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "HTTP/1.1 401 Unauthorized[\r][\n]"
11:52:53 220:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Date: Thu, 18 Jun 2015 03:52:55 GMT[\r][\n]"
11:52:53 221:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Server: nginx/1.4.4[\r][\n]"
11:52:53 221:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Content-Type: application/json[\r][\n]"
11:52:53 222:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Content-Length: 38[\r][\n]"
11:52:53 222:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Access-Control-Allow-Origin: *[\r][\n]"
11:52:53 223:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Access-Control-Max-Age: 2592000[\r][\n]"
11:52:53 224:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Log: IO:1/401[\r][\n]"
11:52:53 224:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Private: 1[\r][\n]"
11:52:53 225:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Reqid: qD0AAP4eQ3W2uOgT[\r][\n]"
11:52:53 226:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Via: 1.1 tzh53:8105 (Cdn Cache Server V2.0), 1.1 wenzhou151:6 (Cdn Cache Server V2.0)[\r][\n]"
11:52:53 226:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Connection: close[\r][\n]"
11:52:53 227:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "[\r][\n]"
11:52:53 227:DEBUG [main] org.apache.http.impl.conn.Wire:86 http-outgoing-0 << "{"error":"download token auth failed"}"
11:52:53 234:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:113 http-outgoing-0 << HTTP/1.1 401 Unauthorized
11:52:53 234:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Date: Thu, 18 Jun 2015 03:52:55 GMT
11:52:53 235:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Server: nginx/1.4.4
11:52:53 235:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Content-Type: application/json
11:52:53 236:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Content-Length: 38
11:52:53 236:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Access-Control-Allow-Origin: *
11:52:53 237:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Access-Control-Max-Age: 2592000
11:52:53 237:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Log: IO:1/401
11:52:53 238:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Private: 1
11:52:53 238:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Reqid: qD0AAP4eQ3W2uOgT
11:52:53 239:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Via: 1.1 tzh53:8105 (Cdn Cache Server V2.0), 1.1 wenzhou151:6 (Cdn Cache Server V2.0)
11:52:53 239:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Connection: close
11:52:53 247:DEBUG [main] org.apache.http.impl.auth.HttpAuthenticator:77 Authentication required
11:52:53 250:DEBUG [main] org.apache.http.impl.auth.HttpAuthenticator:107 bravehorse.qiniudn.com:80 requested authentication
11:52:53 251:DEBUG [main] org.apache.http.impl.auth.HttpAuthenticator:111 Response contains no authentication challenges
11:52:53 278:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:87 http-outgoing-0: Shutdown connection
11:52:53 278:DEBUG [main] org.apache.http.impl.execchain.ConnectionHolder:126 Connection discarded
11:52:53 279:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:79 http-outgoing-0: Close connection
11:52:53 279:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:282 Connection released: [id: 0][route: {}->
http://bravehorse.qiniudn.com:80][total
kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
11:53:30 384:DEBUG [main] net.bravehorse.http.HttpClient:86 http get:
http://bravehorse.qiniudn.com/test?e=1434603210&token=FE-EQycU67p3...
11:53:30 405:DEBUG [main] org.apache.http.client.protocol.RequestAddCookies:122 CookieSpec selected: best-match
11:53:30 419:DEBUG [main] org.apache.http.client.protocol.RequestAuthCache:75 Auth cache not set in the context
11:53:30 421:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:215 Connection request: [route: {}->
http://bravehorse.qiniudn.com:80][total
kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
11:53:30 435:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:246 Connection leased: [id: 0][route: {}->
http://bravehorse.qiniudn.com:80][total
kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
11:53:30 446:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:217 Opening connection {}->
http://bravehorse.qiniudn.com:80
11:53:30 449:DEBUG [main] org.apache.http.impl.conn.HttpClientConnectionOperator:113 Connecting to bravehorse.qiniudn.com/122.228.94.180:80
11:53:30 463:DEBUG [main] org.apache.http.impl.conn.HttpClientConnectionOperator:127 Connection established 192.168.54.53:50761122.228.94.180:80
11:53:30 464:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:238 Executing request GET /test?e=1434603210&token=FE-EQycU67p3hDrmkK72JPOYgoBlo6BKixliSs5k:qIZNeolwemtSjisHpTxp5QulwMo= HTTP/1.1
11:53:30 464:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:243 Target auth state: UNCHALLENGED
11:53:30 464:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:249 Proxy auth state: UNCHALLENGED
11:53:30 466:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:124 http-outgoing-0 >> GET /test?e=1434603210&token=FE-EQycU67p3hDrmkK72JPOYgoBlo6BKixliSs5k:qIZNeolwemtSjisHpTxp5QulwMo= HTTP/1.1
11:53:30 467:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> Host: bravehorse.qiniudn.com
11:53:30 467:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> Connection: Keep-Alive
11:53:30 467:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
11:53:30 467:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:127 http-outgoing-0 >> Accept-Encoding: gzip,deflate
11:53:30 468:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "GET /test?e=1434603210&token=FE-EQycU67p3hDrmkK72JPOYgoBlo6BKixliSs5k:qIZNeolwemtSjisHpTxp5QulwMo= HTTP/1.1[\r][\n]"
11:53:30 469:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "Host: bravehorse.qiniudn.com[\r][\n]"
11:53:30 469:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
11:53:30 469:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36[\r][\n]"
11:53:30 469:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
11:53:30 469:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 >> "[\r][\n]"
11:53:30 538:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
11:53:30 538:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Date: Thu, 18 Jun 2015 03:53:32 GMT[\r][\n]"
11:53:30 539:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Server: nginx/1.4.4[\r][\n]"
11:53:30 539:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Content-Type: application/octet-stream[\r][\n]"
11:53:30 539:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Content-Length: 4[\r][\n]"
11:53:30 539:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Accept-Ranges: bytes[\r][\n]"
11:53:30 540:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Access-Control-Allow-Origin: *[\r][\n]"
11:53:30 540:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Access-Control-Max-Age: 2592000[\r][\n]"
11:53:30 540:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Cache-Control: public, max-age=31536000[\r][\n]"
11:53:30 540:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Content-Disposition: inline; filename="test"[\r][\n]"
11:53:30 540:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Content-Transfer-Encoding: binary[\r][\n]"
11:53:30 541:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "ETag: "FqlKj-XMsZumHEwIc9OR6YeYL7vT"[\r][\n]"
11:53:30 541:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Log: mc.g;IO:3[\r][\n]"
11:53:30 541:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Private: 1[\r][\n]"
11:53:30 541:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Reqid: MG4AAJVMryW_uOgT[\r][\n]"
11:53:30 541:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Whom: nb263[\r][\n]"
11:53:30 541:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Qiniu-Zone: 0[\r][\n]"
11:53:30 542:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "X-Via: 1.1 tzh53:8105 (Cdn Cache Server V2.0), 1.1 wenzhou151:6 (Cdn Cache Server V2.0)[\r][\n]"
11:53:30 542:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "Connection: keep-alive[\r][\n]"
11:53:30 542:DEBUG [main] org.apache.http.impl.conn.Wire:72 http-outgoing-0 << "[\r][\n]"
11:53:30 542:DEBUG [main] org.apache.http.impl.conn.Wire:86 http-outgoing-0 << "test"
11:53:30 544:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:113 http-outgoing-0 << HTTP/1.1 200 OK
11:53:30 544:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Date: Thu, 18 Jun 2015 03:53:32 GMT
11:53:30 544:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Server: nginx/1.4.4
11:53:30 544:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Content-Type: application/octet-stream
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Content-Length: 4
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Accept-Ranges: bytes
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Access-Control-Allow-Origin: *
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Access-Control-Max-Age: 2592000
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Cache-Control: public, max-age=31536000
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Content-Disposition: inline; filename="test"
11:53:30 545:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Content-Transfer-Encoding: binary
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << ETag: "FqlKj-XMsZumHEwIc9OR6YeYL7vT"
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Log: mc.g;IO:3
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Private: 1
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Reqid: MG4AAJVMryW_uOgT
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Whom: nb263
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Qiniu-Zone: 0
11:53:30 546:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << X-Via: 1.1 tzh53:8105 (Cdn Cache Server V2.0), 1.1 wenzhou151:6 (Cdn Cache Server V2.0)
11:53:30 547:DEBUG [main] org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 http-outgoing-0 << Connection: keep-alive
11:53:30 549:DEBUG [main] org.apache.http.impl.execchain.MainClientExec:267 Connection can be kept alive indefinitely
11:53:30 560:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:276 Connection [id: 0][route: {}->
http://bravehorse.qiniudn.com:80]
can be kept alive indefinitely
11:53:30 560:DEBUG [main] org.apache.http.impl.conn.PoolingHttpClientConnectionManager:282 Connection released: [id: 0][route: {}->
http://bravehorse.qiniudn.com:80][total
kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
---------日志结束