Skip to content

http: fix Curl_compareheader for multi value headers#20894

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/compareheader
Closed

http: fix Curl_compareheader for multi value headers#20894
bagder wants to merge 1 commit intomasterfrom
bagder/compareheader

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Mar 11, 2026

Follow-up to 04289c6. Regression shipped in 8.13.0.

  • a logic error made it not loop and thus only match if the searched string was first

  • it no longer matches a substring

Adjusted test 1 to use multiple values in the Connection: response header.

Reported-by: Henrique Pereira

@github-actions github-actions bot added the tests label Mar 11, 2026
@bagder bagder marked this pull request as ready for review March 11, 2026 22:14
@bagder
Copy link
Copy Markdown
Member Author

bagder commented Mar 11, 2026

augment review

@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Mar 11, 2026

🤖 Augment PR Summary

Summary: Fixes Curl_compareheader() to correctly scan comma-separated, multi-value HTTP headers and only match whole tokens.
Why: Addresses a regression shipped in 8.13.0 where only the first value was checked and substring matching behavior changed; updates test1 to cover multi-value Connection: responses.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@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. No suggestions at this time.

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

Copy link
Copy Markdown

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

Fixes a regression in Curl_compareheader() (introduced after 04289c6) so that multi-value HTTP headers are properly searched again, and updates the relevant test data to include a multi-value Connection: response header.

Changes:

  • Update Curl_compareheader() logic intended to iterate over comma-separated header values again.
  • Adjust tests/data/test1 to use multiple values in the Connection: response header.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/data/test1 Updates the canned HTTP response to include multi-value Connection: header values.
lib/http.c Changes the header value matching loop in Curl_compareheader() to handle multiple values.

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

You can also share your feedback on Copilot code review. Take the survey.

Follow-up to 04289c6. Regression shipped in 8.13.0.

- a logic error made it not loop and thus only match if the searched string
  was first

- it no longer matches a substring

Adjusted test 1 to use multiple values in the Connection: response
header. Adjusted test 1542 to have a "Connection: close-not" which
should not match.

Reported-by: Henrique Pereira
@bagder bagder force-pushed the bagder/compareheader branch from 3eca859 to a38365f Compare March 11, 2026 22:58
@bagder bagder closed this in 2938cb7 Mar 12, 2026
@bagder bagder deleted the bagder/compareheader branch March 12, 2026 06:53
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.

2 participants