package cohttp

  1. Overview
  2. Docs
An OCaml library for HTTP clients and servers

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cohttp-4.1.2.tbz
sha256=f027f48e132f214b3e27b63c99b247b150549e70bd6e27ad16da947ed392fa20
sha512=c8fbf840141faecb207af3ad7d2bfcdf8b8bced6c6ca4d5a22b6982d1be13f748fa6e3997c6d97351285cd3a30f57f20fd418b7195a735a13d48ba3bcdf8e23c

doc/cohttp/Cohttp/Auth/index.html

Module Cohttp.Auth

HTTP Authentication and Authorization header parsing and generation

type challenge = [
  1. | `Basic of string
    (*

    Basic authentication within a realm

    *)
]

HTTP authentication challenge types

val sexp_of_challenge : challenge -> Ppx_sexp_conv_lib.Sexp.t
val challenge_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> challenge
val __challenge_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> challenge
type credential = [
  1. | `Basic of string * string
    (*

    Basic authorization with a username and password

    *)
  2. | `Other of string
    (*

    An unknown credential type that will be passed straight through to the application layer

    *)
]

HTTP authorization credential types

val sexp_of_credential : credential -> Ppx_sexp_conv_lib.Sexp.t
val credential_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> credential
val __credential_of_sexp__ : Ppx_sexp_conv_lib.Sexp.t -> credential
val string_of_credential : credential -> string

string_of_credential converts the credential to a string compatible with the HTTP/1.1 wire format for authorization credentials ("responses")

val credential_of_string : string -> credential

credential_of_string cred_s converts an HTTP response to an authentication challenge into a credential. If the credential is not recognized, `Other cred_s is returned.

val string_of_challenge : challenge -> string

string_of_challenge challenge converts the challenge to a string compatible with the HTTP/1.1 wire format for authentication challenges.

For example, a `Basic challenge with realm "foo" will be marshalled to "Basic realm=foo", which can then be combined with a www-authenticate HTTP header and sent back to the client. There is a helper function Header.add_authorization_req that does just this.