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