[kaffe] proxyHost...

Jukka Santala jsantala at tml.hut.fi
Tue May 7 06:50:53 PDT 2002


It's a fairly basic patch to add some sanity-checks to those
proxy-parameters. I should write some test-cases to determine the exact
Sun behaviour and then re-write it to match, though. But as it is, it
allows some nasty compatibility problems when either/or the proxy port or
host is set to an empty string (or non-number).

 -Jukka Santala
-------------- next part --------------
Index: libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java,v
retrieving revision 1.11
diff -u -r1.11 HttpURLConnection.java
--- libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java	4 Jan 2002 05:12:33 -0000	1.11
+++ libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java	7 May 2002 13:41:27 -0000
@@ -40,7 +40,7 @@
 	// How these properties are undocumented in the API doc.  We know
 	// about them from www.icesoft.no's webpage
 	proxyHost = System.getProperty("http.proxyHost");
-	if (proxyHost != null) {
+	if (proxyHost != null && !proxyHost.equals("")) {
 		// Sun also supports a http.nonProxyHosts property to
 		// avoid proxy use for local sites.  It's a regular expression
 		// like so "*.pa.dec.com|*.compaq.com"
@@ -52,7 +52,11 @@
 		useProxy = true;
 		String pp = System.getProperty("http.proxyPort");
 		if (pp != null) {
-			proxyPort = Integer.parseInt(pp);
+			try {
+				proxyPort = Integer.parseInt(pp);
+			} catch (NumberFormatException e) {
+				useProxy=false;
+			}
 		}
 	}
 }


More information about the kaffe mailing list