Q:

Importing Firefox and Chrome cookies to libcurl

I'm using Code::Blocks with MinGW, under Windows 7.
I'm writing a multithreaded web crawler with libcurl, using a CURLSH object with CURL_LOCK_DATA_COOKIE enabled to share cookies among different threads.
Once a handle receives a cookie, it is successfully shared among every other handle. However, I need to copy the initial set of cookies from Firefox or Chrome. I found that they store cookies using sqlite, and I've been able to read cookies from both of them from within my program. The problem is, how do I give these cookies to libcurl? Ideally, there should be some way to feed these cookies to my CURLSH  object, so that they get distributed to every handle. I have found no such thing.
Following this document, I can try to save the cookies I read from my browser to a cookies.txt file, which reduces to finding a correspondence between the fields in the database used by Firefox/Chrome and the Netscape format.
Netscape uses the following format:

domain flag path secure expiration name value

The problem comes with the flag field. I don't know what to write there. Firefox uses the following fields (file cookies.sqlite, table *moz_cookies*), which correspond with the Netscape format as follows (is this correct?):

host ??? path isSecure expiry name value

Chrome uses the following fields (file Cookies, table cookies):

host_key ??? path secure expires_utc name value

So, to create this cookies.txt file, I'm only missing that flag field. The document linked above says:

flag - A TRUE/FALSE value indicating if all machines within a given domain
  can access the variable. This value is set automatically by the
  browser, depending on the value you set for domain.

Which doesn't really tell me what to write there.
However, writting a file and then reading it seems like unnecessary work, given that I'll first load the cookies from Firefox/Chrome in RAM, and I should be able to give them to libcurl directly without going through the hard drive. I've found the CURLOPT_COOKIE option, but it is missing some fields (namely, domain). Also, that option doesn't seem to save the cookies for posterior use. It looks like I would need to call it for every transaction with only the cookies of the corresponding domain (and what if these cookies get changed? I would not want to check for changes manually, given that libcurl can do that).
So, given that I have all my cookies from Firefox/Chrome in memory, how do I give them to libcurl? If the only option is to use a cookies.txt file, what should I write in the flag field?

A:

I've found the answer, with CURLOPT_COOKIELIST (I was confusing it with CURLINFO_COOKIELIST, which can only be used to read cookies). Using CURLOPT_COOKIELIST, I can enter my cookies as HTTP headers, which do not need that flag field. I'll only need to give format to the date. It looks like specifying the cookies for any handle is enough to set them in the CURLSH object, because I can set them in one handle and read them any other handle.

