Skip to content

Commit c8dddac

Browse files
committed
flush outputStream if status >= 400
1 parent 9e8062a commit c8dddac

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

src/main/java/robaho/net/httpserver/ExchangeImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ PlaceholderOutputStream getPlaceholderResponseBody() {
221221

222222
public void sendResponseHeaders(int rCode, long contentLen)
223223
throws IOException {
224-
uis.close();
225224
final Logger logger = getServerImpl().getLogger();
226225
if (sentHeaders) {
227226
throw new IOException("headers already sent");

src/main/java/robaho/net/httpserver/FixedLengthOutputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void close() throws IOException {
9090
// if after reading the rest of the known input for this request, there is
9191
// more input available, http pipelining is in effect, so avoid flush, since
9292
// it will be flushed after processing the next request
93-
if(is.getRawInputStream().available()==0) {
93+
if(is.getRawInputStream().available() == 0 || t.rcode >= 400) {
9494
flush();
9595
}
9696

0 commit comments

Comments
 (0)