Skip to content

Commit

Permalink
Content Length for HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
pepite committed Jul 24, 2010
1 parent 757dab3 commit b3d104b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/play/modules/netty/PlayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ protected static void writeResponse(ChannelHandlerContext ctx, Response response

if (keepAlive) {
// Add 'Content-Length' header only for a keep-alive connection.
Logger.trace("writeResponse: content length [" + content.length + "]");
setContentLength(nettyResponse, content.length);
Logger.trace("writeResponse: content length [" + response.out.size() + "]");
setContentLength(nettyResponse, response.out.size());
}

ChannelFuture f = ctx.getChannel().write(nettyResponse);
Expand Down Expand Up @@ -754,7 +754,9 @@ private static HttpResponse addEtag(HttpRequest nettyRequest, HttpResponse httpR
long last = file.lastModified();
final String etag = "\"" + last + "-" + file.hashCode() + "\"";
if (!isModified(etag, last, nettyRequest)) {
httpResponse.setStatus(HttpResponseStatus.NOT_MODIFIED);
if (nettyRequest.getMethod().equals(HttpMethod.GET)) {
httpResponse.setStatus(HttpResponseStatus.NOT_MODIFIED);
}
if (useEtag) {
httpResponse.setHeader(ETAG, etag);
}
Expand Down

0 comments on commit b3d104b

Please sign in to comment.