diff --git a/http/src/dune b/http/src/dune index 202746dc48..7d23c5e0c4 100644 --- a/http/src/dune +++ b/http/src/dune @@ -1,3 +1,4 @@ (library (name http) + (libraries uri) (public_name http)) diff --git a/http/src/http.ml b/http/src/http.ml index 923aa93a34..c069f14b18 100644 --- a/http/src/http.ml +++ b/http/src/http.ml @@ -757,13 +757,15 @@ module Request = struct Transfer.has_body req.encoding let[@warning "-3"] make ?(meth = `GET) ?(version = `HTTP_1_1) - ?(encoding = Transfer.Chunked) ?(headers = Header.empty) resource = - let encoding = - match Header.get_transfer_encoding headers with - | Transfer.(Chunked | Fixed _) as enc -> enc - | Unknown -> encoding - in - { headers; meth; scheme = None; resource; version; encoding } + ?(headers = Header.empty) resource = + { + headers; + meth; + scheme = Uri.scheme resource; + resource = Uri.path_and_query resource; + version; + encoding = Transfer.Unknown; + } end module Response = struct @@ -790,12 +792,7 @@ module Response = struct | i -> i let make ?(version = `HTTP_1_1) ?(status = `OK) ?(flush = false) - ?(encoding = Transfer.Chunked) ?(headers = Header.empty) () = - let encoding = - match Header.get_transfer_encoding headers with - | Transfer.(Chunked | Fixed _) as enc -> enc - | Unknown -> encoding - in + ?(encoding = Transfer.Unknown) ?(headers = Header.empty) () = { encoding; headers; version; flush; status } let headers t = t.headers diff --git a/http/src/http.mli b/http/src/http.mli index 0e25111310..27d4d1f236 100644 --- a/http/src/http.mli +++ b/http/src/http.mli @@ -385,18 +385,12 @@ module Request : sig (** Return true whether the connection should be reused *) val make : - ?meth:Method.t -> - ?version:Version.t -> - ?encoding:Transfer.encoding -> - ?headers:Header.t -> - string -> - t + ?meth:Method.t -> ?version:Version.t -> ?headers:Header.t -> Uri.t -> t (** [make res)] is [t] where [resource t] is [res]. The default values if not specified are as follows: - [meth] is [`GET] - [version] is [`HTTP_1_1] - - [encoding] is [Transfer.Chunked] - [headers] is [Header.empty] *) end