Normalize CDP response headers #968
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
chromedb doesn't support duplicate header names. Although servers will send this (e.g. Cache-Control: public\r\nCache-Control: max-age=60\r\n), Chrome seems to join them with a "\n". So we do the same.
A note on curl_easy_nextheader, which this code ultimately uses to iterate and collect the headers. The documentation says:
As-is, I'd understand this to mean that a given header name/value is only valid until any API call, including another call to curl_easy_nextheader. So, from this comment, we should be duping the name/value. But we don't. Why? Because, despite the note in the documentation, this doesn't appear to be how it actually works, nor does it really make sense. If it's just a linked list, there's no reason curl_easy_nextheader should invalidate previous results. I'm guessing this is just a general lack of guarantee libcurl is willing to make re lifetimes.
#966