From 74d71c9e774baf52bae5e444e361ba6fddd85183 Mon Sep 17 00:00:00 2001 From: Chinmay Soman Date: Fri, 14 Jun 2013 15:25:52 -0700 Subject: [PATCH] Bug fix in RESTErrorHandler - adding the right content length in the response header --- src/java/voldemort/coordinator/RESTErrorHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/java/voldemort/coordinator/RESTErrorHandler.java b/src/java/voldemort/coordinator/RESTErrorHandler.java index d57b835aa7..c78e7b5540 100644 --- a/src/java/voldemort/coordinator/RESTErrorHandler.java +++ b/src/java/voldemort/coordinator/RESTErrorHandler.java @@ -16,6 +16,7 @@ package voldemort.coordinator; +import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH; import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; @@ -50,6 +51,7 @@ public static void handleError(HttpResponseStatus status, MessageEvent e, String response.setHeader(CONTENT_TYPE, "text/plain; charset=UTF-8"); response.setContent(ChannelBuffers.copiedBuffer("Failure: " + status.toString() + ". " + message + "\r\n", CharsetUtil.UTF_8)); + response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes()); // Write the response to the Netty Channel e.getChannel().write(response);