• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Client http cookie storage, caching and application
2
3lws now has the option to store incoming cookies in a Netscape cookie jar file
4persistently, and auto-apply relevant cookies to future outgoing requests.
5
6A L1 heap cache of recent cookies is maintained, along with LRU tracking and
7removal of entries from cache and the cookie jar file according to their cookie
8expiry time.
9
10The cookie handling is off by default per-connection for backwards compatibility
11and to avoid unexpected tracking.
12
13## Enabling at build-time
14
15Make sure `-DLWS_WITH_CACHE_NSCOOKIEJAR=1` is enabled at cmake (it is on by
16default now).
17
18## Configuring the cookie cache
19
20The cookie cache is managed through context creation info struct members.
21
22|member|function|
23|---|---|
24|`.http_nsc_filepath`|Filepath to store the cookie jar file at|
25|`.http_nsc_heap_max_footprint`|0, or Max size in bytes for the L1 heap cache|
26|`.http_nsc_heap_max_items`|0, or Max number of cookies allowed in L1 heap cache|
27|`.http_nsc_heap_max_payload`|0, or Largest cookie we are willing to handle|
28
29## Enabling per-connection in lws
30
31To enable it on connections at lws level, add the flag `LCCSCF_CACHE_COOKIES` to
32the client connection info struct `.ssl_connection` flags.
33
34## Enabling per-connection in Secure Streams policy
35
36To enable it on Secure Streams, in the streamtype policy add
37
38```
39	"http_cookies":		true
40```
41