Skip to content

tool_parsecfg: accept indented options and CRLF line endings again - #23499

Closed
akashdeshmukh-git wants to merge 1 commit into
curl:masterfrom
akashdeshmukh-git:tool-parsecfg-blanks-crlf
Closed

akashdeshmukh-git wants to merge 1 commit into
curl:masterfrom
akashdeshmukh-git:tool-parsecfg-blanks-crlf

Conversation

@akashdeshmukh-git

Copy link
Copy Markdown
Contributor

Since curl 8.13.0, config files with indented option lines or with CRLF line endings fail to parse:

  • a7fda9a moved comment handling into my_get_line() and with it the skipping of leading whitespace, so an indented option line is now parsed as an empty option name.

  • 1503555 made the option name end at ISBLANK() instead of ISSPACE(), so for an option without argument on a CRLF line the CR becomes part of the name, e.g. "head\r" is reported as unknown. A line with only a CR is also taken as an option name.

Skip leading whitespace and ignore whitespace-only lines in parseconfig(), and end the option name at any whitespace again.

Tests 3040 and 3041 verify.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused parser changes address both regressions with corresponding tests and no unresolved findings.

No open issues 🎉

What changed in this PR

Restores curl config-file parsing for indented options and CRLF line endings.

Changes:

  • Skips leading whitespace and whitespace-only lines.
  • Ends option names at any whitespace.
  • Adds and registers regression tests for both cases.
File Description
tests/​data/​test3041 Tests CRLF config lines, including a blank line and head.
tests/​data/​test3040 Tests options indented with spaces and tabs.
tests/​data/​Makefile.am Registers both regression tests.
src/​tool_parsecfg.c Restores whitespace handling in config parsing.

Review effort: Balanced

@testclutch

Copy link
Copy Markdown

Analysis of PR #23499 at 11882d9b:

Test ../../tests/http/test_17_ssl_use.py::TestSSLUse::test_17_09_ssl_min_max[TLSv1.2-tlsv1-1.3] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them).

Generated by Testclutch

@akashdeshmukh-git
akashdeshmukh-git force-pushed the tool-parsecfg-blanks-crlf branch from 11882d9 to 0975af5 Compare October 21, 2026 07:02
Comment thread tests/data/test3040 Outdated
<file name="%LOGDIR/test%TESTNUMBER.config">
url = "http://%HOSTIP:%HTTPPORT/%TESTNUMBER"
header = "X-Indented: yes"
--user-agent "indented/1.0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please integrate this and the other new test into an existing test case.

Since curl 8.13.0, config files with indented option lines or with CRLF
line endings fail to parse:

- a7fda9a moved comment handling into my_get_line() and with it the
  skipping of leading whitespace, so an indented option line is now
  parsed as an empty option name.

- 1503555 made the option name end at ISBLANK() instead of
  ISSPACE(), so for an option without argument on a CRLF line the CR
  becomes part of the name, e.g. "head\r" is reported as unknown. A line
  with only a CR is also taken as an option name.

Skip leading whitespace and ignore whitespace-only lines in
parseconfig(), and end the option name at any whitespace again.

Test 430 now uses indented lines in one config file and CRLF line
endings in another.
@akashdeshmukh-git
akashdeshmukh-git force-pushed the tool-parsecfg-blanks-crlf branch from 0975af5 to 66871a4 Compare October 22, 2026 06:11
@akashdeshmukh-git

Copy link
Copy Markdown
Contributor Author

Folded both cases into test 430 instead.

@bagder bagder closed this in 6232e46 Oct 22, 2026
@bagder

bagder commented Oct 22, 2026

Copy link
Copy Markdown
Member

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.

5 participants