changeset 3126:b1787ba94eef

fix issue #32 (HTTP keep-alive), make CivetWeb the default HTTP server
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Jan 2019 09:52:05 +0100
parents 58ea4ef84c92
children e678a2b1a25b c262b10bfae1
files LinuxCompilation.txt NEWS OrthancServer/main.cpp Resources/CMake/OrthancFrameworkParameters.cmake Resources/Configuration.json Resources/Testing/Issue32/Java/src/test/java/io/osimis/AppTest.java
diffstat 6 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/LinuxCompilation.txt	Tue Jan 15 18:46:59 2019 +0100
+++ b/LinuxCompilation.txt	Wed Jan 16 09:52:05 2019 +0100
@@ -85,7 +85,7 @@
                        libboost-all-dev libwrap0-dev libjsoncpp-dev libpugixml-dev
 
 # cmake -DALLOW_DOWNLOADS=ON \
-	-DUSE_SYSTEM_MONGOOSE=OFF \
+	-DUSE_SYSTEM_CIVETWEB=OFF \
         -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
         -DDCMTK_LIBRARIES=dcmjpls \
         -DCMAKE_BUILD_TYPE=Release \
@@ -106,7 +106,7 @@
 
 # cmake "-DDCMTK_LIBRARIES=boost_locale;CharLS;dcmjpls;wrap;oflog" \
         -DALLOW_DOWNLOADS=ON \
-	-DUSE_SYSTEM_MONGOOSE=OFF \
+	-DUSE_SYSTEM_CIVETWEB=OFF \
 	-DUSE_SYSTEM_JSONCPP=OFF \
 	-DUSE_SYSTEM_PUGIXML=OFF \
         -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
@@ -126,7 +126,7 @@
 
 # cmake -DALLOW_DOWNLOADS=ON \
         -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON \
-        -DUSE_SYSTEM_MONGOOSE=OFF \
+        -DUSE_SYSTEM_CIVETWEB=OFF \
         -DDCMTK_LIBRARIES=dcmjpls \
         -DCMAKE_BUILD_TYPE=Release \
         ~/Orthanc
@@ -146,6 +146,7 @@
 # sudo yum install gflags-devel
 
 # cmake  "-DDCMTK_LIBRARIES=CharLS" \
+         -DENABLE_CIVETWEB=OFF \
          -DSYSTEM_MONGOOSE_USE_CALLBACKS=OFF \
          -DCMAKE_BUILD_TYPE=Release \
          ~/Orthanc
@@ -162,7 +163,7 @@
               e2fsprogs-libuuid boost-libs sqlite3 python libiconv
 
 # cmake -DALLOW_DOWNLOADS=ON \
-        -DUSE_SYSTEM_MONGOOSE=OFF \
+        -DUSE_SYSTEM_CIVETWEB=OFF \
         -DDCMTK_LIBRARIES="dcmdsig;charls;dcmjpls" \
         -DCMAKE_BUILD_TYPE=Release \
 	~/Orthanc
@@ -178,7 +179,7 @@
 
 # cmake -DALLOW_DOWNLOADS=ON \
         -DUSE_SYSTEM_JSONCPP=OFF \
-        -DUSE_SYSTEM_MONGOOSE=OFF \
+        -DUSE_SYSTEM_CIVETWEB=OFF \
         -DUSE_SYSTEM_PUGIXML=OFF \
         -DUSE_SYSTEM_SQLITE=OFF \
         -DUSE_SYSTEM_BOOST=OFF \
--- a/NEWS	Tue Jan 15 18:46:59 2019 +0100
+++ b/NEWS	Wed Jan 16 09:52:05 2019 +0100
@@ -4,14 +4,16 @@
 Maintenance
 -----------
 
+* CivetWeb is now the default embedded HTTP server (instead of Mongoose)
 * Don't consider tags whose group is below 0x0008 in C-FIND SCP
 * Compatibility with DCMTK 3.6.4
 * Fix issue #21 (DICOM files missing after uploading with Firefox)
+* Fix issue #32 (HTTP keep-alive is now enabled by default)
 * Fix issue #118 (Wording in Configuration.json regarding SynchronousCMove)
 * Fix issue #124 (GET /studies/ID/media fails for certain dicom file)
 * Fix issue #125 (Mongoose: /instances/{id} returns 500 on invalid HTTP Method)
 * Fixed Orthanc Explorer on IE and Firefox: Explorer always show "too many results"
-  and it's therefore impossible to browse the content.
+  and it's therefore impossible to browse the content
 * Upgraded dependencies for static and Windows builds:
   - civetweb 1.11
 
--- a/OrthancServer/main.cpp	Tue Jan 15 18:46:59 2019 +0100
+++ b/OrthancServer/main.cpp	Wed Jan 16 09:52:05 2019 +0100
@@ -809,7 +809,7 @@
       //httpServer.SetThreadsCount(50);
       httpServer.SetPortNumber(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpPort", 8042));
       httpServer.SetRemoteAccessAllowed(lock.GetConfiguration().GetBooleanParameter("RemoteAccessAllowed", false));
-      httpServer.SetKeepAliveEnabled(lock.GetConfiguration().GetBooleanParameter("KeepAlive", false));
+      httpServer.SetKeepAliveEnabled(lock.GetConfiguration().GetBooleanParameter("KeepAlive", true));
       httpServer.SetHttpCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("HttpCompressionEnabled", true));
       httpServer.SetAuthenticationEnabled(lock.GetConfiguration().GetBooleanParameter("AuthenticationEnabled", false));
 
--- a/Resources/CMake/OrthancFrameworkParameters.cmake	Tue Jan 15 18:46:59 2019 +0100
+++ b/Resources/CMake/OrthancFrameworkParameters.cmake	Wed Jan 16 09:52:05 2019 +0100
@@ -30,7 +30,7 @@
 set(STANDALONE_BUILD ON CACHE BOOL "Standalone build (all the resources are embedded, necessary for releases)")
 
 # Generic parameters of the build
-set(ENABLE_CIVETWEB OFF CACHE BOOL "Use Civetweb instead of Mongoose (experimental)")
+set(ENABLE_CIVETWEB ON CACHE BOOL "Use Civetweb instead of Mongoose (Mongoose was the default embedded HTTP server in Orthanc <= 1.5.1)")
 set(ENABLE_PKCS11 OFF CACHE BOOL "Enable PKCS#11 for HTTPS client authentication using hardware security modules and smart cards")
 set(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof")
 set(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
--- a/Resources/Configuration.json	Tue Jan 15 18:46:59 2019 +0100
+++ b/Resources/Configuration.json	Wed Jan 16 09:52:05 2019 +0100
@@ -346,9 +346,13 @@
   // default behavior since Orthanc 1.4.0).
   "LogExportedResources" : false,
 
-  // Enable or disable HTTP Keep-Alive (deprecated). Set this option
-  // to "true" only in the case of high HTTP loads.
-  "KeepAlive" : false,
+  // Enable or disable HTTP Keep-Alive (persistent HTTP
+  // connections). Setting this option to "true" prevents Orthanc
+  // issue #32 ("HttpServer does not support multiple HTTP requests in
+  // the same TCP stream"), but can slow down HTTP clients that do not
+  // support persistent connections. The default behavior used to be
+  // "false" in Orthanc <= 1.5.1.
+  "KeepAlive" : true,
 
   // If this option is set to "false", Orthanc will run in index-only
   // mode. The DICOM files will not be stored on the drive. Note that
--- a/Resources/Testing/Issue32/Java/src/test/java/io/osimis/AppTest.java	Tue Jan 15 18:46:59 2019 +0100
+++ b/Resources/Testing/Issue32/Java/src/test/java/io/osimis/AppTest.java	Wed Jan 16 09:52:05 2019 +0100
@@ -1,6 +1,7 @@
 package io.osimis;
 
 import java.io.IOException;
+import java.util.Base64;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.HttpRequestRetryHandler;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -33,6 +34,10 @@
 
     HttpRequestBase request = new HttpGet("http://localhost:8042/system");
 
+    // Low-level handling of HTTP basic authentication (for integration tests)
+    request.addHeader("Authorization", "Basic " +
+                      Base64.getEncoder().encodeToString("alice:orthanctest".getBytes()));
+
     // The following call works
     //HttpRequestBase request = new HttpGet("https://api.ipify.org?format=json");