diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
commit | 65bf3316cf384588453604be6b4f0ed3751a8b0f (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java | |
parent | 8fc56618a84446beccd45b80381cdfe0e94050df (diff) | |
download | ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.tar.gz ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.zip |
Merged gcj-eclipse branch to trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java')
-rw-r--r-- | libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java index cc68a3bac30..6c926b72fb4 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java +++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java @@ -75,7 +75,7 @@ public class HTTPURLConnection // These are package private for use in anonymous inner classes. String proxyHostname; - int proxyPort; + int proxyPort = -1; String agent; boolean keepAlive; @@ -99,18 +99,21 @@ public class HTTPURLConnection { super(url); requestHeaders = new Headers(); - proxyHostname = SystemProperties.getProperty("http.proxyHost"); - if (proxyHostname != null && proxyHostname.length() > 0) + String proxy = SystemProperties.getProperty("http.proxyHost"); + if (proxy != null && proxy.length() > 0) { String port = SystemProperties.getProperty("http.proxyPort"); if (port != null && port.length() > 0) { - proxyPort = Integer.parseInt(port); - } - else - { - proxyHostname = null; - proxyPort = -1; + try + { + proxyPort = Integer.parseInt(port); + proxyHostname = proxy; + } + catch (NumberFormatException _) + { + // Ignore. + } } } agent = SystemProperties.getProperty("http.agent"); @@ -354,11 +357,14 @@ public class HTTPURLConnection HTTPConnection connection; if (keepAlive) { - connection = HTTPConnection.Pool.instance.get(host, port, secure, getConnectTimeout(), 0); + connection = HTTPConnection.Pool.instance.get(host, port, secure, + getConnectTimeout(), + getReadTimeout()); } else { - connection = new HTTPConnection(host, port, secure, 0, getConnectTimeout()); + connection = new HTTPConnection(host, port, secure, + getConnectTimeout(), getReadTimeout()); } return connection; } @@ -662,23 +668,23 @@ public class HTTPURLConnection } /** - * Set the connection timeout speed, in milliseconds, or zero if the timeout + * Set the read timeout, in milliseconds, or zero if the timeout * is to be considered infinite. * * Overloaded. * */ - public void setConnectTimeout(int timeout) + public void setReadTimeout(int timeout) throws IllegalArgumentException { - super.setConnectTimeout( timeout ); - if( connection == null ) + super.setReadTimeout(timeout); + if (connection == null) return; try { - connection.getSocket().setSoTimeout( timeout ); + connection.getSocket().setSoTimeout(timeout); } - catch(IOException se) + catch (IOException se) { // Ignore socket exceptions. } |