Open Journal Systems
3.3.0
|
Public Member Functions | |
cleanupRequest (Event $event) | |
onRequestSent (Event $event) | |
Static Public Member Functions | |
static | getSubscribedEvents () |
Data Fields | |
const | DISABLE = 'redirect.disable' |
const | MAX_REDIRECTS = 'redirect.max' |
const | PARENT_REQUEST = 'redirect.parent_request' |
const | REDIRECT_COUNT = 'redirect.count' |
const | STRICT_REDIRECTS = 'redirect.strict' |
Protected Member Functions | |
createRedirectRequest (RequestInterface $request, $statusCode, $location, RequestInterface $original) | |
getOriginalRequest (RequestInterface $request) | |
prepareRedirection (RequestInterface $original, RequestInterface $request, Response $response) | |
sendRedirectRequest (RequestInterface $original, RequestInterface $request, Response $response) | |
throwTooManyRedirectsException (RequestInterface $original, $max) | |
Protected Attributes | |
$defaultMaxRedirects = 5 | |
Plugin to implement HTTP redirects. Can redirect like a web browser or using strict RFC 2616 compliance
Definition at line 19 of file RedirectPlugin.php.
Guzzle\Http\RedirectPlugin::cleanupRequest | ( | Event | $event | ) |
Clean up the parameters of a request when it is cloned
Event | $event | Event emitted |
Definition at line 49 of file RedirectPlugin.php.
|
protected |
Create a redirect request for a specific request object
Takes into account strict RFC compliant redirection (e.g. redirect POST with POST) vs doing what most clients do (e.g. redirect POST with GET).
RequestInterface | $request | Request being redirected |
RequestInterface | $original | Original request |
int | $statusCode | Status code of the redirect |
string | $location | Location header of the redirect |
CouldNotRewindStreamException | If the body needs to be rewound but cannot |
Definition at line 120 of file RedirectPlugin.php.
References Guzzle\Http\Url\factory(), Guzzle\Http\Message\EntityEnclosingRequestInterface\getBody(), Guzzle\Http\Message\RequestFactory\getInstance(), Guzzle\Http\Message\MessageInterface\getParams(), Guzzle\Http\Message\RequestInterface\getResponseBody(), Guzzle\Http\RedirectPlugin\PARENT_REQUEST, and Guzzle\Http\Message\RequestInterface\setResponseBody().
Referenced by Guzzle\Http\RedirectPlugin\prepareRedirection().
|
protected |
Get the original request that initiated a series of redirects
RequestInterface | $request | Request to get the original request from |
Definition at line 95 of file RedirectPlugin.php.
Referenced by Guzzle\Http\RedirectPlugin\onRequestSent().
|
static |
Returns an array of event names this subscriber wants to listen to.
The array keys are event names and the value can be:
For instance:
Implements Symfony\Component\EventDispatcher\EventSubscriberInterface.
Definition at line 35 of file RedirectPlugin.php.
Guzzle\Http\RedirectPlugin::onRequestSent | ( | Event | $event | ) |
Called when a request receives a redirect response
Event | $event | Event emitted |
Definition at line 61 of file RedirectPlugin.php.
References Guzzle\Http\RedirectPlugin\getOriginalRequest(), and Guzzle\Http\RedirectPlugin\sendRedirectRequest().
|
protected |
Prepare the request for redirection and enforce the maximum number of allowed redirects per client
RequestInterface | $original | Original request |
RequestInterface | $request | Request to prepare and validate |
Response | $response | The current response |
Definition at line 186 of file RedirectPlugin.php.
References Guzzle\Http\RedirectPlugin\$defaultMaxRedirects, Guzzle\Http\RedirectPlugin\createRedirectRequest(), Guzzle\Http\Message\MessageInterface\getParams(), Guzzle\Http\RedirectPlugin\MAX_REDIRECTS, Guzzle\Http\RedirectPlugin\REDIRECT_COUNT, and Guzzle\Http\RedirectPlugin\throwTooManyRedirectsException().
Referenced by Guzzle\Http\RedirectPlugin\sendRedirectRequest().
|
protected |
Send a redirect request and handle any errors
RequestInterface | $original | The originating request |
RequestInterface | $request | The current request being redirected |
Response | $response | The response of the current request |
BadResponseException| |
Definition at line 219 of file RedirectPlugin.php.
References Guzzle\Http\Exception\BadResponseException\getResponse(), and Guzzle\Http\RedirectPlugin\prepareRedirection().
Referenced by Guzzle\Http\RedirectPlugin\onRequestSent().
|
protected |
Throw a too many redirects exception for a request
RequestInterface | $original | Request |
int | $max | Max allowed redirects |
TooManyRedirectsException | when too many redirects have been issued |
Definition at line 242 of file RedirectPlugin.php.
References Guzzle\Common\HasDispatcherInterface\getEventDispatcher().
Referenced by Guzzle\Http\RedirectPlugin\prepareRedirection().
|
protected |
Default number of redirects allowed when no setting is supplied by a request
Definition at line 33 of file RedirectPlugin.php.
Referenced by Guzzle\Http\RedirectPlugin\prepareRedirection().
const Guzzle\Http\RedirectPlugin::DISABLE = 'redirect.disable' |
Definition at line 25 of file RedirectPlugin.php.
Referenced by Guzzle\Http\Message\EntityEnclosingRequest\configureRedirects(), Guzzle\Tests\Http\Message\EntityEnclosingRequestTest\testCanDisableRedirects(), Guzzle\Tests\Http\Message\RequestTest\testUnresolvedRedirectsReturnResponse(), and Guzzle\Http\Message\RequestFactory\visit_allow_redirects().
const Guzzle\Http\RedirectPlugin::MAX_REDIRECTS = 'redirect.max' |
Definition at line 22 of file RedirectPlugin.php.
Referenced by Guzzle\Http\Message\EntityEnclosingRequest\configureRedirects(), and Guzzle\Http\RedirectPlugin\prepareRedirection().
const Guzzle\Http\RedirectPlugin::PARENT_REQUEST = 'redirect.parent_request' |
Definition at line 24 of file RedirectPlugin.php.
Referenced by Guzzle\Http\RedirectPlugin\createRedirectRequest().
const Guzzle\Http\RedirectPlugin::REDIRECT_COUNT = 'redirect.count' |
Definition at line 21 of file RedirectPlugin.php.
Referenced by Guzzle\Http\Message\Response\getRedirectCount(), Guzzle\Http\RedirectPlugin\prepareRedirection(), and Guzzle\Tests\Plugin\Redirect\RedirectPluginTest\testRedirectsRequests().
const Guzzle\Http\RedirectPlugin::STRICT_REDIRECTS = 'redirect.strict' |
Definition at line 23 of file RedirectPlugin.php.
Referenced by Guzzle\Http\Message\EntityEnclosingRequest\configureRedirects(), Guzzle\Tests\Plugin\Redirect\RedirectPluginTest\testCanRedirectWithStrictRfcCompliance(), Guzzle\Tests\Plugin\Redirect\RedirectPluginTest\testRedirect303WithGetWithStrictRfcCompliance(), and Guzzle\Tests\Http\Message\EntityEnclosingRequestTest\testStrictRedirectsCanBeSpecifiedOnEntityEnclosingRequests().