-
Notifications
You must be signed in to change notification settings - Fork 43
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
Trailers #16
Comments
I wonder whether it would be best to add something like:
... with an appropriate column in the header field registry to record this. I don't think this would break any existing implementations, because trailers are so seldom used right now, and I think there's a strong argument that this is the case anyway; the consuming application has to expect something in trailers to act upon it. |
Can we differentiate between what is processed and what is exposed to APIs? I think we should expose the headers to APIs still and let consumers of those make their own choice. |
Yep, I was thinking that too. It's really hard for a generic implementation to know the semantics of individual headers. For ones that the implementation does look at, however (e.g., caching headers), it should pay attention. This is really just clarifying current behaviour, I think. |
I don't think that is helpful. First, nobody reads header field definitions. Second, servers will not differentiate the processing of extension fields according to their extension semantics, since they don't know the semantics. In any case, we can't assume the client is a browser and the server is a website; that's not the scope of HTTP. When a use case is more limited, an API, media type, or specific application of HTTP may choose to exclude or otherwise narrow the use of trailers. This doesn't prevent them from being used in other contexts. |
Roy, what we're trying to avoid is the assumption that headers and trailers are semantically equivalent (which 7230 heavily implies), mostly for the benefit of senders. The requirements proposed above aren't intended to be targeted at generic HTTP software. How about:
|
WFM. |
The phrasing is important and shouldn't diverge from our existing forms.
|
What is a recipient? In browsers at least there's the low-level HTTP library that's the initial recipient, then there's something akin to what Fetch describes, which is what most features would use, and then there's various APIs such as Currently |
This is really a shame, and was one of the features I was hoping to use. I can't speak for what the standard should say, but my own usage (gRPC) would treat trailers as a key-value list not treated specially by the browser (or any other intermediaries). That means they only have meaning (from the browser POV) to the JS applications, not anything else. |
A recipient is the role associated with anyone/anything receiving the message (as opposed to sending a message). Which API is involved cannot matter for a messaging protocol. However, the reason I narrow the scope to the convoluted "that processes a trailer field for conversion to a corresponding header field" is because this requirement only matters for code that takes a trailer field and merges it with a set of header fields. It would not apply to code that keeps headers and trailers as separate tables. |
What's the import of "having the same name as a header field"? It seems to imply that there are two separate name spaces for headers and trailers, which is surprising to me. |
@mnot there are just some headers which can't be send as a trailer, e.g Transfer-Encoding, Content-Length and Trailer. |
Sure. I just found that turn of phrase very confusing. I think we can simplify it. |
Okay :) |
@spaceone please file a new issue for that. @royfielding thanks, I guess I'm still a bit confused. Generally I would expect trailers not to be merged with headers. They might perhaps end up overriding some functionality, but the initial message parse would just pass data on to a streaming API, which most naturally would expose these as separate fields and not expose trailers as updates to the headers field. |
@annevk My original expectation regarding trailers was an attempt to supply the same information as header fields for data that wasn't known at the message start. Making them the same space was both an editorial simplification (we didn't have to define a new space and could reuse the field definitions) and a byproduct of how we expected shared caches to store them for later use. In other words, I expected a shared cache to merge the fields when storing it, since then it could supply that data as normal header fields on later hits that might serve both HTTP/1.0 and HTTP/1.1 clients. With 20 years of hindsight and better awareness of the security issues, I agree we should have just defined them as two different spaces. I am not sure if we can undo that now. |
@royfielding I'm not sure if there is too much undoing to do, really, because:
Therefore, I think that we should sync with the real-world and split headers and trailers into two different spaces. |
server-timings also uses http trailers successfully. Like Piotr mentions, the http trailer is used to populate the server-timing information but is not merged with the header information for security and sanity reasons. |
Discussed in Bangkok; result was "improve wording." |
Friendly edit to Roy's suggestion:
|
Unless I'm missing something that still leaves the issue unaddressed. Are implementations allowed to maintain trailers separately from headers? (Note that per @mcmanus's comment they already do.) Can something "downstream" from HTTP require that? |
I think implementations are free to consider them separate, but they have to understand that somewhere in the chain, an intermediary may have collapsed trailers into headers -- so if something depends on a particular field showing up in headers, they're going to be disappointed. |
Hmm, I guess as long as that's true it's better to not support them in clients at all, to prevent that kind of thing from messing with application security. |
How do you get there, Anne? How would this "mess with application security"? |
Right, for what I'm worried about it doesn't really matter if browsers implement it or not, it's mostly intermediaries that might do such combining naïvely. E.g., if they put a |
If someone designs a field that has to be in the trailer, and is somehow insecure if it's promoted into a header by an intermediary, they're going to have a bad time (because intermediaries are allowed to fold all trailers into headers). More generally, if someone designs a field that is allowed to be in a trailer and they depend on it being available there end-to-end, they're going to have a bad time. If someone puts a header that doesn't explicitly say it's allowed in trailers into trailers, they're going to have a bad time (because if it arrives at the other end, someone may not be looking for it there -- i.e., trailers are not always automatically folded into headers). AIUI Firefox already supports There are other specific cases where a browser could make a decision about whether or not it supports trailers for a header that it processes -- e.g., I think that browsers can also expose trailers in an API safely, provided that they're not automatically collapsed into headers. That said, the constraints above still apply to the people using them -- and we definitely need to do a better job documenting them. |
Thanks, I think given this the API is rather tricky to expose, as you cannot depend on there not being intermediaries in the wild, so your application might end up failing for a small number of users without that being very visible, but I'll follow-up in #18. |
Going back to the core issue of trailers overriding headers, we should first decide whether we continue to recommend/allow trailer fields to be merged with headers. If not, we should actually specify that! None of the changes in #219 are necessary if merging is not allowed. |
It'd be amazing if we could agree that merging is not allowed and they're essentially a separate member of the response to be processed independently. I think that would increase robustness of the whole setup quite a bit. |
I think we'd still want to say:
... and probably add that older implementations might still merge them, so recipients SHOULD disregard headers that are only defined to appear in trailers. As to whether we should do it -- I doubt that merging is widely implemented in pure intermediaries, since it would require buffering the message. However, I wonder whether it is in proxy/caches; I'll do some testing. |
7230 says:
and:
As discussed at the 2016 HTTP Workshop as part of @annevk's Fetch presentation, this isn't necessarily sensible.
The text was updated successfully, but these errors were encountered: