package paf-cohttp
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=d2ad3b819a735320e85a50389bf3fe1064afbd528067b470564a4ece2ab31b63
sha512=e6bf4640a1411ab15fcec1fda9c494bfa895bd1d5c2f40542a9680252dd2cabf2f3da7f17849489e5ddfef2c003b35a9945a2f8aae432d3d1608745f02767612
doc/paf-cohttp/Paf_cohttp/index.html
Module Paf_cohttpSource
include Cohttp_lwt.S.Client with type ctx = Mimic.ctx
val call :
?ctx:ctx ->
?headers:Cohttp.Header.t ->
?body:Cohttp_lwt.Body.t ->
?chunked:bool ->
Cohttp.Code.meth ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tcall ?ctx ?headers ?body ?chunked meth uri will resolve the uri to a concrete network endpoint using context ctx. It will then issue an HTTP request with method meth, adding request headers from headers if present. If a body is specified then that will be included with the request, using chunked encoding if chunked is true. The default is to disable chunked encoding for HTTP request bodies for compatibility reasons.
In most cases you should use the more specific helper calls in the interface rather than invoke this function directly. See head, get and post for some examples.
To avoid leaks, the body needs to be consumed, using the functions provided in the Body module and, if not necessary, should be explicitly drained calling Body.drain_body. Leaks are logged as debug messages by the client, these can be enabled activating the debug logging. For example, this can be done as follows in cohttp-lwt-unix
Cohttp_lwt_unix.Debug.activate_debug ();
Logs.set_level (Some Logs.Warning)Depending on ctx, the library is able to send a simple HTTP request or an encrypted one with a secured protocol (such as TLS). Depending on how conduit is configured, ctx might initiate a secured connection with TLS (using ocaml-tls) or SSL (using ocaml-ssl), on *:443 or on the specified port by the user. If neitehr ocaml-tls or ocaml-ssl are installed on the system, cohttp/conduit tries the usual (*:80) or the specified port by the user in a non-secured way.
val get :
?ctx:ctx ->
?headers:Cohttp.Header.t ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tval delete :
?ctx:ctx ->
?body:Cohttp_lwt.Body.t ->
?chunked:bool ->
?headers:Cohttp.Header.t ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tval post :
?ctx:ctx ->
?body:Cohttp_lwt.Body.t ->
?chunked:bool ->
?headers:Cohttp.Header.t ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tval put :
?ctx:ctx ->
?body:Cohttp_lwt.Body.t ->
?chunked:bool ->
?headers:Cohttp.Header.t ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tval patch :
?ctx:ctx ->
?body:Cohttp_lwt.Body.t ->
?chunked:bool ->
?headers:Cohttp.Header.t ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tval post_form :
?ctx:ctx ->
?headers:Cohttp.Header.t ->
params:(string * string list) list ->
Uri.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt.tval callv :
?ctx:ctx ->
Uri.t ->
(Cohttp.Request.t * Cohttp_lwt.Body.t) Lwt_stream.t ->
(Cohttp.Response.t * Cohttp_lwt.Body.t) Lwt_stream.t Lwt.t