edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Chris Brannon <chris@the-brannons.com>
To: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] Cookies
Date: Thu, 07 Jan 2016 04:58:36 -0800	[thread overview]
Message-ID: <877fjla6mb.fsf@mushroom.localdomain> (raw)
In-Reply-To: <568DE9E0.6020009@pcdesk.net> (Tyler Spivey's message of "Wed, 6 Jan 2016 20:30:24 -0800")

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

      reply	other threads:[~2016-01-07 12:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07  4:30 Tyler Spivey
2016-01-07 12:58 ` Chris Brannon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fjla6mb.fsf@mushroom.localdomain \
    --to=chris@the-brannons.com \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).