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

Problem with partial responses (Content-Range) #2

Open
joliss opened this issue Sep 29, 2013 · 3 comments
Open

Problem with partial responses (Content-Range) #2

joliss opened this issue Sep 29, 2013 · 3 comments

Comments

@joliss
Copy link

joliss commented Sep 29, 2013

Go's net/http/fs.go sets the Content-Range header based on offsets in the uncompressed files.

But the Content-Range header applies to entity-body (RFC 2616):

14.16 Content-Range

   The Content-Range entity-header is sent with a partial entity-body to
   specify where in the full entity-body the partial body should be
   applied.

And entity-body is defined as the gzipped stream:

       entity-body := Content-Encoding( Content-Type( data ) )

So I believe that if we try to apply gzip encoding transparently, partial responses will become garbled.

I haven't actually tested whether this is a problem, but since I just spent half an hour investigating the RFC, I figured I'd share this with you.

@daaku
Copy link
Owner

daaku commented Sep 30, 2013

Ah, good to know. I'm not terribly familiar with how partial responses work, will try to write some test cases up and see what happens. Or feel free to send a pull request :)

@joliss
Copy link
Author

joliss commented Oct 5, 2013

Another problem might be ETags btw - I believe they may need to be different for the compressed and uncompressed resource. (All of this is trouble because the protocol is kinda broken when it comes to compression.)

@gsauthof
Copy link

Another problem might be ETags btw - I believe they may need to be different for the compressed and uncompressed resource.

One way to deal with that is to weaken the ETag.

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

No branches or pull requests

3 participants