Skip to content

Accept LF-only HTTP headers with simpler bounded parsing - #616

Merged
bsergean merged 1 commit into
masterfrom
fix/pr603-http-header-parsing
Oct 15, 2026
Merged

bsergean merged 1 commit into
masterfrom
fix/pr603-http-header-parsing

Conversation

@bsergean

Copy link
Copy Markdown
Collaborator

HTTP peers that terminate headers with LF instead of CRLF currently fail parsing. Accept either ending by reading through LF and retaining the existing whitespace trimming. This reworks #603 with a smaller parser change and credits its original author, @flagarde, as a co-author.

Reject lines beyond the existing fixed-buffer limit instead of silently treating their remainder as another header. Regression tests cover both line endings, mixed and empty header blocks, body preservation, colon handling, boundary lengths, incomplete input and cancellation.

The Windows GCC failure on #603 occurred during CMake configuration because its pinned cpp_linenoise commit could not be checked out. This branch is based on current master, which already removes that FetchContent dependency in #605 and has passing Windows GCC CI. No additional workflow changes are needed.

Validation:

  • Six local test executables passed: HTTP header parsing, HTTP parsing/server, WebSocket server, Host headers and subprotocol negotiation.
  • clang-format --dry-run --Werror and git diff --check passed.

The original fork disables maintainer edits, so these changes cannot be pushed directly to #603.

Read header lines through LF and use the existing value trimming for CRLF.
Reject lines that exceed the fixed buffer rather than parsing their
remainder as another header. Add coverage for both line endings, empty
blocks, body preservation, boundary lengths, EOF and cancellation.

Based on flagarde's PR #603. Current master also contains the dependency
removal that fixes that PR's stale Windows GCC configure failure.

Co-authored-by: flagarde <flagarde.programs@pm.me>
@bsergean
bsergean merged commit 39b2f36 into master Oct 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant