--- a/jdk/src/share/classes/sun/net/www/http/HttpClient.java Tue May 26 16:43:22 2009 +0800
+++ b/jdk/src/share/classes/sun/net/www/http/HttpClient.java Tue May 26 16:03:51 2009 +0200
@@ -27,10 +27,8 @@
import java.io.*;
import java.net.*;
-import java.util.*;
import sun.net.NetworkClient;
import sun.net.ProgressSource;
-import sun.net.ProgressMonitor;
import sun.net.www.MessageHeader;
import sun.net.www.HeaderParser;
import sun.net.www.MeteredStream;
@@ -38,7 +36,6 @@
import sun.net.www.protocol.http.HttpURLConnection;
import sun.misc.RegexpPool;
-import java.security.*;
/**
* @author Herb Jellinek
* @author Dave Brown
@@ -60,16 +57,8 @@
// if we've had one io error
boolean failedOnce = false;
- /** regexp pool of hosts for which we should connect directly, not Proxy
- * these are intialized from a property.
- */
- private static RegexpPool nonProxyHostsPool = null;
-
- /** The string source of nonProxyHostsPool
- */
- private static String nonProxyHostsSource = null;
-
/** Response code for CONTINUE */
+ private boolean ignoreContinue = true;
private static final int HTTP_CONTINUE = 100;
/** Default port number for http daemons. REMIND: make these private */
@@ -610,7 +599,10 @@
return (parseHTTPHeader(responses, pi, httpuc));
} catch (SocketTimeoutException stex) {
// We don't want to retry the request when the app. sets a timeout
- closeServer();
+ // but don't close the server if timeout while waiting for 100-continue
+ if (ignoreContinue) {
+ closeServer();
+ }
throw stex;
} catch (IOException e) {
closeServer();
@@ -635,12 +627,6 @@
}
- public int setTimeout (int timeout) throws SocketException {
- int old = serverSocket.getSoTimeout ();
- serverSocket.setSoTimeout (timeout);
- return old;
- }
-
private boolean parseHTTPHeader(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
/* If "HTTP/*" is found in the beginning, return true. Let
@@ -768,7 +754,7 @@
code = Integer.parseInt(resp.substring(ind, ind + 3));
} catch (Exception e) {}
- if (code == HTTP_CONTINUE) {
+ if (code == HTTP_CONTINUE && ignoreContinue) {
responses.reset();
return parseHTTPHeader(responses, pi, httpuc);
}
@@ -893,6 +879,7 @@
return serverOutput;
}
+ @Override
public String toString() {
return getClass().getName()+"("+url+")";
}
@@ -909,6 +896,7 @@
return cacheRequest;
}
+ @Override
protected void finalize() throws Throwable {
// This should do nothing. The stream finalizer will
// close the fd.
@@ -919,8 +907,12 @@
failedOnce = value;
}
+ public void setIgnoreContinue(boolean value) {
+ ignoreContinue = value;
+ }
/* Use only on connections in error. */
+ @Override
public void closeServer() {
try {
keepingAlive = false;