mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-25 18:43:22 +01:00
Updated RedirectPlugin to redirect using GET as required by RFC. Always use GET regardless of "strict redirects" setting.
This commit is contained in:
parent
0305bcc947
commit
e5d88ae089
6
src/Guzzle/Http/RedirectPlugin.php
Normal file → Executable file
6
src/Guzzle/Http/RedirectPlugin.php
Normal file → Executable file
@ -123,9 +123,9 @@ class RedirectPlugin implements EventSubscriberInterface
|
||||
$redirectRequest = null;
|
||||
$strict = $original->getParams()->get(self::STRICT_REDIRECTS);
|
||||
|
||||
// Use a GET request if this is an entity enclosing request and we are not forcing RFC compliance, but rather
|
||||
// emulating what all browsers would do
|
||||
if ($request instanceof EntityEnclosingRequestInterface && !$strict && $statusCode <= 302) {
|
||||
// Switch method to GET for 303 redirects. 301 and 302 redirects also switch to GET unless we are forcing RFC
|
||||
// compliance to emulate what most browsers do. NOTE: IE only switches methods on 301/302 when coming from a POST.
|
||||
if ($request instanceof EntityEnclosingRequestInterface && ($statusCode == 303 || (!$strict && $statusCode <= 302))) {
|
||||
$redirectRequest = RequestFactory::getInstance()->cloneRequestWithMethod($request, 'GET');
|
||||
} else {
|
||||
$redirectRequest = clone $request;
|
||||
|
Loading…
x
Reference in New Issue
Block a user