Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Content Length for HEAD

  • Loading branch information...
commit b3d104bc3c5e93d0ddc199841285e63a2541233d 1 parent 757dab3
@pepite pepite authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/play/modules/netty/PlayHandler.java
View
8 src/play/modules/netty/PlayHandler.java
@@ -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);
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.