ASTERIXDB-1939: No chunked encoding with content-length.

Change-Id: I06d561eb023f1c84c531e9b2cfe88a626d7e5280
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1632
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/ApplicationInstallationHandler.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/ApplicationInstallationHandler.java
index 9745091..2b0382b 100755
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/ApplicationInstallationHandler.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/web/ApplicationInstallationHandler.java
@@ -71,6 +71,7 @@
                 : rootDir + File.separator + "/applications/" + File.separator + deployIdString;
         final HttpMethod method = request.getHttpRequest().method();
         try {
+            response.setStatus(HttpResponseStatus.OK);
             if (method == HttpMethod.PUT) {
                 final ByteBuf content = request.getHttpRequest().content();
                 writeToFile(content, deploymentDir, fileName);
diff --git a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/ChunkedResponse.java b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/ChunkedResponse.java
index 1d219ba..8fd444b 100644
--- a/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/ChunkedResponse.java
+++ b/hyracks-fullstack/hyracks/hyracks-http/src/main/java/org/apache/hyracks/http/server/ChunkedResponse.java
@@ -164,6 +164,8 @@
     private void fullResponse(HttpVersion version, HttpResponseStatus status, ByteBuf buffer, HttpHeaders headers) {
         DefaultFullHttpResponse fullResponse = new DefaultFullHttpResponse(version, status, buffer);
         fullResponse.headers().set(headers);
+        // for a full response remove chunked transfer-encoding and set the content length instead
+        fullResponse.headers().remove(HttpHeaderNames.TRANSFER_ENCODING);
         fullResponse.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, buffer.readableBytes());
         future = ctx.writeAndFlush(fullResponse);
         headerSent = true;