-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Milestone
Description
Normally when headers are parsed, each value from the input string is turned into one parsed value entry.
After changes like #65249 and #67227, the insertion order of values is now preserved when enumerating.
The only exception here is Cache-Control. It uses a single CacheControlHeaderValue object to store all values.
This has a few downsides:
- The order of values is not preserved
- Parsing logic for this header has to be aware of implementation details of how headers are stored
- It needs this logic to find the
CacheControlHeaderValue. - Since it's the only header reusing a storage object like this, it adds an extra
storeValueparameter to the method that all other parsers ignore.
- It needs this logic to find the
- Parsing logic has to account for this edge-case, as the
out parsedValueparameter may not be set even if the value is valid and was successfully parsed and saved.- I am referring to complications in
TryParseAndAddRawHeaderValue. As a result, we can't support some edge-cases like storing multiple whitespace-only values for a single header.
- I am referring to complications in
We should try to see if it's possible to make Cache-Control parsing work more like the other headers, without introducing breaking changes for existing users of the strongly-typed CacheControlHeaderValue.
Reactions are currently unavailable