Bugfix for #64433 follow_location parameter of context is ignored for most response codes#303
Bugfix for #64433 follow_location parameter of context is ignored for most response codes#303akbarovs wants to merge 1 commit intophp:masterfrom
Conversation
|
This undoes the fix done by fix to the bug https://bugs.php.net/bug.php?id=62524. I do not think we should be doing this. We should follow redirects if they are redirects - i.e., have proper redirect code. |
|
Stanislav, fix done to the bug https://bugs.php.net/bug.php?id=62524 is incorrect. After applying it we are not able to do not follow location in case of 2xx response codes. Please, double check the fix. It just allows to change follow_location parameter only if response code is 3xx. But in case of 2xx response code you will be redirected to location url and you cannot do anything with it. |
|
@akbarovs But why you need to follow location on non-redirect response? It looks very counter-intuitive when you POST something to an URL and get the content of entirely different URL, without redirect code... And you won't even know which URL is that. |
|
@smalyshev I do not need to follow location. I just want to fix the bug related to the 3xx response codes patch, which broke fopen logic. Let me describe what was changed related to the bug https://bugs.php.net/bug.php?id=62524 |
|
@akbarovs OK, I now understand, thanks for the explanation. Yes, it seems to be wrong that non-3xx statuses always redirect. This was not the intent of the original patch I think. |
|
@smalyshev Yes. Looks like there is difference between original patch intention (which is correct according to the rfc) and implementation. |
|
I'll add some tests (missing tests probably a reason why previous patch failed) and merge. |
|
Comment on behalf of stas at php.net: merged |
Please see: https://bugs.php.net/bug.php?id=64433
I changed the code to follow redirects for 3xx response codes only. If response code is not in 3xx - we do not follow location if 'follow_location' parameter is not set. If 'follow_location' context parameter is set -> we do/do not redirect without checking response code (We cannot restrict to do redirect if somebody want it)