-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
DO NOT MERGE: debug test_unsupported_upgrade #7960
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7960 +/- ##
==========================================
- Coverage 97.53% 97.52% -0.01%
==========================================
Files 107 107
Lines 32843 32886 +43
Branches 3851 3854 +3
==========================================
+ Hits 32032 32073 +41
- Misses 610 613 +3
+ Partials 201 200 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
its getting stuck at message, payload = await protocol.read() # type: ignore[union-attr] |
if not empty_body and (
(length is not None and length > 0)
or msg.chunked
and not msg.upgrade
):
payload = StreamReader(
self.protocol,
timer=self.timer,
loop=loop,
limit=self._limit,
)
payload_parser = HttpPayloadParser(
|
aiohttp/http_parser.py
Outdated
import pprint | ||
|
||
pprint.pprint(["upgraded", msg.upgrade, msg]) | ||
self._upgraded = code == 101 and msg.upgrade |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c parser seems to only set this if code is 101
@@ -505,6 +517,9 @@ def parse_headers( | |||
close_conn = False | |||
# https://www.rfc-editor.org/rfc/rfc9110.html#name-101-switching-protocols | |||
elif v == "upgrade" and headers.get(hdrs.UPGRADE): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the source of the problem for #6446? Just because the Upgrade
header has content, doesn't mean there will be an upgrade. The server has every right to ignore it if the scheme is unsupported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you think you can provide a fix, that'd be great. I believe there is already an xfail test from that issue, so as long as you can get that test passing..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One problem at a time for this newbie... Brotli first 😉
import pprint | ||
|
||
pprint.pprint(["handler except", e]) | ||
raise | ||
|
||
upgrade_headers = {"Connection": "Upgrade", "Upgrade": "unsupported_proto"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is parsing the Upgrade
header, but the fact that it's not a valid token at all should also be considered (IANA upgrade token registry. In fact, it even contains an invalid character, "_", for URL schemes (RFC 1738).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume that would be handled in the parsers (i.e. llhttp or http_parser.py, depending on whether extensions are enabled).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay. My point is, especially it it happens externally, the test should know and account for the behavior.
I would hope, no matter which parser is used, that "unsupported_proto" would simply be thrown away and equivalent to "". Then the test should also test a valid, but unsupported, token.
await resp.start(conn) | ||
except BaseException: | ||
except BaseException as ex: |
Check notice
Code scanning / CodeQL
Except block handles 'BaseException' Note
resp.close() | ||
raise | ||
except BaseException: | ||
except BaseException as ex: |
Check notice
Code scanning / CodeQL
Except block handles 'BaseException' Note
Looks like its an actual bug and the test only passed because of a race |
What do these changes do?
Are there changes in behavior for the user?
Related issue number
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.