|
MediaWiki master
|
Factory creating MWHttpRequest objects. More...
Public Member Functions | |
| __construct (ServiceOptions $options, LoggerInterface $logger, ?TelemetryHeadersInterface $telemetry=null) | |
| 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. | |
| createGuzzleClient (array $config=[]) | |
| Get a GuzzleHttp\Client instance. | |
| createMultiClient ( $options=[]) | |
| Get a MultiHttpClient with MediaWiki configured defaults applied. | |
| get ( $url, array $options=[], $caller=__METHOD__) | |
Simple wrapper for ‘request( 'GET’ ), parameters have the same meaning as forrequest()`. | |
| getUserAgent () | |
| post ( $url, array $options=[], $caller=__METHOD__) | |
Simple wrapper for ‘request( 'POST’ ), parameters have the same meaning as forrequest()`. | |
| request ( $method, $url, array $options=[], $caller=__METHOD__) | |
| Perform an HTTP request. | |
Public Attributes | |
| const | CONSTRUCTOR_OPTIONS |
Factory creating MWHttpRequest objects.
Definition at line 22 of file HttpRequestFactory.php.
| MediaWiki\Http\HttpRequestFactory::__construct | ( | ServiceOptions | $options, |
| LoggerInterface | $logger, | ||
| ?TelemetryHeadersInterface | $telemetry = null ) |
Definition at line 42 of file HttpRequestFactory.php.
References 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 143 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:
|
| string | $caller | The method making this request, for profiling |
Definition at line 87 of file HttpRequestFactory.php.
References $url, MediaWiki\Config\ServiceOptions\get(), MediaWiki\MainConfigNames\HTTPConnectTimeout, MediaWiki\MainConfigNames\HTTPMaxConnectTimeout, MediaWiki\MainConfigNames\HTTPMaxTimeout, and MediaWiki\MainConfigNames\HTTPTimeout.
Referenced by MediaWiki\Http\HttpRequestFactory\request().
| MediaWiki\Http\HttpRequestFactory::createGuzzleClient | ( | array | $config = [] | ) |
Get a GuzzleHttp\Client instance.
| array | $config | Client configuration settings. |
Definition at line 261 of file HttpRequestFactory.php.
References MediaWiki\Http\HttpRequestFactory\getUserAgent().
| 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 222 of file HttpRequestFactory.php.
References MediaWiki\Http\Telemetry\getInstance(), MediaWiki\Http\HttpRequestFactory\getUserAgent(), MediaWiki\MainConfigNames\HTTPConnectTimeout, MediaWiki\MainConfigNames\HTTPMaxConnectTimeout, MediaWiki\MainConfigNames\HTTPMaxTimeout, MediaWiki\MainConfigNames\HTTPTimeout, MediaWiki\MainConfigNames\LocalHTTPProxy, and MediaWiki\MainConfigNames\LocalVirtualHosts.
| MediaWiki\Http\HttpRequestFactory::get | ( | $url, | |
| array | $options = [], | ||
| $caller = __METHOD__ ) |
Simple wrapper for ‘request( 'GET’ ), parameters have the same meaning as forrequest()`.
| string | $url | |
| array | $options | |
| string | $caller |
Definition at line 186 of file HttpRequestFactory.php.
References $url, and MediaWiki\Http\HttpRequestFactory\request().
| MediaWiki\Http\HttpRequestFactory::getUserAgent | ( | ) |
Definition at line 206 of file HttpRequestFactory.php.
References MW_VERSION.
Referenced by MediaWiki\Sparql\SparqlClient\__construct(), MediaWiki\Http\HttpRequestFactory\createGuzzleClient(), and MediaWiki\Http\HttpRequestFactory\createMultiClient().
| MediaWiki\Http\HttpRequestFactory::post | ( | $url, | |
| array | $options = [], | ||
| $caller = __METHOD__ ) |
Simple wrapper for ‘request( 'POST’ ), parameters have the same meaning as forrequest()`.
| string | $url | |
| array | $options | |
| string | $caller |
Definition at line 199 of file HttpRequestFactory.php.
References $url, 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 158 of file HttpRequestFactory.php.
References $url, and MediaWiki\Http\HttpRequestFactory\create().
Referenced by MediaWiki\Http\HttpRequestFactory\get(), and MediaWiki\Http\HttpRequestFactory\post().
| const MediaWiki\Http\HttpRequestFactory::CONSTRUCTOR_OPTIONS |
Definition at line 33 of file HttpRequestFactory.php.