changeset 2557:6d274503d1b7

6954525: Testcase failure java/net/Authenticator/B4769350.java Reviewed-by: michaelm, weijun
author chegar
date Mon, 28 Jun 2010 14:55:25 +0100
parents 9c0f542c8b37
children a89f8c292a5b
files src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java test/java/net/Authenticator/B4769350.java
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Jun 24 14:26:35 2010 +0800
+++ b/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Mon Jun 28 14:55:25 2010 +0100
@@ -2331,7 +2331,7 @@
      * closed the connection to the web server.
      */
     private void disconnectWeb() throws IOException {
-        if (usingProxy()) {
+        if (usingProxy() && http.isKeepingAlive()) {
             responseCode = -1;
             // clean up, particularly, skip the content part
             // of a 401 error response
--- a/test/java/net/Authenticator/B4769350.java	Thu Jun 24 14:26:35 2010 +0800
+++ b/test/java/net/Authenticator/B4769350.java	Mon Jun 28 14:55:25 2010 +0100
@@ -54,6 +54,7 @@
         boolean allowerror;
 
         Client (String authority, String path, boolean allowerror) {
+            super("Thread-" + path);
             this.authority = authority;
             this.path = path;
             this.allowerror = allowerror;
@@ -72,7 +73,8 @@
                 error = true;
             } catch (IOException e) {
                 if (!allowerror) {
-                    System.out.println (e);
+                    System.out.println (Thread.currentThread().getName() + " " + e);
+                    e.printStackTrace();
                     error = true;
                 }
             }
@@ -94,6 +96,7 @@
         }
 
         void okReply (HttpTransaction req) throws IOException {
+            req.addResponseHeader ("Connection", "close");
             req.setResponseEntityBody ("Hello .");
             req.sendResponse (200, "Ok");
             req.orderlyClose();