Skip to content
Snippets Groups Projects
Unverified Commit 5d8c80b1 authored by Jonas Platte's avatar Jonas Platte
Browse files

Strip quotes from X-Matrix fields

parent 21ae63d4
No related branches found
No related tags found
No related merge requests found
...@@ -315,6 +315,13 @@ fn decode(value: &http::HeaderValue) -> Option<Self> { ...@@ -315,6 +315,13 @@ fn decode(value: &http::HeaderValue) -> Option<Self> {
for entry in parameters.split_terminator(',') { for entry in parameters.split_terminator(',') {
let (name, value) = entry.split_once('=')?; let (name, value) = entry.split_once('=')?;
// It's not at all clear why some fields are quoted and others not in the spec,
// let's simply accept either form for every field.
let value = value
.strip_prefix('"')
.and_then(|rest| rest.strip_suffix('"'))
.unwrap_or(value);
// FIXME: Catch multiple fields of the same name // FIXME: Catch multiple fields of the same name
match name { match name {
"origin" => origin = Some(value.try_into().ok()?), "origin" => origin = Some(value.try_into().ok()?),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment