diff Core/HttpServer/HttpOutput.cpp @ 1522:f938f7779bcb

fixes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2015 15:37:42 +0200
parents 3606278d305e
children c388502a066d
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp	Tue Aug 11 13:37:24 2015 +0200
+++ b/Core/HttpServer/HttpOutput.cpp	Tue Aug 11 15:37:42 2015 +0200
@@ -220,8 +220,9 @@
     switch (state_)
     {
       case State_WritingHeader:
-        LOG(ERROR) << "Closing the HTTP body, but the header has not been sent yet";
-        throw OrthancException(ErrorCode_BadSequenceOfCalls);
+        SetContentLength(0);
+        SendBody(NULL, 0);
+        break;
 
       case State_WritingBody:
         if (!hasContentLength_ ||
@@ -390,8 +391,6 @@
 
   void HttpOutput::AnswerEmpty()
   {
-    stateMachine_.SetContentLength(0);
-    stateMachine_.SendBody(NULL, 0);
     stateMachine_.CloseBody();
   }