Skip to content
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

Different behaviour between 1.5.1 and 1.6.0 #509

Closed
CraigMeng opened this issue Sep 25, 2020 · 4 comments
Closed

Different behaviour between 1.5.1 and 1.6.0 #509

CraigMeng opened this issue Sep 25, 2020 · 4 comments

Comments

@CraigMeng
Copy link

Hi,

I`m using aiohttp to do both client and server jobs. I have a pre-encoded url

/testapi/NamespaceTable%28PartitionKey%3D%27universal%27%2C%20RowKey%3D%27testdelete%27%29

In aiohttp client, I use URL(url, encoded=True) passed to GET method. And in aiohttp server, there is a handler defined as following:

app.router.add_delete("/testapi/NamespaceTable(PartitionKey='universal', RowKey='testdelete')", delete_namespace_handler)

In yarl 1.5.1, this works fine, request can be handled correctly.

But in my CI/CD pipeline, when I rebuild my project, yarl (which is a dependency of aiohttp) got upgraded to 1.6.0, and this is not working anymore. The aiohttp server keeps reporting "404, not found".

I dig a little deeper, and found that the "_PATH_QUOTER" in _url.py of yarl behaves differently with 1.5.1.

Server will have incoming request with path /testapi/NamespaceTable%28PartitionKey%3D%27universal%27%2C%20RowKey%3D%27testdelete%27%29
In 1.5.1, _PATH_QUOTER will convert incoming request url to
/testapi/NamespaceTable(PartitionKey='universal', %20RowKey='testdelete')
In 1.6.0, _PATH_QUOTER will convert the path to
/testapi/NamespaceTable%2528PartitionKey%253D%2527universal%2527%252C%2520RowKey%253D%2527testdelete%2527%2529

@aaronkavlie-wf
Copy link

We just got bitten by this as well. Incoming URLs to aiohttp were double-encoded, and we spent a lot of time troubleshooting the issue.
Just discovered late yesterday that it was caused by the upgrade to yarl 1.6.0.

@zeonglow
Copy link

zeonglow commented Sep 28, 2020

Me too! I had an API which accepted JSON as a query parameter, it was failing because it was trying to parse the still encoded string. In other words request.query.q('q') returned characters still encoded. Adding yarl==1.5.1 to my requirements file fixed this, perhaps the solution is aiohttp need to lock the version at their end.

@serhiy-storchaka
Copy link
Contributor

See also aio-libs/aiohttp#4972.

danking pushed a commit to danking/hail that referenced this issue Sep 28, 2020
Related issues in upstream projects:

- YARL issue: aio-libs/yarl#509
- aiohttp issue: aio-libs/aiohttp#4972
danking pushed a commit to danking/hail that referenced this issue Sep 28, 2020
Related issues in upstream projects:

- YARL issue: aio-libs/yarl#509
- aiohttp issue: aio-libs/aiohttp#4972
danking added a commit to hail-is/hail that referenced this issue Sep 28, 2020
Related issues in upstream projects:

- YARL issue: aio-libs/yarl#509
- aiohttp issue: aio-libs/aiohttp#4972
tulir added a commit to mautrix/python that referenced this issue Oct 8, 2020
@asvetlov
Copy link
Member

aiohttp 3.6.3 requires yarl<1.6
The next aiohttp release will be compatible with yarl>=1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants