-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
PR #402 split headers follow-up discussion #404
Comments
Hey thanks for the feedback! These are all valid HTTP headers
My original thought was that if a developer adds a header with leading whitespace, we should keep it intact. Removing leading whitespace would "definitely modify current behavior", as you put it. Just noting that what you're proposing would override what might potentially be a developer's preference for deliberately including leading whitespaces in their headers. I don't see what value that adds on our end or for our users other than to serve an arbitrary aesthetic preference. This isn't a strong opinion, though. I can definitely be convinced otherwise. Do you know if WordPress, Laravel, or Symfony already strip leading whitespace in header values? |
Ah, I think we got a misunderstanding. The new problem now is that we're now always adding one space. acorn/src/Roots/Acorn/Application/Concerns/Bootable.php Lines 145 to 153 in ef4a8a2
Let's break this down with an example if someone did foreach (headers_list() as $header) {
// $header = 'Content-Type: image/png'
[$header, $value] = explode(':', $header, 2);
// $header = 'Content-Type'
// $value = ' image/png'
if (! headers_sent()) {
header_remove($header);
}
$response->header($header, $value, $header !== 'Set-Cookie');
} If we now call Later the header will be sent out via This results in Also if someone would use a Laravel Middleware which has a check similar to this I think what we actually would like to do is using |
I just created #405. Little side-note: I'm using the Caddy Webserver for local development. There I couldn't perceive the added space because it was trimmed there. But in my IntelliJ Debug output tab I could see that the headers really contained the one additional space (
|
Okay, that makes sense to me. Didn't occur to me that Symfony was already adding a leading space to all headers. So if we're including a leading space in the value, and then Symfony adds their own, then the result is two leading spaces. Thanks for clarifying! |
I’m encountering an issue due to sending multiple Link headers from different PHP files. Example: Link: http://www.mywebsite.com/blue-shirt.html; rel="canonical" The above change send only one Link Header |
Related: #356 (comment) and c6fd98e |
Summary
Last week I added a comment to #402. I added a comment to the now-merged PR where I'd like to discuss some more because I'm not sure if modifying current behaviour (as the PR currently does) is a good idea:
cc @QWp6t
Additional context
No response
The text was updated successfully, but these errors were encountered: