Added proxy support.
This commit is contained in:
@@ -211,12 +211,25 @@ class Bootstrap {
|
||||
* the transport layer should wait for an HTTP request. A
|
||||
* transport MAY ignore this parameter, but the ones included
|
||||
* with the library honor it.
|
||||
* - 'transport.ssl.verify': Set this to FALSE to turn off SSL certificate
|
||||
* verification. This is NOT recommended, but is sometimes necessary for
|
||||
* certain proxy configurations.
|
||||
* - 'account' and 'secret'
|
||||
* - 'username' and 'password'
|
||||
* - 'tenantid'
|
||||
* - 'endpoint': The full URL to identity services. This is used by stream
|
||||
* wrappers.
|
||||
*
|
||||
* The CURL wrapper supports proxy settings:
|
||||
*
|
||||
* - proxy: the proxy server URL (CURLOPT_PROXY)
|
||||
* - proxy.userpwd: the proxy username:password (CURLOPT_PROXYUSERPWD)
|
||||
* - proxy.auth: See CURLOPT_PROXYAUTH
|
||||
* - proxy.port: The proxy port. (CURLOPT_PROXYPORT)
|
||||
* - proxy.type: see CURLOPT_PROXYTYPE
|
||||
* - proxy.tunnel: If this is set to TRUE, attempt to tunnel through the
|
||||
* proxy. This is recommended when using a proxy. (CURLOPT_HTTPPROXYTUNNEL)
|
||||
*
|
||||
* @param array $array
|
||||
* An associative array of configuration directives.
|
||||
*/
|
||||
|
||||
@@ -226,6 +226,22 @@ class CURLTransport implements Transporter {
|
||||
$opts[CURLOPT_SSL_VERIFYPEER] = $validate;
|
||||
}
|
||||
|
||||
// PROXY settings
|
||||
$proxyMap = array(
|
||||
'proxy' => CURLOPT_PROXY,
|
||||
'proxy.tunnel' => CURLOPT_HTTPPROXYTUNNEL,
|
||||
'proxy.auth' => CURLOPT_PROXYAUTH,
|
||||
'proxy.port' => CURLOPT_PROXYPORT,
|
||||
'proxy.type' => CURLOPT_PROXYTYPE,
|
||||
'proxy.userpwd' => CURLOPT_USERPWD,
|
||||
);
|
||||
foreach ($proxyMap as $conf => $opt) {
|
||||
if (Bootstrap::hasConfig($conf)) {
|
||||
$val = Bootstrap::config($conf);
|
||||
$opts[$opt] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set all of the curl opts and then execute.
|
||||
curl_setopt_array($curl, $opts);
|
||||
@@ -294,6 +310,7 @@ class CURLTransport implements Transporter {
|
||||
}
|
||||
curl_multi_add_handle($multi, $handle);
|
||||
|
||||
// Initialize all of the listeners
|
||||
$active = NULL;
|
||||
do {
|
||||
$ret = curl_multi_exec($multi, $active);
|
||||
|
||||
Reference in New Issue
Block a user