package http

  1. Overview
  2. Docs
Type definitions of HTTP essentials

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cohttp-6.1.1.tbz
sha256=6b420c56203b3a0b515964f036bcea0fb9a362876b5791cd7ff50e12366c489c
sha512=839ff6156658ca6d7922e6eed63ebb84dd09c76107790477be55a1ffc4a3800bf49c435147a0ed628f147eaeccff9a8d34565e3787f32c15e187b6e8855f0b93

doc/http/Http/Request/index.html

Module Http.RequestSource

Sourcetype t = {
  1. headers : Header.t;
    (*

    HTTP request headers

    *)
  2. meth : Method.t;
    (*

    HTTP request method

    *)
  3. resource : string;
    (*

    Request path and query

    *)
  4. version : Version.t;
    (*

    HTTP version, usually 1.1

    *)
}
Sourceval has_body : t -> [ `No | `Unknown | `Yes ]
Sourceval headers : t -> Header.t
Sourceval meth : t -> Method.t
Sourceval resource : t -> string
Sourceval version : t -> Version.t
Sourceval compare : t -> t -> int
Sourceval is_keep_alive : t -> bool

Return true whether the connection should be reused

Sourceval requires_content_length : t -> bool

requires_content_length t is true if t.meth is one of `POST, `PUT or `PATCH. Otherwise it is false.

A true value indicates that a request must include a "Content-Length" header.

See https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2

Sourceval content_length : t -> int option

content_length t is Some x if the "Content-Length" header in t exists and its value x is a non negative integer, x>=0

It is None if requires_content_length t = false or the value encoded in "Content-Length" is not a valid integer value, i.e >= 0.

See https://www.rfc-editor.org/rfc/rfc7230#section-3.3.2

Sourceval supports_chunked_trailers : t -> bool

supports_chunked_trailers t is true if t contains HTTP header "TE: trailers". Otherwise it is false.

Sourceval add_te_trailers : t -> t

add_te_trailers t adds HTTP headers, 'TE' and 'Connection' to indicate that a user-agent can handle HTTP chunked trailers headers.

Sourceval make : ?meth:Method.t -> ?version:Version.t -> ?headers:Header.t -> string -> t

make resource is a value of t. The default values for the response, if not specified, are as follows: meth is `GET, version is `HTTP_1_1, headers is Header.empty. The request encoding value is determined via the Header.get_transfer_encoding function.

Sourceval pp : Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.