Don't close Outputstream (when using InputStream :body) #31
+2
−4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also don't flush the OutputStream. The Servlet Container will flush
and close the response OutputStream.
The current implementation closes the response OutputStream even though a client requests "keep-alive".
Current:
w→ wget -S -O /dev/null http://localhost:8080 http://localhost:8080
--2011-09-01 16:15:03-- http://localhost:8080/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Content-Type: text/html
Server: Jetty(6.1.26)
Length: unspecified [text/html]
Saving to:
/dev/null'/dev/null' saved [961]2011-09-01 16:15:03 (563 KB/s) -
--2011-09-01 16:15:03-- http://localhost:8080/
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Content-Type: text/html
Server: Jetty(6.1.26)
Length: unspecified [text/html]
Saving to:
/dev/null'/dev/null' saved [961]2011-09-01 16:15:03 (563 KB/s) -
FINISHED --2011-09-01 16:15:03--
Downloaded: 2 files, 1.9K in 0s (1.10 MB/s)
With this patch applied:
→ wget -O /dev/null http://localhost:8080 http://localhost:8080
--2011-09-01 16:16:04-- http://localhost:8080/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 961 [text/html]
Saving to:
/dev/null'/dev/null' saved [961/961]2011-09-01 16:16:04 (563 KB/s) -
--2011-09-01 16:16:04-- http://localhost:8080/
Reusing existing connection to localhost:8080.
HTTP request sent, awaiting response... 200 OK
Length: 961 [text/html]
Saving to:
/dev/null'/dev/null' saved [961/961]2011-09-01 16:16:04 (563 KB/s) -
FINISHED --2011-09-01 16:16:04--
Downloaded: 2 files, 1.9K in 0s (1.10 MB/s)