Mercurial > hg > orthanc
comparison Core/HttpServer/HttpOutput.cpp @ 3154:6e8822be2f08
Fix compatibility with DICOMweb plugin (allow multipart answers over HTTP Keep-Alive)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 21 Jan 2019 12:09:04 +0100 |
parents | 4e43e67f8ecf |
children | 81cd9a4f3018 |
comparison
equal
deleted
inserted
replaced
3153:706b60e7ee1e | 3154:6e8822be2f08 |
---|---|
405 subType != "related") | 405 subType != "related") |
406 { | 406 { |
407 throw OrthancException(ErrorCode_ParameterOutOfRange); | 407 throw OrthancException(ErrorCode_ParameterOutOfRange); |
408 } | 408 } |
409 | 409 |
410 if (keepAlive_) | |
411 { | |
412 throw OrthancException(ErrorCode_NotImplemented, | |
413 "Multipart answers are not implemented together with keep-alive connections"); | |
414 } | |
415 | |
416 if (state_ != State_WritingHeader) | 410 if (state_ != State_WritingHeader) |
417 { | 411 { |
418 throw OrthancException(ErrorCode_BadSequenceOfCalls); | 412 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
419 } | 413 } |
420 | 414 |
425 } | 419 } |
426 | 420 |
427 stream_.OnHttpStatusReceived(status_); | 421 stream_.OnHttpStatusReceived(status_); |
428 | 422 |
429 std::string header = "HTTP/1.1 200 OK\r\n"; | 423 std::string header = "HTTP/1.1 200 OK\r\n"; |
424 | |
425 if (keepAlive_) | |
426 { | |
427 #if ORTHANC_ENABLE_MONGOOSE == 1 | |
428 throw OrthancException(ErrorCode_NotImplemented, | |
429 "Multipart answers are not implemented together " | |
430 "with keep-alive connections if using Mongoose"); | |
431 #else | |
432 // Turn off Keep-Alive for multipart answers | |
433 // https://github.com/civetweb/civetweb/issues/727 | |
434 stream_.DisableKeepAlive(); | |
435 header += "Connection: close\r\n"; | |
436 #endif | |
437 } | |
430 | 438 |
431 // Possibly add the cookies | 439 // Possibly add the cookies |
432 for (std::list<std::string>::const_iterator | 440 for (std::list<std::string>::const_iterator |
433 it = headers_.begin(); it != headers_.end(); ++it) | 441 it = headers_.begin(); it != headers_.end(); ++it) |
434 { | 442 { |