Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
curl doesn't send the last line cookie if there is no trailing newline #4946
I did this
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.
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.
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:
See if this helps:
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.