Skip to content

urldata: move cookiehost to struct SingleRequest#21312

Closed
bagder wants to merge 4 commits into
masterfrom
bagder/cookiehost
Closed

urldata: move cookiehost to struct SingleRequest#21312
bagder wants to merge 4 commits into
masterfrom
bagder/cookiehost

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Apr 14, 2026

To make it scoped for the single request appropriately.

Reported-by: Muhamad Arga Reksapati

Verify with libtest 2504: a custom Host disabled on reused handle

@bagder bagder marked this pull request as ready for review April 14, 2026 09:18
@bagder bagder requested a review from Copilot April 14, 2026 14:19
To make it scoped for the single request appropriately.

Reported-by: Muhamad Arga Reksapati

Verify with libtest 2504: a custom Host *disabled* on reused handle
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

This PR addresses a cookie/Host header scoping issue by moving cookiehost from UrlState to SingleRequest, and adds a regression test to ensure a custom Host: value does not persist across reused easy handles.

Changes:

  • Move cookiehost storage to struct SingleRequest and update HTTP cookie/Set-Cookie logic to use it.
  • Update cleanup/reset paths to free request-scoped cookiehost.
  • Add libtest + test case 2504 to validate behavior when reusing a handle after removing a custom Host: header.

Reviewed changes

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

Show a summary per file
File Description
lib/urldata.h Removes cookiehost from UrlState allocated pointer set.
lib/request.h Adds cookiehost to struct SingleRequest.
lib/request.c Frees req->cookiehost during hard reset.
lib/http.c Stores/uses data->req.cookiehost for cookie host decisions.
lib/url.c Updates easy-handle close cleanup to free data->req.cookiehost.
tests/libtest/lib2504.c New libtest exercising handle reuse with/without custom Host:.
tests/libtest/Makefile.inc Registers lib2504.c in the libtest build.
tests/data/test2504 New test definition verifying request headers across two performs.
tests/data/Makefile.am Registers test2504 in the test suite.

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

Comment thread lib/url.c
Comment thread tests/libtest/lib2504.c Outdated
Comment thread lib/http.c
@bagder bagder force-pushed the bagder/cookiehost branch from cb5b2b8 to 04bffc4 Compare April 14, 2026 14:39
@bagder bagder closed this in 3a19987 Apr 14, 2026
@bagder bagder deleted the bagder/cookiehost branch April 14, 2026 14:59
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