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

Require full version and method regex matches #7701

Merged
merged 2 commits into from
Oct 15, 2023
Merged

Require full version and method regex matches #7701

merged 2 commits into from
Oct 15, 2023

Conversation

kenballus
Copy link
Contributor

@kenballus kenballus commented Oct 14, 2023

What do these changes do?

These changes ensure that HTTP versions and methods fully match the regular expressions for those constructs. AIOHTTP currently only applies prefix-matching, which I assume was unintentional.

Are there changes in behavior for the user?

There should be no observable changes to the user, unless they use HTTP servers/clients that generate very malformed request lines. Such clients/servers are unlikely to exist because most other web servers reject these malformed messages.

Related issue number

Fixes #7700

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 14, 2023
@kenballus
Copy link
Contributor Author

Instead of adding new tests, I just updated the existing tests for bad methods and versions to have valid prefixes. I can add additional tests if that's preferable.

@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

Merging #7701 (e45546e) into master (39f8ff2) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #7701   +/-   ##
=======================================
  Coverage   97.36%   97.36%           
=======================================
  Files         106      106           
  Lines       31665    31665           
  Branches     3624     3624           
=======================================
  Hits        30830    30830           
  Misses        632      632           
  Partials      203      203           
Flag Coverage Δ
CI-GHA 97.28% <100.00%> (ø)
OS-Linux 96.95% <100.00%> (ø)
OS-Windows 95.42% <100.00%> (ø)
OS-macOS 96.61% <100.00%> (-0.01%) ⬇️
Py-3.10.11 95.35% <100.00%> (ø)
Py-3.10.13 96.82% <100.00%> (+<0.01%) ⬆️
Py-3.11.5 96.49% <100.00%> (ø)
Py-3.8.10 95.32% <100.00%> (ø)
Py-3.8.18 96.74% <100.00%> (ø)
Py-3.9.13 95.31% <100.00%> (ø)
Py-3.9.18 96.77% <100.00%> (ø)
Py-pypy7.3.11 96.27% <100.00%> (ø)
VM-macos 96.61% <100.00%> (-0.01%) ⬇️
VM-ubuntu 96.95% <100.00%> (ø)
VM-windows 95.42% <100.00%> (ø)

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

Files Coverage Δ
aiohttp/http_parser.py 98.15% <100.00%> (ø)
tests/test_http_parser.py 99.17% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Dreamsorcerer Dreamsorcerer merged commit 312f747 into aio-libs:master Oct 15, 2023
29 of 34 checks passed
@patchback
Copy link
Contributor

patchback bot commented Oct 15, 2023

Backport to 3.9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.9/312f747de91f20fa33af03fd368f857fbd32f36a/pr-7701

Backported as #7703

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 15, 2023
## What do these changes do?

These changes ensure that HTTP versions and methods fully match the
regular expressions for those constructs. AIOHTTP currently only applies
prefix-matching, which I assume was unintentional.

## Are there changes in behavior for the user?

There should be no observable changes to the user, unless they use HTTP
servers/clients that generate very malformed request lines. Such
clients/servers are unlikely to exist because most other web servers
reject these malformed messages.

## Related issue number

Fixes #7700

(cherry picked from commit 312f747)
Dreamsorcerer pushed a commit that referenced this pull request Oct 15, 2023
…ex matches (#7703)

**This is a backport of PR #7701 as merged into master
(312f747).**

## What do these changes do?

These changes ensure that HTTP versions and methods fully match the
regular expressions for those constructs. AIOHTTP currently only applies
prefix-matching, which I assume was unintentional.

## Are there changes in behavior for the user?

There should be no observable changes to the user, unless they use HTTP
servers/clients that generate very malformed request lines. Such
clients/servers are unlikely to exist because most other web servers
reject these malformed messages.

## Related issue number

Fixes #7700

Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.com>
xiangxli pushed a commit to xiangxli/aiohttp that referenced this pull request Dec 4, 2023
…thod regex matches (aio-libs#7703)

**This is a backport of PR aio-libs#7701 as merged into master
(312f747).**

These changes ensure that HTTP versions and methods fully match the
regular expressions for those constructs. AIOHTTP currently only applies
prefix-matching, which I assume was unintentional.

There should be no observable changes to the user, unless they use HTTP
servers/clients that generate very malformed request lines. Such
clients/servers are unlikely to exist because most other web servers
reject these malformed messages.

Fixes aio-libs#7700

Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.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.

HTTP method and version REs are prefix matched
2 participants