MediaWiki
master
|
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it. More...
Public Member Functions | |
clearCookie ( $name, $options=[]) | |
Unset a browser cookie. More... | |
getHeader ( $key) | |
Get a response header. More... | |
hasCookies () | |
Checks whether this request is performing cookie operations. More... | |
header ( $string, $replace=true, $http_response_code=null) | |
Output an HTTP header, wrapper for PHP's header() More... | |
headersSent () | |
Test if headers have been sent. More... | |
setCookie ( $name, $value, $expire=0, $options=[]) | |
Set the browser cookie. More... | |
statusHeader ( $code) | |
Output an HTTP status code header. More... | |
Static Public Member Functions | |
static | disableForPostSend () |
Disable setters for post-send processing. More... | |
Static Protected Attributes | |
static bool | $disableForPostSend = false |
Used to disable setters before running jobs post-request (T191537) More... | |
static array | $setCookies = [] |
Used to record set cookies, because PHP's setcookie() will happily send an identical Set-Cookie to the client. More... | |
Allow programs to request this object from WebRequest::response() and handle all outputting (or lack of outputting) via it.
Definition at line 36 of file WebResponse.php.
GuzzleHttp\Psr7\Request\WebResponse::clearCookie | ( | $name, | |
$options = [] |
|||
) |
Unset a browser cookie.
This sets the cookie with an empty value and an expiry set to a time in the past, which will cause the browser to remove any cookie with the given name, domain and path from its cookie store. Options other than these (and prefix) have no effect.
string | $name | Cookie name |
array | $options | Cookie options, see setCookie() |
Definition at line 267 of file WebResponse.php.
References GuzzleHttp\Psr7\Request\WebResponse\setCookie().
Referenced by MediaWiki\Block\BlockManager\clearBlockCookie().
|
static |
Disable setters for post-send processing.
After this call, self::setCookie(), self::header(), and self::statusHeader() will log a warning and return without setting cookies or headers.
Definition at line 55 of file WebResponse.php.
GuzzleHttp\Psr7\Request\WebResponse::getHeader | ( | $key | ) |
Get a response header.
string | $key | The name of the header to get (case insensitive). |
Reimplemented in GuzzleHttp\Psr7\Request\FauxResponse.
Definition at line 90 of file WebResponse.php.
References $header.
GuzzleHttp\Psr7\Request\WebResponse::hasCookies | ( | ) |
Checks whether this request is performing cookie operations.
Reimplemented in GuzzleHttp\Psr7\Request\FauxResponse.
Definition at line 277 of file WebResponse.php.
References GuzzleHttp\Psr7\Request\WebResponse\$setCookies.
GuzzleHttp\Psr7\Request\WebResponse::header | ( | $string, | |
$replace = true , |
|||
$http_response_code = null |
|||
) |
Output an HTTP header, wrapper for PHP's header()
string | $string | Header to output |
bool | $replace | Replace current similar header |
null | int | $http_response_code | Forces the HTTP response code to the specified value. |
Reimplemented in GuzzleHttp\Psr7\Request\FauxResponse.
Definition at line 65 of file WebResponse.php.
References wfDebugLog().
GuzzleHttp\Psr7\Request\WebResponse::headersSent | ( | ) |
Test if headers have been sent.
Reimplemented in GuzzleHttp\Psr7\Request\FauxResponse.
Definition at line 122 of file WebResponse.php.
Referenced by MediaWiki\Block\BlockManager\trackBlockWithCookie().
GuzzleHttp\Psr7\Request\WebResponse::setCookie | ( | $name, | |
$value, | |||
$expire = 0 , |
|||
$options = [] |
|||
) |
Set the browser cookie.
string | $name | The name of the cookie. |
string | $value | The value to be stored in the cookie. |
int | null | $expire | Unix timestamp (in seconds) when the cookie should expire.
|
array | $options | Assoc of additional cookie options:
|
Reimplemented in GuzzleHttp\Psr7\Request\FauxResponse.
Definition at line 147 of file WebResponse.php.
References MediaWiki\MainConfigNames\CookieDomain, MediaWiki\MainConfigNames\CookieExpiration, MediaWiki\MainConfigNames\CookieHttpOnly, MediaWiki\MainConfigNames\CookiePath, MediaWiki\MainConfigNames\CookiePrefix, MediaWiki\MainConfigNames\CookieSecure, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\MainConfigNames\UseSameSiteLegacyCookies, and wfDebugLog().
Referenced by GuzzleHttp\Psr7\Request\WebResponse\clearCookie().
GuzzleHttp\Psr7\Request\WebResponse::statusHeader | ( | $code | ) |
Output an HTTP status code header.
int | $code | Status code |
Reimplemented in GuzzleHttp\Psr7\Request\FauxResponse.
Definition at line 105 of file WebResponse.php.
References HttpStatus\header(), and wfDebugLog().
|
staticprotected |
Used to disable setters before running jobs post-request (T191537)
Definition at line 44 of file WebResponse.php.
|
staticprotected |
Used to record set cookies, because PHP's setcookie() will happily send an identical Set-Cookie to the client.
Definition at line 41 of file WebResponse.php.
Referenced by GuzzleHttp\Psr7\Request\WebResponse\hasCookies().