Skip to content

Commit

Permalink
CA-395626: Fix (server status report generation report)
Browse files Browse the repository at this point in the history
Concatenates the query value back after Uri.query splits the string
separated by commas.

Signed-off-by: Andrii Sultanov <[email protected]>
  • Loading branch information
last-genius authored and minglumlu committed Jul 16, 2024
1 parent 9f9c338 commit a97da2d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ocaml/libs/http-lib/http_svr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,13 @@ let request_of_bio_exn ~proxy_seen ~read_timeout ~total_timeout ~max_length bio
proxy |> Option.fold ~none:[] ~some:(fun p -> [("STUNNEL_PROXY", p)])
in
let open Http.Request in
(* Below transformation only keeps one value per key, whereas
a fully compliant implementation following Uri's interface
would operate on list of values for each key instead *)
let kvlist_flatten ls =
List.map (function k, v :: _ -> (k, v) | k, [] -> (k, "")) ls
(* Uri.query splits the value string into several if they are separated
with commas. Like this: "?k=v1,v2,v3" -> [("k", ["v1";"v2";"v3"])]
This function concatenates these back. It will not concatenate values
entered for duplicate keys, as these will be separate tuples:
"?k=v1,v2,v3&k=v4" -> [("k", ["v1"; "v2"; "v3"]); ("k", ["v4"])] *)
List.map (fun (k, vs) -> (k, Astring.String.concat ~sep:"," vs)) ls
in
let request =
Astring.String.cuts ~sep:"\n" headers
Expand Down

0 comments on commit a97da2d

Please sign in to comment.