git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es>
Cc: git@vger.kernel.org, peff@peff.net, sam@vilain.net, spearce@spearce.org
Subject: Re: [PATCH v5 2/5] http: handle proxy proactive authentication
Date: Mon, 09 Apr 2012 17:59:13 -0700	[thread overview]
Message-ID: <7vsjgcs8pq.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7v398cvb30.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Mon, 09 Apr 2012 14:39:47 -0700")

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);

  reply	other threads:[~2012-04-10  0:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 14:03 [PATCH v5 2/5] http: handle proxy proactive authentication Nelson Benitez Leon
2012-04-09 21:39 ` Junio C Hamano
2012-04-10  0:59   ` Junio C Hamano [this message]
2012-04-12 15:54     ` Junio C Hamano
2012-04-12 20:58       ` Jeff King
2012-04-12 21:25         ` Junio C Hamano
2012-04-12 22:05           ` Jeff King
2012-04-12 22:18             ` Junio C Hamano
2012-04-12 22:42               ` Jeff King
2012-04-13 19:35                 ` Junio C Hamano
2012-04-13 20:23                   ` Jeff King
2012-04-13 20:56 ` Jeff King
2012-04-19 17:09   ` 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=7vsjgcs8pq.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=nelsonjesus.benitez@seap.minhap.es \
    --cc=peff@peff.net \
    --cc=sam@vilain.net \
    --cc=spearce@spearce.org \
    /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).