public
Created

  • Download Gist
proxy-type.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
Index: HTTP/Request2.php
===================================================================
--- HTTP/Request2.php (revision 324260)
+++ HTTP/Request2.php (working copy)
@@ -156,6 +156,7 @@
'proxy_user' => '',
'proxy_password' => '',
'proxy_auth_scheme' => self::AUTH_BASIC,
+ 'proxy_type' => 'http',
'ssl_verify_peer' => true,
'ssl_verify_host' => true,
@@ -1012,4 +1013,4 @@
return empty($info)? 'application/octet-stream': $info;
}
}
-?>
\ No newline at end of file
+?>
Index: HTTP/Request2/Adapter/Curl.php
===================================================================
--- HTTP/Request2/Adapter/Curl.php (revision 324260)
+++ HTTP/Request2/Adapter/Curl.php (working copy)
@@ -325,6 +325,21 @@
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST);
}
}
+ if ($type = $this->request->getConfig('proxy_type')) {
+ switch ($type) {
+ case 'http':
+ curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
+ break;
+ case 'socks5':
+ curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
+ break;
+ default:
+ throw new HTTP_Request2_LogicException(
+ sprintf("Proxy type '%s' is not supported", $type),
+ HTTP_Request2_Exception::MISCONFIGURATION
+ );
+ }
+ }
}
// set authentication data

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.