This is automatic generated document for things in Swow\Psr7\Client\MagicClient class

Class MagicClient

Properties

protected $client protected $connectTimeout protected $connectedHost protected $connectedPort protected $connectedProxySignature protected $connectedScheme protected $defaultProxy protected $defaultTlsOptions protected $recvMessageTimeout protected $streamingChunkedResponse

Methods

Method __construct

public function __construct ( ?Client $client )

Method applyTransportRequest

protected function applyTransportRequest ( RequestInterface $request , ?array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool} $proxy ) : RequestInterface

Method buildCryptoOptions

protected function buildCryptoOptions ( string $host , array<string, mixed> $tlsOptions ) : array<string, mixed>

Method buildProxyAuthorization

protected function buildProxyAuthorization ( array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool} $proxy ) : ?string

Method buildProxySignature

protected function buildProxySignature ( ?array $proxy ) : string

Method buildRequest

protected function buildRequest ( string $method , string $url , array<string, mixed> $options ) : RequestInterface

Method buildSocks5AddressPayload

protected function buildSocks5AddressPayload ( string $host , bool $remoteDns ) : string

Method clearProxy

public function clearProxy ( ) : static

Method closeUnderlyingClientSilently

protected function closeUnderlyingClientSilently ( ) : void

Method connectViaHttpProxyTunnel

protected function connectViaHttpProxyTunnel ( RequestInterface $request , array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool} $proxy , string $targetHost , int $targetPort ) : void

Method connectViaSocks5Proxy

protected function connectViaSocks5Proxy ( RequestInterface $request , array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool} $proxy , string $targetHost , int $targetPort ) : void

Method ensureConnectedForUri

protected function ensureConnectedForUri ( UriInterface $uri , RequestInterface $request , ?array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool} $proxy , array<string, mixed> $tlsOptions ) : void

Method get

public function get ( string $url , array<string, mixed> $options ) : ResponseInterface

Method getClient

public function getClient ( ) : Client

Method normalizeHeaders

protected function normalizeHeaders ( mixed $headers ) : array<string, mixed>

Method normalizeOptionalTimeout

protected function normalizeOptionalTimeout ( mixed $timeout ) : ?int

Method normalizeProxyConfig

protected function normalizeProxyConfig ( mixed $proxy ) : ?array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool}

Method normalizeReadSize

protected function normalizeReadSize ( mixed $readSize ) : int

Method normalizeTlsOptions

protected function normalizeTlsOptions ( mixed $tls ) : array<string, mixed>

Method post

public function post ( string $url , array<string, mixed> $options ) : ResponseInterface

Method recreateClient

protected function recreateClient ( ) : void

Method request

public function request ( string $method , string $url , array<string, mixed> $options ) : ResponseInterface

Method resolveProxyConfig

protected function resolveProxyConfig ( array<string, mixed> $options ) : ?array{type: string, host: string, port: int, username: ?string, password: ?string, remote_dns: bool}

Method resolveTlsOptions

protected function resolveTlsOptions ( array<string, mixed> $options ) : array<string, mixed>

Method sendEventStreamRequest

public function sendEventStreamRequest ( RequestInterface $request , ?int $timeout , int $readSize ) : Generator<int, \Swow\Psr7\Message\EventStreamEvent>

Method sendRequest

public function sendRequest ( RequestInterface $request ) : ResponseInterface

Method setConnectTimeout

public function setConnectTimeout ( ?int $timeout ) : static

Method setProxy

public function setProxy ( ?array<string, mixed> $proxy ) : static

Method setRecvMessageTimeout

public function setRecvMessageTimeout ( int $timeout ) : static

Method setStreamingChunkedResponse

public function setStreamingChunkedResponse ( bool $enable ) : static

Method setTlsOptions

public function setTlsOptions ( array<string, mixed> $tlsOptions ) : static

Method stream

public function stream ( string $url , array<string, mixed> $options ) : Generator<int, \Swow\Psr7\Message\EventStreamEvent>

Copyright 2022 the Swow contributors