Skip to content
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

[HttpFoundation] Prevent duplicated headers when using Early Hints #53733

Merged
merged 1 commit into from Feb 8, 2024

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Feb 2, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues n/a
License MIT

Currently, headers are being duplicated in the final response if a 103 response has previously been sent. This patch fixes the issue.

Before:

< HTTP/2 103
< alt-svc: h3=":443"; ma=2592000
< cache-control: no-cache, private
< date: Fri, 02 Feb 2024 15:21:00 GMT
< link: </style.css>; rel=preload; as=style
< server: Caddy
< x-powered-by: PHP/8.3.1
< HTTP/2 200
< cache-control: no-cache, private
< cache-control: no-cache, private
< content-type: text/html; charset=UTF-8
< date: Fri, 02 Feb 2024 15:21:00 GMT
< date: Fri, 02 Feb 2024 15:21:00 GMT
< link: </style.css>; rel=preload; as=style
< link: </style.css>; rel=preload; as=style

@nicolas-grekas
Copy link
Member

Can this be covered by a test case?

@dunglas
Copy link
Member Author

dunglas commented Feb 6, 2024

@nicolas-grekas the only way I can think of to test this is to add FrankenPHP to the CI to do an integration test, or to override the built-in header() function. What would be your preferred approach?

@dunglas
Copy link
Member Author

dunglas commented Feb 6, 2024

Integration test added.

@dunglas dunglas force-pushed the fix/duplicate-headers-when-103 branch 3 times, most recently from bcdd933 to 439e860 Compare February 6, 2024 13:32
@nicolas-grekas
Copy link
Member

Thank you @dunglas.

@nicolas-grekas nicolas-grekas merged commit fa843ce into symfony:6.4 Feb 8, 2024
6 of 9 checks passed
This was referenced Feb 27, 2024
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.

None yet

3 participants