class HttpsDestinationPolicy extends PublicDestinationPolicy

Constants

protected DISALLOWED_NETWORKS

Methods

__construct(array $allowedNetworks = [])

Create a new public destination policy instance.

resolve(string $url, float $timeoutSeconds)

Resolve a public HTTPS destination, including each redirect target.

void
validate(string $url)

Validate a registered URL without making a network request.

string|null
proxyFor(UriInterface $uri)

Return an approved proxy for the destination.

bool
allowsAddress(UriInterface $uri, string $address)

Determine whether a non-public address may be used.

array
resolveHost(string $host, float $timeoutSeconds)

Resolve every address for a hostname.

array|false
resolveAddressFamily(string $host, int $family, float $timeoutSeconds)

Resolve one address family within its share of the request budget.

void
ensureHttps(string $url)

Reject plaintext endpoints before destination resolution.

Details

__construct(array $allowedNetworks = [])

Create a new public destination policy instance.

Parameters

array $allowedNetworks

addresses or CIDR ranges that are allowed even when they are not public

at line 16
ResolvedDestination resolve(string $url, float $timeoutSeconds)

Resolve a public HTTPS destination, including each redirect target.

Parameters

string $url
float $timeoutSeconds

Return Value

ResolvedDestination

at line 26
void validate(string $url)

Validate a registered URL without making a network request.

Parameters

string $url

Return Value

void

protected string|null proxyFor(UriInterface $uri)

Return an approved proxy for the destination.

Applications that require trusted egress proxies may extend this policy and select an absolute URL from a bounded operator-configured set. The policy then vets and pins only the proxy: hostname targets are resolved by the proxy, so it must enforce the same destination rules itself.

Parameters

UriInterface $uri

Return Value

string|null

protected bool allowsAddress(UriInterface $uri, string $address)

Determine whether a non-public address may be used.

Applications may narrowly allow known internal destinations by extending this policy. Every resolved address must be allowed.

Parameters

UriInterface $uri
string $address

Return Value

bool

protected array resolveHost(string $host, float $timeoutSeconds)

Resolve every address for a hostname.

Parameters

string $host
float $timeoutSeconds

Return Value

array

Exceptions

DestinationResolutionException

protected array|false resolveAddressFamily(string $host, int $family, float $timeoutSeconds)

Resolve one address family within its share of the request budget.

Parameters

string $host
int $family
float $timeoutSeconds

Return Value

array|false

at line 36
protected void ensureHttps(string $url)

Reject plaintext endpoints before destination resolution.

Parameters

string $url

Return Value

void