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
Fix: handle max_request_size<=0 #10072
Fix: handle max_request_size<=0 #10072
Conversation
@raskchanky Would you please have a look at this ? |
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 issue with the current approach is that 0 is Go's default value for integers, so if no max request size is specified, it will be 0, in which case the default should be used. Otherwise, it's kinda pointless to have a default value 😁.
In my opinion, the right fix here is to:
- remove the error saying max request size can't be negative
- if max request size is negative, then disable it
- update the docs to reflect this change
Also, in addition to fixing the existing CI failure, it'd be great to have some additional tests showing that:
- the default max request size is still in place if it's not overridden
- it's properly disabled when set to a negative value
- the config is parsed correctly with negative values in it
Thanks so much for working on this!
@raskchanky Thanks for the input, I'm working on it! |
Hi @guacamole , Thanks so much! |
Hello @HridoyRoy |
Signed-off-by: guacamole <gunjanwalecha@gmail.com>
Signed-off-by: guacamole <gunjanwalecha@gmail.com>
Signed-off-by: guacamole <gunjanwalecha@gmail.com>
c5cf9d9
to
3d98b24
Compare
@guacamole is attempting to deploy a commit to the HashiCorp Team on Vercel. A member of the Team first needs to authorize it. |
Hi @raskchanky , I just rebased my PR from master and |
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.
@guacamole lgtm!
I've created a docs PR to go with this change here |
* Fix: handle max_request_size<=0 Signed-off-by: guacamole <gunjanwalecha@gmail.com> * created test cases for listener Signed-off-by: guacamole <gunjanwalecha@gmail.com> * added test case for negative value of MaxRequestSize Signed-off-by: guacamole <gunjanwalecha@gmail.com> Co-authored-by: Hridoy Roy <roy@hashicorp.com>
Signed-off-by: guacamole gunjanwalecha@gmail.com
This PR tries to fix the issue #9936
Setting
max_request_size
to 0 or a negative number should disable request size limitingMotivation
As per the documentation:
max_request_size
is the maximum allowed request size, in bytes. Defaults to 32 MB. Specifying a number less than or equal to 0 should turn off limiting altogether.Implementation details
Old implementation:
max_request_size
is 0, it gets set to a default size of 32 MBmax_request_size
is negative, it throws an error saying: " max_request_size cannot be negative"New implementation:
max_request_size
set to less than or equal to 0, the limiting is disabled