git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Piotr Szlazak via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Piotr Szlazak <piotr.szlazak@gmail.com>
Subject: Re: [PATCH] doc: update http.cookieFile with in-memory cookie processing
Date: Tue, 09 Jul 2024 16:05:36 -0700	[thread overview]
Message-ID: <xmqq4j8ycgjj.fsf@gitster.g> (raw)
In-Reply-To: <pull.1733.git.git.1719177846725.gitgitgadget@gmail.com> (Piotr Szlazak via GitGitGadget's message of "Sun, 23 Jun 2024 21:24:06 +0000")

"Piotr Szlazak via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  http.cookieFile::
>  	The pathname of a file containing previously stored cookie lines,
> -	which should be used
> -	in the Git http session, if they match the server. The file format
> -	of the file to read cookies from should be plain HTTP headers or
> -	the Netscape/Mozilla cookie file format (see `curl(1)`).
> +	which should be used in the Git http session, if they match the server.
> +	The file format of the file to read cookies from should be plain HTTP
> +	headers or the Netscape/Mozilla cookie file format (see `curl(1)`).

With line wrapping it is hard to see if there is any change above
here, but I assume there is none?

> +	Set it to empty value, to enable in-memory cookies processing.

Is it understandable what "in-memory cookies processing" means to
expected audience of this manual page?  I somehow doubt it (I
certainly do not know what you wanted it to mean).

https://curl.se/libcurl/c/CURLOPT_COOKIEFILE.html has this to say:

    By passing the empty string ("") to this option, you enable the
    cookie engine without reading any initial cookies.

But http.cookiefile is also used for CURLOPT_COOKIEJAR when
http.savecookies is true.  Its documentation page does not say what
would happen if you give an empty string to it.

So, a casual one-line mention you added is a bit irresponsible.  At
least you should warn against setting http.savecookies if the user
chooses to use "" for this, or better yet, fix the codepath to use
http.savecookies to prevent us from writing to a file with an empty
filename.

Also the libcURL documentation for CURLOPT_COOKIEFILE has another
thing that is a bit worrysome:

    If you tell libcurl the filename is "-" (just a single minus
    sign), libcurl instead reads from stdin.

So you can easily get your git get stuck by doing

    git -c http.cookiefile=- fetch https://.....

as libcURL will want to read from your stdin, while you are waiting
for the fetch to finish and are not typing anything?

  parent reply	other threads:[~2024-07-09 23:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23 21:24 [PATCH] doc: update http.cookieFile with in-memory cookie processing Piotr Szlazak via GitGitGadget
2024-07-09 21:37 ` Piotr Szlazak
2024-07-09 22:30   ` Junio C Hamano
2024-07-09 23:05 ` Junio C Hamano [this message]
2024-07-11  9:18   ` Piotr Szlazak
2024-07-11  8:36 ` [PATCH v2] " Piotr Szlazak via GitGitGadget
2024-07-11 16:05   ` Junio C Hamano

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=xmqq4j8ycgjj.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=piotr.szlazak@gmail.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).