Skip to content

Instantly share code, notes, and snippets.

@till
Created March 15, 2012 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save till/2040668 to your computer and use it in GitHub Desktop.
Save till/2040668 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment