git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ryan Hendrickson via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>,
	Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>
Subject: [PATCH] http: do not ignore proxy path
Date: Fri, 26 Jul 2024 15:52:50 +0000	[thread overview]
Message-ID: <pull.1767.git.1722009170590.gitgitgadget@gmail.com> (raw)

From: Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>

The documentation for `http.proxy` describes that option, and the
environment variables it overrides, as supporting "the syntax understood
by curl". curl allows SOCKS proxies to use a path to a Unix domain
socket, like `socks5h://localhost/path/to/socket.sock`. Git should
therefore include, if present, the path part of the proxy URL in what it
passes to libcurl.

Signed-off-by: Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>
---
    http: do not ignore proxy path
    
     * Documentation: do I need to add anything?
     * Tests: I could use a pointer on how best to add a test for this.
       Adding a case to t5564-http-proxy.sh seems straightforward but I
       don't think httpd can be configured to listen to domain sockets; can
       I use netcat?

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1767%2Frhendric%2Frhendric%2Fhttp-proxy-path-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1767/rhendric/rhendric/http-proxy-path-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1767

 http.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/http.c b/http.c
index 623ed234891..0cd75986a6b 100644
--- a/http.c
+++ b/http.c
@@ -1265,7 +1265,13 @@ static CURL *get_curl_handle(void)
 		if (!proxy_auth.host)
 			die("Invalid proxy URL '%s'", curl_http_proxy);
 
-		curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);
+		if (proxy_auth.path) {
+			struct strbuf proxy = STRBUF_INIT;
+			strbuf_addf(&proxy, "%s/%s", proxy_auth.host, proxy_auth.path);
+			curl_easy_setopt(result, CURLOPT_PROXY, proxy.buf);
+			strbuf_release(&proxy);
+		} else
+			curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);
 		var_override(&curl_no_proxy, getenv("NO_PROXY"));
 		var_override(&curl_no_proxy, getenv("no_proxy"));
 		curl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);

base-commit: ad57f148c6b5f8735b62238dda8f571c582e0e54
-- 
gitgitgadget

             reply	other threads:[~2024-07-26 15:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 15:52 Ryan Hendrickson via GitGitGadget [this message]
2024-07-26 16:29 ` [PATCH] http: do not ignore proxy path Junio C Hamano
2024-07-26 17:12   ` Ryan Hendrickson
2024-07-26 17:45     ` Junio C Hamano
2024-07-26 21:11 ` Jeff King
2024-07-26 22:43   ` Ryan Hendrickson
2024-07-29 19:31     ` Jeff King
2024-07-27  6:44 ` [PATCH v2] " Ryan Hendrickson via GitGitGadget
2024-07-29 20:09   ` Jeff King
2024-07-31 15:33     ` Ryan Hendrickson
2024-07-31 16:01   ` [PATCH v3] " Ryan Hendrickson via GitGitGadget
2024-07-31 22:24     ` Junio C Hamano
2024-08-01  3:44       ` Ryan Hendrickson
2024-08-01  5:21         ` Junio C Hamano
2024-08-01  5:45       ` Jeff King
2024-08-01 14:40         ` Junio C Hamano
2024-08-01  5:22     ` [PATCH v4] " Ryan Hendrickson via GitGitGadget
2024-08-01  6:04       ` Jeff King
2024-08-01 17:04         ` Junio C Hamano
2024-08-02  5:20       ` [PATCH v5] " Ryan Hendrickson via GitGitGadget
2024-08-02 15:52         ` Junio C Hamano
2024-08-02 16:43           ` Ryan Hendrickson
2024-08-02 17:10             ` Junio C Hamano
2024-08-02 18:03               ` Ryan Hendrickson
2024-08-02 19:28                 ` Junio C Hamano
2024-08-02 19:39                   ` Ryan Hendrickson
2024-08-02 21:13                     ` Junio C Hamano
2024-08-02 21:26                       ` Ryan Hendrickson
2024-08-02 21:43                         ` Junio C Hamano
2024-08-02 21:47                         ` Junio C Hamano
2024-08-02 22:14                           ` Ryan Hendrickson

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=pull.1767.git.1722009170590.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ryan.hendrickson@alum.mit.edu \
    /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).