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

Content codings (Content-Encoding) #716

Open
annevk opened this issue Apr 23, 2018 · 6 comments
Open

Content codings (Content-Encoding) #716

annevk opened this issue Apr 23, 2018 · 6 comments
Labels
needs tests Moving the issue forward requires someone to write tests topic: http

Comments

@annevk
Copy link
Member

annevk commented Apr 23, 2018

I looked into #710 (comment) a bit. Browser interoperability here is far from good. Interesting scenarios:

Somewhat related:

It does not seem worth blocking #710 on this as it's an improvement over the status quo, but this could use more work.

cc @MoritzKn @TimothyGu @MattMenke2 @mnot

@annevk annevk added needs tests Moving the issue forward requires someone to write tests topic: http labels Apr 23, 2018
@annevk
Copy link
Member Author

annevk commented Apr 23, 2018

The other thing that's wrong about the current setup is that Brotli requires HTTPS so that should also be passed through somehow. Cannot just have a codings list and bytes.

Edit: Brotli should require a secure context so it works for localhost: https://bugzilla.mozilla.org/show_bug.cgi?id=1675054. So fun that none of this was standardized...

@annevk
Copy link
Member Author

annevk commented Apr 23, 2018

Changes to "handling content codings":

  1. Iterate over codings and do decoding for each if them, if supported, and retain input as-is otherwise. If decoding fails, return failure.
  2. Pass in the response or some such so you can determine the HTTPS bit. (Might as well move parsing of Content-Encoding there.)

Questions:

  1. Should we define a limit? Maybe at least a lower bound.
  2. Can we make unsupported values an error? Probably not...
  3. ...

@annevk
Copy link
Member Author

annevk commented Apr 23, 2018

From @MattMenke2 at #710 (comment):

That there's also another, related issue here: What if we support an encoding, but didn't advertise it?

Chrome used to let such requests through, applying decoding, but that led to interop issues with brotli (servers were sniffing the user agent instead of looking at the Accept-Encoding header, and sending Brotli responses over HTTP), so we changed, and now reject unadvertised encodings, at least if we recognize them. That change led to issues with other servers that unconditionally send gzip - Chrome doesn't advertise gzip support when requesting media files, so it can use range requests.

@annevk
Copy link
Member Author

annevk commented Apr 24, 2018

Another thing that's wrong here is that the handlers need to keep around some internal state for compression tables, offsets, etc. So it's effectively a sequence of specialized transform streams.

@annevk
Copy link
Member Author

annevk commented Mar 1, 2021

Again from @MattMenke2 now at web-platform-tests/wpt#10548 (comment):

[W]e should ideally have tests with a compressed body and a Content-Length that matches the uncompressed body length (both when the compressed body is larger and smaller than the Content-Length). Chrome considers the latter case not an error in the connection-close case, I believe, but we should probably decide on a common set of behaviors there.

@yoavweiss
Copy link
Collaborator

^^ @pmeenan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests Moving the issue forward requires someone to write tests topic: http
Development

No branches or pull requests

2 participants