Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpClient] Fix using https with proxies#38368
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedOct 1, 2020
Hello, I'm not sure I get what the issue is here.
Where is this line coming from? Note that HTTP/1.1 section 5.3.2 tells that the full uri must be used when going through a proxy:
can you give more hints about this? could your proxy be non-compliant? How does it behave when using CurlHttpClient? |
bohanwood commentedOct 1, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not sure what changed the
I'm testing it withprivoxy, I don't know which proxy is compliant if it isn't. Tested on Symfony 5.1.6, Debian 10, PHP (deb.sury.org) 7.4.10, curl 7.72.0 (from unstable repo to enable the debug log) <?phpdeclare(strict_types=1);useSymfony\Component\HttpClient\CurlHttpClient;useSymfony\Component\HttpClient\NativeHttpClient;useSymfony\Component\HttpClient\HttpClient;require__DIR__ .'/vendor/autoload.php';$client =newNativeHttpClient();$resp =$client->request('GET','https://httpbin.org/get');echo$resp->getContent();echo$resp->getInfo('debug'); Without |
stof commentedOct 1, 2020
According tohttps://www.php.net/manual/fr/context.http.php#context.http.request-fulluri, the |
nicolas-grekas commentedOct 1, 2020
Thanks for the insights. Looking at the details, this means that the fulluri should be used only when https isnot in use. The patch should be
|
stof commentedOct 1, 2020
why would it depend on https ? |
nicolas-grekas commentedOct 1, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
bohanwood commentedOct 1, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Patch applied. Worked with privoxy. |
nicolas-grekas commentedOct 1, 2020
Thank you@bohanyang. |
nicolas-grekas commentedOct 1, 2020
Can you open an issue on the v2ray repo to tell them about this? It should be fixed on their side IMHO. |
stof commentedOct 1, 2020
@nicolas-grekas my understanding of the HTTP/1.1 spec is that the request to the proxy should be |
nicolas-grekas commentedOct 1, 2020
It should, but here this conflicts with the local DNS resolver/cache. But does it matter?
Why would it? |
stof commentedOct 1, 2020
because ofhttps://tools.ietf.org/html/rfc7230#section-5.4:
|
nicolas-grekas commentedOct 1, 2020
@stof I missed that part, grrr. This means we have a conflict between the local DNS resolver/cache and proxies when using NativeHttpClient. I'm going to submit a PR to account for this. @bohanyang maybe this will fix your issue with |
nicolas-grekas commentedOct 1, 2020
@bohanyang can you please test with#38375? |
…las-grekas)This PR was merged into the 4.4 branch.Discussion----------[HttpClient] fix using proxies with NativeHttpClient| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -As spotted by@stof in#38368 (comment), we cannot use local DNS resolution with HTTP proxies.Commits-------28f301b [HttpClient] fix using proxies with NativeHttpClient
Uh oh!
There was an error while loading.Please reload this page.
According to my test, when
request_fulluriis set to true,the host appears in the URL will be the Host header,
even if the Host header is set in the context http header.
Since HttpClient has its own DNS cache, the host inside the URL is usually an IP address.
So this can break many things.
I've also found thisguzzle/guzzle#791
We can also create an option to make it customizable.