view Resources/Patches/civetweb-1.11.patch @ 3403:630fc934597f

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 07 Jun 2019 17:24:26 +0200
parents 6e8822be2f08
children
line wrap: on
line source

diff -urEb civetweb-1.11.orig/include/civetweb.h civetweb-1.11/include/civetweb.h
--- civetweb-1.11.orig/include/civetweb.h	2019-01-17 21:09:41.844888908 +0100
+++ civetweb-1.11/include/civetweb.h	2019-01-21 12:05:08.138998659 +0100
@@ -1507,6 +1507,10 @@
 #endif
 
 
+// Added by SJ
+CIVETWEB_API void mg_disable_keep_alive(struct mg_connection *conn);
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff -urEb civetweb-1.11.orig/src/civetweb.c civetweb-1.11/src/civetweb.c
--- civetweb-1.11.orig/src/civetweb.c	2019-01-17 21:09:41.852888857 +0100
+++ civetweb-1.11/src/civetweb.c	2019-01-21 12:06:35.826868284 +0100
@@ -59,6 +59,9 @@
 #if defined(__linux__) && !defined(_XOPEN_SOURCE)
 #define _XOPEN_SOURCE 600 /* For flockfile() on Linux */
 #endif
+#if defined(__LSB_VERSION__)
+#define NEED_TIMEGM
+#endif
 #if !defined(_LARGEFILE_SOURCE)
 #define _LARGEFILE_SOURCE /* For fseeko(), ftello() */
 #endif
@@ -129,6 +132,12 @@
 
 
 /* Alternative queue is well tested and should be the new default */
+#if defined(__LSB_VERSION__)
+/* Function "eventfd()" is not available in Linux Standard Base, can't
+ * use the alternative queue */
+#define NO_ALTERNATIVE_QUEUE
+#endif
+
 #if defined(NO_ALTERNATIVE_QUEUE)
 #if defined(ALTERNATIVE_QUEUE)
 #error "Define ALTERNATIVE_QUEUE or NO_ALTERNATIVE_QUEUE or none, but not both"
@@ -536,6 +545,10 @@
 #if !defined(EWOULDBLOCK)
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #endif /* !EWOULDBLOCK */
+#if !defined(ECONNRESET)
+/* This macro is not defined e.g. in Visual Studio 2008 */
+#define ECONNRESET WSAECONNRESET
+#endif /* !ECONNRESET */
 #define _POSIX_
 #define INT64_FMT "I64d"
 #define UINT64_FMT "I64u"
@@ -2939,6 +2952,13 @@
 #endif
 
 
+#if defined(__LSB_VERSION__)
+static void
+mg_set_thread_name(const char *threadName)
+{
+  /* prctl() does not seem to be available in Linux Standard Base */
+}
+#else
 static void
 mg_set_thread_name(const char *name)
 {
@@ -2980,6 +3000,7 @@
 	(void)prctl(PR_SET_NAME, threadName, 0, 0, 0);
 #endif
 }
+#endif
 #else /* !defined(NO_THREAD_NAME) */
 void
 mg_set_thread_name(const char *threadName)
@@ -16919,6 +16940,10 @@
 	/* Message is a valid request */
 
 	/* Is there a "host" ? */
+        /* https://github.com/civetweb/civetweb/pull/675/commits/96e3e8c50acb4b8e0c946d02b5f880a3e62986e1 */
+	if (conn->host!=NULL) {
+		mg_free((void *)conn->host);
+	}
 	conn->host = alloc_get_host(conn);
 	if (!conn->host) {
 		mg_snprintf(conn,
@@ -19857,4 +19882,13 @@
 }
 
 
+// Added by SJ
+void mg_disable_keep_alive(struct mg_connection *conn)
+{
+  if (conn != NULL) {
+    conn->must_close = 1;
+  }
+}
+
+
 /* End of civetweb.c */