[JGIT PATCH] Allow http_proxy values without protocol-part

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian Halstrick <christian.halstrick@xxxxxxx>

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@xxxxxxx>
---
 .../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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]