Follow-up coding standard fixes
parent
37476eb61f
commit
1ae0a1b7af
|
@ -43,12 +43,10 @@ final class StreamContextFactory
|
||||||
|
|
||||||
if (isset($proxyPort)) {
|
if (isset($proxyPort)) {
|
||||||
$proxyURL .= ":" . $proxyPort;
|
$proxyURL .= ":" . $proxyPort;
|
||||||
} else {
|
} else if ('http://' == substr($proxyURL, 0, 7)) {
|
||||||
if ('http://' == substr($proxyURL, 0, 7)) {
|
$proxyURL .= ":80";
|
||||||
$proxyURL .= ":80";
|
} else if ('https://' == substr($proxyURL, 0, 8)) {
|
||||||
} else if ('https://' == substr($proxyURL, 0, 8)) {
|
$proxyURL .= ":443";
|
||||||
$proxyURL .= ":443";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http(s):// is not supported in proxy
|
// http(s):// is not supported in proxy
|
||||||
|
@ -75,14 +73,13 @@ final class StreamContextFactory
|
||||||
$auth = base64_encode($auth);
|
$auth = base64_encode($auth);
|
||||||
|
|
||||||
// Preserve headers if already set in default options
|
// Preserve headers if already set in default options
|
||||||
if (isset($defaultOptions['http']) && isset($defaultOptions['http']['header'])) {
|
if (isset($defaultOptions['http']['header'])) {
|
||||||
$defaultOptions['http']['header'] .= "Proxy-Authorization: Basic {$auth}\r\n";
|
$defaultOptions['http']['header'] .= "Proxy-Authorization: Basic {$auth}\r\n";
|
||||||
} else {
|
} else {
|
||||||
$options['http']['header'] = "Proxy-Authorization: Basic {$auth}\r\n";
|
$options['http']['header'] = "Proxy-Authorization: Basic {$auth}\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array_merge_recursive($options, $defaultOptions);
|
$options = array_merge_recursive($options, $defaultOptions);
|
||||||
|
|
||||||
return stream_context_create($options, $defaultParams);
|
return stream_context_create($options, $defaultParams);
|
||||||
|
|
Loading…
Reference in New Issue