MediaWiki
master
|
Class to handle multiple HTTP requests. More...
Public Member Functions | |
__construct (array $options) | |
Since 1.35, callers should use HttpRequestFactory::createMultiClient() to get a client object with appropriately configured timeouts instead of constructing a MultiHttpClient directly. More... | |
__destruct () | |
run (array $req, array $opts=[]) | |
Execute an HTTP(S) request. More... | |
runMulti (array $reqs, array $opts=[]) | |
Execute a set of HTTP(S) requests. More... | |
setLogger (LoggerInterface $logger) | |
Register a logger. More... | |
Protected Member Functions | |
getCurlHandle (array &$req, array $opts) | |
getCurlMulti (array $opts) | |
isCurlEnabled () | |
Determines if the curl extension is available. More... | |
Protected Attributes | |
string null | $caBundlePath |
SSL certificates path. More... | |
resource object | $cmh |
@phpcs:ignore MediaWiki.Commenting.PropertyDocumentation.ObjectTypeHintVar curl_multi_init() handle More... | |
float | $connTimeout = 10 |
string false | $localProxy = false |
string[] | $localVirtualHosts = [] |
LoggerInterface | $logger |
int | $maxConnsPerHost = 50 |
float | $maxConnTimeout = INF |
float | $maxReqTimeout = INF |
string null | $proxy |
proxy More... | |
float | $reqTimeout = 30 |
bool | $usePipelining = false |
string | $userAgent = 'wikimedia/multi-http-client v1.0' |
Class to handle multiple HTTP requests.
If curl is available, requests will be made concurrently. Otherwise, they will be made serially.
HTTP request maps are arrays that use the following format:
Since 1.35, callers should use HttpRequestFactory::createMultiClient() to get a client object with appropriately configured timeouts.
Definition at line 55 of file MultiHttpClient.php.
MultiHttpClient::__construct | ( | array | $options | ) |
Since 1.35, callers should use HttpRequestFactory::createMultiClient() to get a client object with appropriately configured timeouts instead of constructing a MultiHttpClient directly.
array | $options |
|
Exception |
Definition at line 113 of file MultiHttpClient.php.
MultiHttpClient::__destruct | ( | ) |
Definition at line 783 of file MultiHttpClient.php.
|
protected |
array | &$req | HTTP request map @phpcs:ignore Generic.Files.LineLength |
array | $opts |
|
Exception |
Definition at line 354 of file MultiHttpClient.php.
References $header, $matches, and $userAgent.
|
protected |
array | $opts | @phpcs:ignore MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn |
Exception |
Definition at line 487 of file MultiHttpClient.php.
References $cmh, and $maxConnsPerHost.
|
protected |
Determines if the curl extension is available.
Definition at line 229 of file MultiHttpClient.php.
Referenced by runMulti().
MultiHttpClient::run | ( | array | $req, |
array | $opts = [] |
||
) |
Execute an HTTP(S) request.
This method returns a response map of:
array | $req | HTTP request array |
array | $opts |
Definition at line 156 of file MultiHttpClient.php.
References runMulti().
MultiHttpClient::runMulti | ( | array | $reqs, |
array | $opts = [] |
||
) |
Execute a set of HTTP(S) requests.
If curl is available, requests will be made concurrently. Otherwise, they will be made serially.
The maps are returned by this method with the 'response' field set to a map of:
array[] | $reqs | Map of HTTP request arrays |
array | $opts | Options
|
Exception |
Definition at line 191 of file MultiHttpClient.php.
References $connTimeout, $maxConnTimeout, $maxReqTimeout, $reqTimeout, and isCurlEnabled().
Referenced by run().
MultiHttpClient::setLogger | ( | LoggerInterface | $logger | ) |
Register a logger.
LoggerInterface | $logger |
Definition at line 779 of file MultiHttpClient.php.
|
protected |
SSL certificates path.
Definition at line 64 of file MultiHttpClient.php.
|
protected |
@phpcs:ignore MediaWiki.Commenting.PropertyDocumentation.ObjectTypeHintVar curl_multi_init() handle
Definition at line 62 of file MultiHttpClient.php.
Referenced by getCurlMulti().
|
protected |
Definition at line 66 of file MultiHttpClient.php.
Referenced by runMulti().
|
protected |
Definition at line 80 of file MultiHttpClient.php.
|
protected |
Definition at line 82 of file MultiHttpClient.php.
|
protected |
Definition at line 86 of file MultiHttpClient.php.
|
protected |
Definition at line 76 of file MultiHttpClient.php.
Referenced by getCurlMulti().
|
protected |
Definition at line 68 of file MultiHttpClient.php.
Referenced by runMulti().
|
protected |
Definition at line 72 of file MultiHttpClient.php.
Referenced by runMulti().
|
protected |
proxy
Definition at line 78 of file MultiHttpClient.php.
|
protected |
Definition at line 70 of file MultiHttpClient.php.
Referenced by runMulti().
|
protected |
Definition at line 74 of file MultiHttpClient.php.
|
protected |
Definition at line 84 of file MultiHttpClient.php.
Referenced by getCurlHandle().