MediaWiki  master
MultiHttpClient.php
Go to the documentation of this file.
1 <?php
24 use Psr\Log\LoggerAwareInterface;
25 use Psr\Log\LoggerInterface;
26 use Psr\Log\NullLogger;
28 
56 class MultiHttpClient implements LoggerAwareInterface {
58  private const SENSITIVE_HEADERS = '/(^|-|_)(authorization|auth|password|cookie)($|-|_)/';
63  protected $cmh = null;
65  protected $caBundlePath;
67  protected $connTimeout = 10;
69  protected $maxConnTimeout = INF;
71  protected $reqTimeout = 30;
73  protected $maxReqTimeout = INF;
75  protected $usePipelining = false;
77  protected $maxConnsPerHost = 50;
79  protected $proxy;
81  protected $localProxy = false;
83  protected $localVirtualHosts = [];
85  protected $userAgent = 'wikimedia/multi-http-client v1.1';
87  protected $logger;
89  protected array $headers = [];
90 
91  // In PHP 7 due to https://bugs.php.net/bug.php?id=76480 the request/connect
92  // timeouts are periodically polled instead of being accurately respected.
93  // The select timeout is set to the minimum timeout multiplied by this factor.
94  private const TIMEOUT_ACCURACY_FACTOR = 0.1;
95 
96  private ?TelemetryHeadersInterface $telemetry = null;
97 
120  public function __construct( array $options ) {
121  if ( isset( $options['caBundlePath'] ) ) {
122  $this->caBundlePath = $options['caBundlePath'];
123  if ( !file_exists( $this->caBundlePath ) ) {
124  throw new Exception( "Cannot find CA bundle: " . $this->caBundlePath );
125  }
126  }
127  static $opts = [
128  'connTimeout', 'maxConnTimeout', 'reqTimeout', 'maxReqTimeout',
129  'usePipelining', 'maxConnsPerHost', 'proxy', 'userAgent', 'logger',
130  'localProxy', 'localVirtualHosts', 'headers', 'telemetry'
131  ];
132  foreach ( $opts as $key ) {
133  if ( isset( $options[$key] ) ) {
134  $this->$key = $options[$key];
135  }
136  }
137  $this->logger ??= new NullLogger;
138  }
139 
163  public function run( array $req, array $opts = [] ) {
164  return $this->runMulti( [ $req ], $opts )[0]['response'];
165  }
166 
198  public function runMulti( array $reqs, array $opts = [] ) {
199  $this->normalizeRequests( $reqs );
200  $opts += [ 'connTimeout' => $this->connTimeout, 'reqTimeout' => $this->reqTimeout ];
201 
202  if ( $this->maxConnTimeout && $opts['connTimeout'] > $this->maxConnTimeout ) {
203  $opts['connTimeout'] = $this->maxConnTimeout;
204  }
205  if ( $this->maxReqTimeout && $opts['reqTimeout'] > $this->maxReqTimeout ) {
206  $opts['reqTimeout'] = $this->maxReqTimeout;
207  }
208 
209  if ( $this->isCurlEnabled() ) {
210  switch ( $opts['httpVersion'] ?? null ) {
211  case 'v1.0':
212  $opts['httpVersion'] = CURL_HTTP_VERSION_1_0;
213  break;
214  case 'v1.1':
215  $opts['httpVersion'] = CURL_HTTP_VERSION_1_1;
216  break;
217  case 'v2':
218  case 'v2.0':
219  $opts['httpVersion'] = CURL_HTTP_VERSION_2_0;
220  break;
221  default:
222  $opts['httpVersion'] = CURL_HTTP_VERSION_NONE;
223  }
224  return $this->runMultiCurl( $reqs, $opts );
225  } else {
226  # TODO: Add handling for httpVersion option
227  return $this->runMultiHttp( $reqs, $opts );
228  }
229  }
230 
236  protected function isCurlEnabled() {
237  // Explicitly test if curl_multi* is blocked, as some users' hosts provide
238  // them with a modified curl with the multi-threaded parts removed(!)
239  return extension_loaded( 'curl' ) && function_exists( 'curl_multi_init' );
240  }
241 
259  private function runMultiCurl( array $reqs, array $opts ) {
260  $chm = $this->getCurlMulti( $opts );
261 
262  $selectTimeout = $this->getSelectTimeout( $opts );
263 
264  // Add all of the required cURL handles...
265  $handles = [];
266  foreach ( $reqs as $index => &$req ) {
267  $handles[$index] = $this->getCurlHandle( $req, $opts );
268  curl_multi_add_handle( $chm, $handles[$index] );
269  }
270  unset( $req ); // don't assign over this by accident
271 
272  $infos = [];
273  // Execute the cURL handles concurrently...
274  $active = null; // handles still being processed
275  do {
276  // Do any available work...
277  do {
278  $mrc = curl_multi_exec( $chm, $active );
279  $info = curl_multi_info_read( $chm );
280  if ( $info !== false ) {
281  // Note: cast to integer even works on PHP 8.0+ despite the
282  // handle being an object not a resource, because CurlHandle
283  // has a backwards-compatible cast_object handler.
284  $infos[(int)$info['handle']] = $info;
285  }
286  } while ( $mrc == CURLM_CALL_MULTI_PERFORM );
287  // Wait (if possible) for available work...
288  if ( $active > 0 && $mrc == CURLM_OK && curl_multi_select( $chm, $selectTimeout ) == -1 ) {
289  // PHP bug 63411; https://curl.haxx.se/libcurl/c/curl_multi_fdset.html
290  usleep( 5000 ); // 5ms
291  }
292  } while ( $active > 0 && $mrc == CURLM_OK );
293 
294  // Remove all of the added cURL handles and check for errors...
295  foreach ( $reqs as $index => &$req ) {
296  $ch = $handles[$index];
297  curl_multi_remove_handle( $chm, $ch );
298 
299  if ( isset( $infos[(int)$ch] ) ) {
300  $info = $infos[(int)$ch];
301  $errno = $info['result'];
302  if ( $errno !== 0 ) {
303  $req['response']['error'] = "(curl error: $errno)";
304  if ( function_exists( 'curl_strerror' ) ) {
305  $req['response']['error'] .= " " . curl_strerror( $errno );
306  }
307  $this->logger->warning( "Error fetching URL \"{$req['url']}\": " .
308  $req['response']['error'] );
309  } else {
310  $this->logger->debug(
311  "HTTP complete: {method} {url} code={response_code} size={size} " .
312  "total={total_time} connect={connect_time}",
313  [
314  'method' => $req['method'],
315  'url' => $req['url'],
316  'response_code' => $req['response']['code'],
317  'size' => curl_getinfo( $ch, CURLINFO_SIZE_DOWNLOAD ),
318  'total_time' => $this->getCurlTime(
319  $ch, CURLINFO_TOTAL_TIME, 'CURLINFO_TOTAL_TIME_T'
320  ),
321  'connect_time' => $this->getCurlTime(
322  $ch, CURLINFO_CONNECT_TIME, 'CURLINFO_CONNECT_TIME_T'
323  ),
324  ]
325  );
326  }
327  } else {
328  $req['response']['error'] = "(curl error: no status set)";
329  }
330 
331  // For convenience with array destructuring
332  $req['response'][0] = $req['response']['code'];
333  $req['response'][1] = $req['response']['reason'];
334  $req['response'][2] = $req['response']['headers'];
335  $req['response'][3] = $req['response']['body'];
336  $req['response'][4] = $req['response']['error'];
337  curl_close( $ch );
338  // Close any string wrapper file handles
339  if ( isset( $req['_closeHandle'] ) ) {
340  fclose( $req['_closeHandle'] );
341  unset( $req['_closeHandle'] );
342  }
343  }
344  unset( $req ); // don't assign over this by accident
345 
346  return $reqs;
347  }
348 
361  protected function getCurlHandle( array &$req, array $opts ) {
362  $ch = curl_init();
363 
364  curl_setopt( $ch, CURLOPT_PROXY, $req['proxy'] ?? $this->proxy );
365  curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT_MS, intval( $opts['connTimeout'] * 1e3 ) );
366  curl_setopt( $ch, CURLOPT_TIMEOUT_MS, intval( $opts['reqTimeout'] * 1e3 ) );
367  curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
368  curl_setopt( $ch, CURLOPT_MAXREDIRS, 4 );
369  curl_setopt( $ch, CURLOPT_HEADER, 0 );
370  if ( $this->caBundlePath !== null ) {
371  curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, true );
372  curl_setopt( $ch, CURLOPT_CAINFO, $this->caBundlePath );
373  }
374  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
375 
376  $url = $req['url'];
377  $query = http_build_query( $req['query'], '', '&', PHP_QUERY_RFC3986 );
378  if ( $query != '' ) {
379  $url .= strpos( $req['url'], '?' ) === false ? "?$query" : "&$query";
380  }
381  curl_setopt( $ch, CURLOPT_URL, $url );
382  curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $req['method'] );
383  curl_setopt( $ch, CURLOPT_NOBODY, ( $req['method'] === 'HEAD' ) );
384  curl_setopt( $ch, CURLOPT_HTTP_VERSION, $opts['httpVersion'] ?? CURL_HTTP_VERSION_NONE );
385 
386  if ( $req['method'] === 'PUT' ) {
387  curl_setopt( $ch, CURLOPT_PUT, 1 );
388  // phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.is_resource
389  if ( is_resource( $req['body'] ) ) {
390  curl_setopt( $ch, CURLOPT_INFILE, $req['body'] );
391  if ( isset( $req['headers']['content-length'] ) ) {
392  curl_setopt( $ch, CURLOPT_INFILESIZE, $req['headers']['content-length'] );
393  } elseif ( isset( $req['headers']['transfer-encoding'] ) &&
394  $req['headers']['transfer-encoding'] === 'chunks'
395  ) {
396  curl_setopt( $ch, CURLOPT_UPLOAD, true );
397  } else {
398  throw new Exception( "Missing 'Content-Length' or 'Transfer-Encoding' header." );
399  }
400  } elseif ( $req['body'] !== '' ) {
401  $fp = fopen( "php://temp", "wb+" );
402  fwrite( $fp, $req['body'], strlen( $req['body'] ) );
403  rewind( $fp );
404  curl_setopt( $ch, CURLOPT_INFILE, $fp );
405  curl_setopt( $ch, CURLOPT_INFILESIZE, strlen( $req['body'] ) );
406  $req['_closeHandle'] = $fp; // remember to close this later
407  } else {
408  curl_setopt( $ch, CURLOPT_INFILESIZE, 0 );
409  }
410  curl_setopt( $ch, CURLOPT_READFUNCTION,
411  static function ( $ch, $fd, $length ) {
412  return (string)fread( $fd, $length );
413  }
414  );
415  } elseif ( $req['method'] === 'POST' ) {
416  curl_setopt( $ch, CURLOPT_POST, 1 );
417  curl_setopt( $ch, CURLOPT_POSTFIELDS, $req['body'] );
418  } else {
419  // phpcs:ignore MediaWiki.Usage.ForbiddenFunctions.is_resource
420  if ( is_resource( $req['body'] ) || $req['body'] !== '' ) {
421  throw new Exception( "HTTP body specified for a non PUT/POST request." );
422  }
423  $req['headers']['content-length'] = 0;
424  }
425 
426  if ( !isset( $req['headers']['user-agent'] ) ) {
427  $req['headers']['user-agent'] = $this->userAgent;
428  }
429 
430  $headers = [];
431  foreach ( $req['headers'] as $name => $value ) {
432  if ( strpos( $name, ':' ) !== false ) {
433  throw new Exception( "Header name must not contain colon-space." );
434  }
435  $headers[] = $name . ': ' . trim( $value );
436  }
437  curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
438 
439  curl_setopt( $ch, CURLOPT_HEADERFUNCTION,
440  static function ( $ch, $header ) use ( &$req ) {
441  if ( !empty( $req['flags']['relayResponseHeaders'] ) && trim( $header ) !== '' ) {
442  header( $header );
443  }
444  $length = strlen( $header );
445  $matches = [];
446  if ( preg_match( "/^(HTTP\/(?:1\.[01]|2)) (\d{3}) (.*)/", $header, $matches ) ) {
447  $req['response']['code'] = (int)$matches[2];
448  $req['response']['reason'] = trim( $matches[3] );
449  // After a redirect we will receive this again, but we already stored headers
450  // that belonged to a redirect response. Start over.
451  $req['response']['headers'] = [];
452  return $length;
453  }
454  if ( strpos( $header, ":" ) === false ) {
455  return $length;
456  }
457  [ $name, $value ] = explode( ":", $header, 2 );
458  $name = strtolower( $name );
459  $value = trim( $value );
460  if ( isset( $req['response']['headers'][$name] ) ) {
461  $req['response']['headers'][$name] .= ', ' . $value;
462  } else {
463  $req['response']['headers'][$name] = $value;
464  }
465  return $length;
466  }
467  );
468 
469  // This works with both file and php://temp handles (unlike CURLOPT_FILE)
470  $hasOutputStream = isset( $req['stream'] );
471  curl_setopt( $ch, CURLOPT_WRITEFUNCTION,
472  static function ( $ch, $data ) use ( &$req, $hasOutputStream ) {
473  if ( $hasOutputStream ) {
474  // @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset False positive
475  return fwrite( $req['stream'], $data );
476  } else {
477  // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
478  $req['response']['body'] .= $data;
479 
480  return strlen( $data );
481  }
482  }
483  );
484 
485  return $ch;
486  }
487 
494  protected function getCurlMulti( array $opts ) {
495  if ( !$this->cmh ) {
496  $cmh = curl_multi_init();
497  // Limit the size of the idle connection cache such that consecutive parallel
498  // request batches to the same host can avoid having to keep making connections
499  curl_multi_setopt( $cmh, CURLMOPT_MAXCONNECTS, (int)$this->maxConnsPerHost );
500  $this->cmh = $cmh;
501  }
502 
503  $curlVersion = curl_version()['version'];
504 
505  // CURLMOPT_MAX_HOST_CONNECTIONS is available since PHP 7.0.7 and cURL 7.30.0
506  if ( version_compare( $curlVersion, '7.30.0', '>=' ) ) {
507  // Limit the number of in-flight requests for any given host
508  $maxHostConns = $opts['maxConnsPerHost'] ?? $this->maxConnsPerHost;
509  curl_multi_setopt( $this->cmh, CURLMOPT_MAX_HOST_CONNECTIONS, (int)$maxHostConns );
510  }
511 
512  if ( $opts['usePipelining'] ?? $this->usePipelining ) {
513  if ( version_compare( $curlVersion, '7.43', '<' ) ) {
514  // The option is a boolean
515  $pipelining = 1;
516  } elseif ( version_compare( $curlVersion, '7.62', '<' ) ) {
517  // The option is a bitfield and HTTP/1.x pipelining is supported
518  $pipelining = CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX;
519  } else {
520  // The option is a bitfield but HTTP/1.x pipelining has been removed
521  $pipelining = CURLPIPE_MULTIPLEX;
522  }
523  // Suppress deprecation, we know already (T264735)
524  // phpcs:ignore Generic.PHP.NoSilencedErrors
525  @curl_multi_setopt( $this->cmh, CURLMOPT_PIPELINING, $pipelining );
526  }
527 
528  return $this->cmh;
529  }
530 
541  private function getCurlTime( $ch, $oldOption, $newConstName ): string {
542  if ( defined( $newConstName ) ) {
543  return sprintf( "%.6F", curl_getinfo( $ch, constant( $newConstName ) ) / 1e6 );
544  } else {
545  return (string)curl_getinfo( $ch, $oldOption );
546  }
547  }
548 
564  private function runMultiHttp( array $reqs, array $opts = [] ) {
565  $httpOptions = [
566  'timeout' => $opts['reqTimeout'] ?? $this->reqTimeout,
567  'connectTimeout' => $opts['connTimeout'] ?? $this->connTimeout,
568  'logger' => $this->logger,
569  'caInfo' => $this->caBundlePath,
570  ];
571  foreach ( $reqs as &$req ) {
572  $reqOptions = $httpOptions + [
573  'method' => $req['method'],
574  'proxy' => $req['proxy'] ?? $this->proxy,
575  'userAgent' => $req['headers']['user-agent'] ?? $this->userAgent,
576  'postData' => $req['body'],
577  ];
578 
579  $url = $req['url'];
580  $query = http_build_query( $req['query'], '', '&', PHP_QUERY_RFC3986 );
581  if ( $query != '' ) {
582  $url .= strpos( $req['url'], '?' ) === false ? "?$query" : "&$query";
583  }
584 
585  $httpRequest = MediaWikiServices::getInstance()->getHttpRequestFactory()->create(
586  $url, $reqOptions, __METHOD__ );
587  $httpRequest->setLogger( $this->logger );
588  foreach ( $req['headers'] as $header => $value ) {
589  $httpRequest->setHeader( $header, $value );
590  }
591  $sv = $httpRequest->execute()->getStatusValue();
592 
593  $respHeaders = array_map(
594  static function ( $v ) {
595  return implode( ', ', $v );
596  },
597  $httpRequest->getResponseHeaders() );
598 
599  $req['response'] = [
600  'code' => $httpRequest->getStatus(),
601  'reason' => '',
602  'headers' => $respHeaders,
603  'body' => $httpRequest->getContent(),
604  'error' => '',
605  ];
606 
607  if ( !$sv->isOK() ) {
608  $svErrors = $sv->getErrors();
609  if ( isset( $svErrors[0] ) ) {
610  $req['response']['error'] = $svErrors[0]['message'];
611 
612  // param values vary per failure type (ex. unknown host vs unknown page)
613  if ( isset( $svErrors[0]['params'][0] ) ) {
614  if ( is_numeric( $svErrors[0]['params'][0] ) ) {
615  if ( isset( $svErrors[0]['params'][1] ) ) {
616  // @phan-suppress-next-line PhanTypeInvalidDimOffset
617  $req['response']['reason'] = $svErrors[0]['params'][1];
618  }
619  } else {
620  $req['response']['reason'] = $svErrors[0]['params'][0];
621  }
622  }
623  }
624  }
625 
626  $req['response'][0] = $req['response']['code'];
627  $req['response'][1] = $req['response']['reason'];
628  $req['response'][2] = $req['response']['headers'];
629  $req['response'][3] = $req['response']['body'];
630  $req['response'][4] = $req['response']['error'];
631  }
632 
633  return $reqs;
634  }
635 
641  private function normalizeHeaders( array $headers ): array {
642  $normalized = [];
643  foreach ( $headers as $name => $value ) {
644  $normalized[strtolower( $name )] = $value;
645  }
646  return $normalized;
647  }
648 
654  private function normalizeRequests( array &$reqs ) {
655  foreach ( $reqs as &$req ) {
656  $req['response'] = [
657  'code' => 0,
658  'reason' => '',
659  'headers' => [],
660  'body' => '',
661  'error' => ''
662  ];
663  if ( isset( $req[0] ) ) {
664  $req['method'] = $req[0]; // short-form
665  unset( $req[0] );
666  }
667  if ( isset( $req[1] ) ) {
668  $req['url'] = $req[1]; // short-form
669  unset( $req[1] );
670  }
671  if ( !isset( $req['method'] ) ) {
672  throw new Exception( "Request has no 'method' field set." );
673  } elseif ( !isset( $req['url'] ) ) {
674  throw new Exception( "Request has no 'url' field set." );
675  }
676  if ( $this->localProxy !== false && $this->isLocalURL( $req['url'] ) ) {
677  $this->useReverseProxy( $req, $this->localProxy );
678  }
679  $req['query'] ??= [];
680  $req['headers'] = $this->normalizeHeaders(
681  array_merge(
682  $this->headers,
683  $this->telemetry ? $this->telemetry->getRequestHeaders() : [],
684  $req['headers'] ?? []
685  )
686  );
687 
688  if ( !isset( $req['body'] ) ) {
689  $req['body'] = '';
690  $req['headers']['content-length'] = 0;
691  }
692  // Redact some headers we know to have tokens before logging them
693  $logHeaders = $req['headers'];
694  foreach ( $logHeaders as $header => $value ) {
695  if ( preg_match( self::SENSITIVE_HEADERS, $header ) === 1 ) {
696  $logHeaders[$header] = '[redacted]';
697  }
698  }
699  $this->logger->debug( "HTTP start: {method} {url}",
700  [
701  'method' => $req['method'],
702  'url' => $req['url'],
703  'headers' => $logHeaders,
704  ]
705  );
706  $req['flags'] ??= [];
707  }
708  }
709 
710  private function useReverseProxy( array &$req, $proxy ) {
711  $parsedProxy = wfParseUrl( $proxy );
712  if ( $parsedProxy === false ) {
713  throw new Exception( "Invalid reverseProxy configured: $proxy" );
714  }
715  $parsedUrl = wfParseUrl( $req['url'] );
716  if ( $parsedUrl === false ) {
717  throw new Exception( "Invalid url specified: {$req['url']}" );
718  }
719  // Set the current host in the Host header
720  $req['headers']['Host'] = $parsedUrl['host'];
721  // Replace scheme, host and port in the request
722  $parsedUrl['scheme'] = $parsedProxy['scheme'];
723  $parsedUrl['host'] = $parsedProxy['host'];
724  if ( isset( $parsedProxy['port'] ) ) {
725  $parsedUrl['port'] = $parsedProxy['port'];
726  } else {
727  unset( $parsedUrl['port'] );
728  }
729  $req['url'] = wfAssembleUrl( $parsedUrl );
730  // Explicitly disable use of another proxy by setting to false,
731  // since null will fallback to $this->proxy
732  $req['proxy'] = false;
733  }
734 
742  private function isLocalURL( $url ) {
743  if ( !$this->localVirtualHosts ) {
744  // Shortcut
745  return false;
746  }
747 
748  // Extract host part
749  $matches = [];
750  if ( preg_match( '!^https?://([\w.-]+)[/:].*$!', $url, $matches ) ) {
751  $host = $matches[1];
752  // Split up dotwise
753  $domainParts = explode( '.', $host );
754  // Check if this domain or any superdomain is listed as a local virtual host
755  $domainParts = array_reverse( $domainParts );
756 
757  $domain = '';
758  $countParts = count( $domainParts );
759  for ( $i = 0; $i < $countParts; $i++ ) {
760  $domainPart = $domainParts[$i];
761  if ( $i == 0 ) {
762  $domain = $domainPart;
763  } else {
764  $domain = $domainPart . '.' . $domain;
765  }
766 
767  if ( in_array( $domain, $this->localVirtualHosts ) ) {
768  return true;
769  }
770  }
771  }
772 
773  return false;
774  }
775 
782  private function getSelectTimeout( $opts ) {
783  $connTimeout = $opts['connTimeout'] ?? $this->connTimeout;
784  $reqTimeout = $opts['reqTimeout'] ?? $this->reqTimeout;
785  $timeouts = array_filter( [ $connTimeout, $reqTimeout ] );
786  if ( count( $timeouts ) === 0 ) {
787  return 1;
788  }
789 
790  $selectTimeout = min( $timeouts ) * self::TIMEOUT_ACCURACY_FACTOR;
791  // Minimum 10us
792  if ( $selectTimeout < 10e-6 ) {
793  $selectTimeout = 10e-6;
794  }
795  return $selectTimeout;
796  }
797 
803  public function setLogger( LoggerInterface $logger ) {
804  $this->logger = $logger;
805  }
806 
807  public function __destruct() {
808  if ( $this->cmh ) {
809  curl_multi_close( $this->cmh );
810  $this->cmh = null;
811  }
812  }
813 
814 }
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfAssembleUrl( $urlParts)
This function will reassemble a URL parsed with wfParseURL.
$matches
if(!defined('MW_SETUP_CALLBACK'))
Definition: WebStart.php:88
Service locator for MediaWiki core services.
Class to handle multiple HTTP requests.
string[] $localVirtualHosts
runMulti(array $reqs, array $opts=[])
Execute a set of HTTP(S) requests.
__construct(array $options)
Since 1.35, callers should use HttpRequestFactory::createMultiClient() to get a client object with ap...
array array $headers
string null $proxy
proxy
string null $caBundlePath
SSL certificates path.
LoggerInterface $logger
resource object null $cmh
@phpcs:ignore MediaWiki.Commenting.PropertyDocumentation.ObjectTypeHintVar curl_multi_init() handle,...
setLogger(LoggerInterface $logger)
Register a logger.
run(array $req, array $opts=[])
Execute an HTTP(S) request.
string false $localProxy
getCurlHandle(array &$req, array $opts)
isCurlEnabled()
Determines if the curl extension is available.
getCurlMulti(array $opts)
Provide Request Telemetry information.
$header