comparison 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
comparison
equal deleted inserted replaced
1521:3606278d305e 1522:f938f7779bcb
218 void HttpOutput::StateMachine::CloseBody() 218 void HttpOutput::StateMachine::CloseBody()
219 { 219 {
220 switch (state_) 220 switch (state_)
221 { 221 {
222 case State_WritingHeader: 222 case State_WritingHeader:
223 LOG(ERROR) << "Closing the HTTP body, but the header has not been sent yet"; 223 SetContentLength(0);
224 throw OrthancException(ErrorCode_BadSequenceOfCalls); 224 SendBody(NULL, 0);
225 break;
225 226
226 case State_WritingBody: 227 case State_WritingBody:
227 if (!hasContentLength_ || 228 if (!hasContentLength_ ||
228 contentPosition_ == contentLength_) 229 contentPosition_ == contentLength_)
229 { 230 {
388 } 389 }
389 390
390 391
391 void HttpOutput::AnswerEmpty() 392 void HttpOutput::AnswerEmpty()
392 { 393 {
393 stateMachine_.SetContentLength(0);
394 stateMachine_.SendBody(NULL, 0);
395 stateMachine_.CloseBody(); 394 stateMachine_.CloseBody();
396 } 395 }
397 396
398 397
399 void HttpOutput::StateMachine::StartMultipart(const std::string& subType, 398 void HttpOutput::StateMachine::StartMultipart(const std::string& subType,