package cohttp-lwt
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
CoHTTP implementation using the Lwt concurrency library
Install
dune-project
Dependency
Authors
Maintainers
Sources
cohttp-5.3.0.tbz
sha256=b3bd91c704e5ea510e924b83ab2ede1fc46a2cce448b0f8cef4883b9a16eeddd
sha512=529930d9b1f38737d91f47cb94f8bae381df87ea941cb8e75ee798354763bdf5091f4f3be31d0ba14b9944dc68203a3d98e235c38c66e7e176a114be9ff4acf3
doc/cohttp-lwt/Cohttp_lwt/Make_server/index.html
Module Cohttp_lwt.Make_serverSource
Parameters
Signature
Source
type response_action = [ | `Expert of Cohttp.Response.t * (IO.ic -> IO.oc -> unit Lwt.t)| `Response of Cohttp.Response.t * Body.t
]A request handler can respond in two ways:
- Using
`Response, with aResponse.tand aBody.t. - Using
`Expert, with aResponse.tand an IO function that is expected to write the response body. The IO function has access to the underlyingIO.icandIO.oc, which allows writing a response body more efficiently, stream a response or to switch protocols entirely (e.g. websockets). Processing of pipelined requests continue after theunitLwt.tis resolved. The connection can be closed by closing theIO.ic.
Source
val make_response_action :
?conn_closed:(conn -> unit) ->
callback:(conn -> Cohttp.Request.t -> Body.t -> response_action Lwt.t) ->
unit ->
tSource
val make :
?conn_closed:(conn -> unit) ->
callback:
(conn -> Cohttp.Request.t -> Body.t -> (Cohttp.Response.t * Body.t) Lwt.t) ->
unit ->
tResolve a URI and a docroot into a concrete local filename.
Deprecated. Please use Cohttp.Path.resolve_local_file.
Source
val respond :
?headers:Cohttp.Header.t ->
?flush:bool ->
status:Cohttp.Code.status_code ->
body:Body.t ->
unit ->
(Cohttp.Response.t * Body.t) Lwt.trespond ?headers ?flush ~status ~body will respond to an HTTP request with the given status code and response body. If flush is true, then every response chunk will be flushed to the network rather than being buffered. flush is true by default. The transfer encoding will be detected from the body value and set to chunked encoding if it cannot be determined immediately. You can override the encoding by supplying an appropriate Content-length or Transfer-encoding in the headers parameter.
Source
val respond_string :
?flush:bool ->
?headers:Cohttp.Header.t ->
status:Cohttp.Code.status_code ->
body:string ->
unit ->
(Cohttp.Response.t * Body.t) Lwt.tSource
val respond_error :
?headers:Cohttp.Header.t ->
?status:Cohttp.Code.status_code ->
body:string ->
unit ->
(Cohttp.Response.t * Body.t) Lwt.tSource
val respond_redirect :
?headers:Cohttp.Header.t ->
uri:Uri.t ->
unit ->
(Cohttp.Response.t * Body.t) Lwt.tSource
val respond_need_auth :
?headers:Cohttp.Header.t ->
auth:Cohttp.Auth.challenge ->
unit ->
(Cohttp.Response.t * Body.t) Lwt.t sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page