git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Halstrick <christian.halstrick@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>,
	Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH] Allow http_proxy values without protocol-part
Date: Thu, 9 Jul 2009 23:28:22 +0200	[thread overview]
Message-ID: <20090709232822.00000164@unknown> (raw)

From: Christian Halstrick <christian.halstrick@sap.com>

jgit reads the environment variable http_proxy to configure the proxy
for http traffic in the same way as applications using the libcurl
library. It would be nice if jgit would understand the same values as
libcurl, but for libcurl the protocol part is optional (e.g.
http_proxy=proxy:8080 is valid). I changed jgit to also support
http_proxy values without a protocol spec. When no protocol is
specified "http://" is assumed.

Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
---
 .../src/org/spearce/jgit/util/HttpSupport.java     |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/util/HttpSupport.java b/org.spearce.jgit/src/org/spearce/jgit/util/HttpSupport.java
index 33dfcee..5f21677 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/util/HttpSupport.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/util/HttpSupport.java
@@ -69,7 +69,7 @@ public static void configureHttpProxy() throws MalformedURLException {
 		if (s == null || s.equals(""))
 			return;
 
-		final URL u = new URL(s);
+		final URL u = new URL((s.indexOf("://")==-1) ? "http://"+s : s);
 		if (!"http".equals(u.getProtocol()))
 			throw new MalformedURLException("Invalid http_proxy: " + s
 					+ ": Only http supported.");
-- 
1.6.3.2.1299.gee46c

             reply	other threads:[~2009-07-09 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 21:28 Christian Halstrick [this message]
2009-07-10 15:22 ` [JGIT PATCH] Allow http_proxy values without protocol-part Shawn O. Pearce

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=20090709232822.00000164@unknown \
    --to=christian.halstrick@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --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).