Clarification needed re: Chunked Transfer Encoding

asked 2011-06-08 08:46:16 -0600

rclocal gravatar image


Re: Chunked Transfer Encoding

The docs say : Users can upload data without needing to know in advance the amount of data to be uploaded. Users can do this by specifying an HTTP header of Transfer-Encoding: chunked and not using a Content-Length header

Could someone please clarify the wording :

(1) Does this mean it is illegal syntax to supply a "Content-Length" header when using chunked encoding ? Or does it only mean that the "Content-Length" header is optional when using chunked encoding, and hence if I DO know the content-length, I can provide it, and the API will use it ?

(2) Similar question in relation to provision of Etag MD5 hash.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2011-06-14 08:48:08 -0600

rclocal gravatar image


Thanks for this.

Discoverd the RFC in the interim period, so it was more the etag I wanted to verify.

edit flag offensive delete link more

answered 2011-06-13 22:38:45 -0600

gholt gravatar image

If you know the content length, you don't need to use chunked transfer encoding because, you know the content length. :) According to the HTTP spec "If a message is received with both a Transfer-Encoding header field and a Content-Length header field, the latter MUST be ignored." I'm uncertain whether that specific case is accounted for in Swift.

The etag is optional but will be computed and stored for you if you don't provide it. Providing an etag is just extra assurance the transfer was not corrupted somehow.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2011-06-08 08:46:16 -0600

Seen: 170 times

Last updated: Jun 14 '11