changeset 1110:becde5351e47

preparing to update mongoose
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Sep 2014 11:11:00 +0200
parents 2e3bfa9a82b7
children 929bf8c2123d
files Core/HttpServer/MongooseServer.cpp Resources/CMake/MongooseConfiguration.cmake Resources/Patches/mongoose-3.1-patch.diff Resources/Patches/mongoose-patch.diff
diffstat 4 files changed, 62 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp	Thu Aug 07 13:54:16 2014 +0200
+++ b/Core/HttpServer/MongooseServer.cpp	Mon Sep 01 11:11:00 2014 +0200
@@ -785,7 +785,14 @@
       }
 
       const char *options[] = {
+        // Set the TCP port for the HTTP server
         "listening_ports", port.c_str(), 
+        
+        // Optimization reported by Chris Hafey
+        // https://groups.google.com/d/msg/orthanc-users/CKueKX0pJ9E/_UCbl8T-VjIJ
+        // "enable_keep_alive", "yes",
+
+        // Set the SSL certificate, if any. This must be the last option.
         ssl_ ? "ssl_certificate" : NULL,
         certificate_.c_str(),
         NULL
--- a/Resources/CMake/MongooseConfiguration.cmake	Thu Aug 07 13:54:16 2014 +0200
+++ b/Resources/CMake/MongooseConfiguration.cmake	Mon Sep 01 11:11:00 2014 +0200
@@ -7,7 +7,7 @@
 
   # Patch mongoose
   execute_process(
-    COMMAND patch mongoose.c ${ORTHANC_ROOT}/Resources/Patches/mongoose-patch.diff
+    COMMAND patch mongoose.c ${ORTHANC_ROOT}/Resources/Patches/mongoose-3.1-patch.diff
     WORKING_DIRECTORY ${MONGOOSE_SOURCES_DIR}
     )
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/mongoose-3.1-patch.diff	Mon Sep 01 11:11:00 2014 +0200
@@ -0,0 +1,54 @@
+--- /home/jodogne/Subversion/Orthanc/ThirdPartyDownloads/mongoose/mongoose.c	2012-03-11 23:41:35.000000000 +0100
++++ mongoose.c	2013-03-07 10:07:00.566266153 +0100
+@@ -92,8 +92,9 @@
+ #define strtoll(x, y, z) strtol(x, y, z)
+ #else
+ #define __func__  __FUNCTION__
+-#define strtoull(x, y, z) _strtoui64(x, y, z)
+-#define strtoll(x, y, z) _strtoi64(x, y, z)
++#include <stdlib.h>
++//#define strtoull(x, y, z) _strtoui64(x, y, z)
++//#define strtoll(x, y, z) _strtoi64(x, y, z)
+ #endif // _MSC_VER
+ 
+ #define ERRNO   GetLastError()
+@@ -253,6 +254,14 @@
+ #define MSG_NOSIGNAL 0
+ #endif
+ 
++#if __gnu_hurd__ == 1
++/**
++ * There is no limit on the length on a path under GNU Hurd, so we set
++ * it to an arbitrary constant.
++ **/
++#define PATH_MAX 4096
++#endif
++
+ typedef void * (*mg_thread_func_t)(void *);
+ 
+ static const char *http_500_error = "Internal Server Error";
+@@ -3844,10 +3853,8 @@
+ }
+ 
+ static void discard_current_request_from_buffer(struct mg_connection *conn) {
+-  char *buffered;
+   int buffered_len, body_len;
+ 
+-  buffered = conn->buf + conn->request_len;
+   buffered_len = conn->data_len - conn->request_len;
+   assert(buffered_len >= 0);
+ 
+@@ -4148,7 +4155,13 @@
+ 
+   // Wait until mg_fini() stops
+   while (ctx->stop_flag != 2) {
++#if defined(__linux)
++    usleep(100000);
++#elif defined(_WIN32)
++    Sleep(100);
++#else
+     (void) sleep(0);
++#endif
+   }
+   free_context(ctx);
+ 
--- a/Resources/Patches/mongoose-patch.diff	Thu Aug 07 13:54:16 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
---- /home/jodogne/Subversion/Orthanc/ThirdPartyDownloads/mongoose/mongoose.c	2012-03-11 23:41:35.000000000 +0100
-+++ mongoose.c	2013-03-07 10:07:00.566266153 +0100
-@@ -92,8 +92,9 @@
- #define strtoll(x, y, z) strtol(x, y, z)
- #else
- #define __func__  __FUNCTION__
--#define strtoull(x, y, z) _strtoui64(x, y, z)
--#define strtoll(x, y, z) _strtoi64(x, y, z)
-+#include <stdlib.h>
-+//#define strtoull(x, y, z) _strtoui64(x, y, z)
-+//#define strtoll(x, y, z) _strtoi64(x, y, z)
- #endif // _MSC_VER
- 
- #define ERRNO   GetLastError()
-@@ -253,6 +254,14 @@
- #define MSG_NOSIGNAL 0
- #endif
- 
-+#if __gnu_hurd__ == 1
-+/**
-+ * There is no limit on the length on a path under GNU Hurd, so we set
-+ * it to an arbitrary constant.
-+ **/
-+#define PATH_MAX 4096
-+#endif
-+
- typedef void * (*mg_thread_func_t)(void *);
- 
- static const char *http_500_error = "Internal Server Error";
-@@ -3844,10 +3853,8 @@
- }
- 
- static void discard_current_request_from_buffer(struct mg_connection *conn) {
--  char *buffered;
-   int buffered_len, body_len;
- 
--  buffered = conn->buf + conn->request_len;
-   buffered_len = conn->data_len - conn->request_len;
-   assert(buffered_len >= 0);
- 
-@@ -4148,7 +4155,13 @@
- 
-   // Wait until mg_fini() stops
-   while (ctx->stop_flag != 2) {
-+#if defined(__linux)
-+    usleep(100000);
-+#elif defined(_WIN32)
-+    Sleep(100);
-+#else
-     (void) sleep(0);
-+#endif
-   }
-   free_context(ctx);
-