aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-02-27 19:53:06 +0100
committerAlex Auvolat <alex@adnab.me>2022-02-27 19:53:06 +0100
commit4ba13a3fcbbabf2bd41f94f2eff8c50c9c296693 (patch)
tree3f81e739b387e24199c5c054c67c2506e5988c4f
parentd85ef182691057c96e546d39f8527e2274d3bcef (diff)
downloadtricot-docker-36.tar.gz
tricot-docker-36.zip
Correct cookie concatenationdocker-36
-rw-r--r--src/reverse_proxy.rs6
1 files 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<B>(
}
// 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()?);
}