diff Core/HttpServer/HttpServer.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 6e8822be2f08
children 07a2f637b76d
line wrap: on
line diff
--- a/Core/HttpServer/HttpServer.cpp	Wed Jan 30 10:24:12 2019 +0100
+++ b/Core/HttpServer/HttpServer.cpp	Wed Jan 30 12:41:20 2019 +0100
@@ -47,6 +47,9 @@
 #elif ORTHANC_ENABLE_CIVETWEB == 1
 #  include <civetweb.h>
 #  define MONGOOSE_USE_CALLBACKS 1
+#  if !defined(CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
+#    error Macro CIVETWEB_HAS_DISABLE_KEEP_ALIVE must be defined
+#  endif
 
 #else
 #  error "Either Mongoose or Civetweb must be enabled to compile this file"
@@ -114,8 +117,18 @@
 #if ORTHANC_ENABLE_MONGOOSE == 1
         throw OrthancException(ErrorCode_NotImplemented,
                                "Only available if using CivetWeb");
+
 #elif ORTHANC_ENABLE_CIVETWEB == 1
+#  if CIVETWEB_HAS_DISABLE_KEEP_ALIVE == 1
         mg_disable_keep_alive(connection_);
+#  else
+#       warning The function "mg_disable_keep_alive()" is not available, DICOMweb might run slowly
+        throw OrthancException(ErrorCode_NotImplemented,
+                               "Only available if using a patched version of CivetWeb");
+#  endif
+
+#else
+#  error Please support your embedded Web server here
 #endif
       }
     };