1diff -urEb civetweb-1.11.orig/include/civetweb.h civetweb-1.11/include/civetweb.h 2--- civetweb-1.11.orig/include/civetweb.h 2019-01-17 21:09:41.844888908 +0100 3+++ civetweb-1.11/include/civetweb.h 2019-01-21 12:05:08.138998659 +0100 4@@ -1507,6 +1507,10 @@ 5 #endif 6 7 8+// Added by SJ 9+CIVETWEB_API void mg_disable_keep_alive(struct mg_connection *conn); 10+ 11+ 12 #ifdef __cplusplus 13 } 14 #endif /* __cplusplus */ 15diff -urEb civetweb-1.11.orig/src/civetweb.c civetweb-1.11/src/civetweb.c 16--- civetweb-1.11.orig/src/civetweb.c 2019-01-17 21:09:41.852888857 +0100 17+++ civetweb-1.11/src/civetweb.c 2019-01-21 12:06:35.826868284 +0100 18@@ -59,6 +59,9 @@ 19 #if defined(__linux__) && !defined(_XOPEN_SOURCE) 20 #define _XOPEN_SOURCE 600 /* For flockfile() on Linux */ 21 #endif 22+#if defined(__LSB_VERSION__) 23+#define NEED_TIMEGM 24+#endif 25 #if !defined(_LARGEFILE_SOURCE) 26 #define _LARGEFILE_SOURCE /* For fseeko(), ftello() */ 27 #endif 28@@ -129,6 +132,12 @@ 29 30 31 /* Alternative queue is well tested and should be the new default */ 32+#if defined(__LSB_VERSION__) 33+/* Function "eventfd()" is not available in Linux Standard Base, can't 34+ * use the alternative queue */ 35+#define NO_ALTERNATIVE_QUEUE 36+#endif 37+ 38 #if defined(NO_ALTERNATIVE_QUEUE) 39 #if defined(ALTERNATIVE_QUEUE) 40 #error "Define ALTERNATIVE_QUEUE or NO_ALTERNATIVE_QUEUE or none, but not both" 41@@ -536,6 +545,10 @@ 42 #if !defined(EWOULDBLOCK) 43 #define EWOULDBLOCK WSAEWOULDBLOCK 44 #endif /* !EWOULDBLOCK */ 45+#if !defined(ECONNRESET) 46+/* This macro is not defined e.g. in Visual Studio 2008 */ 47+#define ECONNRESET WSAECONNRESET 48+#endif /* !ECONNRESET */ 49 #define _POSIX_ 50 #define INT64_FMT "I64d" 51 #define UINT64_FMT "I64u" 52@@ -2939,6 +2952,13 @@ 53 #endif 54 55 56+#if defined(__LSB_VERSION__) 57+static void 58+mg_set_thread_name(const char *threadName) 59+{ 60+ /* prctl() does not seem to be available in Linux Standard Base */ 61+} 62+#else 63 static void 64 mg_set_thread_name(const char *name) 65 { 66@@ -2980,6 +3000,7 @@ 67 (void)prctl(PR_SET_NAME, threadName, 0, 0, 0); 68 #endif 69 } 70+#endif 71 #else /* !defined(NO_THREAD_NAME) */ 72 void 73 mg_set_thread_name(const char *threadName) 74@@ -16919,6 +16940,10 @@ 75 /* Message is a valid request */ 76 77 /* Is there a "host" ? */ 78+ /* https://github.com/civetweb/civetweb/pull/675/commits/96e3e8c50acb4b8e0c946d02b5f880a3e62986e1 */ 79+ if (conn->host!=NULL) { 80+ mg_free((void *)conn->host); 81+ } 82 conn->host = alloc_get_host(conn); 83 if (!conn->host) { 84 mg_snprintf(conn, 85@@ -19857,4 +19882,13 @@ 86 } 87 88 89+// Added by SJ 90+void mg_disable_keep_alive(struct mg_connection *conn) 91+{ 92+ if (conn != NULL) { 93+ conn->must_close = 1; 94+ } 95+} 96+ 97+ 98 /* End of civetweb.c */ 99