package http-cookie

Build not checked
  1. Overview
  2. Docs
HTTP cookie library for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

http-cookie-v4.2.0.tbz
sha256=cdb91d7ee5420c38503fd3b333d0349a2c6689166b8c17f95fda8cd1c2454ed6
sha512=2f024dfaa1062e5701e811f933ce84ec674b579a3cded8a5279fc34366a4de360cd5f0ca3f68311f6ff527ec8a8a5c71325f8849bb05b8e98bf467bd33762191

Description

A comprehensive and strict standards compliant HTTP cookies library for ocaml.

http-cookie supports consuming and creating HTTP cookies found in HTTP request Cookie header and in Set-Cookie header in HTTP response. The library validates all cookie attributes, cookie name and cookie value for standards conformance and correct usage. The validation suite is comprehensive and includes validation of domain name, IPv4, IPv6 and HTTP date-time formats.

The RFC standards/validations implemented by the library are:

  • RFC 6265
  • RFC 1123
  • RFC 1034
  • IPV4/IPV6 address validation

Added to opam-repository:

README

Cookies

A comprehensive and strict standards compliant HTTP cookies library for ocaml. API Documentation

http-cookie supports consuming and creating HTTP cookies found in HTTP request Cookie header and in Set-Cookie header in HTTP response. The library validates all cookie attributes, cookie name and cookie value for standards conformance and correct usage. The validation suite is comprehensive and includes validation of domain name, IPv4, IPv6 and HTTP date-time formats.

The RFC standards implemented by the library are:

Usage

# #require "http-cookie";;
# #install_printer Http_cookie.pp;;

HTTP Cookie header value:

# let s = "SID=234234asdasdasda" in
  let c = List.nth (Http_cookie.of_cookie s |> Result.get_ok) 0 in 
  let s1 = Http_cookie.to_cookie c in 
  s = s1 ;;
- : bool = true

HTTP Set-Cookie header value:

# let s = "SID=31d4d96e407aad42; Path=/; Domain=ffff::0234:ddd:192.168.0.1; Expires=Sun, 06 Nov 1994 08:49:37 GMT; Secure; HttpOnly" in
  let c = Http_cookie.of_set_cookie s |> Result.get_ok in
  let s2 = Http_cookie.to_set_cookie c in 
  s = s2
- : bool = true

Create HTTP cookie:

# Http_cookie.create ~path:"/home" ~domain:"eee:aaa:abdf::223:192.168.0.1" ~secure:true ~same_site:`Strict ~name:"SID" "31d4d96e407aad42";;
- : (Http_cookie.t, string) result =
Ok
 name: SID
 value: 31d4d96e407aad42
 path: /home
 domain: eee:aaa:abdf::223:192.168.0.1
 expires:
 max_age:
 secure: true
 http_only: true
 same_site: Strict
 extension:

Dependencies (4)

  1. angstrom >= "0.15.0"
  2. fmt >= "0.8.9"
  3. ocaml >= "4.10.0"
  4. dune >= "2.8"

Dev Dependencies (3)

  1. odoc with-doc
  2. mdx with-test & < "2.0"
  3. ppx_expect with-test

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building http-cookie with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
4.3.0 good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure