package httpcats

  1. Overview
  2. Docs
A simple HTTP client / server using h1, h2, and miou

Install

dune-project
 Dependency

Authors

Maintainers

Sources

httpcats-0.2.0.tbz
sha256=3587d8d1e297025340ab59b934acc2c96fabfc36ff60f07a7d64e7067521e631
sha512=8bb3be3ec6ff35e5ced00cd99d87c4a2f3941571cce90b54817de68374143a217b65ab1bd211a92414664a344fd41b61e1e92e908fcda900331cb14e5a2dd6f1

doc/src/httpcats.core/httpcats_core.ml.html

Source file httpcats_core.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module Version = H1.Version
module Status = H2.Status
module Headers = H2.Headers
module Method = H2.Method
module Cookie = Cookie

type request = { meth: Method.t; target: string; headers: Headers.t }

type response = {
    version: Version.t
  ; status: Status.t
  ; reason: string
  ; headers: Headers.t
}

type error =
  [ `V1 of H1.Client_connection.error
  | `V2 of H2.Client_connection.error
  | `Protocol of string
  | `Msg of string
  | `Exn of exn ]

type body = String of string | Stream of string Seq.t
type meta = (Ipaddr.t * int) * Tls.Core.epoch_data option
type 'a handler = meta -> request -> response -> 'a -> string option -> 'a

module Server = struct
  type error =
    [ `V1 of H1.Server_connection.error
    | `V2 of H2.Server_connection.error
    | `Protocol of string ]

  type request = {
      meth: Method.t
    ; target: string
    ; scheme: string
    ; headers: Headers.t
  }

  type response = { status: Status.t; headers: Headers.t }
  type body = [ `V1 of H1.Body.Writer.t | `V2 of H2.Body.Writer.t ]
  type reqd = [ `V1 of H1.Reqd.t | `V2 of H2.Reqd.t ]

  type error_handler =
    [ `V1 | `V2 ] -> ?request:request -> error -> (Headers.t -> body) -> unit

  type 'a handler = 'a -> reqd -> unit
end