Inherited by CurlHttpRequest, and PhpHttpRequest.
Public Member Functions | |
__construct ($url, $options=array()) | |
getContent () | |
Get the body, or content, of the response to the request. | |
proxySetup () | |
Take care of setting up the proxy (override in subclass). | |
setReferer ($url) | |
Set the refererer header. | |
setUserAgent ($UA) | |
Set the user agent. | |
setHeader ($name, $value) | |
Set an arbitrary header. | |
getHeaderList () | |
Get an array of the headers. | |
setCallback ($callback) | |
Set the callback. | |
read ($fh, $content) | |
A generic callback to read the body of the response from a remote server. | |
execute () | |
Take care of whatever is necessary to perform the URI request. | |
isRedirect () | |
Returns true if the last status code was a redirect. | |
getResponseHeaders () | |
Returns an associative array of response headers after the request has been executed. | |
getResponseHeader ($header) | |
Returns the value of the given response header. | |
setCookieJar ($jar) | |
Tells the HttpRequest object to use this pre-loaded CookieJar. | |
getCookieJar () | |
Returns the cookie jar in use. | |
setCookie ($name, $value=null, $attr=null) | |
Sets a cookie. | |
getFinalUrl () | |
Returns the final URL after all redirections. | |
Static Public Member Functions | |
static | factory ($url, $options=null) |
Generate a new request object. | |
Public Attributes | |
$status | |
Protected Member Functions | |
parseHeader () | |
Parses the headers, including the HTTP status code and any Set-Cookie headers. | |
setStatus () | |
Sets the member variable status to a fatal status if the HTTP status code was not 200. | |
parseCookies () | |
Parse the cookies in the response headers and store them in the cookie jar. | |
Protected Attributes | |
$content | |
$timeout = 'default' | |
$headersOnly = null | |
$postData = null | |
$proxy = null | |
$noProxy = false | |
$sslVerifyHost = true | |
$caInfo = null | |
$method = "GET" | |
$reqHeaders = array() | |
$url | |
$parsedUrl | |
$callback | |
$maxRedirects = 5 | |
$followRedirects = true | |
$cookieJar | |
$headerList = array() | |
$respVersion = "0.9" | |
$respStatus = "200 Ok" | |
$respHeaders = array() |
Definition at line 122 of file HttpFunctions.php.
HttpRequest::__construct | ( | $ | url, | |
$ | options = array() | |||
) |
$url | string url to use | |
$options | array (optional) extra params to pass (see Http::request()) |
Definition at line 152 of file HttpFunctions.php.
References $options, $url, $wgHTTPTimeout, Http::isValidURI(), Status::newFatal(), and Status::newGood().
HttpRequest::execute | ( | ) |
Take care of whatever is necessary to perform the URI request.
Reimplemented in CurlHttpRequest, and PhpHttpRequest.
Definition at line 295 of file HttpFunctions.php.
References $wgTitle, proxySetup(), setCallback(), setReferer(), setUserAgent(), Http::userAgent(), and wfArrayToCGI().
static HttpRequest::factory | ( | $ | url, | |
$ | options = null | |||
) | [static] |
Generate a new request object.
Definition at line 183 of file HttpFunctions.php.
References Http::$httpEngine, $options, $url, and wfIniGetBool().
Referenced by Http::request(), HttpTest::runCookieRequests(), HttpTest::runHTTPFailureChecks(), ApiTest::testApiGotCookie(), ApiTest::testApiListPages(), and HttpTest::testInstantiation().
HttpRequest::getContent | ( | ) |
Get the body, or content, of the response to the request.
Definition at line 209 of file HttpFunctions.php.
HttpRequest::getCookieJar | ( | ) |
Returns the cookie jar in use.
Definition at line 422 of file HttpFunctions.php.
References parseHeader().
HttpRequest::getFinalUrl | ( | ) |
Returns the final URL after all redirections.
Definition at line 461 of file HttpFunctions.php.
References getResponseHeader().
Referenced by parseCookies().
HttpRequest::getHeaderList | ( | ) |
Get an array of the headers.
Definition at line 258 of file HttpFunctions.php.
References $name.
Referenced by PhpHttpRequest::execute(), and CurlHttpRequest::execute().
HttpRequest::getResponseHeader | ( | $ | header | ) |
Returns the value of the given response header.
$header | string |
Definition at line 399 of file HttpFunctions.php.
References parseHeader().
Referenced by PhpHttpRequest::execute(), and getFinalUrl().
HttpRequest::getResponseHeaders | ( | ) |
Returns an associative array of response headers after the request has been executed.
Because some headers (e.g. Set-Cookie) can appear more than once the, each value of the associative array is an array of the values given.
Definition at line 387 of file HttpFunctions.php.
References parseHeader().
HttpRequest::isRedirect | ( | ) |
Returns true if the last status code was a redirect.
Definition at line 368 of file HttpFunctions.php.
References $status, and parseHeader().
Referenced by PhpHttpRequest::execute().
HttpRequest::parseCookies | ( | ) | [protected] |
Parse the cookies in the response headers and store them in the cookie jar.
Definition at line 445 of file HttpFunctions.php.
References $url, and getFinalUrl().
Referenced by parseHeader().
HttpRequest::parseHeader | ( | ) | [protected] |
Parses the headers, including the HTTP status code and any Set-Cookie headers.
This function expectes the headers to be found in an array in the member variable headerList.
Definition at line 329 of file HttpFunctions.php.
References parseCookies().
Referenced by PhpHttpRequest::execute(), CurlHttpRequest::execute(), getCookieJar(), getResponseHeader(), getResponseHeaders(), isRedirect(), and setStatus().
HttpRequest::proxySetup | ( | ) |
Take care of setting up the proxy (override in subclass).
Definition at line 218 of file HttpFunctions.php.
References $wgHTTPProxy, and Http::isLocalURL().
Referenced by execute().
HttpRequest::read | ( | $ | fh, | |
$ | content | |||
) |
A generic callback to read the body of the response from a remote server.
$fh | handle | |
$content | string |
Definition at line 286 of file HttpFunctions.php.
References $content.
HttpRequest::setCallback | ( | $ | callback | ) |
Set the callback.
$callback | callback |
Definition at line 276 of file HttpFunctions.php.
References $callback.
Referenced by execute().
HttpRequest::setCookie | ( | $ | name, | |
$ | value = null , |
|||
$ | attr = null | |||
) |
Sets a cookie.
Used before a request to set up any individual cookies. Used internally after a request to parse the Set-Cookie headers.
Definition at line 435 of file HttpFunctions.php.
References $name.
HttpRequest::setCookieJar | ( | $ | jar | ) |
Tells the HttpRequest object to use this pre-loaded CookieJar.
$jar | CookieJar |
Definition at line 414 of file HttpFunctions.php.
HttpRequest::setHeader | ( | $ | name, | |
$ | value | |||
) |
Set an arbitrary header.
Definition at line 250 of file HttpFunctions.php.
References $name.
Referenced by setReferer(), and setUserAgent().
HttpRequest::setReferer | ( | $ | url | ) |
Set the refererer header.
Definition at line 236 of file HttpFunctions.php.
References $url, and setHeader().
Referenced by execute().
HttpRequest::setStatus | ( | ) | [protected] |
Sets the member variable status to a fatal status if the HTTP status code was not 200.
Definition at line 352 of file HttpFunctions.php.
References $code, and parseHeader().
Referenced by PhpHttpRequest::execute(), and CurlHttpRequest::execute().
HttpRequest::setUserAgent | ( | $ | UA | ) |
Set the user agent.
Definition at line 243 of file HttpFunctions.php.
References setHeader().
Referenced by execute().
HttpRequest::$caInfo = null [protected] |
Definition at line 130 of file HttpFunctions.php.
HttpRequest::$callback [protected] |
HttpRequest::$content [protected] |
Definition at line 123 of file HttpFunctions.php.
Referenced by read(), and CurlHttpRequest::readHeader().
HttpRequest::$cookieJar [protected] |
Definition at line 139 of file HttpFunctions.php.
HttpRequest::$followRedirects = true [protected] |
Definition at line 137 of file HttpFunctions.php.
HttpRequest::$headerList = array() [protected] |
Definition at line 141 of file HttpFunctions.php.
HttpRequest::$headersOnly = null [protected] |
Definition at line 125 of file HttpFunctions.php.
HttpRequest::$maxRedirects = 5 [protected] |
Definition at line 136 of file HttpFunctions.php.
HttpRequest::$method = "GET" [protected] |
Definition at line 131 of file HttpFunctions.php.
HttpRequest::$noProxy = false [protected] |
Definition at line 128 of file HttpFunctions.php.
HttpRequest::$parsedUrl [protected] |
HttpRequest::$postData = null [protected] |
Definition at line 126 of file HttpFunctions.php.
HttpRequest::$proxy = null [protected] |
Definition at line 127 of file HttpFunctions.php.
HttpRequest::$reqHeaders = array() [protected] |
Definition at line 132 of file HttpFunctions.php.
HttpRequest::$respHeaders = array() [protected] |
Definition at line 144 of file HttpFunctions.php.
HttpRequest::$respStatus = "200 Ok" [protected] |
Definition at line 143 of file HttpFunctions.php.
HttpRequest::$respVersion = "0.9" [protected] |
Definition at line 142 of file HttpFunctions.php.
HttpRequest::$sslVerifyHost = true [protected] |
Definition at line 129 of file HttpFunctions.php.
HttpRequest::$status |
HttpRequest::$timeout = 'default' [protected] |
Definition at line 124 of file HttpFunctions.php.
HttpRequest::$url [protected] |
Definition at line 133 of file HttpFunctions.php.
Referenced by __construct(), PhpHttpRequest::execute(), factory(), parseCookies(), setReferer(), and PhpHttpRequest::urlToTcp().