Repository navigation
tool_paramhlp: reject trailing garbage in seconds arguments - #23500
akashdeshmukh-git wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The localized parsing changes match the intended behavior, include regression coverage, and have no identified blocking issues.
No open issues 🎉
What changed in this PR
Tightens seconds-argument parsing for curl command-line timeout and retry options.
Changes:
- Rejects trailing garbage instead of silently accepting numeric prefixes.
- Reports missing fractional digits as
PARAM_BAD_NUMERIC. - Adds and registers regression test 3039.
| File | Description |
|---|---|
| tests/data/test3039 | Checks rejection of --max-time 2m. |
| tests/data/Makefile.am | Registers test 3039. |
| src/tool_paramhlp.c | Validates full argument consumption and distinguishes fractional parsing errors. |
Review effort: Balanced
|
Analysis of PR #23500 at 8f6b9c49: Test ../../tests/http/test_02_download.py::TestDownload::test_02_34_max_total_conns[False-0-h2] failed, but it has been 0.6% flaky lately, so it's probably NOT a fault of the PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them). Generated by Testclutch |
8f6b9c4 to
518dec1
Compare
| Pass in number with trailing garbage to --max-time | ||
| </name> | ||
| <command> | ||
| http://%HOSTIP:%NOLISTENPORT/%TESTNUMBER --max-time 2m |
There was a problem hiding this comment.
Do we need a separate test for this, and run it millions of times after this?
I'm not convinced. If important, try integrating into an existing where it fits.
518dec1 to
c7c713a
Compare
|
Moved the checks into unit test 1623 instead of a new test. |
|
Thanks for the review, @vszakats. That's a fair point — the unit tests for |
|
@vszakats The separate test is gone; the checks are now only in tool1623. Marking this ready for review. |
secs2ms(), used for --connect-timeout, --expect100-timeout, --max-time, --retry-delay and --retry-max-time, did not check that the whole argument was consumed. Values like "10m" or "1.5abc" were silently accepted as 10 and 1.5 seconds, while str2num() and friends reject such input. Also return PARAM_BAD_NUMERIC instead of PARAM_NUMBER_TOO_LARGE when no digits follow the decimal point, as in "1.". Unit test 1623 now also checks secs2ms() with valid values and with trailing garbage.
3f0472d to
e53e767
Compare
|
thanks! |
secs2ms(), used for --connect-timeout, --expect100-timeout, --max-time, --retry-delay and --retry-max-time, did not check that the whole argument was consumed. Values like "10m" or "1.5abc" were silently accepted as 10 and 1.5 seconds, while str2num() and friends reject such input.
Also return PARAM_BAD_NUMERIC instead of PARAM_NUMBER_TOO_LARGE when no digits follow the decimal point, as in "1.".
Unit test tool1623 verifies.