-
Notifications
You must be signed in to change notification settings - Fork 64
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
Limit number of headers #155
Comments
I'm not sure why to limit by number? I think |
Well... To be honest... Neither do I. I was going to ask you later. 🤣 I thought it would make sense as Also, we have |
Yeah, if your goal is to prevent DoS attacks, then using a limit on the number of headers means you have to incrementally parse each header as it arrives and compare it against the limit, which is substantially slower than just checking the size of header block as it streams in and parsing it afterwards in one go. And then you'd still need a size limit anyway, to stop someone sending a single gigabyte-sized header. So that's why I went with one overall limit on all the headers, instead of doing something per-header. You could reasonably rename that |
Perfect. Thanks for the insight @njsmith 🙏 |
Hi there 👋
I'm trying to implement a logic to limit the number of header fields in
uvicorn
, and I was wondering: is it even possible?I can check the size of the
Request.headers
, but my intention is to send a 400 when I pass a threshold when reading the data, not when I already have the headers. Pretty much howgunicorn
does: https://docs.gunicorn.org/en/stable/settings.html?highlight=limit_request_fields#limit-request-fields .Tips for me here?
The text was updated successfully, but these errors were encountered: