package naboris

  1. Overview
  2. Docs

Module for working with incoming requests.

type 'sessionData t
val reqd : 'sessionData t -> Httpaf.Reqd.t

Get HttpAf request descriptor.

val getHeader : string -> 'sessionData t -> string option

Get header from request. None if no matching header is found.

val getBody : 'sessionData t -> string Lwt.t

Get lwt promise of the body string from an http request.

val getSessionData : 'sessionData t -> 'sessionData option

Extracts 'sessionData from request.

Returns None if no session exists.

val setSessionData : 'sessionData Session.t option -> 'sessionData t -> 'sessionData t

Sets 'sessionData onto a request.

val fromReqd : Httpaf.Reqd.t -> 'sessionData SessionConfig.t option -> string option -> bool -> Etag.strength option -> 'sessionData t

Intended for internal use. Creates default req record.

val sidKey : 'sessionData t -> string

Get key for session id cookie

val maxAge : 'sessionData t -> int

Get max age for session id cookies (in seconds)

val secret : 'sessionData t -> string

Get secret used to sign session id cookies.

val staticCacheControl : 'sessionData t -> string option

Get Cache-control header value for static requests based on ServerConfig.t.

val staticLastModified : 'sessionData t -> bool

Get bool value where true signals the server to set Last-modified headers for static requests.

val responseEtag : 'sessionDate t -> Etag.strength option

Get option([`Strong | `Weak]) which is set by ServerConfig.t.

OCaml

Innovation. Community. Security.