-
Notifications
You must be signed in to change notification settings - Fork 342
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
Add trailer support to network responses #344
Conversation
Paging @mnot @yutakahirano @tyoshino @louiscryan for review. |
Looks about right to me. I wonder what folks think should be permitted in CORS. 'Trailers' is not a mandatory header and is less useful in HTTP2 than it might have been in HTTP1. 'TE: trailers' seems like it has more value however. |
You mean for request headers? |
Ah, I didn't notice this PR when I wrote a comment at #34. Never mind. I think you need to reject the trailer promise whenever you get an error. |
What kind of error are you thinking about? |
Whenever a fetch is terminated after a response is received. |
Re: CORS, TE "opt-in" would be desired, as proxies may drop response trailers without such a request header (no?) Trailer is a response header and there is no harm for the server to always include such a header with Access-Control-Expose-Headers. Discussion or spec clarification may be needed to clarify if UA needs drop trailers that are not specified with Trailer. |
@yutakahirano I guess we could do that as it aligns with throwing an error for the body stream, but it also seems fine that trailer just returns an empty header list in that case. Hmm. |
Addressed feedback thus far apart from
|
What it does help with is determining whether an entire path is compatible with trailers; i.e., whether or not there's a HTTP/1.0 hop. So it make sense for intermediaries to generate it when the downstream path is trailer-safe, or the intermediary buffers responses and sticks them into headers. |
Thanks, given httpwg/http-core#18 I suggest we postpone/separate any changes around |
When a response comes from the service worker, no fetch-response-done task is queued, right? |
Good point. I should probably move that task queuing to "main fetch" instead somehow. |
@yutakahirano does that apply to fetch termination as well? |
I moved the task to main fetch. Fetch termination is something we need to sort through further and there's various issues on it already. We can take that up elsewhere. Anything else? |
So I forgot about two things that need to be fixed before landing: 1) Filtering for "no-cors". 2) How this works with CORS.
|
👍 |
As a heads up, I plan to land trailer support tomorrow. If you have concerns or would like more time, please leave a comment. |
Sorry for the late response. I think Response.clone needs to create a new trailer promise. |
Better late than too late. @domenic does the last commit look okay to you? I basically need to resolve the promise of the cloned response when the promise of the original response is fulfilled, but I should probably not reuse the |
(Also, that was great feedback @yutakahirano, but you probably knew that already. 😊) |
LGTM |
Additional trailer support we can add in the future if this minimal viable solution (that is nonetheless complicated) is a success: * Support for synthetic responses. * Support for (synthetic) requests. * Trailer headers that have semantics. * Support for trailer headers in CORS (only for responses I think). Fixes #34 and fixes #343.
Thanks everyone for the help. Now it's up to you all to get it tested and implemented. 😊 |
Trailer support we can add in the future if this minimal viable
solution is a success:
Fixes #343 and fixes #34.