rwf2 / cookie-rs

HTTP cookie parsing and cookie jar management for Rust.
https://docs.rs/cookie
Apache License 2.0
312 stars 119 forks source link

Parse multiple cookies in single string? #192

Closed muscache closed 2 years ago

muscache commented 3 years ago

HTTP clients must send a single Cookie: header with all the cookies separated by a ; according to RFC 6265.

If I attempt to parse such a header, I only get the first cookie:

let cookie_str = "__Secure-A=AAA; __Secure-B=BBB";

// Only returns first cookie, '__Secure-A'.
cookie::Cookie::parse(cookie_str).unwrap();

Currently I manually split the header value by ';' and parse each cookie. It would be nice to have a method eg. parse_multiple that returns a Vec<Cookie>

SergioBenitez commented 2 years ago

See #156 and #137.