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

[JGIT PATCH] Allow http_proxy values without protocol-part

From
Christian Halstrick <christian.halstrick@gmail.com>
Date
Jul 9, 2009, 21:28 UTC
Message-ID
<20090709232822.00000164@unknown>
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
Next: Shawn O. Pearce
Message 1 of 2 in “Allow http_proxy values without protocol-part”
  1. Allow http_proxy values without protocol-partChristian Halstrick, Jul 9, 2009
  2. Shawn O. PearceJul 10, 2009

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.