function StreamHandler::add_proxy
Parameters
mixed $value as passed via Request transfer options.:
File
-
vendor/
guzzlehttp/ guzzle/ src/ Handler/ StreamHandler.php, line 416
Class
- StreamHandler
- HTTP handler that uses PHP's HTTP stream wrapper.
Namespace
GuzzleHttp\HandlerCode
private function add_proxy(RequestInterface $request, array &$options, $value, array &$params) : void {
$uri = null;
if (!\is_array($value)) {
$uri = $value;
}
else {
$scheme = $request->getUri()
->getScheme();
if (isset($value[$scheme])) {
if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()
->getHost(), $value['no'])) {
$uri = $value[$scheme];
}
}
}
if (!$uri) {
return;
}
$parsed = $this->parse_proxy($uri);
$options['http']['proxy'] = $parsed['proxy'];
if ($parsed['auth']) {
if (!isset($options['http']['header'])) {
$options['http']['header'] = [];
}
$options['http']['header'] .= "\r\nProxy-Authorization: {$parsed['auth']}";
}
}