From e58cfac5e28fdffa18a92f9d01f99cfff7ab9f6f Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 12 Jan 2010 11:06:19 +0100 Subject: [PATCH] Add proxy port. --- framework/Http/lib/Horde/Http/Client.php | 1 + framework/Http/lib/Horde/Http/Request/Base.php | 6 ++++++ framework/Http/lib/Horde/Http/Request/Curl.php | 3 +++ framework/Http/lib/Horde/Http/Request/Fopen.php | 3 +++ framework/Http/lib/Horde/Http/Request/Peclhttp.php | 3 +++ 5 files changed, 16 insertions(+) diff --git a/framework/Http/lib/Horde/Http/Client.php b/framework/Http/lib/Horde/Http/Client.php index 9c9045d8a..6f57c4a3c 100644 --- a/framework/Http/lib/Horde/Http/Client.php +++ b/framework/Http/lib/Horde/Http/Client.php @@ -54,6 +54,7 @@ class Horde_Http_Client * - request.method * - request.data * - request.proxyServer + * - request.proxyPort * - request.proxyUser * - request.proxyPass * - request.timeout diff --git a/framework/Http/lib/Horde/Http/Request/Base.php b/framework/Http/lib/Horde/Http/Request/Base.php index d6f72b9d0..73e9e917f 100644 --- a/framework/Http/lib/Horde/Http/Request/Base.php +++ b/framework/Http/lib/Horde/Http/Request/Base.php @@ -73,6 +73,12 @@ abstract class Horde_Http_Request_Base protected $_proxyServer = null; /** + * Proxy port + * @var string + */ + protected $_proxyPort = null; + + /** * Proxy username * @var string */ diff --git a/framework/Http/lib/Horde/Http/Request/Curl.php b/framework/Http/lib/Horde/Http/Request/Curl.php index 44528ba31..11dc1ca7a 100644 --- a/framework/Http/lib/Horde/Http/Request/Curl.php +++ b/framework/Http/lib/Horde/Http/Request/Curl.php @@ -65,6 +65,9 @@ class Horde_Http_Request_Curl extends Horde_Http_Request_Base // Proxy settings if ($this->proxyServer) { curl_setopt($curl, CURLOPT_PROXY, $this->proxyServer); + if ($this->proxyPort) { + curl_setopt($curl, CURLOPT_PROXYPORT, $this->proxyPort); + } if ($this->proxyUsername && $this->proxyPassword) { curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxyUsername . ':' . $this->proxyPassword); curl_setopt($curl, CURLOPT_PROXYAUTH, $this->_httpAuthScheme($this->proxyAuthenticationScheme)); diff --git a/framework/Http/lib/Horde/Http/Request/Fopen.php b/framework/Http/lib/Horde/Http/Request/Fopen.php index 7b53dc45c..af3658626 100644 --- a/framework/Http/lib/Horde/Http/Request/Fopen.php +++ b/framework/Http/lib/Horde/Http/Request/Fopen.php @@ -45,6 +45,9 @@ class Horde_Http_Request_Fopen extends Horde_Http_Request_Base // Proxy settings if ($this->proxyServer) { $opts['http']['proxy'] = 'tcp://' . $this->proxyServer; + if ($this->proxyPort) { + $opts['http']['proxy'] .= ':' . $this->proxyPort; + } $opts['http']['request_fulluri'] = true; if ($this->proxyUsername && $this->proxyPassword) { // @TODO check $this->proxyAuthenticationScheme diff --git a/framework/Http/lib/Horde/Http/Request/Peclhttp.php b/framework/Http/lib/Horde/Http/Request/Peclhttp.php index 06c7f655a..b607bf90a 100644 --- a/framework/Http/lib/Horde/Http/Request/Peclhttp.php +++ b/framework/Http/lib/Horde/Http/Request/Peclhttp.php @@ -75,6 +75,9 @@ class Horde_Http_Request_Peclhttp extends Horde_Http_Request_Base // Proxy settings if ($this->proxyServer) { $httpOptions['proxyhost'] = $this->proxyServer; + if ($this->proxyPort) { + $httpOptions['proxyport'] = $this->proxyPort; + } if ($this->proxyUsername && $this->proxyPassword) { $httpOptions['proxyauth'] = $this->proxyUsername . ':' . $this->proxyPassword; $httpOptions['proxyauthtype'] = $this->_httpAuthScheme($this->proxyAuthenticationScheme); -- 2.11.0