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

Fix inconsistency between Python and C http request parsers. #4973

Merged
merged 13 commits into from
Oct 21, 2020

Conversation

serhiy-storchaka
Copy link
Contributor

@serhiy-storchaka serhiy-storchaka commented Sep 25, 2020

They both now correctly parse URLs containing pct-encoded sequences and work with yarl 1.6.0.

Yarl >= 1.6 is now required.

Closes #4972

They both now correctly parse URLs containing pct-encoded sequences
and work with yarl 1.6.0.
Yarl >= 1.6 is now required.
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Sep 25, 2020
@webknjaz
Copy link
Member

@serhiy-storchaka looks like the CI failures are caused by this change.

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2020

Codecov Report

Merging #4973 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4973   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files          43       43           
  Lines        8933     8936    +3     
  Branches     1406     1405    -1     
=======================================
+ Hits         8720     8723    +3     
  Misses         95       95           
  Partials      118      118           
Flag Coverage Δ
#unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiohttp/web_urldispatcher.py 99.24% <100.00%> (+0.15%) ⬆️
aiohttp/http_parser.py 96.42% <0.00%> (-0.23%) ⬇️
aiohttp/web_protocol.py 92.69% <0.00%> (-0.05%) ⬇️
aiohttp/tracing.py 100.00% <0.00%> (ø)
aiohttp/resolver.py 100.00% <0.00%> (ø)
aiohttp/multipart.py 96.27% <0.00%> (ø)
aiohttp/web_routedef.py 100.00% <0.00%> (ø)
aiohttp/web_exceptions.py 99.52% <0.00%> (ø)
aiohttp/client_exceptions.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55e6497...adc55f4. Read the comment docs.

tests/test_http_parser.py Outdated Show resolved Hide resolved
serhiy-storchaka and others added 3 commits September 26, 2020 12:25
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
@serhiy-storchaka
Copy link
Contributor Author

Now there is a question: do we want to support yarl < 1.6 or require yarl >= 1.6?

@webknjaz
Copy link
Member

Now there is a question: do we want to support yarl < 1.6 or require yarl >= 1.6?

I'm okay with doing >= 1.6 for master (future 4.0) but the backport may be a bit more tricky: what if the end-users are stuck with old yarl for some reason? OTOH since it fixes a bug, it'd be okay to increase the required version if it's needed for the bugfix.

@webknjaz
Copy link
Member

re: CI failures -- test_close[pyloop] is the only test that fails with Python 3.8 under Win/Mac but it also fails on master so it's unrelated to this PR.

@mwhudson
Copy link

Any update on this?

@TBBle
Copy link

TBBle commented Oct 12, 2020

What about this fix required yarl 1.6? My understanding of the yarl change is that if we just ensure we specify encoded=True for all calls of URL.build (and with_xxx and operator /, but I don't think they're used here...), then that would be compatible with yarl 1.5 as well.

The core issue as I understood it was that we were passing encoded elements to URL.build, which defaults encoded=False, and it worked before yarl 1.6 because it was ignoring the % and there were no other characters that needed re-encoding (because we'd already encoded it).

aiohttp/web_urldispatcher.py Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Oct 16, 2020

Codecov Report

Merging #4973 into master will increase coverage by 0.51%.
The diff coverage is 85.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4973      +/-   ##
==========================================
+ Coverage   97.10%   97.62%   +0.51%     
==========================================
  Files          43       43              
  Lines        8996     9007      +11     
  Branches     1413     1414       +1     
==========================================
+ Hits         8736     8793      +57     
+ Misses        144      100      -44     
+ Partials      116      114       -2     
Flag Coverage Δ
#unit 97.62% <85.18%> (+0.51%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiohttp/web_urldispatcher.py 97.83% <85.18%> (-0.41%) ⬇️
aiohttp/helpers.py 96.71% <0.00%> (+0.23%) ⬆️
aiohttp/web_protocol.py 92.73% <0.00%> (+0.29%) ⬆️
aiohttp/test_utils.py 99.68% <0.00%> (+0.62%) ⬆️
aiohttp/http_websocket.py 98.64% <0.00%> (+0.81%) ⬆️
aiohttp/http_parser.py 96.69% <0.00%> (+1.32%) ⬆️
aiohttp/http_writer.py 99.08% <0.00%> (+1.83%) ⬆️
aiohttp/connector.py 96.80% <0.00%> (+1.91%) ⬆️
aiohttp/frozenlist.py 97.91% <0.00%> (+2.08%) ⬆️
aiohttp/pytest_plugin.py 97.51% <0.00%> (+4.96%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 967b1b9...50945e2. Read the comment docs.

@serhiy-storchaka
Copy link
Contributor Author

It now works also with yarl <1.6.

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asvetlov asvetlov merged commit d321923 into aio-libs:master Oct 21, 2020
@asvetlov
Copy link
Member

Thanks, @serhiy-storchaka

aio-libs-github-bot bot pushed a commit that referenced this pull request Oct 21, 2020
They both now correctly parse URLs containing pct-encoded sequences
and work with yarl 1.6.0.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
@aio-libs-github-bot
Copy link
Contributor

💚 Backport successful

The PR was backported to the following branches:

aio-libs-github-bot bot added a commit that referenced this pull request Oct 21, 2020
…4973) (#5097)

Backports the following commits to 3.7:
 - Fix inconsistency between Python and C http request parsers. (#4973)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inconsistent query arg handling between python and C http request parsers with yarl 1.6.0
7 participants