changeset 4259:5227df2a650f

upgrade to civetweb 1.13
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Oct 2020 13:29:23 +0100
parents 6f5d4bfb2c90
children ec4bccff52d7
files NEWS OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake OrthancFramework/Resources/Patches/civetweb-1.13.patch
diffstat 4 files changed, 72 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Oct 26 12:23:36 2020 +0100
+++ b/NEWS	Tue Oct 27 13:29:23 2020 +0100
@@ -2,6 +2,8 @@
 ===============================
 
 * C-GET SCP: Fix responses and handling of cancel
+* Upgraded dependencies for static builds (notably on Windows and LSB):
+  - civetweb 1.13
 
 
 Version 1.8.0 (2020-10-16)
--- a/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake	Mon Oct 26 12:23:36 2020 +0100
+++ b/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake	Tue Oct 27 13:29:23 2020 +0100
@@ -20,21 +20,21 @@
 
 if (STATIC_BUILD OR NOT USE_SYSTEM_CIVETWEB)
 
-  ## WARNING: "civetweb-1.12.tar.gz" comes with a subfolder
-  ## "civetweb-1.12/test/nonlatin" that cannot be removed by "hg purge
+  ## WARNING: "civetweb-1.13.tar.gz" comes with a subfolder
+  ## "civetweb-1.13/test/nonlatin" that cannot be removed by "hg purge
   ## --all" on Windows hosts. We thus created a custom
-  ## "civetweb-1.12-fixed.tar.gz" as follows:
+  ## "civetweb-1.13-fixed.tar.gz" as follows:
   ##
   ##  $ cd /tmp
-  ##  $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.12.tar.gz
-  ##  $ tar xvf civetweb-1.12.tar.gz
-  ##  $ rm -rf civetweb-1.12/src/third_party/ civetweb-1.12/test/
-  ##  $ tar cvfz civetweb-1.12-fixed.tar.gz civetweb-1.12
+  ##  $ 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
   ##
   
-  set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.12)
-  set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.12-fixed.tar.gz")
-  set(CIVETWEB_MD5 "016ed7cd26cbc46b5941f0cbfb2e4ac8")
+  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")
 
   if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}")
     set(FirstRun OFF)
@@ -46,7 +46,7 @@
 
   execute_process(
     COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
-    ${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.12.patch
+    ${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.13.patch
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     RESULT_VARIABLE Failure
     )
@@ -64,11 +64,8 @@
     )
 
   # New in Orthanc 1.6.0: Enable support of compression in civetweb
-  set_source_files_properties(
-    ${CIVETWEB_SOURCES}
-    PROPERTIES COMPILE_DEFINITIONS
-    "USE_ZLIB=1")
-  
+  set(tmp "USE_ZLIB=1")
+    
   if (ENABLE_SSL)
     add_definitions(
       -DNO_SSL_DL=1
@@ -78,12 +75,25 @@
       link_libraries(dl)
     endif()
 
+    if (CIVETWEB_OPENSSL_API STREQUAL "1.0")
+      set(tmp "${tmp};OPENSSL_API_1_0=1")
+    elseif (CIVETWEB_OPENSSL_API STREQUAL "1.1")
+      set(tmp "${tmp};OPENSSL_API_1_1=1")
+    else()
+      message(FATAL_ERROR "Unsupported value for CIVETWEB_OPENSSL_API: ${CIVETWEB_OPENSSL_API}")
+    endif()
+
   else()
     add_definitions(
       -DNO_SSL=1   # Remove SSL support from civetweb
       )
   endif()
 
+  set_source_files_properties(
+    ${CIVETWEB_SOURCES}
+    PROPERTIES COMPILE_DEFINITIONS "${tmp}"
+    )
+  
   source_group(ThirdParty\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*)
 
   add_definitions(
@@ -108,7 +118,7 @@
   unset(CMAKE_REQUIRED_LIBRARIES)
 
   # Check whether the system distribution of civetweb contains the
-  # patch "../Patches/civetweb-1.12.patch" that allows to disable
+  # 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)
--- a/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake	Mon Oct 26 12:23:36 2020 +0100
+++ b/OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake	Tue Oct 27 13:29:23 2020 +0100
@@ -94,7 +94,9 @@
 set(EMSCRIPTEN_TARGET_MODE "wasm" CACHE STRING "Sets the target mode for Emscripten (can be \"wasm\" or \"asm.js\")")
 set(EMSCRIPTEN_TRAP_MODE "" CACHE STRING "Sets the trap mode for Emscripten for numeric errors (can notably be empty, or \"clamp\")")
 set(OPENSSL_STATIC_VERSION "1.1.1" CACHE STRING "Version of OpenSSL to be used in static builds (can be \"1.0.2\", or \"1.1.1\")")
+set(CIVETWEB_OPENSSL_API "1.1" CACHE STRING "Version of the OpenSSL API to be used in civetweb in static builds (can be \"1.0\" or \"1.1\"")
 
+mark_as_advanced(CIVETWEB_OPENSSL_API)
 mark_as_advanced(EMSCRIPTEN_TARGET_MODE)
 mark_as_advanced(EMSCRIPTEN_TRAP_MODE)
 mark_as_advanced(SYSTEM_MONGOOSE_USE_CALLBACKS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OrthancFramework/Resources/Patches/civetweb-1.13.patch	Tue Oct 27 13:29:23 2020 +0100
@@ -0,0 +1,41 @@
+diff -urEb civetweb-1.13.orig/include/civetweb.h civetweb-1.13/include/civetweb.h
+--- civetweb-1.13.orig/include/civetweb.h	2020-10-27 13:11:13.870113645 +0100
++++ civetweb-1.13/include/civetweb.h	2020-10-27 13:12:33.997986337 +0100
+@@ -1695,6 +1695,9 @@
+                                   struct mg_error_data *error);
+ #endif
+ 
++// Added by SJ
++CIVETWEB_API void mg_disable_keep_alive(struct mg_connection *conn);
++
+ #ifdef __cplusplus
+ }
+ #endif /* __cplusplus */
+diff -urEb civetweb-1.13.orig/src/civetweb.c civetweb-1.13/src/civetweb.c
+--- civetweb-1.13.orig/src/civetweb.c	2020-10-27 13:11:13.870113645 +0100
++++ civetweb-1.13/src/civetweb.c	2020-10-27 13:12:14.534017414 +0100
+@@ -10876,6 +10876,11 @@
+     /* + MicroSoft extensions
+      * https://msdn.microsoft.com/en-us/library/aa142917.aspx */
+ 
++    /* Added by SJ, for write access to WebDAV on Windows >= 7 */
++    {"LOCK", 1, 1, 0, 0, 0},
++    {"UNLOCK", 1, 0, 0, 0, 0},
++    {"PROPPATCH", 1, 1, 0, 0, 0},
++    
+     /* REPORT method (RFC 3253) */
+     {"REPORT", 1, 1, 1, 1, 1},
+     /* REPORT method only allowed for CGI/Lua/LSP and callbacks. */
+@@ -21287,4 +21292,12 @@
+ }
+ 
+ 
++// Added by SJ
++void mg_disable_keep_alive(struct mg_connection *conn)
++{
++  if (conn != NULL) {
++    conn->must_close = 1;
++  }
++}
++ 
+ /* End of civetweb.c */