Skip to content

Commit

Permalink
Commented out Keep alive code as it does not seem to work with Opera …
Browse files Browse the repository at this point in the history
…and IE
  • Loading branch information
pepite committed Mar 2, 2010
1 parent ea6383f commit 3bfcb19
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions src/play/modules/netty/PlayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,16 @@ public static void copyResponse(ChannelHandlerContext ctx, Request request, Resp
ctx.getChannel().write(nettyResponse);
ChannelFuture writeFuture = ctx.getChannel().write(new ChunkedNioFile(file));
// Decide whether to close the connection or not.
boolean close =
HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION)) ||
nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
!HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION));

if (close) {
// Comment out for now as it does not seem to work with Opera and IE
// boolean close =
// HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION)) ||
// nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
// !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION));
//
// if (close) {
// Close the connection when the whole content is written out.
writeFuture.addListener(ChannelFutureListener.CLOSE);
}
//}


} catch (Exception e) {
Expand All @@ -254,16 +255,17 @@ public static void copyResponse(ChannelHandlerContext ctx, Request request, Resp
} else if (is != null) {
ctx.getChannel().write(nettyResponse);
ChannelFuture writeFuture = ctx.getChannel().write(new ChunkedStream(is));
// Comment out for now as it does not seem to work with Opera and IE
// Decide whether to close the connection or not.
boolean close =
HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION)) ||
nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
!HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION));

if (close) {
// boolean close =
// HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION)) ||
// nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
// !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION));
//
// if (close) {
// Close the connection when the whole content is written out.
writeFuture.addListener(ChannelFutureListener.CLOSE);
}
// }


} else {
Expand Down Expand Up @@ -542,15 +544,16 @@ public static void serveStatic(RenderStatic renderStatic, ChannelHandlerContext
ctx.getChannel().write(nettyResponse);
ChannelFuture writeFuture = ctx.getChannel().write(new ChunkedNioFile(file.getRealFile()));
// Decide whether to close the connection or not.
boolean close =
HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION)) ||
nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
!HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION));

if (close) {
// Decide whether to close the connection or not.
// boolean close =
// HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION)) ||
// nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0) &&
// !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(nettyRequest.getHeader(HttpHeaders.Names.CONNECTION));
//
// if (close) {
// Close the connection when the whole content is written out.
writeFuture.addListener(ChannelFutureListener.CLOSE);
}
// }
}

}
Expand Down

0 comments on commit 3bfcb19

Please sign in to comment.