wp-includes/SimplePie/src/HTTP/Psr18Client.php:22HTTP Client based on PSR-18 and PSR-17 implementations
$httpClientPsr\Http\Client\ClientInterfaceprivate$requestFactoryPsr\Http\Message\RequestFactoryInterfaceprivate$uriFactoryPsr\Http\Message\UriFactoryInterfaceprivate$allowedRedirectsintprivatefinal class Psr18Client implements Client{ /** * @var ClientInterface */ private $httpClient; /** * @var RequestFactoryInterface */ private $requestFactory; /** * @var UriFactoryInterface */ private $uriFactory; /** * @var int */ private $allowedRedirects = 5; public function __construct(ClientInterface $httpClient, RequestFactoryInterface $requestFactory, UriFactoryInterface $uriFactory) { $this->httpClient = $httpClient; $this->requestFactory = $requestFactory; $this->uriFactory = $uriFactory; } public function getHttpClient(): ClientInterface { return $this->httpClient; } public function getRequestFactory(): RequestFactoryInterface { return $this->requestFactory; } public function getUriFactory(): UriFactoryInterface { return $this->uriFactory; } /** * send a request and return the response * * @param Client::METHOD_* $method * @param string $url * @param array<string,string|string[]> $headers * * @throws ClientException if anything goes wrong requesting the data */ public function request(string $method, string $url, array $headers = []): Response { if ($method !== self::METHOD_GET) { throw new InvalidArgumentException(sprintf( '%s(): Argument #1 ($method) only supports method "%s".', __METHOD__, self::METHOD_GET ), 1); } if (preg_match('/^http(s)?:\/\//i', $url)) { return $this->requestUrl($method, $url, $headers); } return $this->requestLocalFile($url); } /** * @param array<string,string|string[]> $headers */ private function requestUrl(string $method, string $url, array $headers): Response { $permanentUrl = $url; $requestedUrl = $url; $remainingRedirects = $this->allowedRedirects; $request = $this->requestFactory->createRequest(Unchanged from 6.9.7 through 7.1.0.
Signature, return type and hooks compared across 3 parsed releases.
src/wp-includes/SimplePie/src/HTTP/Psr18Client.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.