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

"Status line is too long" error message when URL is too long #7177

Open
1 task done
mmb opened this issue Jan 18, 2023 · 2 comments
Open
1 task done

"Status line is too long" error message when URL is too long #7177

mmb opened this issue Jan 18, 2023 · 2 comments
Assignees
Labels

Comments

@mmb
Copy link

mmb commented Jan 18, 2023

Describe the bug

The "Status line is too long" error in cb_on_url is confusing because the URL is too long, not the status line. It looks like it might have been copied from cb_on_status.

https://github.com/aio-libs/aiohttp/blob/master/aiohttp/_http_parser.pyx#L671

To Reproduce

  1. Request a URL that exceeds the length limit
  2. See the "Status line is too long" message

Expected behavior

I expect a more accurate error message like "URL is too long".

Logs/tracebacks

aiohttp.http_exceptions.LineTooLong: 400, message='Got more than 16380 bytes (27594) when reading Status line is too long.'

Python Version

$ python --version
Python 3.8.0

aiohttp Version

$ python -m pip show aiohttp

multidict Version

$ python -m pip show multidict

yarl Version

$ python -m pip show yarl

OS

Linux

Related component

Server

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@mmb mmb added the bug label Jan 18, 2023
@webknjaz
Copy link
Member

Fair enough. If you end up sending a PR, make sure to add a test verifying that the behavior is the same for Cython and pure-Python implementations.

@Dreamsorcerer
Copy link
Member

These are basically the same though. I think it should just say request line instead of status line here.

Strictly speaking, we should probably be using on_method and on_version to track the length of the entire request line. It's currently possible to exceed the line length using a long method.

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

No branches or pull requests

3 participants