-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] URL with colon is not correctly parsed #54332
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
Comments
According to the RFC 3986 this is the correct implementation (your case is the first “normal example”). Prefix your path with |
The proposed solution works, so I close. |
Hi!
However, when I add a I think it should not behave differently depending on the presence or not of a |
This is due to php/php-src#12703 |
Support for |
This PR was merged into the 5.4 branch. Discussion ---------- Work around `parse_url()` bug | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #52579, #54332 | License | MIT Works around * php/php-src#12703 Commits ------- fb76e53 Work around parse_url() bug
Symfony version(s) affected
6.4 and 7.0
Description
I'm using Google API for address validation. As referenced in their documentation, the URL to call is
/v1:validateAddress
The problem is that HTTP client is trying to parse the URL without including the domain, so the part before the colon is interpreted as a schema, resulting in a "Unsupported scheme" HTTPException.
How to reproduce
Define an HTTP client like this:
then inject your client as
HttpClientInterface $mapAddressClient
and try to use it:You'll get a
Symfony\Component\HttpKernel\Exception\ HttpException
Unsupported scheme in "v1:validateAddress?key=<redacted>
Possible Solution
I guess that the parsing of the URL done in
symfony/src/Symfony/Component/HttpClient/HttpClientTrait.php
Line 621 in a2fc092
Additional Context
No response
The text was updated successfully, but these errors were encountered: