changeset 4616:57b1a36645ae

upgrade to civetweb 1.14
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Apr 2021 12:08:20 +0200
parents 8661811abca3
children 943dea50f358 926fa5ef8b4f
files NEWS OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake OrthancFramework/Sources/HttpServer/HttpServer.cpp OrthancServer/UnitTestsSources/VersionsTests.cpp
diffstat 4 files changed, 29 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Apr 02 13:50:56 2021 +0200
+++ b/NEWS	Wed Apr 14 12:08:20 2021 +0200
@@ -12,6 +12,8 @@
 -----------
 
 * Use the local timezone for query/retrieve in the Orthanc Explorer interface (was UTC before)
+* Upgraded dependencies for static builds (notably on Windows and LSB):
+  - civetweb 1.14
 
 
 Version 1.9.1 (2021-02-25)
--- a/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake	Fri Apr 02 13:50:56 2021 +0200
+++ b/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake	Wed Apr 14 12:08:20 2021 +0200
@@ -20,21 +20,21 @@
 
 if (STATIC_BUILD OR NOT USE_SYSTEM_CIVETWEB)
 
-  ## WARNING: "civetweb-1.13.tar.gz" comes with a subfolder
-  ## "civetweb-1.13/test/nonlatin" that cannot be removed by "hg purge
+  ## WARNING: "civetweb-1.14.tar.gz" comes with a subfolder
+  ## "civetweb-1.14/test/nonlatin" that cannot be removed by "hg purge
   ## --all" on Windows hosts. We thus created a custom
-  ## "civetweb-1.13-fixed.tar.gz" as follows:
+  ## "civetweb-1.14-fixed.tar.gz" as follows:
   ##
   ##  $ cd /tmp
-  ##  $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.13.tar.gz
-  ##  $ tar xvf civetweb-1.13.tar.gz
-  ##  $ rm -rf civetweb-1.13/src/third_party/ civetweb-1.13/test/
-  ##  $ tar cvfz civetweb-1.13-fixed.tar.gz civetweb-1.13
+  ##  $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.14.tar.gz
+  ##  $ tar xvf civetweb-1.14.tar.gz
+  ##  $ rm -rf civetweb-1.14/src/third_party/ civetweb-1.14/test/
+  ##  $ tar cvfz civetweb-1.14-fixed.tar.gz civetweb-1.14
   ##
   
-  set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.13)
-  set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.13-fixed.tar.gz")
-  set(CIVETWEB_MD5 "9cf9d22cf8a06a8487d98637bbcd543c")
+  set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.14)
+  set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.14-fixed.tar.gz")
+  set(CIVETWEB_MD5 "1f25d516b7a4e65d8b270d1cc399e0a9")
 
   if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}")
     set(FirstRun OFF)
@@ -44,17 +44,6 @@
 
   DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}")
 
-  execute_process(
-    COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
-    ${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.13.patch
-    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    RESULT_VARIABLE Failure
-    )
-
-  if (FirstRun AND Failure)
-    message(FATAL_ERROR "Error while patching a file")
-  endif()
-  
   include_directories(
     ${CIVETWEB_SOURCES_DIR}/include
     )
@@ -115,14 +104,15 @@
   endif()
 
   link_libraries(civetweb)
-  unset(CMAKE_REQUIRED_LIBRARIES)
 
   # Check whether the system distribution of civetweb contains the
   # patch "../Patches/civetweb-1.13.patch" that allows to disable
   # keep-alive on selected HTTP connections. This is useful to speed
   # up multipart transfers, as encountered in DICOMweb.
-  CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
-  if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
+  CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1)  # From "../Patches/civetweb-1.13.patch"
+  CHECK_LIBRARY_EXISTS(civetweb mg_disable_connection_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2)  # From civetweb >= 1.14
+  if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1 OR
+      CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2)
     add_definitions(
       -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1
       -DCIVETWEB_HAS_WEBDAV_WRITING=1
@@ -135,6 +125,8 @@
       -DCIVETWEB_HAS_WEBDAV_WRITING=0
       )
   endif()
+
+  unset(CMAKE_REQUIRED_LIBRARIES)  # This reset must be after "CHECK_LIBRARY_EXISTS"
 endif()
 
 
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Fri Apr 02 13:50:56 2021 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Wed Apr 14 12:08:20 2021 +0200
@@ -121,7 +121,17 @@
 
 #elif ORTHANC_ENABLE_CIVETWEB == 1
 #  if CIVETWEB_HAS_DISABLE_KEEP_ALIVE == 1
+#    if CIVETWEB_VERSION_MAJOR == 1 && CIVETWEB_VERSION_MINOR <= 13   // From "civetweb-1.13.patch"
         mg_disable_keep_alive(connection_);
+#    else
+        /**
+         * Function "mg_disable_keep_alive()" contributed by Sebastien
+         * Jodogne was renamed as "mg_disable_connection_keep_alive()"
+         * in the official CivetWeb repository:
+         * https://github.com/civetweb/civetweb/commit/78d45f4c4b0ab821f4f259b21ad3783f6d6c556a
+         **/
+        mg_disable_connection_keep_alive(connection_);
+#    endif
 #  else
 #    if defined(__GNUC__) || defined(__clang__)
 #       warning The function "mg_disable_keep_alive()" is not available, DICOMweb might run slowly
--- a/OrthancServer/UnitTestsSources/VersionsTests.cpp	Fri Apr 02 13:50:56 2021 +0200
+++ b/OrthancServer/UnitTestsSources/VersionsTests.cpp	Wed Apr 14 12:08:20 2021 +0200
@@ -201,7 +201,7 @@
 TEST(Version, Civetweb)
 {
   ASSERT_EQ(1, CIVETWEB_VERSION_MAJOR);
-  ASSERT_EQ(13, CIVETWEB_VERSION_MINOR);
+  ASSERT_EQ(14, CIVETWEB_VERSION_MINOR);
   ASSERT_EQ(0, CIVETWEB_VERSION_PATCH);
 }
 #endif