Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpClient] Preserve the case of headers when sending them #32823

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

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jul 30, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #32819
License MIT
Doc PR -

Some hosts are case sensitive, let's present headers in the submitted form.

@fabpot
Copy link
Member

fabpot commented Jul 31, 2019

What about ETag?

@javiereguiluz
Copy link
Member

@nicolas-grekas as you said here #32819 (comment)

  • In HTTP 1, headers should be lowercase (but some APIs don't respect that)
  • In HTTP/2, headers can only be lowercase

So, could we leave headers as-is when using HTTP 1 (no strtolower, no ucwords, no changes whatsoever) and just apply strtolower() unconditionally when using HTTP/2? Thanks.

@nicolas-grekas
Copy link
Member Author

Got it, see also comments on the linked issue.

@nicolas-grekas
Copy link
Member Author

So, could we leave headers as-is when using HTTP 1 (no strtolower, no ucwords, no changes whatsoever) and just apply strtolower() unconditionally when using HTTP/2? Thanks.

That is not possible, because the protocol can be decided automatically.
The only sensible way is to preserve the input case.
That will break normalization, but since this is internal concern, there should be ways around.

@nicolas-grekas nicolas-grekas changed the title [HttpClient] use ucwords() on header names before sending them [HttpClient] Preserve the case of headers when sending them Jul 31, 2019
@nicolas-grekas
Copy link
Member Author

PR updated, ready.

@nicolas-grekas nicolas-grekas merged commit 9ac85d5 into symfony:4.3 Jul 31, 2019
nicolas-grekas added a commit that referenced this pull request Jul 31, 2019
…m (nicolas-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Preserve the case of headers when sending them

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32819
| License       | MIT
| Doc PR        | -

Some hosts are case sensitive, let's present headers in the submitted form.

Commits
-------

9ac85d5 [HttpClient] Preserve the case of headers when sending them
@nicolas-grekas nicolas-grekas deleted the hc-ucwords branch July 31, 2019 15:52
@fabpot fabpot mentioned this pull request Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants