diff Core/HttpServer/HttpOutput.cpp @ 1523:c388502a066d

testing FilesystemHttpSender
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2015 16:09:00 +0200
parents f938f7779bcb
children 9c5d93510414
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp	Tue Aug 11 15:37:42 2015 +0200
+++ b/Core/HttpServer/HttpOutput.cpp	Tue Aug 11 16:09:00 2015 +0200
@@ -502,23 +502,7 @@
 
   void HttpOutput::Answer(IHttpStreamAnswer& stream)
   {
-    stateMachine_.SetContentLength(stream.GetContentLength());
-
-    std::string contentType = stream.GetContentType();
-    if (contentType.empty())
-    {
-      contentType = "application/octet-stream";
-    }
-
-    stateMachine_.SetContentType(contentType.c_str());
-
-    std::string filename;
-    if (stream.HasContentFilename(filename))
-    {
-      SetContentFilename(filename.c_str());
-    }
-
-    HttpCompression compression = stream.GetHttpCompression(isGzipAllowed_, isDeflateAllowed_);
+    HttpCompression compression = stream.SetupHttpCompression(isGzipAllowed_, isDeflateAllowed_);
 
     switch (compression)
     {
@@ -537,6 +521,22 @@
         throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
 
+    stateMachine_.SetContentLength(stream.GetContentLength());
+
+    std::string contentType = stream.GetContentType();
+    if (contentType.empty())
+    {
+      contentType = "application/octet-stream";
+    }
+
+    stateMachine_.SetContentType(contentType.c_str());
+
+    std::string filename;
+    if (stream.HasContentFilename(filename))
+    {
+      SetContentFilename(filename.c_str());
+    }
+
     while (stream.ReadNextChunk())
     {
       stateMachine_.SendBody(stream.GetChunkContent(),