cow_cookie.asciidoc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. = cow_cookie(3)
  2. == Name
  3. cow_cookie - Cookies
  4. == Description
  5. The module `cow_cookie` provides functions for parsing
  6. and manipulating cookie headers.
  7. == Exports
  8. * link:man:cow_cookie:parse_cookie(3)[cow_cookie:parse_cookie(3)] - Parse a cookie header
  9. * link:man:cow_cookie:setcookie(3)[cow_cookie:setcookie(3)] - Generate a set-cookie header
  10. == Types
  11. === cookie_opts()
  12. [source,erlang]
  13. ----
  14. cookie_opts() :: #{
  15. domain => binary(),
  16. http_only => boolean(),
  17. max_age => non_neg_integer(),
  18. path => binary(),
  19. same_site => lax | strict,
  20. secure => boolean()
  21. }
  22. ----
  23. Options for the set-cookie header. They are added to the
  24. header as attributes. More information about the options
  25. can be found in https://tools.ietf.org/html/rfc6265[RFC 6265].
  26. The following options are defined:
  27. domain::
  28. Hosts to which the cookie will be sent. By default it will
  29. only be sent to the origin server.
  30. http_only::
  31. Whether the cookie should be restricted to HTTP requests, or
  32. it should also be exposed to other APIs, for example Javascript.
  33. By default there are no restrictions.
  34. max_age::
  35. Maximum lifetime of the cookie, in seconds. By default the
  36. cookie is kept for the duration of the session.
  37. path::
  38. Path to which the cookie will be sent. By default it will
  39. be sent to the current "directory" of the effective request URI.
  40. same_site::
  41. Whether the cookie should be sent along with cross-site
  42. requests. This header is currently non-standard but is in
  43. the process of being standardized. Please refer to the
  44. https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7[RFC 6265 (bis) draft]
  45. for details.
  46. secure::
  47. Whether the cookie should be sent only on secure channels
  48. (for example TLS). Note that this does not guarantee the
  49. integrity of the cookie, only its confidentiality during
  50. transfer. By default there are no restrictions.
  51. == See also
  52. link:man:cowlib(7)[cowlib(7)],
  53. https://tools.ietf.org/html/rfc6265[RFC 6265]