-
Notifications
You must be signed in to change notification settings - Fork 7.8k
PHP behavior for parsing http header value is not consistent across http APIs #17829
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
Comments
Yes and no. I'd rather not mess with what third-party libraries are doing (e.g. cURL), but where we're fully in control (e.g. ext/soap), it may make sense to be consistent. |
@cmb69 , Thanks for replying.
|
I have done a bit of checking and I'm not really sure I understand this issue. As far as I see curl API offers API only for reading the whole response or headers line ( In terms of stream API, it also provides only header line which is removing the trialing spaces. All of this is optional and it is also fine that it can get removed. It is possible that I'm misunderstanding your request so please clarify with examples what issues you see and how it contradicts to the RFC. Don't forget that the RFC is talking about extracting the actual value, not processing the header line.
about this I have no idea why we should be doing it. This is even recommended in RFC to keep - |
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you. |
Description
The following code:
PHP behavior for parsing headers keys and header values are not consistent across PHP supported hTTP APIs.
For example: curl APIs doesnt trim leading spaces from headers key and value . " Header2 : VALUE2 " Here key ad value will have spaces in it for CURL APIs.
However for Soap APIs remove leading/trailing spaces before reading header key and value .
IMO , There should be some consistency around PHP HTTP APIs for parsing headers key and values.
header key and values should be propagated as it is provided by user by tokenizing based on ": " or ":" because few people has tendency to write space after each punctuation , so everything after ": " or ":" should be considered as value and key should be propagated as it is .
PHP Version
PHP 8.4
Operating System
Ubuntu24
The text was updated successfully, but these errors were encountered: