Vendors/Resto: allow client to send host header
This commit is contained in:
parent
d0dd6be9c0
commit
1f213b385b
10
vendors/ocplib-resto/lib_resto-cohttp/client.ml
vendored
10
vendors/ocplib-resto/lib_resto-cohttp/client.ml
vendored
@ -123,12 +123,14 @@ module Make (Encoding : Resto.ENCODING) = struct
|
|||||||
let generic_call meth ?(logger = null_logger) ?(headers = []) ?accept ?body ?media uri : (content, content) generic_rest_result Lwt.t =
|
let generic_call meth ?(logger = null_logger) ?(headers = []) ?accept ?body ?media uri : (content, content) generic_rest_result Lwt.t =
|
||||||
let module Logger = (val logger) in
|
let module Logger = (val logger) in
|
||||||
let headers = List.fold_left (fun headers (header, value) ->
|
let headers = List.fold_left (fun headers (header, value) ->
|
||||||
if String.length header < 2
|
let header = String.lowercase_ascii header in
|
||||||
|| String.sub (String.lowercase_ascii header) 0 2 <> "x-" then
|
if header <> "host"
|
||||||
|
&& (String.length header < 2
|
||||||
|
|| String.sub header 0 2 <> "x-") then
|
||||||
invalid_arg
|
invalid_arg
|
||||||
"Resto_cohttp.Client.call: \
|
"Resto_cohttp.Client.call: \
|
||||||
only headers starting with \"x-\" are supported"
|
only headers \"host\" or starting with \"x-\" are supported"
|
||||||
else Header.add headers header value)
|
else Header.replace headers header value)
|
||||||
(Header.init ()) headers in
|
(Header.init ()) headers in
|
||||||
begin
|
begin
|
||||||
match body with
|
match body with
|
||||||
|
Loading…
Reference in New Issue
Block a user