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

Re: [PATCH v5 2/5] http: handle proxy proactive authentication

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 10, 2012, 00:59 UTC
Message-ID
<7vsjgcs8pq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7v398cvb30.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> I haven't formed an opinion on what the proper solution should be, but
> either the credential_from_url() function needs to be updated to accept
> the scp style [user@]<host>:<port> argument, or this specific caller
> should take the responsibility to do special case the syntax.

Well, calling the above "scp" style is a mistake (it is not scp style at all), but the patch to teach the credentail_from_url() to handle the proxy specification may look like this:

 credential.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/credential.c b/credential.c
index 62d1c56..482ae88 100644
--- a/credential.c
+++ b/credential.c
@@ -324,11 +324,13 @@ void credential_from_url(struct credential *c, const char *url)
 	 *   (1) proto://<host>/...
 	 *   (2) proto://<user>@<host>/...
 	 *   (3) proto://<user>:<pass>@<host>/...
+	 * or "proto://"-less variants of the above for *_proxy variables.
 	 */
 	proto_end = strstr(url, "://");
-	if (!proto_end)
-		return;
-	cp = proto_end + 3;
+	if (proto_end)
+		cp = proto_end + 3;
+	else
+		cp = url;
 	at = strchr(cp, '@');
 	colon = strchr(cp, ':');
 	slash = strchrnul(cp, '/');
@@ -348,7 +350,7 @@ void credential_from_url(struct credential *c, const char *url)
 		host = at + 1;
 	}
 
-	if (proto_end - url > 0)
+	if (proto_end && proto_end != url)
 		c->protocol = xmemdupz(url, proto_end - url);
 	if (slash - host > 0)
 		c->host = url_decode_mem(host, slash - host);
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 13 in “http: handle proxy proactive authentication”
  1. 2/5 http: handle proxy proactive authenticationNelson Benitez Leon, Mar 13, 2012
  2. Junio C HamanoApr 9, 2012
  3. Junio C HamanoApr 10, 2012
  4. Junio C HamanoApr 12, 2012
  5. Jeff KingApr 12, 2012
  6. Junio C HamanoApr 12, 2012
  7. Jeff KingApr 12, 2012
  8. Junio C HamanoApr 12, 2012
  9. Jeff KingApr 12, 2012
  10. Junio C HamanoApr 13, 2012
  11. Jeff KingApr 13, 2012
  12. Jeff KingApr 13, 2012
  13. Junio C HamanoApr 19, 2012

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.