Skip to content

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

@hoelzro

Description

@hoelzro

Summary

If I have multiple cookies for a domain in a cookies file provided via -C, only one of them appears to get sent.

Reproduction

Create cookies.txt:

# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

localhost	TRUE	/	FALSE	1793197913	test_cookie1	one
localhost	TRUE	/	FALSE	1793197913	test_cookie2	two

Run httpbin:

$ podman run -p 8000:80 kennethreitz/httpbin

Run monolith against that httpbin instance, and observe only a single value in the Cookie header:

$ monolith -C cookies.txt http://localhost:8000/headers
http://localhost:8000/headers
{
  "headers": {
    "Accept": "*/*", 
    "Accept-Encoding": "gzip, br, deflate", 
    "Cookie": "test_cookie2=two", 
    "Host": "localhost:8000", 
    "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0"
  }
}

Suspected Cause

I believe the issue is the use of insert instead of append here:

.insert(COOKIE, HeaderValue::from_str(&cookie_header_value).unwrap());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions