package cohttp

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cohttp-v6.0.0_beta2.tbz
sha256=90ecec8bd580411b4272c031b2f6b9c0a50485d20683c6a9c615242f3724b017
sha512=83ef539469d982862174a929e9baeb5b2a34e9323ee577d8be7148ebed9e785d835d59cc22982bc083bb872e4544616e2bf531ed7edf96bc397151c28bf618d6

doc/cohttp/Cohttp/Auth/index.html

Module Cohttp.AuthSource

HTTP Authentication and Authorization header parsing and generation

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

    Basic authentication within a realm

    *)
]

HTTP authentication challenge types

Sourceval sexp_of_challenge : challenge -> Sexplib0.Sexp.t
Sourceval challenge_of_sexp : Sexplib0.Sexp.t -> challenge
Sourceval __challenge_of_sexp__ : Sexplib0.Sexp.t -> challenge
Sourcetype 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

Sourceval sexp_of_credential : credential -> Sexplib0.Sexp.t
Sourceval credential_of_sexp : Sexplib0.Sexp.t -> credential
Sourceval __credential_of_sexp__ : Sexplib0.Sexp.t -> credential
Sourceval 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")

Sourceval 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.

Sourceval 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.