Skip to content

Commit

Permalink
Discard encoding with priority 0 (#3)
Browse files Browse the repository at this point in the history
This fixes parsing headers such as "identity;q=1, *;q=0"
  • Loading branch information
samoht authored Nov 8, 2024
1 parent 0085ff4 commit 0a2c423
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/dream_encoding.ml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ let accepted_encodings_with_weights request =
let accepted_encodings request =
match accepted_encodings_with_weights request with
| None -> None
| Some encodings -> Some (List.map (fun (a, _) -> a) encodings)
| Some encodings ->
Some
(List.filter_map (function _, 0 -> None | a, _ -> Some a) encodings)

let preferred_content_encoding request =
match accepted_encodings request with
Expand Down

0 comments on commit 0a2c423

Please sign in to comment.