From: Leslie Cheng <leslie.cheng5@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
Leslie Cheng via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Eric Wong <e@80x24.org>,
Leslie Cheng <leslie@lc.fyi>
Subject: Re: [PATCH v2] Add unix domain socket support to HTTP transport
Date: Fri, 23 Feb 2024 14:24:33 -0800 [thread overview]
Message-ID: <4dfca119-3210-4574-998b-0bee53e61464@gmail.com> (raw)
In-Reply-To: <xmqq5xyfyyn0.fsf@gitster.g>
On 2024-02-23 12:37 a.m., Junio C Hamano wrote:
> How about following that convention, perhaps like:
>
> In some corporate environments, the proxy server listens to a
> local unix domain socket for requests, instead of listening to a
> network port. Even though we have http.proxy (and more
> destination specific http.<url>.proxy) configuration variables
> to specify the network address/port of a proxy, that would not
> help if your proxy does not listen to the network.
>
> Introduce an `http.unixSocket` (and `http.<url>.unixSocket`)
> configuration variables that specify the path to a unix domain
> socket for such a proxy. Recent versions of libcURL library
> added CURLOPT_UNIX_SOCKET_PATH to support "curl --unix-socket
> <path>"---use the same mechanism to implement it.
This is excellent, thanks for the guidance (and all the other
suggestions prior)! I'll update in the next patch.
> Unlike NO_UNIX_SOCKETS, GIT_CURL_HAVE_CURLOPT_UNIX_SOCKET_PATH is
> entirely internal to your implementation and not surfaced to neither
> the end-users or the binary packagers. Because of that, I suspect
> that any description that has to use that name probably falls on the
> other side of "too much implementation details" to be useful to help
> future developers..
That's reasonable, I figured it would fit as a cover letter detail but I
agree it's not relevant as a commit message that lives in the history of
the project. I'll also update this in the next patch.
> Talking about precedence between this and http.proxy is good thing,
> but one very important piece of information is missing. What value
> does it take?
>
> The absolute path of a unix-domain socket to pass the HTTP
> traffic over, instead of using the network.
>
> or something, perhaps?
I like that wording, I'll update in the next patch.
> It might make the code easier to follow if you did:
>
> #if !defined(NO_CURLOPT_UNIX_SOCKET_PATH) && !defined(NO_UNIX_SOCKETS)
> #if defined(GIT_CURL_HAVE_CURLOPT_UNIX_SOCKET_PATH)
> #define USE_CURLOPT_UNIX_SOCKET_PATH
> #endif
> #endif
>
> The points are
>
> (1) the users can decline to use CURLOPT_UNIX_SOCKET_PATH while
> still using unix domain socket for other purposes, and
>
> (2) you do not have to care if you HAVE it or not most of time;
> what matters more often is if the user told you to USE it.
>
> Hmm?
Do you think this functionality is worth adding another macro to
conditionally include it in the build? It felt out-of-the-way enough
that we could just use the same `NO_UNIX_SOCKETS` macro to control for
environments that don't support unix domain sockets.
>> +#if defined(GIT_CURL_HAVE_CURLOPT_UNIX_SOCKET_PATH) &&
!defined(NO_UNIX_SOCKETS)
>> +static const char *curl_unix_socket_path;
>> +#endif
>
> The guard here would become "#ifdef USE_CURLOPT_UNIX_SOCKET_PATH" if
> we wanted this to be conditional, but I think it is easier to make
> the variable unconditionally available; see below.
Agreed in general, I was looking to other patterns for conditional
variables in file, e.g.
https://github.com/git/git/blob/3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0/http.c#L66-L68
But, revisiting, this looks like an exception rather than the norm.
> In general, it is inadvisable to issue a warning in the codepath
> that parses configuration variables, as the values we read may not
> be necessarily used. We could instead accept the given path into a
> variable unconditionally, and complain only before it gets used,
> near the call to curl_easy_setopt().
Similar to above, I followed what was already done for certain
configuration variables (e.g.
https://github.com/git/git/blob/3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0/http.c#L485-L501),
but I agree with your feedback since this would result in constant warnings.
To summarize, I'll do the following in the next patch:
- change the wording of the commit message
- move the conditional variables and parsing to a check at
`curl_easy_setopt()` time
I'm still undecided on whether I should introduce another macro
specifically for this functionality, and I'd like to hear your thoughts
on why it might make sense.
prev parent reply other threads:[~2024-02-23 22:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 9:14 [PATCH] Add unix domain socket support to HTTP transport Leslie Cheng via GitGitGadget
2024-02-21 22:09 ` Eric Wong
2024-02-22 3:04 ` Leslie Cheng
2024-02-23 1:58 ` [PATCH v2] " Leslie Cheng via GitGitGadget
2024-02-23 8:37 ` Junio C Hamano
2024-02-23 15:43 ` Junio C Hamano
2024-02-23 22:24 ` Leslie Cheng [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=4dfca119-3210-4574-998b-0bee53e61464@gmail.com \
--to=leslie.cheng5@gmail.com \
--cc=e@80x24.org \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=leslie@lc.fyi \
/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).