1
0
Fork 0

Disable request_fulluri by default for HTTPS connections

pull/7904/head
Jordi Boggiano 2018-11-12 15:35:46 +01:00
parent f946d8eb5a
commit 1cd9f4f9db
2 changed files with 3 additions and 5 deletions

View File

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

View File

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