Skip to content

Conversation

@bagder
Copy link
Member

@bagder bagder commented Dec 23, 2025

Update test 1941 to verify this

Remove unused code from dynhds for handling folded headers.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for folded headers (obsolete line folding per RFC 7230) in HTTP CONNECT responses. Folded headers allow a header value to span multiple lines when continuation lines start with whitespace (space or tab). The implementation unfolds these headers by stripping trailing whitespace from the main line and replacing leading whitespace on continuation lines with a single space.

Key changes:

  • Implements folded header parsing in the CONNECT response handler (lib/cf-h1-proxy.c)
  • Removes now-unused folded header handling from the generic dynamic headers module (lib/dynhds.c)
  • Updates test1941 to verify correct handling of folded headers in CONNECT responses

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/cf-h1-proxy.c Adds two state flags (maybe_folded and leading_unfold) to track header folding state; implements folded header detection and unfolding logic; extracts header processing into a new single_header helper function
lib/dynhds.c Removes the entry_append function and folded header continuation handling from the generic H1 header parsing, as this is now handled at a higher level in the CONNECT proxy code
tests/data/test1941 Updates CONNECT response test data to include folded headers: Content-Type header with value on continuation line, and Server header folded across three lines
tests/unit/unit2602.c Removes unit tests for header continuation handling that is no longer supported in the dynhds module
tests/unit/unit2603.c Removes TEST5a which tested folded header parsing in the generic request parser, as this functionality has been moved to the CONNECT-specific handler

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder marked this pull request as ready for review December 23, 2025 15:23
@bagder bagder force-pushed the bagder/dynhd-unfold branch from d0cecfe to ea033a0 Compare December 23, 2025 15:28
@bagder
Copy link
Member Author

bagder commented Dec 23, 2025

augment review

@augmentcode
Copy link

augmentcode bot commented Dec 23, 2025

🤖 Augment PR Summary

Summary: This PR teaches the HTTP/1 proxy CONNECT filter to accept and unfold obsolete “folded” (obs-fold) header lines in CONNECT responses.

Changes:

  • Adds CONNECT-response folding state (`maybe_folded`, `leading_unfold`) and unfolds continuation lines by trimming CRLF/trailing whitespace and inserting a single space.
  • Refactors CONNECT header processing into a shared helper (`single_header`) to centralize callback/debug/header-size accounting.
  • Promotes the “trim CRLF + trailing whitespace” helper into `Curl_http_to_fold()` for reuse.
  • Removes folded-header continuation support from `dynhds` (now treated as invalid there) along with related unit test coverage.
  • Updates test1941 to include folded headers in both the proxy response and CONNECT response sections.

Technical Notes: CONNECT parsing now defers emitting a header line until it can determine whether the next line begins with whitespace (folded) or starts a new header.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Update test 1941 to verify this

Remove unused code from dynhds for handling folded headers, and the
associated unit tests of those functions in test 2602 and 2603.

Closes #20080
@bagder bagder force-pushed the bagder/dynhd-unfold branch from 170e394 to cbeada2 Compare December 23, 2025 15:55
@bagder bagder closed this in 7e064d0 Dec 23, 2025
@bagder bagder deleted the bagder/dynhd-unfold branch December 23, 2025 16:13
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.

1 participant