-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpClient] Fix over-encoding of URL parts to match browser's behavior #49299
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
Conversation
217409d
to
7758591
Compare
7758591
to
6a7ca92
Compare
6a7ca92
to
e79e331
Compare
For what it's worth, this is breaking an API client to WooCommerce for us. With 5.4.20> GET /wp-json/wc/v3/orders?status%5B0%5D=processing&status%5B1%5D=completed&after=2023-03-29T10%3A35%3A09%2B02%3A00&before=2023-03-29T11%3A04%3A18%2B02%3A00 HTTP/2
Host: gazon-naturel-en-rouleau.fr
pragma: No-cache
accept: */*
authorization: Basic **********
user-agent: Symfony HttpClient/Curl
accept-encoding: gzip
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200 With 5.4.21> GET /wp-json/wc/v3/orders?status[0]=processing&status[1]=completed&after=2023-03-29T10:35:09+02:00&before=2023-03-29T11:02:48+02:00 HTTP/2
Host: gazon-naturel-en-rouleau.fr
pragma: No-cache
accept: */*
authorization: Basic *************
user-agent: Symfony HttpClient/Curl
accept-encoding: gzip
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 400 This is how the request is constructed: $response = $client->request(
'GET',
$this->currentShop['endpoint'],
[
'auth_basic' => [
$this->currentShop['api_key'],
$this->currentShop['api_secret']
],
'headers' => [
'Pragma' => 'No-cache',
],
'query' => [
'status' => ['processing', 'completed'],
'after' => $dates['after']->modify('-5 minutes')->format('c'),
'before' => $dates['before']->modify('-5 minutes')->format('c'),
],
'on_progress' => function () use ($downloadProgress): void {
$downloadProgress->advance();
},
]
); |
Which part/character? You can know by generating the query string on your own to test. |
It's the plus signs here. |
OK, so this is #49579, fixed in the next release. |
Indeed, I had seen that ticket actually but not made the connection, sorry.
|
This has broken our aplication should not we stick confrontant to RFC? |
@Kozzi11 Please open a new issue if you think this introduced a bug. |
Yes, the RFC says these chars should be url-encoded:
But in practice, browser's don't encode them, and some servers don't expect them to be encoded either.
See https://stackoverflow.com/questions/2366260/whats-valid-and-whats-not-in-a-uri-query for some pointers.