curl / Mailing Lists / curl-library / Single Mail


CURLOPT_COOKIEFILE with "-" as filename freezes program

From: Aron Bergman <>
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
<> 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
<> 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

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.


Aron Bergman

Received on 2018-03-13