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

tool_getparam: Limit --rate to be smaller than number of ms #12116

Closed

Conversation

sohomdatta1
Copy link
Contributor

@sohomdatta1 sohomdatta1 commented Oct 13, 2023

Currently, curl allows users to specify absurd request rates that might be higher than the number of milliseconds in the unit (ex: curl --rate 3600050/h http://localhost:8080 does not error out despite there being only 3600000ms in a hour).

This PR adds a conditional check before the millisecond calculation making sure that the number is not higher than the numerator (the unit) If the number is higher, curl errors out with PARAM_NUMBER_TOO_LARGE

Currently, curl allows users to specify absurd request rates that
might be higher than the number of milliseconds in the unit
(ex: curl --rate 3600050/h http://localhost:8080 does not error out
despite there being only 3600000ms in a hour).

This PR adds a conditional check before the millisecond calculation
making sure that the number is not higher than the numerator (the unit)
If the number is higher, curl errors out with PARAM_NUMBER_TOO_LARGE
@sohomdatta1
Copy link
Contributor Author

sohomdatta1 commented Oct 13, 2023

In the current tool, the result of the division is zero for numbers higher than the number of ms in the unit, so it doesn't really make sense to keep that case around

@bagder bagder closed this in 8993efc Oct 14, 2023
@bagder
Copy link
Member

bagder commented Oct 14, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants