MediaWiki  REL1_19
Http Class Reference

Various HTTP related functions. More...

List of all members.

Static Public Member Functions

static get ($url, $timeout= 'default', $options=array())
 Simple wrapper for Http::request( 'GET' )
static isLocalURL ($url)
 Check if the URL can be served by localhost.
static isValidURI ($uri)
 Checks that the given URI is a valid one.
static post ($url, $options=array())
 Simple wrapper for Http::request( 'POST' )
static request ($method, $url, $options=array())
 Perform an HTTP request.
static userAgent ()
 A standard user-agent we can use for external requests.

Static Public Attributes

static $httpEngine = false

Detailed Description

Various HTTP related functions.

Definition at line 10 of file HttpFunctions.php.


Member Function Documentation

static Http::get ( url,
timeout = 'default',
options = array() 
) [static]

Simple wrapper for Http::request( 'GET' )

See also:
Http::request()
Parameters:
$url
$timeoutstring
$optionsarray
Returns:
string

Definition at line 66 of file HttpFunctions.php.

References $options, $url, and request().

Referenced by Installer\dirIsExecutable(), bench_HTTP_HTTPS\doRequest(), WikiRevision\downloadSource(), ImportSiteScripts\execute(), ExternalStoreHttp\fetchFromURL(), Parser\fetchScaryTemplateMaybeFromCache(), ImportSiteScripts\fetchScriptList(), File\getDescriptionText(), getFileCommentFromSourceWiki(), getFileUserFromSourceWiki(), and FindHooks\getHooksFromOnlineDoc().

Here is the call graph for this function:

Here is the caller graph for this function:

static Http::isLocalURL ( url) [static]

Check if the URL can be served by localhost.

Parameters:
$urlString: full url to check
Returns:
Boolean

Definition at line 89 of file HttpFunctions.php.

References $matches, $url, and $wgCommandLineMode.

Referenced by MWHttpRequest\proxySetup().

Here is the caller graph for this function:

static Http::isValidURI ( uri) [static]

Checks that the given URI is a valid one.

Hardcoding the protocols, because we only want protocols that both cURL and php support.

file:// should not be allowed here for security purpose (r67684)

this is wildly inaccurate and fails to actually check most stuff

Parameters:
$uriMixed: URI to check for validity
Returns:
Boolean

Definition at line 144 of file HttpFunctions.php.

Referenced by MWHttpRequest\__construct(), PhpHttpRequest\execute(), UploadFromUrl\fetchFile(), UploadFromUrl\isValidRequest(), and HttpTest\testIsValidUri().

Here is the caller graph for this function:

static Http::post ( url,
options = array() 
) [static]

Simple wrapper for Http::request( 'POST' )

See also:
Http::request()
Parameters:
$url
$optionsarray
Returns:
string

Definition at line 79 of file HttpFunctions.php.

References $options, $url, and request().

Here is the call graph for this function:

static Http::request ( method,
url,
options = array() 
) [static]

Perform an HTTP request.

Parameters:
$methodString: HTTP method. Usually GET/POST
$urlString: full URL to act on. If protocol-relative, will be expanded to an http:// URL
$optionsArray: options to pass to MWHttpRequest object. Possible keys for the array:
  • timeout Timeout length in seconds
  • postData An array of key-value pairs or a url-encoded form data
  • proxy The proxy to use. Will use $wgHTTPProxy (if set) otherwise.
  • noProxy Override $wgHTTPProxy (if set) and don't use any proxy at all.
  • sslVerifyHost (curl only) Verify hostname against certificate
  • sslVerifyCert (curl only) Verify SSL certificate
  • caInfo (curl only) Provide CA information
  • maxRedirects Maximum number of redirects to follow (defaults to 5)
  • followRedirects Whether to follow redirects (defaults to false). Note: this should only be used when the target URL is trusted, to avoid attacks on intranet services accessible by HTTP.
  • userAgent A user agent, if you want to override the default MediaWiki/$wgVersion
Returns:
Mixed: (bool)false on failure or a string on success

Definition at line 36 of file HttpFunctions.php.

References $options, $url, MWHttpRequest\factory(), and wfDebug().

Referenced by get(), ImportStreamSource\newFromURL(), and post().

Here is the call graph for this function:

Here is the caller graph for this function:

static Http::userAgent ( ) [static]

A standard user-agent we can use for external requests.

Returns:
String

Definition at line 127 of file HttpFunctions.php.

References $wgVersion.

Referenced by MWHttpRequest\execute(), ForeignAPIRepo\getUserAgent(), and SquidPurgeClient\queuePurge().

Here is the caller graph for this function:


Member Data Documentation

Http::$httpEngine = false [static]

Definition at line 11 of file HttpFunctions.php.

Referenced by MWHttpRequest\factory().


The documentation for this class was generated from the following file: