Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File argument to --cookie doesn't behave as expected #666

Closed
baumanj opened this issue Feb 18, 2016 · 4 comments
Closed

File argument to --cookie doesn't behave as expected #666

baumanj opened this issue Feb 18, 2016 · 4 comments

Comments

@baumanj
Copy link

baumanj commented Feb 18, 2016

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.

I did this

Passed a file argument to --cookie of the form:

Cookie: foo=bar
Cookie: baz=qux

I expected the following

curl to send the cookie headers. I realized after reading the source that curl expects the file to contain:

Set-Cookie: foo=bar
Set-Cookie: baz=qux

It would be nice if the docs were clearer or if curl accepted either format.

curl/libcurl version

> curl -V
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.16.2.3 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 

operating system

> 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
@jay
Copy link
Member

jay commented Feb 18, 2016

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
--- a/docs/curl.1
+++ b/docs/curl.1
@@ -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

@baumanj
Copy link
Author

baumanj commented Feb 18, 2016

That sounds good to me!

jay added a commit that referenced this issue Feb 19, 2016
Bug: #666
Reported-by: baumanj@users.noreply.github.com
@jay
Copy link
Member

jay commented Feb 19, 2016

Thanks, landed in a11c5f3. FYI you can see the latest information for that option online: -b, --cookie.

@jay jay closed this as completed Feb 19, 2016
@baumanj
Copy link
Author

baumanj commented Feb 19, 2016

Way to close out issue 666 with expediency! 👼

jay added a commit that referenced this issue Feb 19, 2016
Bug: #666
Reported-by: baumanj@users.noreply.github.com
@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants