Solving the issue #1387
parent
0f337dd56a
commit
df592d40de
|
@ -245,7 +245,7 @@ class InstallationManager
|
|||
$opts = array('http' =>
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-type: application/x-www-form-urlencoded',
|
||||
'header' => array('Content-type: application/x-www-form-urlencoded'),
|
||||
'content' => http_build_query($params, '', '&'),
|
||||
'timeout' => 3,
|
||||
)
|
||||
|
@ -269,7 +269,7 @@ class InstallationManager
|
|||
$opts = array('http' =>
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/json',
|
||||
'header' => array('Content-Type: application/json'),
|
||||
'content' => json_encode($postData),
|
||||
'timeout' => 6,
|
||||
)
|
||||
|
|
|
@ -67,19 +67,12 @@ final class StreamContextFactory
|
|||
$auth .= ':' . $proxy['pass'];
|
||||
}
|
||||
$auth = base64_encode($auth);
|
||||
$authHeader = "Proxy-Authorization: Basic {$auth}";
|
||||
|
||||
// Preserve headers if already set in default options
|
||||
if (isset($defaultOptions['http']['header'])) {
|
||||
if (is_array($defaultOptions['http']['header']))
|
||||
$defaultOptions['http']['header'][] = $authHeader;
|
||||
else
|
||||
$defaultOptions['http']['header'] = array(
|
||||
$defaultOptions['http']['header'],
|
||||
$authHeader
|
||||
);
|
||||
$defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
|
||||
} else {
|
||||
$options['http']['header'] = array($authHeader);
|
||||
$options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,20 +126,6 @@ class StreamContextFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testHttpProxyWithContentTypeHeader() {
|
||||
$_SERVER['http_proxy'] = 'http://username:password@proxyserver.net';
|
||||
|
||||
$context = StreamContextFactory::getContext(array('http' => array('method' => 'GET', 'header' => 'Content-Type: application/json')));
|
||||
$options = stream_context_get_options($context);
|
||||
|
||||
$this->assertEquals(array('http' => array(
|
||||
'proxy' => 'tcp://proxyserver.net:80',
|
||||
'request_fulluri' => true,
|
||||
'method' => 'GET',
|
||||
'header' => array("Content-Type: application/json", "Proxy-Authorization: Basic " . base64_encode('username:password'))
|
||||
)), $options);
|
||||
}
|
||||
|
||||
public function dataSSLProxy()
|
||||
{
|
||||
return array(
|
||||
|
|
Loading…
Reference in New Issue