-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
curl doesn't send the last line cookie if there is no trailing newline #4946
Comments
Do you actually mean an extra newline or do you mean a newline ? Because I can reproduce your problem if I make the cookie line in the file not have a newline at all, but I only need one newline at the end of that cookie line to make it work. (I tested on Linux though, and I won't be surprise if this is different on Windows). |
I think I mean a newline. As I posted in the question body This doesn't work:
This works:
↑ |
I think I'll go with updating the documentation to say that a newline at the end is required. It is really the most sensible way we know that we have read a complete and not a partial line. |
I'm unable to find any definitive file format specification for the Netscape cookie file. I am inclined to document a trailing newline as being required though, and possibly issue a warning or error for other non-comment lines not ending in a newline? |
👍 |
... so that we know we got the whole and not a partial line. Also, changed the formatting of the fields away from a table again since the table format requires a github-markdown tool version that we don't run on the web server atm. Reported-by: Sunny Bean Fixes #4946
See if this helps: https://unix.stackexchange.com/questions/36531/format-of-cookies-when-using-wget/210282 |
I'm convinced there never was one, we all just copied what they apparently used back in the day... And whatever we'll find today is just people who have tried to document what has been observed. Pretty much like we document how we use and create the file, as I expect that curl and wget are nowadays the two major consumers and producers of this style of cookie file. |
I did this
http://httpbin.org/cookies/set/name/value
filename: cookie
The cookie is not sent according the verbose information (No HTTP cookie header is shown in request)
I expected the following
The cookie I saved should appear in request headers. The cookie should be sent.
curl/libcurl version
operating system
Windows7
Solution
Adding an extra blank line at the end of the cookie file then it works. The cookie will be sent.
I don't know if this can be counted as a bug. But it did cause me a few hours to find the problem and the documentation doesn't say anything about this requirement(an blank line at the end) for local cookie files, if I don't miss any details.
The text was updated successfully, but these errors were encountered: