Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp Sun Jan 20 14:02:49 2019 +0100 +++ b/Core/HttpServer/HttpOutput.cpp Mon Jan 21 12:09:04 2019 +0100 @@ -407,12 +407,6 @@ throw OrthancException(ErrorCode_ParameterOutOfRange); } - if (keepAlive_) - { - throw OrthancException(ErrorCode_NotImplemented, - "Multipart answers are not implemented together with keep-alive connections"); - } - if (state_ != State_WritingHeader) { throw OrthancException(ErrorCode_BadSequenceOfCalls); @@ -428,6 +422,20 @@ std::string header = "HTTP/1.1 200 OK\r\n"; + if (keepAlive_) + { +#if ORTHANC_ENABLE_MONGOOSE == 1 + throw OrthancException(ErrorCode_NotImplemented, + "Multipart answers are not implemented together " + "with keep-alive connections if using Mongoose"); +#else + // Turn off Keep-Alive for multipart answers + // https://github.com/civetweb/civetweb/issues/727 + stream_.DisableKeepAlive(); + header += "Connection: close\r\n"; +#endif + } + // Possibly add the cookies for (std::list<std::string>::const_iterator it = headers_.begin(); it != headers_.end(); ++it)