From 4ba13a3fcbbabf2bd41f94f2eff8c50c9c296693 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 27 Feb 2022 19:53:06 +0100 Subject: Correct cookie concatenation --- src/reverse_proxy.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reverse_proxy.rs b/src/reverse_proxy.rs index 791b2d5..b5916be 100644 --- a/src/reverse_proxy.rs +++ b/src/reverse_proxy.rs @@ -84,16 +84,16 @@ fn create_proxied_request( } // Concatenate cookie headers into single header - // (HTTP/2 allows several cookie headers, but we are proxying to - // HTTP/1.1 that does not) + // (HTTP/2 allows several cookie headers, but we are proxying to HTTP/1.1 that does not) let mut cookie_concat = vec![]; - while let Some(cookie) = headers.remove(header::COOKIE) { + for cookie in headers.get_all(header::COOKIE) { if !cookie_concat.is_empty() { cookie_concat.extend(b"; "); } cookie_concat.extend_from_slice(cookie.as_bytes()); } if !cookie_concat.is_empty() { + // insert clears the old value of COOKIE and inserts the concatenated version instead headers.insert(header::COOKIE, cookie_concat.try_into()?); } -- cgit v1.2.3