Mercurial > hg > orthanc
diff Core/HttpServer/HttpOutput.cpp @ 3178:6d558598d713
Fix build with unpatched versions of Civetweb (missing "mg_disable_keep_alive()")
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Jan 2019 12:41:20 +0100 |
parents | 81cd9a4f3018 |
children | 0528a6c36f3d |
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp Wed Jan 30 10:24:12 2019 +0100 +++ b/Core/HttpServer/HttpOutput.cpp Wed Jan 30 12:41:20 2019 +0100 @@ -46,6 +46,13 @@ #include <boost/lexical_cast.hpp> +#if ORTHANC_ENABLE_CIVETWEB == 1 +# if !defined(CIVETWEB_HAS_DISABLE_KEEP_ALIVE) +# error Macro CIVETWEB_HAS_DISABLE_KEEP_ALIVE must be defined +# endif +#endif + + namespace Orthanc { HttpOutput::StateMachine::StateMachine(IHttpOutputStream& stream, @@ -432,11 +439,22 @@ throw OrthancException(ErrorCode_NotImplemented, "Multipart answers are not implemented together " "with keep-alive connections if using Mongoose"); -#else + +#elif ORTHANC_ENABLE_CIVETWEB == 1 +# if CIVETWEB_HAS_DISABLE_KEEP_ALIVE == 1 // Turn off Keep-Alive for multipart answers // https://github.com/civetweb/civetweb/issues/727 stream_.DisableKeepAlive(); header += "Connection: close\r\n"; +# else + // The function "mg_disable_keep_alive()" is not available, + // let's continue with Keep-Alive. Performance of WADO-RS will + // decrease. + header += "Connection: keep-alive\r\n"; +# endif + +#else +# error Please support your embedded Web server here #endif } else