Skip to content

fix: send all matching cookies instead of only the last one#492

Open
goingforstudying-ctrl wants to merge 1 commit into
Y2Z:masterfrom
goingforstudying-ctrl:fix/cookie-multiple-values
Open

fix: send all matching cookies instead of only the last one#492
goingforstudying-ctrl wants to merge 1 commit into
Y2Z:masterfrom
goingforstudying-ctrl:fix/cookie-multiple-values

Conversation

@goingforstudying-ctrl
Copy link
Copy Markdown

What

Fixes a bug where only the last matching cookie was sent when multiple cookies matched a URL.

Why

When using a cookies file with multiple cookies for the same domain, only one cookie would be sent in the HTTP request. This breaks websites that require multiple cookies for authentication or session management.

The root cause was using inside a loop, which overwrote the Cookie header on each iteration.

How

  • Collect all matching cookie name=value pairs into a Vec
  • Join them with (per RFC 6265)
  • Insert the combined value as a single Cookie header

Testing

Fixes #479

When multiple cookies match a URL, the previous code used
which overwrote the Cookie header on each iteration, causing only the
last matching cookie to be sent.

This fix collects all matching cookie name=value pairs and joins them
with '; ' (per RFC 6265) into a single Cookie header value.

Fixes Y2Z#479
@goingforstudying-ctrl
Copy link
Copy Markdown
Author

Hi @snshn — this fixes the cookie handling bug from #479 where only the last matching cookie was sent. Ready for review whenever you have a moment.

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.

Multiple cookies for the same domain don't appear to get sent

1 participant