-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Audit: single value header field error handling #193
Comments
A few initial thoughts:
|
There's #59 on What I'd like to see is that
and
end up being treated in equivalent manner. Otherwise a naïvely-combining intermediary in front of some clients can cause drastic different results from clients that don't have such an intermediary in front of them. |
|
Ticking off Expect due to #203 |
Starting to gather some data about Age here. It seems like most implementations honour the last value if there are more than one. Safari and Apache look like they consider the comma as making the Age invalid (and therefore not present). |
Niiiiice... It appears that most implementations will pay attention to the last Age value if they appear on the same header line, but the first header line if there are two. |
I am kind of disappointed that they don't treat the comma as a thousands indicator. |
@mnot that's fairly consistent with other headers. The way parsers in browsers work is that they are per header-line. And it's considered risky to change those such that they effectively work on a combined value. With more tests and encouragement and maybe effectively making it impossible to have this distinction in future wire formats this can hopefully be overcome. |
@annevk what if we specified that multiple Age headers (on different or the same line) caused the response to be uncacheable? |
Ticking off |
@mnot sounds reasonable to me. Caching or not caching doesn't seem like a potential compatibility issue. |
Chrome fails requests when we have multiple Content-Length, Content-Disposition, or Location headers, if they have different values (Content-Length, at least, resulted in too many problems when we disallowed multiple identical values). We only check for multiple distinct Content-Length values when the response is not using chunked encoding. Of those, looks like Content-Disposition hasn't been listed here yet. I believe the main concern that led us to start blocking these was (somewhat) mitigating header injection attacks. Content-Length injection leads to response splitting, Location leads to redirect hijacking. The original motivating bug was actually on the FireFox tracker: https://bugzilla.mozilla.org/show_bug.cgi?id=655389 |
Also, those checks are only at the HTTP/1.x layer. I'm not sure if we currently have in place similar mitigations for H2 or H3 (The Content-Length one doesn't matter, but the other two do). I would guess we do not. |
in Host -
Probably should be "... more than one Host header field value..." |
field line? |
We need a shorthand for a singleton header that has multiple values present, whether comma-separated or on separate field lines. |
Ticked off Content-Type due to #39. |
I'm starting to think that we should explicitly state that all field values are inherently list-based, because of the possibility of headers being combined. Field definitions should take this into account and define how to extract a single value from the list if they only want one. |
See #369. If we go down this route, the next step would be to convert all existing singleton fields to the @royfielding @reschke thoughts? |
Hm, that looks disruptive. I'm +1 on stating how to handle multiple values, but I'm not convinced that we should change the ABNFs for that. Are we discussing guidelines or normative text? |
Guidelines, I think. Remember that #203 already is taking us in this direction... |
To be clear, the ABNF is signaling an error condition when a singleton field is received more than once. We still want that. Guidelines to work around that error, after it is seen as an error, are fine. |
OK, so I think we should adjust 4.4 Field Values to look like this:
Does that work (noting that this doesn't touch the ABNF)? I'm not terribly happy with "singleton field", so if there are better suggestions for terminology, I'd be happy to replace it. |
As discussed in #74, we need to assure that all single-value headers we define have appropriate error handling for when more then one value is received. This could be a variety of things, including "it's not important for this header."
The text was updated successfully, but these errors were encountered: