git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC] http: pass http.cookiefile using CURLOPT_COOKIEFILE

From
DBDuncan Brown <dabrown@physics.syr.edu>
Date
Jun 3, 2011, 02:43 UTC
Message-ID
<BD4E94C2-E51C-44CA-8E6B-BE9371131DC5@physics.syr.edu>
In-Reply-To
<BANLkTi=3cQx9L4rrkniBhqFfL1TuNgu0doaSpdV8ajgsWJvw1Q@mail.gmail.com>
Hi Shawn,
On Jun 2, 2011, at 8:01 PM, Shawn Pearce wrote:
Show 8 quoted lines
> On Thu, Jun 2, 2011 at 13:31, Duncan Brown <dabrown@physics.syr.edu> wrote:
>> If the config option http.cookiefile is set, pass this file to libCURL using
>> the CURLOPT_COOKIEFILE option. This is similar to calling curl with the -b
>> option.  This allows git http authorization with authentication mechanisms
>> that use cookies, such as SAML Enhanced Client or Proxy (ECP) used by
>> Shibboleth.
> 
> Wow, the patch was this simple?
Yep, it took longer to google for the libCURL docs than it did to write the code! With this patch, I can do the following:

[dbrown@spice-dev2 test]$ ./ecp.sh SUGWG https://sugwg-git.phy.syr.edu/git/qm/info/refs?service=git-upload-pack dbrown Enter host password for user 'dbrown':

001e# service=git-upload-pack 0000009b0b31a9bef84542ff7dd5a10eb72ef2a67d176a35 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed 003f0b31a9bef84542ff7dd5a10eb72ef2a67d176a35 refs/heads/master 00424b2259eb6bada1a160e8dcf394b93fa60a60c90d refs/tags/first_corr 004266eea9443af5f0026a44d58990547f8ff60897c6 refs/tags/pre_double 0043f8d991153a857af157e9dfaa9e8851ae2440cafd refs/tags/ptf_test_01 0000

ecp.sh is Scott Koranda's demonstration ECP client:
<https://wiki.shibboleth.net/confluence/display/SHIB2/Contributions#Contributions-simplebash>
It gets a Shib session cookie and stores it in ~/.curlcookies with curl and xlstproc command line tools. Now that I have my session cookie, I can do

[dbrown@spice-dev2 test]$ git config --global http.cookiefile "/home/dbrown/.curlcookies" [dbrown@spice-dev2 test]$ git clone https://sugwg-git.phy.syr.edu/git/qm Cloning into qm... remote: Counting objects: 2071, done. remote: Compressing objects: 100% (833/833), done. remote: Total 2071 (delta 1352), reused 1851 (delta 1224) Receiving objects: 100% (2071/2071), 681.53 KiB, done. Resolving deltas: 100% (1352/1352), done.

Without the session cookie:

[dbrown@spice-dev2 test]$ rm ~/.curlcookies [dbrown@spice-dev2 test]$ git clone https://sugwg-git.phy.syr.edu/git/qm Cloning into qm... warning: remote HEAD refers to nonexistent ref, unable to checkout.

> Thanks Duncan!
No problem.

Cheers, Duncan.

Show 12 quoted lines
> 
>> ---
>>  Documentation/config.txt |    8 ++++++++
>>  http.c                   |    5 +++++
>>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> Junio, I didn't test this myself, but the code looks good to me. I
> don't see any obvious issues with it.
> 
> -- 
> Shawn.
> 
-- 
Duncan Brown                          Room 263-1, Department of Physics,
Associate Professor of Physics        Syracuse University, NY 13244, USA
Phone: (315) 443 5993             http://www.gravity.phy.syr.edu/~duncan
Previous: Shawn Pearce
Message 3 of 3 in “http: pass http.cookiefile using CURLOPT_COOKIEFILE”
  1. http: pass http.cookiefile using CURLOPT_COOKIEFILEDuncan Brown, Jun 2, 2011
  2. Shawn PearceJun 3, 2011
  3. Duncan BrownJun 3, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.