Disable request_fulluri by default for HTTPS connections

main
Jordi Boggiano 6 years ago
parent f946d8eb5a
commit 1cd9f4f9db

@ -87,15 +87,15 @@ final class StreamContextFactory
// enabled request_fulluri unless it is explicitly disabled
switch (parse_url($url, PHP_URL_SCHEME)) {
case 'http': // default request_fulluri to true
case 'http': // default request_fulluri to true for HTTP
$reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
$options['http']['request_fulluri'] = true;
}
break;
case 'https': // default request_fulluri to true
case 'https': // default request_fulluri to false for HTTPS
$reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
if (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv) {
$options['http']['request_fulluri'] = true;
}
break;

@ -142,7 +142,6 @@ class StreamContextFactoryTest extends TestCase
$expected = array(
'http' => array(
'proxy' => 'tcp://proxyserver.net:80',
'request_fulluri' => true,
'method' => 'GET',
'header' => array('User-Agent: foo', "Proxy-Authorization: Basic " . base64_encode('username:password')),
'max_redirects' => 20,
@ -173,7 +172,6 @@ class StreamContextFactoryTest extends TestCase
$expected = array(
'http' => array(
'proxy' => 'ssl://woopproxy.net:443',
'request_fulluri' => true,
'method' => 'GET',
'max_redirects' => 20,
'follow_location' => 1,

Loading…
Cancel
Save