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

Ranges and Content and Transfer Encoding #11

Closed
martinthomson opened this issue Dec 22, 2015 · 3 comments · Fixed by #323
Closed

Ranges and Content and Transfer Encoding #11

martinthomson opened this issue Dec 22, 2015 · 3 comments · Fixed by #323

Comments

@martinthomson
Copy link
Contributor

RFC 7233 does not mention content encoding at all. Same for transfer encoding. I assume that is because this is completely unspecified and therefore completely unreliable, however, for my sanity...

My reading is that a 206 response includes ranges of the encoded message, and that the content-encoding applies to the complete message body prior to being split into ranges. Thus, if I had a "x2" content encoding that turned "Hello World!" into "HHeelllloo WWoorrlldd!!", asking for bytes 3-5 would get you "eel" and not "llo".

The text in Section 4.1 suggests that you would not include a Content-Encoding header field if the client used If-Range on the expectation that they already know. That seems pretty dangerous, but it's consistent with the idea that you are repairing a larger message.

On the other hand, I have to assume that a Transfer-Encoding applies after the range request.

@enygren
Copy link

enygren commented Apr 6, 2016

This is also potentially weird in the case where a client specifies multiple Accept-Encodings and a Range request, such as "Accept-Encoding: gzip, br". In these cases, the bytes returned will depend on which Content-Encoding is selected by the server. (As minimal operational guidance, clients presumably will need to be very careful about this and may need to limit which encodings they accept for subsequent ranges requests based on what was returned from the first, or be prepared to get the full object back.)

@mnot
Copy link
Member

mnot commented Apr 11, 2016

RFC7233 Section 3.1 says:

The "Range" header field on a GET request modifies the method semantics to request transfer of only one or more subranges of the selected representation data, rather than the entire selected representation data.

RFC7231 Section 3.1.2.2 says:

Unlike Transfer-Encoding (Section 3.3.1 of [RFC7230]), the codings listed in Content-Encoding are a characteristic of the representation; the representation is defined in terms of the coded form, and all other metadata about the representation is about the coded form unless otherwise noted in the metadata definition.

That gives you all the information you should need. Could it be clearer? Probably. A hyperlink to defining terms would probably help.

@mnot mnot added the ranges label Jun 20, 2017
@mnot mnot changed the title RFC 7233: Content and Transfer Encoding Ranges and Content and Transfer Encoding Jun 5, 2018
@reschke reschke added semantics and removed ranges labels Jun 29, 2018
@royfielding royfielding self-assigned this Mar 31, 2019
royfielding added a commit that referenced this issue Apr 4, 2019
@reschke
Copy link
Contributor

reschke commented Jan 7, 2020

I believe this issue can be closed.

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

Successfully merging a pull request may close this issue.

5 participants