docs/HTTP-COOKIES.md: link to more information

Closes #15891
This commit is contained in:
Daniel Stenberg 2025-01-01 21:18:11 +01:00
parent 7fb113f01f
commit 91587522a1
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -103,69 +103,69 @@ SPDX-License-Identifier: curl
Command line options: Command line options:
`-b, --cookie` [`-b, --cookie`](https://curl.se/docs/manpage.html#-b)
tell curl a file to read cookies from and start the cookie engine, or if it tell curl a file to read cookies from and start the cookie engine, or if it
is not a file it passes on the given string. `-b name=var` works and so does is not a file it passes on the given string. `-b name=var` works and so does
`-b cookiefile`. `-b cookiefile`.
`-j, --junk-session-cookies` [`-j, --junk-session-cookies`](https://curl.se/docs/manpage.html#-j)
when used in combination with -b, it skips all "session cookies" on load so when used in combination with -b, it skips all "session cookies" on load so
as to appear to start a new cookie session. as to appear to start a new cookie session.
`-c, --cookie-jar` [`-c, --cookie-jar`](https://curl.se/docs/manpage.html#-c)
tell curl to start the cookie engine and write cookies to the given file tell curl to start the cookie engine and write cookies to the given file
after the request(s) after the request(s)
## Cookies with libcurl ## Cookies with libcurl
libcurl offers several ways to enable and interface the cookie engine. These libcurl offers several ways to enable and interface the cookie engine. These
options are the ones provided by the native API. libcurl bindings may offer options are the ones provided by the native API. libcurl bindings may offer
access to them using other means. access to them using other means.
`CURLOPT_COOKIE` [`CURLOPT_COOKIE`](https://curl.se/libcurl/c/CURLOPT_COOKIE.html)
Is used when you want to specify the exact contents of a cookie header to Is used when you want to specify the exact contents of a cookie header to
send to the server. send to the server.
`CURLOPT_COOKIEFILE` [`CURLOPT_COOKIEFILE`](https://curl.se/libcurl/c/CURLOPT_COOKIEFILE.html)
Tell libcurl to activate the cookie engine, and to read the initial set of Tell libcurl to activate the cookie engine, and to read the initial set of
cookies from the given file. Read-only. cookies from the given file. Read-only.
`CURLOPT_COOKIEJAR` [`CURLOPT_COOKIEJAR`](https://curl.se/libcurl/c/CURLOPT_COOKIEJAR.html)
Tell libcurl to activate the cookie engine, and when the easy handle is Tell libcurl to activate the cookie engine, and when the easy handle is
closed save all known cookies to the given cookie jar file. Write-only. closed save all known cookies to the given cookie jar file. Write-only.
`CURLOPT_COOKIELIST` [`CURLOPT_COOKIELIST`](https://curl.se/libcurl/c/CURLOPT_COOKIELIST.html)
Provide detailed information about a single cookie to add to the internal Provide detailed information about a single cookie to add to the internal
storage of cookies. Pass in the cookie as an HTTP header with all the storage of cookies. Pass in the cookie as an HTTP header with all the
details set, or pass in a line from a Netscape cookie file. This option can details set, or pass in a line from a Netscape cookie file. This option can
also be used to flush the cookies etc. also be used to flush the cookies etc.
`CURLOPT_COOKIESESSION` [`CURLOPT_COOKIESESSION`](https://curl.se/libcurl/c/CURLOPT_COOKIESESSION.html)
Tell libcurl to ignore all cookies it is about to load that are session Tell libcurl to ignore all cookies it is about to load that are session
cookies. cookies.
`CURLINFO_COOKIELIST` [`CURLINFO_COOKIELIST`](https://curl.se/libcurl/c/CURLINFO_COOKIELIST.html)
Extract cookie information from the internal cookie storage as a linked Extract cookie information from the internal cookie storage as a linked
list. list.
## Cookies with JavaScript ## Cookies with JavaScript
These days a lot of the web is built up by JavaScript. The web browser loads These days a lot of the web is built up by JavaScript. The web browser loads
complete programs that render the page you see. These JavaScript programs complete programs that render the page you see. These JavaScript programs
can also set and access cookies. can also set and access cookies.
Since curl and libcurl are plain HTTP clients without any knowledge of or Since curl and libcurl are plain HTTP clients without any knowledge of or
capability to handle JavaScript, such cookies are not detected or used. capability to handle JavaScript, such cookies are not detected or used.
Often, if you want to mimic what a browser does on such websites, you can Often, if you want to mimic what a browser does on such websites, you can
record web browser HTTP traffic when using such a site and then repeat the record web browser HTTP traffic when using such a site and then repeat the
cookie operations using curl or libcurl. cookie operations using curl or libcurl.