0017-00000505

Updated at:

Error code 0017-00000505 indicates a Content-Length mismatch: the body size that a request declares in its header differs from the number of bytes the request actually sends. The following sections describe the cause of the mismatch, an example request that triggers it, and how to correct the declared value.

Problem description

The value of the Content-Length header does not match the size of the request body.

Causes

The request specifies the Content-Length header, but the value it declares is not the number of bytes that the request body contains. The incorrect value originates in the logic that calculates Content-Length before the client sends the request.

Examples

The following PUT request specifies a Content-Length value that does not match the size of the request body:

PUT /oss.jpg HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Cache-control: no-cache
Expires: Fri, 28 Feb 2012 05:38:42 GMT
Content-Encoding: utf-8
Content-Disposition: attachment;filename=oss_download.jpg
Date: Fri, 24 Feb 2012 06:03:28 GMT
Content-Type: image/jpeg
Content-Length: 344606
x-oss-storage-class: Archive
Authorization: OSS qn6q**************:77Dv****************
[341606 bytes of object data]

The header declares Content-Length: 344606, but the body that follows carries 341606 bytes — 3,000 bytes fewer than the declared value.

Solutions

Check the logic that calculates Content-Length and make sure that the value it sets equals the size of the request body.

References

PutObject