parent
33d641de4e
commit
960c9f557a
@ -80,6 +80,7 @@ class Curl
|
||||
if (isset($options['connection_timeout'])) {
|
||||
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $options['connection_timeout']);
|
||||
}
|
||||
|
||||
if (isset($options['proxy_host'])) {
|
||||
if (false !== $options['proxy_host']) {
|
||||
$proxyHost = $options['proxy_host'].(isset($options['proxy_port']) ? $options['proxy_port'] : 8080);
|
||||
@ -88,10 +89,12 @@ class Curl
|
||||
}
|
||||
|
||||
curl_setopt($this->ch, CURLOPT_PROXY, $proxyHost);
|
||||
|
||||
if ($proxyHost && isset($options['proxy_user'])) {
|
||||
curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'].':'.$options['proxy_pass']);
|
||||
}
|
||||
}
|
||||
if (isset($options['proxy_user'])) {
|
||||
curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'] . ':' . $options['proxy_password']);
|
||||
}
|
||||
|
||||
if (isset($options['login'])) {
|
||||
curl_setopt($this->ch, CURLOPT_HTTPAUTH, isset($options['extra_options']['http_auth']) ? $options['extra_options']['http_auth'] : CURLAUTH_ANY);
|
||||
curl_setopt($this->ch, CURLOPT_USERPWD, $options['login'].':'.$options['password']);
|
||||
|
@ -180,14 +180,14 @@ class SoapClientBuilder extends AbstractSoapBuilder
|
||||
*
|
||||
* @return \BeSimple\SoapClient\SoapClientBuilder
|
||||
*/
|
||||
public function withProxy($host, $port, $username = null, $password = null)
|
||||
public function withProxy($host, $port, $user = null, $pass = null)
|
||||
{
|
||||
$this->soapOptions['proxy_host'] = $host;
|
||||
$this->soapOptions['proxy_port'] = $port;
|
||||
|
||||
if ($username) {
|
||||
$this->soapOptions['proxy_login'] = $username;
|
||||
$this->soapOptions['proxy_password'] = $password;
|
||||
if ($user) {
|
||||
$this->soapOptions['proxy_user'] = $user;
|
||||
$this->soapOptions['proxy_pass'] = $pass;
|
||||
}
|
||||
|
||||
return $this;
|
||||
@ -236,4 +236,4 @@ class SoapClientBuilder extends AbstractSoapBuilder
|
||||
{
|
||||
$this->validateWsdl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class SoapClientBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => 'localhost', 'proxy_port' => 8080)), $builder->getSoapOptions());
|
||||
|
||||
$builder->withProxy('127.0.0.1', 8585, 'foo', 'bar');
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_login' => 'foo', 'proxy_password' => 'bar')), $builder->getSoapOptions());
|
||||
$this->assertEquals($this->mergeOptions(array('proxy_host' => '127.0.0.1', 'proxy_port' => 8585, 'proxy_user' => 'foo', 'proxy_pass' => 'bar')), $builder->getSoapOptions());
|
||||
}
|
||||
|
||||
public function testCreateWithDefaults()
|
||||
|
Loading…
Reference in New Issue
Block a user