6630639: lightweight HttpServer leaks file descriptors on no-data connections
authormichaelm
Tue, 10 Mar 2009 03:18:22 -0700
changeset 2612 d7fb0809c7e4
parent 2611 c22bf553c819
child 2614 0aa41d90aad6
6630639: lightweight HttpServer leaks file descriptors on no-data connections Summary: not cleaning up no-data connections properly Reviewed-by: chegar
jdk/src/share/classes/sun/net/httpserver/Request.java
jdk/src/share/classes/sun/net/httpserver/ServerImpl.java
--- a/jdk/src/share/classes/sun/net/httpserver/Request.java	Fri Mar 06 12:40:38 2009 +0300
+++ b/jdk/src/share/classes/sun/net/httpserver/Request.java	Tue Mar 10 03:18:22 2009 -0700
@@ -52,6 +52,9 @@
         os = rawout;
         do {
             startLine = readLine();
+            if (startLine == null) {
+                return;
+            }
             /* skip blank lines */
         } while (startLine.equals (""));
     }
--- a/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java	Fri Mar 06 12:40:38 2009 +0300
+++ b/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java	Tue Mar 10 03:18:22 2009 -0700
@@ -441,6 +441,7 @@
                         rawin = sslStreams.getInputStream();
                         rawout = sslStreams.getOutputStream();
                         engine = sslStreams.getSSLEngine();
+                        connection.sslStreams = sslStreams;
                     } else {
                         rawin = new BufferedInputStream(
                             new Request.ReadStream (
@@ -450,6 +451,8 @@
                             ServerImpl.this, chan
                         );
                     }
+                    connection.raw = rawin;
+                    connection.rawout = rawout;
                 }
                 Request req = new Request (rawin, rawout);
                 requestLine = req.requestLine();