From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (unknown [IPv6:2602:4b:a4cb:c000::1]) by hurricane.the-brannons.com (Postfix) with ESMTPSA id 2B7DD77DC1 for ; Thu, 7 Jan 2016 04:57:53 -0800 (PST) From: Chris Brannon To: Edbrowse-dev@lists.the-brannons.com References: <568DE9E0.6020009@pcdesk.net> Date: Thu, 07 Jan 2016 04:58:36 -0800 In-Reply-To: <568DE9E0.6020009@pcdesk.net> (Tyler Spivey's message of "Wed, 6 Jan 2016 20:30:24 -0800") Message-ID: <877fjla6mb.fsf@mushroom.localdomain> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Edbrowse-dev] Cookies X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2016 12:57:53 -0000 The cookie file is not being read, but it's being saved when we quit. So CURLOPT_COOKIEFILE is effectively ignored. A long-winded explanation of why is ahead. In fact, CURLOPT_COOKIEFILE doesn't work with shared handles, and it isn't really supposed to. The curl shared handles share an in-memory cookie jar, nothing more, nothing less. They don't share file access. Even the CURLOPT_COOKIEJAR, which is where curl writes cookies at cleanup, isn't technically shared among handles at all. In our case, one handle owns it, namely global_http_handle, and when that handle is cleaned up, the contents of that shared in-memory cookie jar get written to the right place. CURLOPT_COOKIEFILE is weirder. When you say curl_easy_setopt(some_handle, CURLOPT_COOKIEFILE, filename), this does not load cookies from the file immediately. Apparently, cookies will not be loaded from the file until you make the first HTTP transfer with some_handle. If some_handle is part of a share, then cookies from the file are added to the shared in-memory cookie jar the first time you make a transfer with some_handle. We're using global_http_handle to manage our cookie file, but we never make a transfer from it. Hence, the file named by CURLOPT_COOKIEFILE will never be loaded, and its cookies will never be added to the shared in-memory jar. I suspect that the best approach will be to just forget CURLOPT_COOKIEFILE entirely and feed the cookies in manually at startup. Ugly, but that's how it goes. -- Chris