-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [CURLRequest] add option for Proxy #7632
Conversation
public function testProxyuOption() | ||
{ | ||
$this->request->request('get', 'http://example.com', [ | ||
'proxy' => 'http://localhost:3128', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think proxy
should be an array that can set CURLOPT_PROXY
, CURLOPT_PROXYTYPE
, CURLOPT_PROXYPORT
and etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems Guzzle does not have such options.
https://docs.guzzlephp.org/en/stable/request-options.html#proxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can flexible option with basic below?
[
'proxy' => [
'host' => '127.0.0.1:1337',
'type' => 'sock5', // sock5 or sock4 or default with CURLPROXY_HTTP
'auth' => 'user:pass', // or array
]
]
It seems not. Document Guzzle gives an example as below: $client->request('GET', '/', [
'proxy' => [
'http' => 'http://localhost:8125', // Use this proxy with "http"
'https' => 'http://localhost:9124', // Use this proxy with "https",
'no' => ['.mit.edu', 'foo.com'] // Don't use a proxy with these
]
]); However, I think the documents of this PR should clearly indicate how to set these things. |
I think CURLRequest is a lightweight Guzzle, and if you need more functionality, use Guzzle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw dont forget adding note for auth like http://username:[email protected]:10
@kenjis thanks for this. I really need this as soon as possible in my app. |
@ddevsr If someone needs it, s/he can implement and send a PR. |
Description
proxy
Checklist: