Repository navigation
tool_getparam: preserve field names for empty URL-encoded files - #23577
derekxmartin wants to merge 2 commits into
Conversation
Empty file input is normalized to an empty string in data_urlencode(), but skips the encoding path that adds the field name and equals sign. Run the size check separately after normalization so empty input reaches that path while retaining oversized-input rejection. Add regression tests for named empty file and stdin inputs in POST bodies and URL queries, alongside literal empty values and surrounding fields. AI assistance was used in the investigation and patch preparation.
There was a problem hiding this comment.
🟢 Approval recommended
The narrow control-flow fix preserves existing safeguards, and the regression tests cover both affected options with no unresolved issues identified.
No open issues 🎉
What changed in this PR
This PR fixes curl’s URL-encoding option handling so empty file and stdin inputs retain their field names and equals signs.
Changes:
- Lets normalized empty input reach the encoding path while preserving oversized-input rejection.
- Adds POST-body and URL-query regressions covering empty files, stdin, literal values, and surrounding fields.
- Registers both regression tests.
| File | Description |
|---|---|
| tests/data/test2141 | Tests named empty inputs in URL queries. |
| tests/data/test2140 | Tests named empty inputs in URL-encoded POST bodies. |
| tests/data/Makefile.am | Registers both new tests. |
| src/tool_getparam.c | Separates size validation from empty-input normalization. |
Review effort: Balanced
| test2118 \ | ||
| test2119 \ | ||
| test2140 \ | ||
| test2141 \ |
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
vszakats
left a comment
There was a problem hiding this comment.
Can we integrate any necessary regression tests into an existing
test case, or drop? It seems to me disproportionate to add and
run two new tests millions of time for a one-liner patch fixing
a rare corner case.
|
I don't think testing this should be dropped, but it could certainly be integrated into an existing test |
Extend tests 1015 and 1624 with named empty file and stdin fields, literal empty values, and surrounding fields. Preserve the existing inputs and the second GET after --next. Remove the standalone tests and their registrations. AI assistance was used in the investigation and patch preparation.
|
Thanks! |
Empty file input is normalized to an empty string in data_urlencode(), but skips the encoding path that adds the field name and equals sign.
Run the size check separately after normalization so empty input reaches that path while retaining oversized-input rejection.
Add regression tests for named empty file and stdin inputs in POST bodies and URL queries, alongside literal empty values and surrounding fields.
Validated on Windows/MSVC: regression tests fail before the fix and pass afterward; existing tests, the 15-case request matrix, allocation-failure tests and style checks pass. Full-suite, sanitizer and other-platform testing were not performed.
AI assistance was used in the investigation and patch preparation.