Skip to content

Silent fail of long url parsing #68

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

Closed
euri10 opened this issue Jun 2, 2021 · 2 comments
Closed

Silent fail of long url parsing #68

euri10 opened this issue Jun 2, 2021 · 2 comments

Comments

@euri10
Copy link

euri10 commented Jun 2, 2021

greetings, while I see the following issue: #43 has been closed I wondered since the parser was changed if this could be reevaluated or if we should handle that downstream in uvicorn,

this added test will fail if the url us 2^16-1 bytes long and the returned url is b''

    def test_parser_url_11(self):
        LARGE_URL = b'/' + b'a' * (2**16-1)
        self.assertEqual(self.parse(LARGE_URL), (None, None, None, LARGE_URL, None, None, None))
Failure
Traceback (most recent call last):
  File "/home/lotso/PycharmProjects/httptools/tests/test_parser.py", line 630, in test_parser_url_11
    self.assertEqual(self.parse(LARGE_URL), (None, None, None, LARGE_URL, None, None, None))
AssertionError: Tuples differ: (None, None, None, b'', None, None, None) != (None, None, None, b'/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[65510 chars]None)

First differing element 3:
b''
b'/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[65491 chars]aaaa'

Diff is 71676 characters long. Set self.maxDiff to None to see it.

note the issue is slightly different here we get b'' while in old issue the url was trimmed

@euri10
Copy link
Author

euri10 commented Jun 2, 2021

ha now I read the readme and I'm confused, http-parse is still used for url parsing ?

@euri10
Copy link
Author

euri10 commented Jun 2, 2021

ok it is, and llhttp does not do it nodejs/llhttp#7
sorry for the noise

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

1 participant