MediaWiki fundraising/REL1_35
|
Factory creating MWHttpRequest objects. More...
Public Member Functions | |
__construct (ServiceOptions $options, LoggerInterface $logger) | |
canMakeRequests () | |
Simple function to test if we can make any sort of requests at all, using cURL or fopen() | |
create ( $url, array $options=[], $caller=__METHOD__) | |
Generate a new MWHttpRequest object. | |
createMultiClient ( $options=[]) | |
Get a MultiHttpClient with MediaWiki configured defaults applied. | |
get ( $url, array $options=[], $caller=__METHOD__) | |
Simple wrapper for request( 'GET' ), parameters have same meaning as for request() | |
getUserAgent () | |
post ( $url, array $options=[], $caller=__METHOD__) | |
Simple wrapper for request( 'POST' ), parameters have same meaning as for request() | |
request ( $method, $url, array $options=[], $caller=__METHOD__) | |
Perform an HTTP request. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
Private Member Functions | |
normalizeTimeout ( $parameter, $maxParameter, $default, $maxConfigured) | |
Given a passed parameter value, a default and a maximum, figure out the correct timeout to pass to the backend. | |
Private Attributes | |
LoggerInterface | $logger |
ServiceOptions | $options |
Factory creating MWHttpRequest objects.
Definition at line 38 of file HttpRequestFactory.php.
MediaWiki\Http\HttpRequestFactory::__construct | ( | ServiceOptions | $options, |
LoggerInterface | $logger ) |
Definition at line 51 of file HttpRequestFactory.php.
References MediaWiki\Http\HttpRequestFactory\$logger, MediaWiki\Http\HttpRequestFactory\$options, and MediaWiki\Config\ServiceOptions\assertRequiredOptions().
MediaWiki\Http\HttpRequestFactory::canMakeRequests | ( | ) |
Simple function to test if we can make any sort of requests at all, using cURL or fopen()
Definition at line 164 of file HttpRequestFactory.php.
References wfIniGetBool().
MediaWiki\Http\HttpRequestFactory::create | ( | $url, | |
array | $options = [], | ||
$caller = __METHOD__ ) |
Generate a new MWHttpRequest object.
string | $url | Url to use |
array | $options | Possible keys for the array:
|
-param array{timeout?:int|string,connectTimeout?:int|string,postData?:string|array,proxy?:?string,noProxy?:bool,sslVerifyHost?:bool,sslVerifyCert?:bool,caInfo?:?string,maxRedirects?:int,followRedirects?:bool,userAgent?:string,method?:string,logger?:\Psr\Log\LoggerInterface,username?:string,password?:string,originalRequest?:\WebRequest|array{ip:string,userAgent:string}} $options
string | $caller | The method making this request, for profiling |
RuntimeException |
Definition at line 94 of file HttpRequestFactory.php.
References Http\$httpEngine, MediaWiki\Http\HttpRequestFactory\$logger, MediaWiki\Http\HttpRequestFactory\$options, MediaWiki\Config\ServiceOptions\get(), Profiler\instance(), and MediaWiki\Http\HttpRequestFactory\normalizeTimeout().
Referenced by MediaWiki\Http\HttpRequestFactory\request().
MediaWiki\Http\HttpRequestFactory::createMultiClient | ( | $options = [] | ) |
Get a MultiHttpClient with MediaWiki configured defaults applied.
Unlike create(), by default, no proxy will be used. To use a proxy, specify the 'proxy' option.
array | $options | Options as documented in MultiHttpClient::__construct(), except that for consistency with create(), 'timeout' is accepted as an alias for 'reqTimeout', and 'connectTimeout' is accepted as an alias for 'connTimeout'. |
Definition at line 243 of file HttpRequestFactory.php.
References MediaWiki\Http\HttpRequestFactory\$logger, MediaWiki\Http\HttpRequestFactory\$options, MediaWiki\Config\ServiceOptions\get(), MediaWiki\Http\HttpRequestFactory\getUserAgent(), and MediaWiki\Http\HttpRequestFactory\normalizeTimeout().
MediaWiki\Http\HttpRequestFactory::get | ( | $url, | |
array | $options = [], | ||
$caller = __METHOD__ ) |
Simple wrapper for request( 'GET' ), parameters have same meaning as for request()
string | $url | |
array | $options | |
string | $caller |
Definition at line 207 of file HttpRequestFactory.php.
References MediaWiki\Http\HttpRequestFactory\$options, and MediaWiki\Http\HttpRequestFactory\request().
MediaWiki\Http\HttpRequestFactory::getUserAgent | ( | ) |
Definition at line 227 of file HttpRequestFactory.php.
References MW_VERSION.
Referenced by MediaWiki\Http\HttpRequestFactory\createMultiClient().
|
private |
Given a passed parameter value, a default and a maximum, figure out the correct timeout to pass to the backend.
int | float | string | null | $parameter | The timeout in seconds, or "default" or null |
int | float | null | $maxParameter | The maximum timeout specified by the caller |
int | float | $default | The configured default timeout |
int | float | $maxConfigured | The configured maximum timeout |
Definition at line 137 of file HttpRequestFactory.php.
Referenced by MediaWiki\Http\HttpRequestFactory\create(), and MediaWiki\Http\HttpRequestFactory\createMultiClient().
MediaWiki\Http\HttpRequestFactory::post | ( | $url, | |
array | $options = [], | ||
$caller = __METHOD__ ) |
Simple wrapper for request( 'POST' ), parameters have same meaning as for request()
string | $url | |
array | $options | |
string | $caller |
Definition at line 220 of file HttpRequestFactory.php.
References MediaWiki\Http\HttpRequestFactory\$options, and MediaWiki\Http\HttpRequestFactory\request().
MediaWiki\Http\HttpRequestFactory::request | ( | $method, | |
$url, | |||
array | $options = [], | ||
$caller = __METHOD__ ) |
Perform an HTTP request.
string | $method | HTTP method. Usually GET/POST |
string | $url | Full URL to act on. If protocol-relative, will be expanded to an http:// URL |
array | $options | See HttpRequestFactory::create |
string | $caller | The method making this request, for profiling |
Definition at line 179 of file HttpRequestFactory.php.
References MediaWiki\Http\HttpRequestFactory\$logger, MediaWiki\Http\HttpRequestFactory\$options, and MediaWiki\Http\HttpRequestFactory\create().
Referenced by MediaWiki\Http\HttpRequestFactory\get(), and MediaWiki\Http\HttpRequestFactory\post().
|
private |
Definition at line 42 of file HttpRequestFactory.php.
Referenced by MediaWiki\Http\HttpRequestFactory\__construct(), MediaWiki\Http\HttpRequestFactory\create(), MediaWiki\Http\HttpRequestFactory\createMultiClient(), and MediaWiki\Http\HttpRequestFactory\request().
|
private |
Definition at line 40 of file HttpRequestFactory.php.
Referenced by MediaWiki\Http\HttpRequestFactory\__construct(), MediaWiki\Http\HttpRequestFactory\create(), MediaWiki\Http\HttpRequestFactory\createMultiClient(), MediaWiki\Http\HttpRequestFactory\get(), MediaWiki\Http\HttpRequestFactory\post(), and MediaWiki\Http\HttpRequestFactory\request().
const MediaWiki\Http\HttpRequestFactory::CONSTRUCTOR_OPTIONS |
Definition at line 44 of file HttpRequestFactory.php.