-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
http trailers support #1020
http trailers support #1020
Conversation
OK I will tentatively answer these questions. Note that I am not 100% sure and might change opinion if I later read something I forgot about right now.
This also means that the check for the TE header should probably be done in stream_reply, and only when the user sets the Trailer header.
|
So here are some updates to this PR.
To achieve the second one I will have add trailers support for gun. Probably, should looks something like this: |
You probably want to name your test function stream_trailers, "do_trailers" will not be considered as a test (everything do_*) is ignored. Gun support needs to be added indeed. The message should probably be {gun_trailers, ...} and await return {trailers, ...} like you did. |
Another question. I'm trying to check some preconditions here a50b77b#diff-2db000a0dd01503e2f022387f23413cbR709 |
resp_headers is for the headers that are preset. It's not all the headers. And transfer-encoding is only for HTTP/1.1 and should not be used outside the cowboy_http module. |
Could you please clarify, you mean, that user will have to set "trailer" header with set_resp_header manually?
Honestly, some of this preconditions checks, already protocol version related, so.. should I remove/move all of them? |
You need a separate value in the map, like "has_trailers", see 5). For the checks, they can be done at the protocol level and we can keep a value in the map indicating that trailers can be sent. Both values can probably be merged, maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this PR, it just works find :)
sorry, it's a typo - "find" should be "fine" (I have no idea how to modify the review comment) |
@essen Any plan to merge this PR? |
After 2.0 sorry. Priorities... |
@IgorKarymov I found we have to buffer the trailers if there're DATA in the local_buffer queue, which is implemented for the flow control recently. I do a simple implementation here tony612@d047a94. You may want to add this or something similar after you rebase master later on.😁 |
FYI I got feedback that this works fine and will look into gRPC compatibility soon after 2.0 gets out at the end of the month. |
Hi, everybody. Unfortunately, it's very small chance that I will be able to complete this PR in an acceptable time frame. Sorry for this. If you interested I have a version of gun with trailers support somewhere (because you need one to run the tests). But I affraid that branches is way to far from master and a lot of things are changed. |
I've made a full implementation in 39baed6 for both HTTP/1.1 and HTTP/2. I've made different decisions regarding the sending of the trailers command to the connection process: I send it unconditionally. I made this decision because the logic around whether to include trailers or not is protocol-specific and so fits better in the protocol code. The same reasoning is applied for informational responses or for chunked transfer-encoding in general, the user tells Cowboy what it wants to send, and the protocol sends what it can. Closing, thanks! |
I decide to start with very basic support and improve it step by step with your comments.
This version tested with few different HTTP/2.0 clients.
My questions:
in response headers with the list of headers that we want to send in trailers (https://tools.ietf.org/html/rfc7230#section-4.4). How-to better to pass such header and validate this condition? Should I introduce new special value similar to resp_cookie, or just simple composed by the user header is ok?