-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix: remove CURLRequest headers sharing from $_SERVER #5249
Fix: remove CURLRequest headers sharing from $_SERVER #5249
Conversation
If you reset it at the beginning of the request(), you will not be able to use setForm().
…er between CURL requests
Initial review looks good but I will take a deeper look on desktop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that removing populateHeaders()
call when the headers
array is empty will solve most of the problems that users had. We will need an entry in the changelog for this - if it gonna be merged.
The real question is how big a problem for devs these changes will be... My point is that missing some headers that were populated before may cause some requests to not work. Personally, I have always specified my own headers, but it looks like a lot of people have not.
To override the values.
If user setHeader() that is defined in $unsharedHeaders, the header will be removed before sending request, and there is no way to send the header. The reason I didn't do the reset after sending is because a test failed. This time I modify the test, too.
I guess it is very small. But I have no data. |
Added one fix and documentation. |
$defaultOptions is options passed in the constructor. They are applied for all requests. All request headers are cleared after sending request, and $defaultOptions are set again.
I removed
In other words, there are two kind of After sending a request, all headers are cleared. And I wanted to reset all |
The explanation was not accurate. Co-authored-by: Michal Sniatala <[email protected]>
The explanation was not accurate. Co-authored-by: Michal Sniatala <[email protected]>
If $CURLRequestShareOptions is false, reset all config after sending a request. If true, keep the all config (the same as before).
Added |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @kenjis, I think it looks really good.
The only important thing that is missing is the separate config file and some documentation for this new feature (shareOptions
).
@WinterSilence I'm not sure if I'm understanding you correctly, but if you're proposing to add a new implementation of this class because of BC, that's not going to happen. The possible BC break is accidental and is a derivative from a bug that is now fixed. Technically speaking we are dealing with a bug here. However, we are aware that fixing it may lead to problems in some cases. Therefore, we raise this issue in the changelog and upgrade notes. |
…uest::$shareOptions
@WinterSilence I'm also not get what you want to say. |
@kenjis I want minimal changes in "behavior" of current classes i.e. save public part "as is". Next release is not new major version - BC not allowed. But some errors can't be solved without BC, so I suggest a temporary solution - similar classes with fixes - users will choose version to use. Old/deprecated classes will be removed in next major version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my point of view, this is ready. Thanks!
@WinterSilence I thought that old/new two classes. Adding config for a new behavior is a bit better than maintaining two classes, I thought. |
Description
Alternative to #5218 (Inclueds #5218)
Fixes #4826
populateHeaders()
which gets request headers from the browser and sets the same headers to the curl request and shares the headers between curl requests, is a bug. So removepopulateHeaders()
logic completelyConfig\CURLRequest::$shareOptions
. The default istrue
false
,$defaultOptions
which are passed in the constructor are applied to all requestsshare$option['headers']
except$unsharedHeaders
between curl requestsCURLRequestTest::testOptionsHeadersUsingPopulate()
Checklist: