2018-03-13 9:51 GMT+01:00 Aron Bergman <bathing...@gmail.com>:

> 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
>
> bathing...@gmail.com
>

Oh, I just realized that I misunderstood this. COOKIELIST works as
intended, it just save the cookies, not read them (I mixed the meanings
up), which is why the program "froze", it just awaited input from the
command line.

I still think that the documentation should use "" as the argument value or
it should be stated that using "-" will require input (or CTRL + D).
Thoughts?

Regards
Aron Bergman
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to