According to the man page, the file format of the file to read cookies from should be plain HTTP headers or the Netscape/Mozilla cookie file format.
Passed a file argument to --cookie of the form:
curl to send the cookie headers. I realized after reading the source that curl expects the file to contain:
It would be nice if the docs were clearer or if curl accepted either format.
> curl -V
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/188.8.131.52 Basic ECC zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz
> uname -a
Linux 3.10.0-123.20.1.el7.x86_64 #1 SMP Thu Jan 29 18:05:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
I can see how that is confusing. What if we change the way it is documented to:
diff --git a/docs/curl.1 b/docs/curl.1
index beb9194..cc9f07c 100644
@@ -216,8 +216,8 @@ read previously stored cookie lines from, which should be us
if they match. Using this method also activates the cookie engine which will
make curl record incoming cookies too, which may be handy if you're using this
in combination with the \fI-L, --location\fP option. The file format of the
-file to read cookies from should be plain HTTP headers or the Netscape/Mozilla
-cookie file format.
+file to read cookies from should be plain HTTP headers (Set-Cookie style) or
+the Netscape/Mozilla cookie file format.
The file specified with \fI-b, --cookie\fP is only used as input. No cookies
will be written to the file. To store cookies, use the \fI-c, --cookie-jar\fP
That sounds good to me!
curl.1: HTTP headers for --cookie must be Set-Cookie style
Thanks, landed in a11c5f3. FYI you can see the latest information for that option online: -b, --cookie.
Way to close out issue 666 with expediency! 👼
CURLOPT_COOKIEFILE.3: HTTP headers must be Set-Cookie style