curl / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_COOKIEFILE with "-" as filename freezes program

From: Aron Bergman <bathingrad_at_gmail.com>
Date: Tue, 13 Mar 2018 09:51:21 +0100

I'm trying to fetch cookies from a website and print them to the console.
To get started, I looked at the CURLINFO_COOKIELIST documentation
<https://curl.haxx.se/libcurl/c/CURLINFO_COOKIELIST.html> and used the
example provided there.
The example states that you can enable the cookie engine using a
non-existing file and provides "-" as the filename argument on the line
below. Trying to run the example code only make my program hang.
I then looked at the CURLOPT_COOKIEFILE documentation
<https://curl.haxx.se/libcurl/c/CURLOPT_COOKIEFILE.html> to see if there
were any clues to why this happened. The documentation states that:
"Given an empty or non-existing file or by passing the empty string ("") to
this option, you can enable the cookie engine without reading any initial
cookies."

Changed the argument from "-" to "" made the CURLINFO_COOKIELIST example
code work.
Are anyone having the same problem?
I suspect that the reason that the COOKIELIST example uses "-" is because
that would print to console using cURL on the commandline, but I don't know
if "-" is supposed to be supported in libcurl.

If the COOKIELIST example uses a unsupported argument I'll be happy to
create a PR.

Regards

Aron Bergman

bathingrad_at_gmail.com

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-03-13