aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--doc/examples/basicauthentication.c62
-rw-r--r--doc/examples/hellobrowser.c25
-rw-r--r--doc/examples/largepost.c302
-rw-r--r--doc/examples/logging.c18
-rw-r--r--doc/examples/responseheaders.c56
-rw-r--r--doc/examples/sessions.c561
-rw-r--r--doc/examples/simplepost.c156
-rw-r--r--doc/examples/tlsauthentication.c150
-rw-r--r--doc/libmicrohttpd.texi50
-rw-r--r--src/examples/authorization_example.c4
-rw-r--r--src/examples/benchmark.c2
-rw-r--r--src/examples/benchmark_https.c2
-rw-r--r--src/examples/chunked_example.c4
-rw-r--r--src/examples/demo.c16
-rw-r--r--src/examples/demo_https.c18
-rw-r--r--src/examples/digest_auth_example.c4
-rw-r--r--src/examples/dual_stack_example.c4
-rw-r--r--src/examples/fileserver_example.c4
-rw-r--r--src/examples/fileserver_example_dirs.c4
-rw-r--r--src/examples/fileserver_example_external_select.c4
-rw-r--r--src/examples/http_chunked_compression.c8
-rw-r--r--src/examples/http_compression.c10
-rw-r--r--src/examples/https_fileserver_example.c4
-rw-r--r--src/examples/minimal_example.c4
-rw-r--r--src/examples/minimal_example_comet.c4
-rw-r--r--src/examples/minimal_example_empty.c4
-rw-r--r--src/examples/minimal_example_empty_tls.c4
-rw-r--r--src/examples/post_example.c30
-rw-r--r--src/examples/querystring_example.c4
-rw-r--r--src/examples/refuse_post_example.c4
-rw-r--r--src/examples/suspend_resume_epoll.c4
-rw-r--r--src/examples/timeout.c4
-rw-r--r--src/examples/upgrade_example.c4
-rw-r--r--src/include/microhttpd.h134
-rw-r--r--src/microhttpd/connection.c46
-rw-r--r--src/microhttpd/connection.h12
-rw-r--r--src/microhttpd/daemon.c68
-rw-r--r--src/microhttpd/digestauth.c12
-rw-r--r--src/microhttpd/internal.c2
-rw-r--r--src/microhttpd/internal.h4
-rw-r--r--src/microhttpd/postprocessor.c31
-rw-r--r--src/microhttpd/response.c16
-rw-r--r--src/microhttpd/response.h2
-rw-r--r--src/microhttpd/test_daemon.c6
-rw-r--r--src/microhttpd/test_postprocessor.c12
-rw-r--r--src/microhttpd/test_postprocessor_amp.c2
-rw-r--r--src/microhttpd/test_postprocessor_large.c2
-rw-r--r--src/microhttpd/test_upgrade.c4
-rw-r--r--src/microhttpd/test_upgrade_large.c4
-rw-r--r--src/testcurl/https/test_empty_response.c4
-rw-r--r--src/testcurl/https/test_https_get.c4
-rw-r--r--src/testcurl/https/test_https_get_select.c4
-rw-r--r--src/testcurl/https/test_https_session_info.c17
-rw-r--r--src/testcurl/https/tls_test_common.c6
-rw-r--r--src/testcurl/https/tls_test_common.h4
-rw-r--r--src/testcurl/perf_get.c4
-rw-r--r--src/testcurl/perf_get_concurrent.c4
-rw-r--r--src/testcurl/test_callback.c4
-rw-r--r--src/testcurl/test_concurrent_stop.c4
-rw-r--r--src/testcurl/test_delete.c4
-rw-r--r--src/testcurl/test_digestauth.c4
-rw-r--r--src/testcurl/test_digestauth_sha256.c4
-rw-r--r--src/testcurl/test_digestauth_with_arguments.c4
-rw-r--r--src/testcurl/test_get.c8
-rw-r--r--src/testcurl/test_get_chunked.c4
-rw-r--r--src/testcurl/test_get_response_cleanup.c4
-rw-r--r--src/testcurl/test_get_sendfile.c6
-rw-r--r--src/testcurl/test_iplimit.c4
-rw-r--r--src/testcurl/test_large_put.c4
-rw-r--r--src/testcurl/test_long_header.c6
-rw-r--r--src/testcurl/test_parse_cookies.c4
-rw-r--r--src/testcurl/test_patch.c4
-rw-r--r--src/testcurl/test_post.c10
-rw-r--r--src/testcurl/test_post_loop.c4
-rw-r--r--src/testcurl/test_postform.c6
-rw-r--r--src/testcurl/test_process_arguments.c4
-rw-r--r--src/testcurl/test_process_headers.c6
-rw-r--r--src/testcurl/test_put.c4
-rw-r--r--src/testcurl/test_put_chunked.c4
-rw-r--r--src/testcurl/test_quiesce.c4
-rw-r--r--src/testcurl/test_quiesce_stream.c4
-rw-r--r--src/testcurl/test_termination.c4
-rw-r--r--src/testcurl/test_timeout.c4
-rw-r--r--src/testcurl/test_urlparse.c6
-rw-r--r--src/testzzuf/test_get.c4
-rw-r--r--src/testzzuf/test_get_chunked.c4
-rw-r--r--src/testzzuf/test_long_header.c17
-rw-r--r--src/testzzuf/test_post.c6
-rw-r--r--src/testzzuf/test_post_form.c6
-rw-r--r--src/testzzuf/test_put.c4
-rw-r--r--src/testzzuf/test_put_chunked.c4
-rw-r--r--src/testzzuf/test_put_large.c6
93 files changed, 1086 insertions, 1039 deletions
diff --git a/ChangeLog b/ChangeLog
index 36c5bdbf..9fede6ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
1Wed 08 Apr 2020 10:53:01 PM CEST
2 Introduce `enum MHD_Result` for #MHD_YES/#MHD_NO to avoid using 'int' so much.
3 Note that this change WILL cause compiler warnings until (most) MHD callbacks
4 in application code change their return type from 'int' to 'enum MHD_Result'.
5 That said, avoiding possible confusions of different enums is going to make
6 the code more robust in the future. For conditional compilation, test
7 for "MHD_VERSION >= 0x00097002". -CG
8
1Tue 07 Apr 2020 02:58:39 PM BRT 9Tue 07 Apr 2020 02:58:39 PM BRT
2 Fixed #5501 (Added example for how to provide a tiny threaded websocket server). -SC 10 Fixed #5501 (Added example for how to provide a tiny threaded websocket server). -SC
3 11
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c
index 88cb79b7..5d156f04 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -17,7 +17,7 @@
17#define PORT 8888 17#define PORT 8888
18 18
19 19
20static int 20static enum MHD_Result
21answer_to_connection (void *cls, struct MHD_Connection *connection, 21answer_to_connection (void *cls, struct MHD_Connection *connection,
22 const char *url, const char *method, 22 const char *url, const char *method,
23 const char *version, const char *upload_data, 23 const char *version, const char *upload_data,
@@ -28,45 +28,47 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
28 int fail; 28 int fail;
29 int ret; 29 int ret;
30 struct MHD_Response *response; 30 struct MHD_Response *response;
31 (void)cls; /* Unused. Silent compiler warning. */ 31 (void) cls; /* Unused. Silent compiler warning. */
32 (void)url; /* Unused. Silent compiler warning. */ 32 (void) url; /* Unused. Silent compiler warning. */
33 (void)version; /* Unused. Silent compiler warning. */ 33 (void) version; /* Unused. Silent compiler warning. */
34 (void)upload_data; /* Unused. Silent compiler warning. */ 34 (void) upload_data; /* Unused. Silent compiler warning. */
35 (void)upload_data_size; /* Unused. Silent compiler warning. */ 35 (void) upload_data_size; /* Unused. Silent compiler warning. */
36 36
37 if (0 != strcmp (method, "GET")) 37 if (0 != strcmp (method, "GET"))
38 return MHD_NO; 38 return MHD_NO;
39 if (NULL == *con_cls) 39 if (NULL == *con_cls)
40 { 40 {
41 *con_cls = connection; 41 *con_cls = connection;
42 return MHD_YES; 42 return MHD_YES;
43 } 43 }
44 pass = NULL; 44 pass = NULL;
45 user = MHD_basic_auth_get_username_password (connection, 45 user = MHD_basic_auth_get_username_password (connection,
46 &pass); 46 &pass);
47 fail = ( (NULL == user) || 47 fail = ( (NULL == user) ||
48 (0 != strcmp (user, "root")) || 48 (0 != strcmp (user, "root")) ||
49 (0 != strcmp (pass, "pa$$w0rd") ) ); 49 (0 != strcmp (pass, "pa$$w0rd") ) );
50 if (NULL != user) MHD_free (user); 50 if (NULL != user)
51 if (NULL != pass) MHD_free (pass); 51 MHD_free (user);
52 if (NULL != pass)
53 MHD_free (pass);
52 if (fail) 54 if (fail)
53 { 55 {
54 const char *page = "<html><body>Go away.</body></html>"; 56 const char *page = "<html><body>Go away.</body></html>";
55 response = 57 response =
56 MHD_create_response_from_buffer (strlen (page), (void *) page, 58 MHD_create_response_from_buffer (strlen (page), (void *) page,
57 MHD_RESPMEM_PERSISTENT); 59 MHD_RESPMEM_PERSISTENT);
58 ret = MHD_queue_basic_auth_fail_response (connection, 60 ret = MHD_queue_basic_auth_fail_response (connection,
59 "my realm", 61 "my realm",
60 response); 62 response);
61 } 63 }
62 else 64 else
63 { 65 {
64 const char *page = "<html><body>A secret.</body></html>"; 66 const char *page = "<html><body>A secret.</body></html>";
65 response = 67 response =
66 MHD_create_response_from_buffer (strlen (page), (void *) page, 68 MHD_create_response_from_buffer (strlen (page), (void *) page,
67 MHD_RESPMEM_PERSISTENT); 69 MHD_RESPMEM_PERSISTENT);
68 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 70 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
69 } 71 }
70 MHD_destroy_response (response); 72 MHD_destroy_response (response);
71 return ret; 73 return ret;
72} 74}
diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c
index dce4ee6d..0c13c24d 100644
--- a/doc/examples/hellobrowser.c
+++ b/doc/examples/hellobrowser.c
@@ -14,7 +14,7 @@
14 14
15#define PORT 8888 15#define PORT 8888
16 16
17static int 17static enum MHD_Result
18answer_to_connection (void *cls, struct MHD_Connection *connection, 18answer_to_connection (void *cls, struct MHD_Connection *connection,
19 const char *url, const char *method, 19 const char *url, const char *method,
20 const char *version, const char *upload_data, 20 const char *version, const char *upload_data,
@@ -22,18 +22,18 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
22{ 22{
23 const char *page = "<html><body>Hello, browser!</body></html>"; 23 const char *page = "<html><body>Hello, browser!</body></html>";
24 struct MHD_Response *response; 24 struct MHD_Response *response;
25 int ret; 25 enum MHD_Result ret;
26 (void)cls; /* Unused. Silent compiler warning. */ 26 (void) cls; /* Unused. Silent compiler warning. */
27 (void)url; /* Unused. Silent compiler warning. */ 27 (void) url; /* Unused. Silent compiler warning. */
28 (void)method; /* Unused. Silent compiler warning. */ 28 (void) method; /* Unused. Silent compiler warning. */
29 (void)version; /* Unused. Silent compiler warning. */ 29 (void) version; /* Unused. Silent compiler warning. */
30 (void)upload_data; /* Unused. Silent compiler warning. */ 30 (void) upload_data; /* Unused. Silent compiler warning. */
31 (void)upload_data_size; /* Unused. Silent compiler warning. */ 31 (void) upload_data_size; /* Unused. Silent compiler warning. */
32 (void)con_cls; /* Unused. Silent compiler warning. */ 32 (void) con_cls; /* Unused. Silent compiler warning. */
33 33
34 response = 34 response =
35 MHD_create_response_from_buffer (strlen (page), (void *) page, 35 MHD_create_response_from_buffer (strlen (page), (void *) page,
36 MHD_RESPMEM_PERSISTENT); 36 MHD_RESPMEM_PERSISTENT);
37 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 37 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
38 MHD_destroy_response (response); 38 MHD_destroy_response (response);
39 39
@@ -46,7 +46,8 @@ main (void)
46{ 46{
47 struct MHD_Daemon *daemon; 47 struct MHD_Daemon *daemon;
48 48
49 daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, 49 daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
50 PORT, NULL, NULL,
50 &answer_to_connection, NULL, MHD_OPTION_END); 51 &answer_to_connection, NULL, MHD_OPTION_END);
51 if (NULL == daemon) 52 if (NULL == daemon)
52 return 1; 53 return 1;
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index 8ef7c9fe..8618209f 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -15,11 +15,11 @@
15 15
16#ifdef _MSC_VER 16#ifdef _MSC_VER
17#ifndef strcasecmp 17#ifndef strcasecmp
18#define strcasecmp(a,b) _stricmp((a),(b)) 18#define strcasecmp(a,b) _stricmp ((a),(b))
19#endif /* !strcasecmp */ 19#endif /* !strcasecmp */
20#endif /* _MSC_VER */ 20#endif /* _MSC_VER */
21 21
22#if defined(_MSC_VER) && _MSC_VER+0 <= 1800 22#if defined(_MSC_VER) && _MSC_VER + 0 <= 1800
23/* Substitution is OK while return value is not used */ 23/* Substitution is OK while return value is not used */
24#define snprintf _snprintf 24#define snprintf _snprintf
25#endif 25#endif
@@ -29,10 +29,10 @@
29#define MAXCLIENTS 2 29#define MAXCLIENTS 2
30 30
31enum ConnectionType 31enum ConnectionType
32 { 32{
33 GET = 0, 33 GET = 0,
34 POST = 1 34 POST = 1
35 }; 35};
36 36
37static unsigned int nr_of_uploading_clients = 0; 37static unsigned int nr_of_uploading_clients = 0;
38 38
@@ -66,7 +66,8 @@ struct connection_info_struct
66}; 66};
67 67
68 68
69const char *askpage = "<html><body>\n\ 69const char *askpage =
70 "<html><body>\n\
70 Upload a file, please!<br>\n\ 71 Upload a file, please!<br>\n\
71 There are %u clients uploading at the moment.<br>\n\ 72 There are %u clients uploading at the moment.<br>\n\
72 <form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\ 73 <form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\
@@ -85,23 +86,23 @@ const char *fileexistspage =
85 "<html><body>This file already exists.</body></html>"; 86 "<html><body>This file already exists.</body></html>";
86const char *fileioerror = 87const char *fileioerror =
87 "<html><body>IO error writing to disk.</body></html>"; 88 "<html><body>IO error writing to disk.</body></html>";
88const char* const postprocerror = 89const char*const postprocerror =
89 "<html><head><title>Error</title></head><body>Error processing POST data</body></html>"; 90 "<html><head><title>Error</title></head><body>Error processing POST data</body></html>";
90 91
91 92
92static int 93static enum MHD_Result
93send_page (struct MHD_Connection *connection, 94send_page (struct MHD_Connection *connection,
94 const char *page, 95 const char *page,
95 int status_code) 96 int status_code)
96{ 97{
97 int ret; 98 enum MHD_Result ret;
98 struct MHD_Response *response; 99 struct MHD_Response *response;
99 100
100 response = 101 response =
101 MHD_create_response_from_buffer (strlen (page), 102 MHD_create_response_from_buffer (strlen (page),
102 (void *) page, 103 (void *) page,
103 MHD_RESPMEM_MUST_COPY); 104 MHD_RESPMEM_MUST_COPY);
104 if (!response) 105 if (! response)
105 return MHD_NO; 106 return MHD_NO;
106 MHD_add_response_header (response, 107 MHD_add_response_header (response,
107 MHD_HTTP_HEADER_CONTENT_TYPE, 108 MHD_HTTP_HEADER_CONTENT_TYPE,
@@ -115,7 +116,7 @@ send_page (struct MHD_Connection *connection,
115} 116}
116 117
117 118
118static int 119static enum MHD_Result
119iterate_post (void *coninfo_cls, 120iterate_post (void *coninfo_cls,
120 enum MHD_ValueKind kind, 121 enum MHD_ValueKind kind,
121 const char *key, 122 const char *key,
@@ -128,50 +129,50 @@ iterate_post (void *coninfo_cls,
128{ 129{
129 struct connection_info_struct *con_info = coninfo_cls; 130 struct connection_info_struct *con_info = coninfo_cls;
130 FILE *fp; 131 FILE *fp;
131 (void)kind; /* Unused. Silent compiler warning. */ 132 (void) kind; /* Unused. Silent compiler warning. */
132 (void)content_type; /* Unused. Silent compiler warning. */ 133 (void) content_type; /* Unused. Silent compiler warning. */
133 (void)transfer_encoding; /* Unused. Silent compiler warning. */ 134 (void) transfer_encoding; /* Unused. Silent compiler warning. */
134 (void)off; /* Unused. Silent compiler warning. */ 135 (void) off; /* Unused. Silent compiler warning. */
135 136
136 if (0 != strcmp (key, "file")) 137 if (0 != strcmp (key, "file"))
138 {
139 con_info->answerstring = servererrorpage;
140 con_info->answercode = MHD_HTTP_BAD_REQUEST;
141 return MHD_YES;
142 }
143
144 if (! con_info->fp)
145 {
146 if (0 != con_info->answercode) /* something went wrong */
147 return MHD_YES;
148 if (NULL != (fp = fopen (filename, "rb")))
137 { 149 {
138 con_info->answerstring = servererrorpage; 150 fclose (fp);
139 con_info->answercode = MHD_HTTP_BAD_REQUEST; 151 con_info->answerstring = fileexistspage;
152 con_info->answercode = MHD_HTTP_FORBIDDEN;
140 return MHD_YES; 153 return MHD_YES;
141 } 154 }
142 155 /* NOTE: This is technically a race with the 'fopen()' above,
143 if (! con_info->fp) 156 but there is no easy fix, short of moving to open(O_EXCL)
157 instead of using fopen(). For the example, we do not care. */
158 con_info->fp = fopen (filename, "ab");
159 if (! con_info->fp)
144 { 160 {
145 if (0 != con_info->answercode) /* something went wrong */ 161 con_info->answerstring = fileioerror;
146 return MHD_YES; 162 con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
147 if (NULL != (fp = fopen (filename, "rb"))) 163 return MHD_YES;
148 {
149 fclose (fp);
150 con_info->answerstring = fileexistspage;
151 con_info->answercode = MHD_HTTP_FORBIDDEN;
152 return MHD_YES;
153 }
154 /* NOTE: This is technically a race with the 'fopen()' above,
155 but there is no easy fix, short of moving to open(O_EXCL)
156 instead of using fopen(). For the example, we do not care. */
157 con_info->fp = fopen (filename, "ab");
158 if (!con_info->fp)
159 {
160 con_info->answerstring = fileioerror;
161 con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
162 return MHD_YES;
163 }
164 } 164 }
165 }
165 166
166 if (size > 0) 167 if (size > 0)
168 {
169 if (! fwrite (data, sizeof (char), size, con_info->fp))
167 { 170 {
168 if (! fwrite (data, sizeof (char), size, con_info->fp)) 171 con_info->answerstring = fileioerror;
169 { 172 con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
170 con_info->answerstring = fileioerror; 173 return MHD_YES;
171 con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
172 return MHD_YES;
173 }
174 } 174 }
175 }
175 176
176 return MHD_YES; 177 return MHD_YES;
177} 178}
@@ -184,31 +185,31 @@ request_completed (void *cls,
184 enum MHD_RequestTerminationCode toe) 185 enum MHD_RequestTerminationCode toe)
185{ 186{
186 struct connection_info_struct *con_info = *con_cls; 187 struct connection_info_struct *con_info = *con_cls;
187 (void)cls; /* Unused. Silent compiler warning. */ 188 (void) cls; /* Unused. Silent compiler warning. */
188 (void)connection; /* Unused. Silent compiler warning. */ 189 (void) connection; /* Unused. Silent compiler warning. */
189 (void)toe; /* Unused. Silent compiler warning. */ 190 (void) toe; /* Unused. Silent compiler warning. */
190 191
191 if (NULL == con_info) 192 if (NULL == con_info)
192 return; 193 return;
193 194
194 if (con_info->connectiontype == POST) 195 if (con_info->connectiontype == POST)
196 {
197 if (NULL != con_info->postprocessor)
195 { 198 {
196 if (NULL != con_info->postprocessor) 199 MHD_destroy_post_processor (con_info->postprocessor);
197 { 200 nr_of_uploading_clients--;
198 MHD_destroy_post_processor (con_info->postprocessor);
199 nr_of_uploading_clients--;
200 }
201
202 if (con_info->fp)
203 fclose (con_info->fp);
204 } 201 }
205 202
203 if (con_info->fp)
204 fclose (con_info->fp);
205 }
206
206 free (con_info); 207 free (con_info);
207 *con_cls = NULL; 208 *con_cls = NULL;
208} 209}
209 210
210 211
211static int 212static enum MHD_Result
212answer_to_connection (void *cls, 213answer_to_connection (void *cls,
213 struct MHD_Connection *connection, 214 struct MHD_Connection *connection,
214 const char *url, 215 const char *url,
@@ -218,109 +219,109 @@ answer_to_connection (void *cls,
218 size_t *upload_data_size, 219 size_t *upload_data_size,
219 void **con_cls) 220 void **con_cls)
220{ 221{
221 (void)cls; /* Unused. Silent compiler warning. */ 222 (void) cls; /* Unused. Silent compiler warning. */
222 (void)url; /* Unused. Silent compiler warning. */ 223 (void) url; /* Unused. Silent compiler warning. */
223 (void)version; /* Unused. Silent compiler warning. */ 224 (void) version; /* Unused. Silent compiler warning. */
224 225
225 if (NULL == *con_cls) 226 if (NULL == *con_cls)
226 { 227 {
227 /* First call, setup data structures */ 228 /* First call, setup data structures */
228 struct connection_info_struct *con_info; 229 struct connection_info_struct *con_info;
230
231 if (nr_of_uploading_clients >= MAXCLIENTS)
232 return send_page (connection,
233 busypage,
234 MHD_HTTP_SERVICE_UNAVAILABLE);
229 235
230 if (nr_of_uploading_clients >= MAXCLIENTS) 236 con_info = malloc (sizeof (struct connection_info_struct));
231 return send_page (connection, 237 if (NULL == con_info)
232 busypage, 238 return MHD_NO;
233 MHD_HTTP_SERVICE_UNAVAILABLE); 239 con_info->answercode = 0; /* none yet */
240 con_info->fp = NULL;
234 241
235 con_info = malloc (sizeof (struct connection_info_struct)); 242 if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST))
236 if (NULL == con_info) 243 {
244 con_info->postprocessor =
245 MHD_create_post_processor (connection,
246 POSTBUFFERSIZE,
247 &iterate_post,
248 (void *) con_info);
249
250 if (NULL == con_info->postprocessor)
251 {
252 free (con_info);
237 return MHD_NO; 253 return MHD_NO;
238 con_info->answercode = 0; /* none yet */ 254 }
239 con_info->fp = NULL;
240 255
241 if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) 256 nr_of_uploading_clients++;
242 {
243 con_info->postprocessor =
244 MHD_create_post_processor (connection,
245 POSTBUFFERSIZE,
246 &iterate_post,
247 (void *) con_info);
248 257
249 if (NULL == con_info->postprocessor) 258 con_info->connectiontype = POST;
250 { 259 }
251 free (con_info); 260 else
252 return MHD_NO; 261 {
253 } 262 con_info->connectiontype = GET;
263 }
254 264
255 nr_of_uploading_clients++; 265 *con_cls = (void *) con_info;
256 266
257 con_info->connectiontype = POST; 267 return MHD_YES;
258 } 268 }
259 else
260 {
261 con_info->connectiontype = GET;
262 }
263 269
264 *con_cls = (void *) con_info; 270 if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET))
271 {
272 /* We just return the standard form for uploads on all GET requests */
273 char buffer[1024];
274
275 snprintf (buffer,
276 sizeof (buffer),
277 askpage,
278 nr_of_uploading_clients);
279 return send_page (connection,
280 buffer,
281 MHD_HTTP_OK);
282 }
265 283
266 return MHD_YES; 284 if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST))
267 } 285 {
286 struct connection_info_struct *con_info = *con_cls;
268 287
269 if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET)) 288 if (0 != *upload_data_size)
270 { 289 {
271 /* We just return the standard form for uploads on all GET requests */ 290 /* Upload not yet done */
272 char buffer[1024]; 291 if (0 != con_info->answercode)
292 {
293 /* we already know the answer, skip rest of upload */
294 *upload_data_size = 0;
295 return MHD_YES;
296 }
297 if (MHD_YES !=
298 MHD_post_process (con_info->postprocessor,
299 upload_data,
300 *upload_data_size))
301 {
302 con_info->answerstring = postprocerror;
303 con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
304 }
305 *upload_data_size = 0;
273 306
274 snprintf (buffer, 307 return MHD_YES;
275 sizeof (buffer),
276 askpage,
277 nr_of_uploading_clients);
278 return send_page (connection,
279 buffer,
280 MHD_HTTP_OK);
281 } 308 }
282 309 /* Upload finished */
283 if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST)) 310 if (NULL != con_info->fp)
284 { 311 {
285 struct connection_info_struct *con_info = *con_cls; 312 fclose (con_info->fp);
286 313 con_info->fp = NULL;
287 if (0 != *upload_data_size)
288 {
289 /* Upload not yet done */
290 if (0 != con_info->answercode)
291 {
292 /* we already know the answer, skip rest of upload */
293 *upload_data_size = 0;
294 return MHD_YES;
295 }
296 if (MHD_YES !=
297 MHD_post_process (con_info->postprocessor,
298 upload_data,
299 *upload_data_size))
300 {
301 con_info->answerstring = postprocerror;
302 con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
303 }
304 *upload_data_size = 0;
305
306 return MHD_YES;
307 }
308 /* Upload finished */
309 if (NULL != con_info->fp)
310 {
311 fclose (con_info->fp);
312 con_info->fp = NULL;
313 }
314 if (0 == con_info->answercode)
315 {
316 /* No errors encountered, declare success */
317 con_info->answerstring = completepage;
318 con_info->answercode = MHD_HTTP_OK;
319 }
320 return send_page (connection,
321 con_info->answerstring,
322 con_info->answercode);
323 } 314 }
315 if (0 == con_info->answercode)
316 {
317 /* No errors encountered, declare success */
318 con_info->answerstring = completepage;
319 con_info->answercode = MHD_HTTP_OK;
320 }
321 return send_page (connection,
322 con_info->answerstring,
323 con_info->answercode);
324 }
324 325
325 /* Note a GET or a POST, generate error */ 326 /* Note a GET or a POST, generate error */
326 return send_page (connection, 327 return send_page (connection,
@@ -337,14 +338,15 @@ main ()
337 daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD, 338 daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD,
338 PORT, NULL, NULL, 339 PORT, NULL, NULL,
339 &answer_to_connection, NULL, 340 &answer_to_connection, NULL,
340 MHD_OPTION_NOTIFY_COMPLETED, &request_completed, NULL, 341 MHD_OPTION_NOTIFY_COMPLETED, &request_completed,
342 NULL,
341 MHD_OPTION_END); 343 MHD_OPTION_END);
342 if (NULL == daemon) 344 if (NULL == daemon)
343 { 345 {
344 fprintf (stderr, 346 fprintf (stderr,
345 "Failed to start daemon\n"); 347 "Failed to start daemon\n");
346 return 1; 348 return 1;
347 } 349 }
348 (void) getchar (); 350 (void) getchar ();
349 MHD_stop_daemon (daemon); 351 MHD_stop_daemon (daemon);
350 return 0; 352 return 0;
diff --git a/doc/examples/logging.c b/doc/examples/logging.c
index 239fbe7d..22ff7e62 100644
--- a/doc/examples/logging.c
+++ b/doc/examples/logging.c
@@ -14,28 +14,28 @@
14#define PORT 8888 14#define PORT 8888
15 15
16 16
17static int 17static enum MHD_Result
18print_out_key (void *cls, enum MHD_ValueKind kind, const char *key, 18print_out_key (void *cls, enum MHD_ValueKind kind, const char *key,
19 const char *value) 19 const char *value)
20{ 20{
21 (void)cls; /* Unused. Silent compiler warning. */ 21 (void) cls; /* Unused. Silent compiler warning. */
22 (void)kind; /* Unused. Silent compiler warning. */ 22 (void) kind; /* Unused. Silent compiler warning. */
23 printf ("%s: %s\n", key, value); 23 printf ("%s: %s\n", key, value);
24 return MHD_YES; 24 return MHD_YES;
25} 25}
26 26
27 27
28static int 28static enum MHD_Result
29answer_to_connection (void *cls, struct MHD_Connection *connection, 29answer_to_connection (void *cls, struct MHD_Connection *connection,
30 const char *url, const char *method, 30 const char *url, const char *method,
31 const char *version, const char *upload_data, 31 const char *version, const char *upload_data,
32 size_t *upload_data_size, void **con_cls) 32 size_t *upload_data_size, void **con_cls)
33{ 33{
34 (void)cls; /* Unused. Silent compiler warning. */ 34 (void) cls; /* Unused. Silent compiler warning. */
35 (void)version; /* Unused. Silent compiler warning. */ 35 (void) version; /* Unused. Silent compiler warning. */
36 (void)upload_data; /* Unused. Silent compiler warning. */ 36 (void) upload_data; /* Unused. Silent compiler warning. */
37 (void)upload_data_size; /* Unused. Silent compiler warning. */ 37 (void) upload_data_size; /* Unused. Silent compiler warning. */
38 (void)con_cls; /* Unused. Silent compiler warning. */ 38 (void) con_cls; /* Unused. Silent compiler warning. */
39 printf ("New %s request for %s using version %s\n", method, url, version); 39 printf ("New %s request for %s using version %s\n", method, url, version);
40 40
41 MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key, 41 MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key,
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index 391f86f6..f1cf939c 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -19,7 +19,7 @@
19#define FILENAME "picture.png" 19#define FILENAME "picture.png"
20#define MIMETYPE "image/png" 20#define MIMETYPE "image/png"
21 21
22static int 22static enum MHD_Result
23answer_to_connection (void *cls, struct MHD_Connection *connection, 23answer_to_connection (void *cls, struct MHD_Connection *connection,
24 const char *url, const char *method, 24 const char *url, const char *method,
25 const char *version, const char *upload_data, 25 const char *version, const char *upload_data,
@@ -27,43 +27,43 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
27{ 27{
28 struct MHD_Response *response; 28 struct MHD_Response *response;
29 int fd; 29 int fd;
30 int ret; 30 enum MHD_Result ret;
31 struct stat sbuf; 31 struct stat sbuf;
32 (void)cls; /* Unused. Silent compiler warning. */ 32 (void) cls; /* Unused. Silent compiler warning. */
33 (void)url; /* Unused. Silent compiler warning. */ 33 (void) url; /* Unused. Silent compiler warning. */
34 (void)version; /* Unused. Silent compiler warning. */ 34 (void) version; /* Unused. Silent compiler warning. */
35 (void)upload_data; /* Unused. Silent compiler warning. */ 35 (void) upload_data; /* Unused. Silent compiler warning. */
36 (void)upload_data_size; /* Unused. Silent compiler warning. */ 36 (void) upload_data_size; /* Unused. Silent compiler warning. */
37 (void)con_cls; /* Unused. Silent compiler warning. */ 37 (void) con_cls; /* Unused. Silent compiler warning. */
38 38
39 if (0 != strcmp (method, "GET")) 39 if (0 != strcmp (method, "GET"))
40 return MHD_NO; 40 return MHD_NO;
41 41
42 if ( (-1 == (fd = open (FILENAME, O_RDONLY))) || 42 if ( (-1 == (fd = open (FILENAME, O_RDONLY))) ||
43 (0 != fstat (fd, &sbuf)) ) 43 (0 != fstat (fd, &sbuf)) )
44 { 44 {
45 const char *errorstr = 45 const char *errorstr =
46 "<html><body>An internal server error has occurred!\ 46 "<html><body>An internal server error has occurred!\
47 </body></html>"; 47 </body></html>";
48 /* error accessing file */ 48 /* error accessing file */
49 if (fd != -1) 49 if (fd != -1)
50 (void) close (fd); 50 (void) close (fd);
51 response = 51 response =
52 MHD_create_response_from_buffer (strlen (errorstr), 52 MHD_create_response_from_buffer (strlen (errorstr),
53 (void *) errorstr, 53 (void *) errorstr,
54 MHD_RESPMEM_PERSISTENT); 54 MHD_RESPMEM_PERSISTENT);
55 if (NULL != response) 55 if (NULL != response)
56 { 56 {
57 ret = 57 ret =
58 MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, 58 MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR,
59 response); 59 response);
60 MHD_destroy_response (response); 60 MHD_destroy_response (response);
61 61
62 return ret; 62 return ret;
63 }
64 else
65 return MHD_NO;
66 } 63 }
64 else
65 return MHD_NO;
66 }
67 response = 67 response =
68 MHD_create_response_from_fd_at_offset64 (sbuf.st_size, fd, 0); 68 MHD_create_response_from_fd_at_offset64 (sbuf.st_size, fd, 0);
69 MHD_add_response_header (response, "Content-Type", MIMETYPE); 69 MHD_add_response_header (response, "Content-Type", MIMETYPE);
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 139dcbc8..6d6cf5ba 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -11,7 +11,7 @@
11#include <time.h> 11#include <time.h>
12#include <microhttpd.h> 12#include <microhttpd.h>
13 13
14#if defined _WIN32 && !defined(__MINGW64_VERSION_MAJOR) 14#if defined _WIN32 && ! defined(__MINGW64_VERSION_MAJOR)
15static int 15static int
16asprintf (char **resultp, const char *format, ...) 16asprintf (char **resultp, const char *format, ...)
17{ 17{
@@ -32,7 +32,7 @@ asprintf (char **resultp, const char *format, ...)
32 if (result != NULL) 32 if (result != NULL)
33 { 33 {
34 int len2 = _vscprintf ((char *) format, argptr); 34 int len2 = _vscprintf ((char *) format, argptr);
35 if (len2 != len - 1 || len2 <= 0) 35 if ((len2 != len - 1) || (len2 <= 0))
36 { 36 {
37 free (result); 37 free (result);
38 result = NULL; 38 result = NULL;
@@ -49,37 +49,45 @@ asprintf (char **resultp, const char *format, ...)
49 va_end (argptr); 49 va_end (argptr);
50 return len; 50 return len;
51} 51}
52
53
52#endif 54#endif
53 55
54/** 56/**
55 * Invalid method page. 57 * Invalid method page.
56 */ 58 */
57#define METHOD_ERROR "<html><head><title>Illegal request</title></head><body>Go away.</body></html>" 59#define METHOD_ERROR \
60 "<html><head><title>Illegal request</title></head><body>Go away.</body></html>"
58 61
59/** 62/**
60 * Invalid URL page. 63 * Invalid URL page.
61 */ 64 */
62#define NOT_FOUND_ERROR "<html><head><title>Not found</title></head><body>Go away.</body></html>" 65#define NOT_FOUND_ERROR \
66 "<html><head><title>Not found</title></head><body>Go away.</body></html>"
63 67
64/** 68/**
65 * Front page. (/) 69 * Front page. (/)
66 */ 70 */
67#define MAIN_PAGE "<html><head><title>Welcome</title></head><body><form action=\"/2\" method=\"post\">What is your name? <input type=\"text\" name=\"v1\" value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>" 71#define MAIN_PAGE \
72 "<html><head><title>Welcome</title></head><body><form action=\"/2\" method=\"post\">What is your name? <input type=\"text\" name=\"v1\" value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>"
68 73
69/** 74/**
70 * Second page. (/2) 75 * Second page. (/2)
71 */ 76 */
72#define SECOND_PAGE "<html><head><title>Tell me more</title></head><body><a href=\"/\">previous</a> <form action=\"/S\" method=\"post\">%s, what is your job? <input type=\"text\" name=\"v2\" value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>" 77#define SECOND_PAGE \
78 "<html><head><title>Tell me more</title></head><body><a href=\"/\">previous</a> <form action=\"/S\" method=\"post\">%s, what is your job? <input type=\"text\" name=\"v2\" value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>"
73 79
74/** 80/**
75 * Second page (/S) 81 * Second page (/S)
76 */ 82 */
77#define SUBMIT_PAGE "<html><head><title>Ready to submit?</title></head><body><form action=\"/F\" method=\"post\"><a href=\"/2\">previous </a> <input type=\"hidden\" name=\"DONE\" value=\"yes\" /><input type=\"submit\" value=\"Submit\" /></body></html>" 83#define SUBMIT_PAGE \
84 "<html><head><title>Ready to submit?</title></head><body><form action=\"/F\" method=\"post\"><a href=\"/2\">previous </a> <input type=\"hidden\" name=\"DONE\" value=\"yes\" /><input type=\"submit\" value=\"Submit\" /></body></html>"
78 85
79/** 86/**
80 * Last page. 87 * Last page.
81 */ 88 */
82#define LAST_PAGE "<html><head><title>Thank you</title></head><body>Thank you.</body></html>" 89#define LAST_PAGE \
90 "<html><head><title>Thank you</title></head><body>Thank you.</body></html>"
83 91
84/** 92/**
85 * Name of our cookie. 93 * Name of our cookie.
@@ -159,8 +167,6 @@ struct Request
159static struct Session *sessions; 167static struct Session *sessions;
160 168
161 169
162
163
164/** 170/**
165 * Return the session handle for this connection, or 171 * Return the session handle for this connection, or
166 * create one if this is a new user. 172 * create one if this is a new user.
@@ -172,40 +178,40 @@ get_session (struct MHD_Connection *connection)
172 const char *cookie; 178 const char *cookie;
173 179
174 cookie = MHD_lookup_connection_value (connection, 180 cookie = MHD_lookup_connection_value (connection,
175 MHD_COOKIE_KIND, 181 MHD_COOKIE_KIND,
176 COOKIE_NAME); 182 COOKIE_NAME);
177 if (cookie != NULL) 183 if (cookie != NULL)
184 {
185 /* find existing session */
186 ret = sessions;
187 while (NULL != ret)
178 { 188 {
179 /* find existing session */ 189 if (0 == strcmp (cookie, ret->sid))
180 ret = sessions; 190 break;
181 while (NULL != ret) 191 ret = ret->next;
182 {
183 if (0 == strcmp (cookie, ret->sid))
184 break;
185 ret = ret->next;
186 }
187 if (NULL != ret)
188 {
189 ret->rc++;
190 return ret;
191 }
192 } 192 }
193 if (NULL != ret)
194 {
195 ret->rc++;
196 return ret;
197 }
198 }
193 /* create fresh session */ 199 /* create fresh session */
194 ret = calloc (1, sizeof (struct Session)); 200 ret = calloc (1, sizeof (struct Session));
195 if (NULL == ret) 201 if (NULL == ret)
196 { 202 {
197 fprintf (stderr, "calloc error: %s\n", strerror (errno)); 203 fprintf (stderr, "calloc error: %s\n", strerror (errno));
198 return NULL; 204 return NULL;
199 } 205 }
200 /* not a super-secure way to generate a random session ID, 206 /* not a super-secure way to generate a random session ID,
201 but should do for a simple example... */ 207 but should do for a simple example... */
202 snprintf (ret->sid, 208 snprintf (ret->sid,
203 sizeof (ret->sid), 209 sizeof (ret->sid),
204 "%X%X%X%X", 210 "%X%X%X%X",
205 (unsigned int) rand (), 211 (unsigned int) rand (),
206 (unsigned int) rand (), 212 (unsigned int) rand (),
207 (unsigned int) rand (), 213 (unsigned int) rand (),
208 (unsigned int) rand ()); 214 (unsigned int) rand ());
209 ret->rc++; 215 ret->rc++;
210 ret->start = time (NULL); 216 ret->start = time (NULL);
211 ret->next = sessions; 217 ret->next = sessions;
@@ -221,12 +227,12 @@ get_session (struct MHD_Connection *connection)
221 * @param mime mime type to use 227 * @param mime mime type to use
222 * @param session session information 228 * @param session session information
223 * @param connection connection to process 229 * @param connection connection to process
224 * @param MHD_YES on success, MHD_NO on failure 230 * @param #MHD_YES on success, #MHD_NO on failure
225 */ 231 */
226typedef int (*PageHandler)(const void *cls, 232typedef enum MHD_Result (*PageHandler)(const void *cls,
227 const char *mime, 233 const char *mime,
228 struct Session *session, 234 struct Session *session,
229 struct MHD_Connection *connection); 235 struct MHD_Connection *connection);
230 236
231 237
232/** 238/**
@@ -264,22 +270,22 @@ struct Page
264 */ 270 */
265static void 271static void
266add_session_cookie (struct Session *session, 272add_session_cookie (struct Session *session,
267 struct MHD_Response *response) 273 struct MHD_Response *response)
268{ 274{
269 char cstr[256]; 275 char cstr[256];
270 snprintf (cstr, 276 snprintf (cstr,
271 sizeof (cstr), 277 sizeof (cstr),
272 "%s=%s", 278 "%s=%s",
273 COOKIE_NAME, 279 COOKIE_NAME,
274 session->sid); 280 session->sid);
275 if (MHD_NO == 281 if (MHD_NO ==
276 MHD_add_response_header (response, 282 MHD_add_response_header (response,
277 MHD_HTTP_HEADER_SET_COOKIE, 283 MHD_HTTP_HEADER_SET_COOKIE,
278 cstr)) 284 cstr))
279 { 285 {
280 fprintf (stderr, 286 fprintf (stderr,
281 "Failed to set session cookie header!\n"); 287 "Failed to set session cookie header!\n");
282 } 288 }
283} 289}
284 290
285 291
@@ -292,27 +298,27 @@ add_session_cookie (struct Session *session,
292 * @param session session handle 298 * @param session session handle
293 * @param connection connection to use 299 * @param connection connection to use
294 */ 300 */
295static int 301static enum MHD_Result
296serve_simple_form (const void *cls, 302serve_simple_form (const void *cls,
297 const char *mime, 303 const char *mime,
298 struct Session *session, 304 struct Session *session,
299 struct MHD_Connection *connection) 305 struct MHD_Connection *connection)
300{ 306{
301 int ret; 307 enum MHD_Result ret;
302 const char *form = cls; 308 const char *form = cls;
303 struct MHD_Response *response; 309 struct MHD_Response *response;
304 310
305 /* return static form */ 311 /* return static form */
306 response = MHD_create_response_from_buffer (strlen (form), 312 response = MHD_create_response_from_buffer (strlen (form),
307 (void *) form, 313 (void *) form,
308 MHD_RESPMEM_PERSISTENT); 314 MHD_RESPMEM_PERSISTENT);
309 add_session_cookie (session, response); 315 add_session_cookie (session, response);
310 MHD_add_response_header (response, 316 MHD_add_response_header (response,
311 MHD_HTTP_HEADER_CONTENT_ENCODING, 317 MHD_HTTP_HEADER_CONTENT_ENCODING,
312 mime); 318 mime);
313 ret = MHD_queue_response (connection, 319 ret = MHD_queue_response (connection,
314 MHD_HTTP_OK, 320 MHD_HTTP_OK,
315 response); 321 response);
316 MHD_destroy_response (response); 322 MHD_destroy_response (response);
317 return ret; 323 return ret;
318} 324}
@@ -326,35 +332,35 @@ serve_simple_form (const void *cls,
326 * @param session session handle 332 * @param session session handle
327 * @param connection connection to use 333 * @param connection connection to use
328 */ 334 */
329static int 335static enum MHD_Result
330fill_v1_form (const void *cls, 336fill_v1_form (const void *cls,
331 const char *mime, 337 const char *mime,
332 struct Session *session, 338 struct Session *session,
333 struct MHD_Connection *connection) 339 struct MHD_Connection *connection)
334{ 340{
335 int ret; 341 enum MHD_Result ret;
336 const char *form = cls; 342 const char *form = cls;
337 char *reply; 343 char *reply;
338 struct MHD_Response *response; 344 struct MHD_Response *response;
339 345
340 if (-1 == asprintf (&reply, 346 if (-1 == asprintf (&reply,
341 form, 347 form,
342 session->value_1)) 348 session->value_1))
343 { 349 {
344 /* oops */ 350 /* oops */
345 return MHD_NO; 351 return MHD_NO;
346 } 352 }
347 /* return static form */ 353 /* return static form */
348 response = MHD_create_response_from_buffer (strlen (reply), 354 response = MHD_create_response_from_buffer (strlen (reply),
349 (void *) reply, 355 (void *) reply,
350 MHD_RESPMEM_MUST_FREE); 356 MHD_RESPMEM_MUST_FREE);
351 add_session_cookie (session, response); 357 add_session_cookie (session, response);
352 MHD_add_response_header (response, 358 MHD_add_response_header (response,
353 MHD_HTTP_HEADER_CONTENT_ENCODING, 359 MHD_HTTP_HEADER_CONTENT_ENCODING,
354 mime); 360 mime);
355 ret = MHD_queue_response (connection, 361 ret = MHD_queue_response (connection,
356 MHD_HTTP_OK, 362 MHD_HTTP_OK,
357 response); 363 response);
358 MHD_destroy_response (response); 364 MHD_destroy_response (response);
359 return ret; 365 return ret;
360} 366}
@@ -368,36 +374,36 @@ fill_v1_form (const void *cls,
368 * @param session session handle 374 * @param session session handle
369 * @param connection connection to use 375 * @param connection connection to use
370 */ 376 */
371static int 377static enum MHD_Result
372fill_v1_v2_form (const void *cls, 378fill_v1_v2_form (const void *cls,
373 const char *mime, 379 const char *mime,
374 struct Session *session, 380 struct Session *session,
375 struct MHD_Connection *connection) 381 struct MHD_Connection *connection)
376{ 382{
377 int ret; 383 enum MHD_Result ret;
378 const char *form = cls; 384 const char *form = cls;
379 char *reply; 385 char *reply;
380 struct MHD_Response *response; 386 struct MHD_Response *response;
381 387
382 if (-1 == asprintf (&reply, 388 if (-1 == asprintf (&reply,
383 form, 389 form,
384 session->value_1, 390 session->value_1,
385 session->value_2)) 391 session->value_2))
386 { 392 {
387 /* oops */ 393 /* oops */
388 return MHD_NO; 394 return MHD_NO;
389 } 395 }
390 /* return static form */ 396 /* return static form */
391 response = MHD_create_response_from_buffer (strlen (reply), 397 response = MHD_create_response_from_buffer (strlen (reply),
392 (void *) reply, 398 (void *) reply,
393 MHD_RESPMEM_MUST_FREE); 399 MHD_RESPMEM_MUST_FREE);
394 add_session_cookie (session, response); 400 add_session_cookie (session, response);
395 MHD_add_response_header (response, 401 MHD_add_response_header (response,
396 MHD_HTTP_HEADER_CONTENT_ENCODING, 402 MHD_HTTP_HEADER_CONTENT_ENCODING,
397 mime); 403 mime);
398 ret = MHD_queue_response (connection, 404 ret = MHD_queue_response (connection,
399 MHD_HTTP_OK, 405 MHD_HTTP_OK,
400 response); 406 response);
401 MHD_destroy_response (response); 407 MHD_destroy_response (response);
402 return ret; 408 return ret;
403} 409}
@@ -411,27 +417,27 @@ fill_v1_v2_form (const void *cls,
411 * @param session session handle 417 * @param session session handle
412 * @param connection connection to use 418 * @param connection connection to use
413 */ 419 */
414static int 420static enum MHD_Result
415not_found_page (const void *cls, 421not_found_page (const void *cls,
416 const char *mime, 422 const char *mime,
417 struct Session *session, 423 struct Session *session,
418 struct MHD_Connection *connection) 424 struct MHD_Connection *connection)
419{ 425{
420 int ret; 426 enum MHD_Result ret;
421 struct MHD_Response *response; 427 struct MHD_Response *response;
422 (void)cls; /* Unused. Silent compiler warning. */ 428 (void) cls; /* Unused. Silent compiler warning. */
423 (void)session; /* Unused. Silent compiler warning. */ 429 (void) session; /* Unused. Silent compiler warning. */
424 430
425 /* unsupported HTTP method */ 431 /* unsupported HTTP method */
426 response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR), 432 response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR),
427 (void *) NOT_FOUND_ERROR, 433 (void *) NOT_FOUND_ERROR,
428 MHD_RESPMEM_PERSISTENT); 434 MHD_RESPMEM_PERSISTENT);
429 ret = MHD_queue_response (connection, 435 ret = MHD_queue_response (connection,
430 MHD_HTTP_NOT_FOUND, 436 MHD_HTTP_NOT_FOUND,
431 response); 437 response);
432 MHD_add_response_header (response, 438 MHD_add_response_header (response,
433 MHD_HTTP_HEADER_CONTENT_ENCODING, 439 MHD_HTTP_HEADER_CONTENT_ENCODING,
434 mime); 440 mime);
435 MHD_destroy_response (response); 441 MHD_destroy_response (response);
436 return ret; 442 return ret;
437} 443}
@@ -440,15 +446,13 @@ not_found_page (const void *cls,
440/** 446/**
441 * List of all pages served by this HTTP server. 447 * List of all pages served by this HTTP server.
442 */ 448 */
443static struct Page pages[] = 449static struct Page pages[] = {
444 { 450 { "/", "text/html", &fill_v1_form, MAIN_PAGE },
445 { "/", "text/html", &fill_v1_form, MAIN_PAGE }, 451 { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE },
446 { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE }, 452 { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE },
447 { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE }, 453 { "/F", "text/html", &serve_simple_form, LAST_PAGE },
448 { "/F", "text/html", &serve_simple_form, LAST_PAGE }, 454 { NULL, NULL, &not_found_page, NULL } /* 404 */
449 { NULL, NULL, &not_found_page, NULL } /* 404 */ 455};
450 };
451
452 456
453 457
454/** 458/**
@@ -470,53 +474,53 @@ static struct Page pages[] =
470 * @return MHD_YES to continue iterating, 474 * @return MHD_YES to continue iterating,
471 * MHD_NO to abort the iteration 475 * MHD_NO to abort the iteration
472 */ 476 */
473static int 477static enum MHD_Result
474post_iterator (void *cls, 478post_iterator (void *cls,
475 enum MHD_ValueKind kind, 479 enum MHD_ValueKind kind,
476 const char *key, 480 const char *key,
477 const char *filename, 481 const char *filename,
478 const char *content_type, 482 const char *content_type,
479 const char *transfer_encoding, 483 const char *transfer_encoding,
480 const char *data, uint64_t off, size_t size) 484 const char *data, uint64_t off, size_t size)
481{ 485{
482 struct Request *request = cls; 486 struct Request *request = cls;
483 struct Session *session = request->session; 487 struct Session *session = request->session;
484 (void)kind; /* Unused. Silent compiler warning. */ 488 (void) kind; /* Unused. Silent compiler warning. */
485 (void)filename; /* Unused. Silent compiler warning. */ 489 (void) filename; /* Unused. Silent compiler warning. */
486 (void)content_type; /* Unused. Silent compiler warning. */ 490 (void) content_type; /* Unused. Silent compiler warning. */
487 (void)transfer_encoding; /* Unused. Silent compiler warning. */ 491 (void) transfer_encoding; /* Unused. Silent compiler warning. */
488 492
489 if (0 == strcmp ("DONE", key)) 493 if (0 == strcmp ("DONE", key))
490 { 494 {
491 fprintf (stdout, 495 fprintf (stdout,
492 "Session `%s' submitted `%s', `%s'\n", 496 "Session `%s' submitted `%s', `%s'\n",
493 session->sid, 497 session->sid,
494 session->value_1, 498 session->value_1,
495 session->value_2); 499 session->value_2);
496 return MHD_YES; 500 return MHD_YES;
497 } 501 }
498 if (0 == strcmp ("v1", key)) 502 if (0 == strcmp ("v1", key))
499 { 503 {
500 if (size + off > sizeof(session->value_1)) 504 if (size + off > sizeof(session->value_1))
501 size = sizeof (session->value_1) - off; 505 size = sizeof (session->value_1) - off;
502 memcpy (&session->value_1[off], 506 memcpy (&session->value_1[off],
503 data, 507 data,
504 size); 508 size);
505 if (size + off < sizeof (session->value_1)) 509 if (size + off < sizeof (session->value_1))
506 session->value_1[size+off] = '\0'; 510 session->value_1[size + off] = '\0';
507 return MHD_YES; 511 return MHD_YES;
508 } 512 }
509 if (0 == strcmp ("v2", key)) 513 if (0 == strcmp ("v2", key))
510 { 514 {
511 if (size + off > sizeof(session->value_2)) 515 if (size + off > sizeof(session->value_2))
512 size = sizeof (session->value_2) - off; 516 size = sizeof (session->value_2) - off;
513 memcpy (&session->value_2[off], 517 memcpy (&session->value_2[off],
514 data, 518 data,
515 size); 519 size);
516 if (size + off < sizeof (session->value_2)) 520 if (size + off < sizeof (session->value_2))
517 session->value_2[size+off] = '\0'; 521 session->value_2[size + off] = '\0';
518 return MHD_YES; 522 return MHD_YES;
519 } 523 }
520 fprintf (stderr, "Unsupported form value `%s'\n", key); 524 fprintf (stderr, "Unsupported form value `%s'\n", key);
521 return MHD_YES; 525 return MHD_YES;
522} 526}
@@ -556,101 +560,101 @@ post_iterator (void *cls,
556 * MHS_NO if the socket must be closed due to a serious 560 * MHS_NO if the socket must be closed due to a serious
557 * error while handling the request 561 * error while handling the request
558 */ 562 */
559static int 563static enum MHD_Result
560create_response (void *cls, 564create_response (void *cls,
561 struct MHD_Connection *connection, 565 struct MHD_Connection *connection,
562 const char *url, 566 const char *url,
563 const char *method, 567 const char *method,
564 const char *version, 568 const char *version,
565 const char *upload_data, 569 const char *upload_data,
566 size_t *upload_data_size, 570 size_t *upload_data_size,
567 void **ptr) 571 void **ptr)
568{ 572{
569 struct MHD_Response *response; 573 struct MHD_Response *response;
570 struct Request *request; 574 struct Request *request;
571 struct Session *session; 575 struct Session *session;
572 int ret; 576 enum MHD_Result ret;
573 unsigned int i; 577 unsigned int i;
574 (void)cls; /* Unused. Silent compiler warning. */ 578 (void) cls; /* Unused. Silent compiler warning. */
575 (void)version; /* Unused. Silent compiler warning. */ 579 (void) version; /* Unused. Silent compiler warning. */
576 580
577 request = *ptr; 581 request = *ptr;
578 if (NULL == request) 582 if (NULL == request)
583 {
584 request = calloc (1, sizeof (struct Request));
585 if (NULL == request)
579 { 586 {
580 request = calloc (1, sizeof (struct Request)); 587 fprintf (stderr, "calloc error: %s\n", strerror (errno));
581 if (NULL == request) 588 return MHD_NO;
582 { 589 }
583 fprintf (stderr, "calloc error: %s\n", strerror (errno)); 590 *ptr = request;
584 return MHD_NO; 591 if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
585 } 592 {
586 *ptr = request; 593 request->pp = MHD_create_post_processor (connection, 1024,
587 if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) 594 &post_iterator, request);
588 { 595 if (NULL == request->pp)
589 request->pp = MHD_create_post_processor (connection, 1024, 596 {
590 &post_iterator, request); 597 fprintf (stderr, "Failed to setup post processor for `%s'\n",
591 if (NULL == request->pp) 598 url);
592 { 599 return MHD_NO; /* internal error */
593 fprintf (stderr, "Failed to setup post processor for `%s'\n", 600 }
594 url);
595 return MHD_NO; /* internal error */
596 }
597 }
598 return MHD_YES;
599 } 601 }
602 return MHD_YES;
603 }
600 if (NULL == request->session) 604 if (NULL == request->session)
605 {
606 request->session = get_session (connection);
607 if (NULL == request->session)
601 { 608 {
602 request->session = get_session (connection); 609 fprintf (stderr, "Failed to setup session for `%s'\n",
603 if (NULL == request->session) 610 url);
604 { 611 return MHD_NO; /* internal error */
605 fprintf (stderr, "Failed to setup session for `%s'\n",
606 url);
607 return MHD_NO; /* internal error */
608 }
609 } 612 }
613 }
610 session = request->session; 614 session = request->session;
611 session->start = time (NULL); 615 session->start = time (NULL);
612 if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) 616 if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
617 {
618 /* evaluate POST data */
619 MHD_post_process (request->pp,
620 upload_data,
621 *upload_data_size);
622 if (0 != *upload_data_size)
613 { 623 {
614 /* evaluate POST data */ 624 *upload_data_size = 0;
615 MHD_post_process (request->pp, 625 return MHD_YES;
616 upload_data,
617 *upload_data_size);
618 if (0 != *upload_data_size)
619 {
620 *upload_data_size = 0;
621 return MHD_YES;
622 }
623 /* done with POST data, serve response */
624 MHD_destroy_post_processor (request->pp);
625 request->pp = NULL;
626 method = MHD_HTTP_METHOD_GET; /* fake 'GET' */
627 if (NULL != request->post_url)
628 url = request->post_url;
629 } 626 }
627 /* done with POST data, serve response */
628 MHD_destroy_post_processor (request->pp);
629 request->pp = NULL;
630 method = MHD_HTTP_METHOD_GET; /* fake 'GET' */
631 if (NULL != request->post_url)
632 url = request->post_url;
633 }
630 634
631 if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || 635 if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
632 (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) 636 (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) )
633 { 637 {
634 /* find out which page to serve */ 638 /* find out which page to serve */
635 i=0; 639 i = 0;
636 while ( (pages[i].url != NULL) && 640 while ( (pages[i].url != NULL) &&
637 (0 != strcmp (pages[i].url, url)) ) 641 (0 != strcmp (pages[i].url, url)) )
638 i++; 642 i++;
639 ret = pages[i].handler (pages[i].handler_cls, 643 ret = pages[i].handler (pages[i].handler_cls,
640 pages[i].mime, 644 pages[i].mime,
641 session, connection); 645 session, connection);
642 if (ret != MHD_YES) 646 if (ret != MHD_YES)
643 fprintf (stderr, "Failed to create page for `%s'\n", 647 fprintf (stderr, "Failed to create page for `%s'\n",
644 url); 648 url);
645 return ret; 649 return ret;
646 } 650 }
647 /* unsupported HTTP method */ 651 /* unsupported HTTP method */
648 response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), 652 response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
649 (void *) METHOD_ERROR, 653 (void *) METHOD_ERROR,
650 MHD_RESPMEM_PERSISTENT); 654 MHD_RESPMEM_PERSISTENT);
651 ret = MHD_queue_response (connection, 655 ret = MHD_queue_response (connection,
652 MHD_HTTP_NOT_ACCEPTABLE, 656 MHD_HTTP_NOT_ACCEPTABLE,
653 response); 657 response);
654 MHD_destroy_response (response); 658 MHD_destroy_response (response);
655 return ret; 659 return ret;
656} 660}
@@ -667,14 +671,14 @@ create_response (void *cls,
667 */ 671 */
668static void 672static void
669request_completed_callback (void *cls, 673request_completed_callback (void *cls,
670 struct MHD_Connection *connection, 674 struct MHD_Connection *connection,
671 void **con_cls, 675 void **con_cls,
672 enum MHD_RequestTerminationCode toe) 676 enum MHD_RequestTerminationCode toe)
673{ 677{
674 struct Request *request = *con_cls; 678 struct Request *request = *con_cls;
675 (void)cls; /* Unused. Silent compiler warning. */ 679 (void) cls; /* Unused. Silent compiler warning. */
676 (void)connection; /* Unused. Silent compiler warning. */ 680 (void) connection; /* Unused. Silent compiler warning. */
677 (void)toe; /* Unused. Silent compiler warning. */ 681 (void) toe; /* Unused. Silent compiler warning. */
678 682
679 if (NULL == request) 683 if (NULL == request)
680 return; 684 return;
@@ -702,21 +706,21 @@ expire_sessions ()
702 prev = NULL; 706 prev = NULL;
703 pos = sessions; 707 pos = sessions;
704 while (NULL != pos) 708 while (NULL != pos)
709 {
710 next = pos->next;
711 if (now - pos->start > 60 * 60)
705 { 712 {
706 next = pos->next; 713 /* expire sessions after 1h */
707 if (now - pos->start > 60 * 60) 714 if (NULL == prev)
708 { 715 sessions = pos->next;
709 /* expire sessions after 1h */
710 if (NULL == prev)
711 sessions = pos->next;
712 else
713 prev->next = next;
714 free (pos);
715 }
716 else 716 else
717 prev = pos; 717 prev->next = next;
718 pos = next; 718 free (pos);
719 } 719 }
720 else
721 prev = pos;
722 pos = next;
723 }
720} 724}
721 725
722 726
@@ -737,48 +741,49 @@ main (int argc, char *const *argv)
737 MHD_UNSIGNED_LONG_LONG mhd_timeout; 741 MHD_UNSIGNED_LONG_LONG mhd_timeout;
738 742
739 if (argc != 2) 743 if (argc != 2)
740 { 744 {
741 printf ("%s PORT\n", argv[0]); 745 printf ("%s PORT\n", argv[0]);
742 return 1; 746 return 1;
743 } 747 }
744 /* initialize PRNG */ 748 /* initialize PRNG */
745 srand ((unsigned int) time (NULL)); 749 srand ((unsigned int) time (NULL));
746 d = MHD_start_daemon (MHD_USE_ERROR_LOG, 750 d = MHD_start_daemon (MHD_USE_ERROR_LOG,
747 atoi (argv[1]), 751 atoi (argv[1]),
748 NULL, NULL, 752 NULL, NULL,
749 &create_response, NULL, 753 &create_response, NULL,
750 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15, 754 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
751 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, 755 MHD_OPTION_NOTIFY_COMPLETED,
752 MHD_OPTION_END); 756 &request_completed_callback, NULL,
757 MHD_OPTION_END);
753 if (NULL == d) 758 if (NULL == d)
754 return 1; 759 return 1;
755 while (1) 760 while (1)
761 {
762 expire_sessions ();
763 max = 0;
764 FD_ZERO (&rs);
765 FD_ZERO (&ws);
766 FD_ZERO (&es);
767 if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
768 break; /* fatal internal error */
769 if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
756 { 770 {
757 expire_sessions (); 771 tv.tv_sec = mhd_timeout / 1000;
758 max = 0; 772 tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
759 FD_ZERO (&rs); 773 tvp = &tv;
760 FD_ZERO (&ws);
761 FD_ZERO (&es);
762 if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
763 break; /* fatal internal error */
764 if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
765 {
766 tv.tv_sec = mhd_timeout / 1000;
767 tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
768 tvp = &tv;
769 }
770 else
771 tvp = NULL;
772 if (-1 == select (max + 1, &rs, &ws, &es, tvp))
773 {
774 if (EINTR != errno)
775 fprintf (stderr,
776 "Aborting due to error during select: %s\n",
777 strerror (errno));
778 break;
779 }
780 MHD_run (d);
781 } 774 }
775 else
776 tvp = NULL;
777 if (-1 == select (max + 1, &rs, &ws, &es, tvp))
778 {
779 if (EINTR != errno)
780 fprintf (stderr,
781 "Aborting due to error during select: %s\n",
782 strerror (errno));
783 break;
784 }
785 MHD_run (d);
786 }
782 MHD_stop_daemon (d); 787 MHD_stop_daemon (d);
783 return 0; 788 return 0;
784} 789}
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
index a3bba94a..1e52e5dd 100644
--- a/doc/examples/simplepost.c
+++ b/doc/examples/simplepost.c
@@ -13,7 +13,7 @@
13#include <string.h> 13#include <string.h>
14#include <stdlib.h> 14#include <stdlib.h>
15 15
16#if defined(_MSC_VER) && _MSC_VER+0 <= 1800 16#if defined(_MSC_VER) && _MSC_VER + 0 <= 1800
17/* Substitution is OK while return value is not used */ 17/* Substitution is OK while return value is not used */
18#define snprintf _snprintf 18#define snprintf _snprintf
19#endif 19#endif
@@ -33,7 +33,8 @@ struct connection_info_struct
33 struct MHD_PostProcessor *postprocessor; 33 struct MHD_PostProcessor *postprocessor;
34}; 34};
35 35
36const char *askpage = "<html><body>\ 36const char *askpage =
37 "<html><body>\
37 What's your name, Sir?<br>\ 38 What's your name, Sir?<br>\
38 <form action=\"/namepost\" method=\"post\">\ 39 <form action=\"/namepost\" method=\"post\">\
39 <input name=\"name\" type=\"text\">\ 40 <input name=\"name\" type=\"text\">\
@@ -47,17 +48,17 @@ const char *errorpage =
47 "<html><body>This doesn't seem to be right.</body></html>"; 48 "<html><body>This doesn't seem to be right.</body></html>";
48 49
49 50
50static int 51static enum MHD_Result
51send_page (struct MHD_Connection *connection, const char *page) 52send_page (struct MHD_Connection *connection, const char *page)
52{ 53{
53 int ret; 54 enum MHD_Result ret;
54 struct MHD_Response *response; 55 struct MHD_Response *response;
55 56
56 57
57 response = 58 response =
58 MHD_create_response_from_buffer (strlen (page), (void *) page, 59 MHD_create_response_from_buffer (strlen (page), (void *) page,
59 MHD_RESPMEM_PERSISTENT); 60 MHD_RESPMEM_PERSISTENT);
60 if (!response) 61 if (! response)
61 return MHD_NO; 62 return MHD_NO;
62 63
63 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 64 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
@@ -67,135 +68,138 @@ send_page (struct MHD_Connection *connection, const char *page)
67} 68}
68 69
69 70
70static int 71static enum MHD_Result
71iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, 72iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
72 const char *filename, const char *content_type, 73 const char *filename, const char *content_type,
73 const char *transfer_encoding, const char *data, uint64_t off, 74 const char *transfer_encoding, const char *data, uint64_t off,
74 size_t size) 75 size_t size)
75{ 76{
76 struct connection_info_struct *con_info = coninfo_cls; 77 struct connection_info_struct *con_info = coninfo_cls;
77 (void)kind; /* Unused. Silent compiler warning. */ 78 (void) kind; /* Unused. Silent compiler warning. */
78 (void)filename; /* Unused. Silent compiler warning. */ 79 (void) filename; /* Unused. Silent compiler warning. */
79 (void)content_type; /* Unused. Silent compiler warning. */ 80 (void) content_type; /* Unused. Silent compiler warning. */
80 (void)transfer_encoding; /* Unused. Silent compiler warning. */ 81 (void) transfer_encoding; /* Unused. Silent compiler warning. */
81 (void)off; /* Unused. Silent compiler warning. */ 82 (void) off; /* Unused. Silent compiler warning. */
82 83
83 if (0 == strcmp (key, "name")) 84 if (0 == strcmp (key, "name"))
85 {
86 if ((size > 0) && (size <= MAXNAMESIZE))
84 { 87 {
85 if ((size > 0) && (size <= MAXNAMESIZE)) 88 char *answerstring;
86 { 89 answerstring = malloc (MAXANSWERSIZE);
87 char *answerstring; 90 if (! answerstring)
88 answerstring = malloc (MAXANSWERSIZE); 91 return MHD_NO;
89 if (!answerstring)
90 return MHD_NO;
91
92 snprintf (answerstring, MAXANSWERSIZE, greetingpage, data);
93 con_info->answerstring = answerstring;
94 }
95 else
96 con_info->answerstring = NULL;
97 92
98 return MHD_NO; 93 snprintf (answerstring, MAXANSWERSIZE, greetingpage, data);
94 con_info->answerstring = answerstring;
99 } 95 }
96 else
97 con_info->answerstring = NULL;
98
99 return MHD_NO;
100 }
100 101
101 return MHD_YES; 102 return MHD_YES;
102} 103}
103 104
105
104static void 106static void
105request_completed (void *cls, struct MHD_Connection *connection, 107request_completed (void *cls, struct MHD_Connection *connection,
106 void **con_cls, enum MHD_RequestTerminationCode toe) 108 void **con_cls, enum MHD_RequestTerminationCode toe)
107{ 109{
108 struct connection_info_struct *con_info = *con_cls; 110 struct connection_info_struct *con_info = *con_cls;
109 (void)cls; /* Unused. Silent compiler warning. */ 111 (void) cls; /* Unused. Silent compiler warning. */
110 (void)connection; /* Unused. Silent compiler warning. */ 112 (void) connection; /* Unused. Silent compiler warning. */
111 (void)toe; /* Unused. Silent compiler warning. */ 113 (void) toe; /* Unused. Silent compiler warning. */
112 114
113 if (NULL == con_info) 115 if (NULL == con_info)
114 return; 116 return;
115 117
116 if (con_info->connectiontype == POST) 118 if (con_info->connectiontype == POST)
117 { 119 {
118 MHD_destroy_post_processor (con_info->postprocessor); 120 MHD_destroy_post_processor (con_info->postprocessor);
119 if (con_info->answerstring) 121 if (con_info->answerstring)
120 free (con_info->answerstring); 122 free (con_info->answerstring);
121 } 123 }
122 124
123 free (con_info); 125 free (con_info);
124 *con_cls = NULL; 126 *con_cls = NULL;
125} 127}
126 128
127 129
128static int 130static enum MHD_Result
129answer_to_connection (void *cls, struct MHD_Connection *connection, 131answer_to_connection (void *cls, struct MHD_Connection *connection,
130 const char *url, const char *method, 132 const char *url, const char *method,
131 const char *version, const char *upload_data, 133 const char *version, const char *upload_data,
132 size_t *upload_data_size, void **con_cls) 134 size_t *upload_data_size, void **con_cls)
133{ 135{
134 (void)cls; /* Unused. Silent compiler warning. */ 136 (void) cls; /* Unused. Silent compiler warning. */
135 (void)url; /* Unused. Silent compiler warning. */ 137 (void) url; /* Unused. Silent compiler warning. */
136 (void)version; /* Unused. Silent compiler warning. */ 138 (void) version; /* Unused. Silent compiler warning. */
137 139
138 if (NULL == *con_cls) 140 if (NULL == *con_cls)
139 { 141 {
140 struct connection_info_struct *con_info; 142 struct connection_info_struct *con_info;
141 143
142 con_info = malloc (sizeof (struct connection_info_struct)); 144 con_info = malloc (sizeof (struct connection_info_struct));
143 if (NULL == con_info) 145 if (NULL == con_info)
144 return MHD_NO; 146 return MHD_NO;
145 con_info->answerstring = NULL; 147 con_info->answerstring = NULL;
146 148
147 if (0 == strcmp (method, "POST")) 149 if (0 == strcmp (method, "POST"))
148 { 150 {
149 con_info->postprocessor = 151 con_info->postprocessor =
150 MHD_create_post_processor (connection, POSTBUFFERSIZE, 152 MHD_create_post_processor (connection, POSTBUFFERSIZE,
151 iterate_post, (void *) con_info); 153 iterate_post, (void *) con_info);
152 154
153 if (NULL == con_info->postprocessor) 155 if (NULL == con_info->postprocessor)
154 { 156 {
155 free (con_info); 157 free (con_info);
156 return MHD_NO; 158 return MHD_NO;
157 } 159 }
158 160
159 con_info->connectiontype = POST; 161 con_info->connectiontype = POST;
160 } 162 }
161 else 163 else
162 con_info->connectiontype = GET; 164 con_info->connectiontype = GET;
163 165
164 *con_cls = (void *) con_info; 166 *con_cls = (void *) con_info;
165 167
166 return MHD_YES; 168 return MHD_YES;
167 } 169 }
168 170
169 if (0 == strcmp (method, "GET")) 171 if (0 == strcmp (method, "GET"))
170 { 172 {
171 return send_page (connection, askpage); 173 return send_page (connection, askpage);
172 } 174 }
173 175
174 if (0 == strcmp (method, "POST")) 176 if (0 == strcmp (method, "POST"))
177 {
178 struct connection_info_struct *con_info = *con_cls;
179
180 if (*upload_data_size != 0)
175 { 181 {
176 struct connection_info_struct *con_info = *con_cls; 182 MHD_post_process (con_info->postprocessor, upload_data,
177 183 *upload_data_size);
178 if (*upload_data_size != 0) 184 *upload_data_size = 0;
179 { 185
180 MHD_post_process (con_info->postprocessor, upload_data, 186 return MHD_YES;
181 *upload_data_size);
182 *upload_data_size = 0;
183
184 return MHD_YES;
185 }
186 else if (NULL != con_info->answerstring)
187 return send_page (connection, con_info->answerstring);
188 } 187 }
188 else if (NULL != con_info->answerstring)
189 return send_page (connection, con_info->answerstring);
190 }
189 191
190 return send_page (connection, errorpage); 192 return send_page (connection, errorpage);
191} 193}
192 194
195
193int 196int
194main () 197main ()
195{ 198{
196 struct MHD_Daemon *daemon; 199 struct MHD_Daemon *daemon;
197 200
198 daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, PORT, NULL, NULL, 201 daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
202 PORT, NULL, NULL,
199 &answer_to_connection, NULL, 203 &answer_to_connection, NULL,
200 MHD_OPTION_NOTIFY_COMPLETED, request_completed, 204 MHD_OPTION_NOTIFY_COMPLETED, request_completed,
201 NULL, MHD_OPTION_END); 205 NULL, MHD_OPTION_END);
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
index 43b41bf1..ca8187bc 100644
--- a/doc/examples/tlsauthentication.c
+++ b/doc/examples/tlsauthentication.c
@@ -38,20 +38,20 @@ string_to_base64 (const char *message)
38 return NULL; 38 return NULL;
39 tmp[0] = 0; 39 tmp[0] = 0;
40 for (i = 0; i < length; i += 3) 40 for (i = 0; i < length; i += 3)
41 { 41 {
42 l = (((unsigned long) message[i]) << 16) 42 l = (((unsigned long) message[i]) << 16)
43 | (((i + 1) < length) ? (((unsigned long) message[i + 1]) << 8) : 0) 43 | (((i + 1) < length) ? (((unsigned long) message[i + 1]) << 8) : 0)
44 | (((i + 2) < length) ? ((unsigned long) message[i + 2]) : 0); 44 | (((i + 2) < length) ? ((unsigned long) message[i + 2]) : 0);
45 45
46 46
47 strncat (tmp, &lookup[(l >> 18) & 0x3F], 1); 47 strncat (tmp, &lookup[(l >> 18) & 0x3F], 1);
48 strncat (tmp, &lookup[(l >> 12) & 0x3F], 1); 48 strncat (tmp, &lookup[(l >> 12) & 0x3F], 1);
49 49
50 if (i + 1 < length) 50 if (i + 1 < length)
51 strncat (tmp, &lookup[(l >> 6) & 0x3F], 1); 51 strncat (tmp, &lookup[(l >> 6) & 0x3F], 1);
52 if (i + 2 < length) 52 if (i + 2 < length)
53 strncat (tmp, &lookup[l & 0x3F], 1); 53 strncat (tmp, &lookup[l & 0x3F], 1);
54 } 54 }
55 55
56 if (length % 3) 56 if (length % 3)
57 strncat (tmp, "===", 3 - length % 3); 57 strncat (tmp, "===", 3 - length % 3);
@@ -67,16 +67,16 @@ get_file_size (const char *filename)
67 67
68 fp = fopen (filename, "rb"); 68 fp = fopen (filename, "rb");
69 if (fp) 69 if (fp)
70 { 70 {
71 long size; 71 long size;
72 72
73 if ((0 != fseek (fp, 0, SEEK_END)) || (-1 == (size = ftell (fp)))) 73 if ((0 != fseek (fp, 0, SEEK_END)) || (-1 == (size = ftell (fp))))
74 size = 0; 74 size = 0;
75 75
76 fclose (fp); 76 fclose (fp);
77 77
78 return size; 78 return size;
79 } 79 }
80 else 80 else
81 return 0; 81 return 0;
82} 82}
@@ -99,58 +99,58 @@ load_file (const char *filename)
99 99
100 buffer = malloc (size + 1); 100 buffer = malloc (size + 1);
101 if (! buffer) 101 if (! buffer)
102 { 102 {
103 fclose (fp); 103 fclose (fp);
104 return NULL; 104 return NULL;
105 } 105 }
106 buffer[size] = '\0'; 106 buffer[size] = '\0';
107 107
108 if (size != (long)fread (buffer, 1, size, fp)) 108 if (size != (long) fread (buffer, 1, size, fp))
109 { 109 {
110 free (buffer); 110 free (buffer);
111 buffer = NULL; 111 buffer = NULL;
112 } 112 }
113 113
114 fclose (fp); 114 fclose (fp);
115 return buffer; 115 return buffer;
116} 116}
117 117
118 118
119static int 119static enum MHD_Result
120ask_for_authentication (struct MHD_Connection *connection, const char *realm) 120ask_for_authentication (struct MHD_Connection *connection, const char *realm)
121{ 121{
122 int ret; 122 enum MHD_Result ret;
123 struct MHD_Response *response; 123 struct MHD_Response *response;
124 char *headervalue; 124 char *headervalue;
125 size_t slen; 125 size_t slen;
126 const char *strbase = "Basic realm="; 126 const char *strbase = "Basic realm=";
127 127
128 response = MHD_create_response_from_buffer (0, NULL, 128 response = MHD_create_response_from_buffer (0, NULL,
129 MHD_RESPMEM_PERSISTENT); 129 MHD_RESPMEM_PERSISTENT);
130 if (!response) 130 if (! response)
131 return MHD_NO; 131 return MHD_NO;
132 132
133 slen = strlen (strbase) + strlen (realm) + 1; 133 slen = strlen (strbase) + strlen (realm) + 1;
134 if (NULL == (headervalue = malloc (slen))) 134 if (NULL == (headervalue = malloc (slen)))
135 return MHD_NO; 135 return MHD_NO;
136 snprintf (headervalue, 136 snprintf (headervalue,
137 slen, 137 slen,
138 "%s%s", 138 "%s%s",
139 strbase, 139 strbase,
140 realm); 140 realm);
141 ret = MHD_add_response_header (response, 141 ret = MHD_add_response_header (response,
142 "WWW-Authenticate", 142 "WWW-Authenticate",
143 headervalue); 143 headervalue);
144 free (headervalue); 144 free (headervalue);
145 if (! ret) 145 if (! ret)
146 { 146 {
147 MHD_destroy_response (response); 147 MHD_destroy_response (response);
148 return MHD_NO; 148 return MHD_NO;
149 } 149 }
150 150
151 ret = MHD_queue_response (connection, 151 ret = MHD_queue_response (connection,
152 MHD_HTTP_UNAUTHORIZED, 152 MHD_HTTP_UNAUTHORIZED,
153 response); 153 response);
154 MHD_destroy_response (response); 154 MHD_destroy_response (response);
155 return ret; 155 return ret;
156} 156}
@@ -159,7 +159,7 @@ ask_for_authentication (struct MHD_Connection *connection, const char *realm)
159static int 159static int
160is_authenticated (struct MHD_Connection *connection, 160is_authenticated (struct MHD_Connection *connection,
161 const char *username, 161 const char *username,
162 const char *password) 162 const char *password)
163{ 163{
164 const char *headervalue; 164 const char *headervalue;
165 char *expected_b64; 165 char *expected_b64;
@@ -180,10 +180,10 @@ is_authenticated (struct MHD_Connection *connection,
180 if (NULL == (expected = malloc (slen))) 180 if (NULL == (expected = malloc (slen)))
181 return 0; 181 return 0;
182 snprintf (expected, 182 snprintf (expected,
183 slen, 183 slen,
184 "%s:%s", 184 "%s:%s",
185 username, 185 username,
186 password); 186 password);
187 expected_b64 = string_to_base64 (expected); 187 expected_b64 = string_to_base64 (expected);
188 free (expected); 188 free (expected);
189 if (NULL == expected_b64) 189 if (NULL == expected_b64)
@@ -196,17 +196,17 @@ is_authenticated (struct MHD_Connection *connection,
196} 196}
197 197
198 198
199static int 199static enum MHD_Result
200secret_page (struct MHD_Connection *connection) 200secret_page (struct MHD_Connection *connection)
201{ 201{
202 int ret; 202 enum MHD_Result ret;
203 struct MHD_Response *response; 203 struct MHD_Response *response;
204 const char *page = "<html><body>A secret.</body></html>"; 204 const char *page = "<html><body>A secret.</body></html>";
205 205
206 response = 206 response =
207 MHD_create_response_from_buffer (strlen (page), (void *) page, 207 MHD_create_response_from_buffer (strlen (page), (void *) page,
208 MHD_RESPMEM_PERSISTENT); 208 MHD_RESPMEM_PERSISTENT);
209 if (!response) 209 if (! response)
210 return MHD_NO; 210 return MHD_NO;
211 211
212 ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 212 ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
@@ -216,27 +216,27 @@ secret_page (struct MHD_Connection *connection)
216} 216}
217 217
218 218
219static int 219static enum MHD_Result
220answer_to_connection (void *cls, struct MHD_Connection *connection, 220answer_to_connection (void *cls, struct MHD_Connection *connection,
221 const char *url, const char *method, 221 const char *url, const char *method,
222 const char *version, const char *upload_data, 222 const char *version, const char *upload_data,
223 size_t *upload_data_size, void **con_cls) 223 size_t *upload_data_size, void **con_cls)
224{ 224{
225 (void)cls; /* Unused. Silent compiler warning. */ 225 (void) cls; /* Unused. Silent compiler warning. */
226 (void)url; /* Unused. Silent compiler warning. */ 226 (void) url; /* Unused. Silent compiler warning. */
227 (void)version; /* Unused. Silent compiler warning. */ 227 (void) version; /* Unused. Silent compiler warning. */
228 (void)upload_data; /* Unused. Silent compiler warning. */ 228 (void) upload_data; /* Unused. Silent compiler warning. */
229 (void)upload_data_size; /* Unused. Silent compiler warning. */ 229 (void) upload_data_size; /* Unused. Silent compiler warning. */
230 230
231 if (0 != strcmp (method, "GET")) 231 if (0 != strcmp (method, "GET"))
232 return MHD_NO; 232 return MHD_NO;
233 if (NULL == *con_cls) 233 if (NULL == *con_cls)
234 { 234 {
235 *con_cls = connection; 235 *con_cls = connection;
236 return MHD_YES; 236 return MHD_YES;
237 } 237 }
238 238
239 if (!is_authenticated (connection, USER, PASSWORD)) 239 if (! is_authenticated (connection, USER, PASSWORD))
240 return ask_for_authentication (connection, REALM); 240 return ask_for_authentication (connection, REALM);
241 241
242 return secret_page (connection); 242 return secret_page (connection);
@@ -254,14 +254,14 @@ main ()
254 cert_pem = load_file (SERVERCERTFILE); 254 cert_pem = load_file (SERVERCERTFILE);
255 255
256 if ((key_pem == NULL) || (cert_pem == NULL)) 256 if ((key_pem == NULL) || (cert_pem == NULL))
257 { 257 {
258 printf ("The key/certificate files could not be read.\n"); 258 printf ("The key/certificate files could not be read.\n");
259 if (NULL != key_pem) 259 if (NULL != key_pem)
260 free (key_pem); 260 free (key_pem);
261 if (NULL != cert_pem) 261 if (NULL != cert_pem)
262 free (cert_pem); 262 free (cert_pem);
263 return 1; 263 return 1;
264 } 264 }
265 265
266 daemon = 266 daemon =
267 MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS, PORT, NULL, 267 MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS, PORT, NULL,
@@ -269,14 +269,14 @@ main ()
269 MHD_OPTION_HTTPS_MEM_KEY, key_pem, 269 MHD_OPTION_HTTPS_MEM_KEY, key_pem,
270 MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END); 270 MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END);
271 if (NULL == daemon) 271 if (NULL == daemon)
272 { 272 {
273 printf ("%s\n", cert_pem); 273 printf ("%s\n", cert_pem);
274 274
275 free (key_pem); 275 free (key_pem);
276 free (cert_pem); 276 free (cert_pem);
277 277
278 return 1; 278 return 1;
279 } 279 }
280 280
281 (void) getchar (); 281 (void) getchar ();
282 282
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 09ae691b..419cf44a 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1284,7 +1284,7 @@ Information about an MHD daemon.
1284@chapter Callback functions definition 1284@chapter Callback functions definition
1285 1285
1286 1286
1287@deftypefn {Function Pointer} int {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen) 1287@deftypefn {Function Pointer} enum MHD_Result {*MHD_AcceptPolicyCallback} (void *cls, const struct sockaddr * addr, socklen_t addrlen)
1288Invoked in the context of a connection to allow or deny a client to 1288Invoked in the context of a connection to allow or deny a client to
1289connect. This callback return @code{MHD_YES} if connection is allowed, 1289connect. This callback return @code{MHD_YES} if connection is allowed,
1290@code{MHD_NO} if not. 1290@code{MHD_NO} if not.
@@ -1300,7 +1300,7 @@ length of the address information.
1300@end deftypefn 1300@end deftypefn
1301 1301
1302 1302
1303@deftypefn {Function Pointer} int {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) 1303@deftypefn {Function Pointer} enum MHD_Result {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
1304Invoked in the context of a connection to answer a request from the 1304Invoked in the context of a connection to answer a request from the
1305client. This callback must call MHD functions (example: the 1305client. This callback must call MHD functions (example: the
1306@code{MHD_Response} ones) to provide content to give back to the client 1306@code{MHD_Response} ones) to provide content to give back to the client
@@ -1403,7 +1403,7 @@ reason for request termination see @code{MHD_OPTION_NOTIFY_COMPLETED}.
1403@end deftypefn 1403@end deftypefn
1404 1404
1405 1405
1406@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size) 1406@deftypefn {Function Pointer} enum MHD_Result {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size)
1407Iterator over key-value pairs. This iterator can be used to iterate 1407Iterator over key-value pairs. This iterator can be used to iterate
1408over all of the cookies, headers, or @code{POST}-data fields of a 1408over all of the cookies, headers, or @code{POST}-data fields of a
1409request, and also to iterate over the headers that have been added to a 1409request, and also to iterate over the headers that have been added to a
@@ -1440,7 +1440,7 @@ iteration.
1440@end deftypefn 1440@end deftypefn
1441 1441
1442 1442
1443@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max) 1443@deftypefn {Function Pointer} ssize_t {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max)
1444Callback used by MHD in order to obtain content. The callback has to 1444Callback used by MHD in order to obtain content. The callback has to
1445copy at most @var{max} bytes of content into @var{buf}. The total 1445copy at most @var{max} bytes of content into @var{buf}. The total
1446number of bytes that has been placed into @var{buf} should be returned. 1446number of bytes that has been placed into @var{buf} should be returned.
@@ -1496,7 +1496,7 @@ It should be used to free resources associated with the content reader.
1496@end deftypefn 1496@end deftypefn
1497 1497
1498 1498
1499@deftypefn {Function Pointer} int {*MHD_PostDataIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size) 1499@deftypefn {Function Pointer} enum MHD_Result {*MHD_PostDataIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *filename, const char *content_type, const char *transfer_encoding, const char *data, uint64_t off, size_t size)
1500Iterator over key-value pairs where the value maybe made available in 1500Iterator over key-value pairs where the value maybe made available in
1501increments and/or may not be zero-terminated. Used for processing 1501increments and/or may not be zero-terminated. Used for processing
1502@code{POST} data. 1502@code{POST} data.
@@ -1587,7 +1587,7 @@ Return @code{NULL} on error, handle to daemon on success.
1587@end deftypefun 1587@end deftypefun
1588 1588
1589 1589
1590@deftypefun int MHD_quiesce_daemon (struct MHD_Daemon *daemon) 1590@deftypefun MHD_socket MHD_quiesce_daemon (struct MHD_Daemon *daemon)
1591@cindex quiesce 1591@cindex quiesce
1592Stop accepting connections from the listening socket. Allows clients 1592Stop accepting connections from the listening socket. Allows clients
1593to continue processing, but stops accepting new connections. Note 1593to continue processing, but stops accepting new connections. Note
@@ -1613,7 +1613,7 @@ Shutdown an HTTP daemon.
1613@end deftypefun 1613@end deftypefun
1614 1614
1615 1615
1616@deftypefun int MHD_run (struct MHD_Daemon *daemon) 1616@deftypefun enum MHD_Result MHD_run (struct MHD_Daemon *daemon)
1617Run webserver operations (without blocking unless in client callbacks). 1617Run webserver operations (without blocking unless in client callbacks).
1618This method should be called by clients in combination with 1618This method should be called by clients in combination with
1619@code{MHD_get_fdset()} if the client-controlled @code{select}-method is used. 1619@code{MHD_get_fdset()} if the client-controlled @code{select}-method is used.
@@ -1634,7 +1634,7 @@ started with the right options for this call.
1634@end deftypefun 1634@end deftypefun
1635 1635
1636 1636
1637@deftypefun int MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set) 1637@deftypefun enum MHD_Result MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set)
1638Run webserver operations given sets of ready socket handles. 1638Run webserver operations given sets of ready socket handles.
1639@cindex select 1639@cindex select
1640 1640
@@ -1710,7 +1710,7 @@ to indicate further details about the error.
1710@chapter Implementing external @code{select} 1710@chapter Implementing external @code{select}
1711 1711
1712 1712
1713@deftypefun int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd) 1713@deftypefun enum MHD_Result MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd)
1714Obtain the @code{select()} sets for this daemon. The daemon's socket 1714Obtain the @code{select()} sets for this daemon. The daemon's socket
1715is added to @var{read_fd_set}. The list of currently existent 1715is added to @var{read_fd_set}. The list of currently existent
1716connections is scanned and their file descriptors added to the correct 1716connections is scanned and their file descriptors added to the correct
@@ -1736,12 +1736,12 @@ the right options for this call.
1736@end deftypefun 1736@end deftypefun
1737 1737
1738 1738
1739@deftypefun int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize) 1739@deftypefun enum MHD_Result MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, unsigned int fd_setsize)
1740Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application. 1740Like @code{MHD_get_fdset()}, except that you can manually specify the value of FD_SETSIZE used by your application.
1741@end deftypefun 1741@end deftypefun
1742 1742
1743 1743
1744@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout) 1744@deftypefun enum MHD_Result MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long *timeout)
1745@cindex timeout 1745@cindex timeout
1746Obtain timeout value for select for this daemon (only needed if 1746Obtain timeout value for select for this daemon (only needed if
1747connection timeout is used). The returned value is how many 1747connection timeout is used). The returned value is how many
@@ -1802,7 +1802,7 @@ would contain the string ``key''.
1802@end deftypefun 1802@end deftypefun
1803 1803
1804 1804
1805@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value) 1805@deftypefun enum MHD_Result MHD_set_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key, const char *value)
1806This function can be used to append an entry to 1806This function can be used to append an entry to
1807the list of HTTP headers of a connection (so that the 1807the list of HTTP headers of a connection (so that the
1808@code{MHD_get_connection_values function} will return 1808@code{MHD_get_connection_values function} will return
@@ -1884,7 +1884,7 @@ response and we finally destroy it only when the daemon shuts down.
1884@section Enqueuing a response 1884@section Enqueuing a response
1885 1885
1886 1886
1887@deftypefun int MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response) 1887@deftypefun enum MHD_Result MHD_queue_response (struct MHD_Connection *connection, unsigned int status_code, struct MHD_Response *response)
1888Queue a response to be transmitted to the client as soon as possible 1888Queue a response to be transmitted to the client as soon as possible
1889but only after MHD_AccessHandlerCallback returns. This function 1889but only after MHD_AccessHandlerCallback returns. This function
1890checks that it is legal to queue a response at this time for the 1890checks that it is legal to queue a response at this time for the
@@ -2148,7 +2148,7 @@ MHD_destroy_response(response);
2148@section Adding headers to a response 2148@section Adding headers to a response
2149 2149
2150 2150
2151@deftypefun int MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) 2151@deftypefun enum MHD_Result MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content)
2152Add a header line to the response. The strings referenced by 2152Add a header line to the response. The strings referenced by
2153@var{header} and @var{content} must be zero-terminated and they are 2153@var{header} and @var{content} must be zero-terminated and they are
2154duplicated into memory blocks embedded in @var{response}. 2154duplicated into memory blocks embedded in @var{response}.
@@ -2172,7 +2172,7 @@ memory allocation error).
2172@end deftypefun 2172@end deftypefun
2173 2173
2174 2174
2175@deftypefun int MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content) 2175@deftypefun enum MHD_Result MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content)
2176Add a footer line to the response. The strings referenced by 2176Add a footer line to the response. The strings referenced by
2177@var{footer} and @var{content} must be zero-terminated and they are 2177@var{footer} and @var{content} must be zero-terminated and they are
2178duplicated into memory blocks embedded in @var{response}. 2178duplicated into memory blocks embedded in @var{response}.
@@ -2190,7 +2190,7 @@ memory allocation error).
2190 2190
2191 2191
2192 2192
2193@deftypefun int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) 2193@deftypefun enum MHD_Result MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content)
2194Delete a header (or footer) line from the response. Return @code{MHD_NO} on error 2194Delete a header (or footer) line from the response. Return @code{MHD_NO} on error
2195(arguments are invalid or no such header known). 2195(arguments are invalid or no such header known).
2196@end deftypefun 2196@end deftypefun
@@ -2201,7 +2201,7 @@ Delete a header (or footer) line from the response. Return @code{MHD_NO} on err
2201@section Setting response options 2201@section Setting response options
2202 2202
2203 2203
2204@deftypefun int MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...) 2204@deftypefun enum MHD_Result MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags, ...)
2205Set special flags and options for a response. 2205Set special flags and options for a response.
2206 2206
2207Calling this functions sets the given flags and options for the response. 2207Calling this functions sets the given flags and options for the response.
@@ -2281,7 +2281,7 @@ a connection by queueing a response (using the
2281have been created with the following function: 2281have been created with the following function:
2282 2282
2283 2283
2284@deftypefun int MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls) 2284@deftypefun enum MHD_Result MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls)
2285Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}. 2285Create a response suitable for switching protocols. Returns @code{MHD_YES} on success. @code{upgrade_handler} must not be @code{NULL}.
2286 2286
2287When creating this type of response, the ``Connection: Upgrade'' 2287When creating this type of response, the ``Connection: Upgrade''
@@ -2322,7 +2322,7 @@ argument for calls to @code{MHD_upgrade_action}. Applications must eventually u
2322 2322
2323@end deftypefn 2323@end deftypefn
2324 2324
2325@deftypefun int MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...) 2325@deftypefun enum MHD_Result MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...)
2326Perform special operations related to upgraded connections. 2326Perform special operations related to upgraded connections.
2327 2327
2328@table @var 2328@table @var
@@ -2374,7 +2374,7 @@ Instead, applications using thread modes other than
2374@code{MHD_USE_THREAD_PER_CONNECTION} should use the 2374@code{MHD_USE_THREAD_PER_CONNECTION} should use the
2375following functions to perform flow control. 2375following functions to perform flow control.
2376 2376
2377@deftypefun int MHD_suspend_connection (struct MHD_Connection *connection) 2377@deftypefun enum MHD_Result MHD_suspend_connection (struct MHD_Connection *connection)
2378Suspend handling of network data for a given connection. This can 2378Suspend handling of network data for a given connection. This can
2379be used to dequeue a connection from MHD's event loop (external 2379be used to dequeue a connection from MHD's event loop (external
2380select, internal select or thread pool; not applicable to 2380select, internal select or thread pool; not applicable to
@@ -2408,7 +2408,7 @@ the connection to suspend
2408@end table 2408@end table
2409@end deftypefun 2409@end deftypefun
2410 2410
2411@deftypefun int MHD_resume_connection (struct MHD_Connection *connection) 2411@deftypefun enum MHD_Result MHD_resume_connection (struct MHD_Connection *connection)
2412Resume handling of network data for suspended connection. It is safe 2412Resume handling of network data for suspended connection. It is safe
2413to resume a suspended connection at any time. Calling this function 2413to resume a suspended connection at any time. Calling this function
2414on a connection that was not previously suspended will result in 2414on a connection that was not previously suspended will result in
@@ -2602,7 +2602,7 @@ Most of the time it is sound to specify 300 seconds as its values.
2602@end deftypefun 2602@end deftypefun
2603 2603
2604 2604
2605@deftypefun int MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale, enum MHD_DigestAuthAlgorithm algo) 2605@deftypefun enum MHD_Result MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale, enum MHD_DigestAuthAlgorithm algo)
2606Queues a response to request authentication from the client, 2606Queues a response to request authentication from the client,
2607return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. 2607return @code{MHD_YES} if successful, otherwise @code{MHD_NO}.
2608 2608
@@ -2626,7 +2626,7 @@ must then be selected when checking digests received from clients!
2626@end deftypefun 2626@end deftypefun
2627 2627
2628 2628
2629@deftypefun int MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale) 2629@deftypefun enum MHD_Result MHD_queue_auth_fail_response (struct MHD_Connection *connection, const char *realm, const char *opaque, struct MHD_Response *response, int signal_stale)
2630Queues a response to request authentication from the client, 2630Queues a response to request authentication from the client,
2631return @code{MHD_YES} if successful, otherwise @code{MHD_NO}. 2631return @code{MHD_YES} if successful, otherwise @code{MHD_NO}.
2632 2632
@@ -2847,7 +2847,7 @@ a PP handle.
2847@end deftypefun 2847@end deftypefun
2848 2848
2849 2849
2850@deftypefun int MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len) 2850@deftypefun enum MHD_Result MHD_post_process (struct MHD_PostProcessor *pp, const char *post_data, size_t post_data_len)
2851Parse and process @code{POST} data. Call this function when @code{POST} 2851Parse and process @code{POST} data. Call this function when @code{POST}
2852data is available (usually during an @code{MHD_AccessHandlerCallback}) 2852data is available (usually during an @code{MHD_AccessHandlerCallback})
2853with the @var{upload_data} and @var{upload_data_size}. Whenever 2853with the @var{upload_data} and @var{upload_data_size}. Whenever
@@ -2870,7 +2870,7 @@ Return @code{MHD_YES} on success, @code{MHD_NO} on error
2870@end deftypefun 2870@end deftypefun
2871 2871
2872 2872
2873@deftypefun int MHD_destroy_post_processor (struct MHD_PostProcessor *pp) 2873@deftypefun enum MHD_Result MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
2874Release PostProcessor resources. After this function is being called, 2874Release PostProcessor resources. After this function is being called,
2875the PostProcessor is guaranteed to no longer call its iterator. There 2875the PostProcessor is guaranteed to no longer call its iterator. There
2876is no special call to the iterator to indicate the end of the post processing 2876is no special call to the iterator to indicate the end of the post processing
diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c
index 40bffcb7..644b03ef 100644
--- a/src/examples/authorization_example.c
+++ b/src/examples/authorization_example.c
@@ -39,7 +39,7 @@
39 "<html><head><title>Access denied</title></head><body>Access denied</body></html>" 39 "<html><head><title>Access denied</title></head><body>Access denied</body></html>"
40 40
41 41
42static int 42static enum MHD_Result
43ahc_echo (void *cls, 43ahc_echo (void *cls,
44 struct MHD_Connection *connection, 44 struct MHD_Connection *connection,
45 const char *url, 45 const char *url,
@@ -50,7 +50,7 @@ ahc_echo (void *cls,
50 static int aptr; 50 static int aptr;
51 const char *me = cls; 51 const char *me = cls;
52 struct MHD_Response *response; 52 struct MHD_Response *response;
53 int ret; 53 enum MHD_Result ret;
54 char *user; 54 char *user;
55 char *pass; 55 char *pass;
56 int fail; 56 int fail;
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index 9b07e5c8..939995c9 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -106,7 +106,7 @@ uri_logger_cb (void *cls,
106} 106}
107 107
108 108
109static int 109static enum MHD_Result
110ahc_echo (void *cls, 110ahc_echo (void *cls,
111 struct MHD_Connection *connection, 111 struct MHD_Connection *connection,
112 const char *url, 112 const char *url,
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index 53b83e0a..6f0cd478 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -106,7 +106,7 @@ uri_logger_cb (void *cls,
106} 106}
107 107
108 108
109static int 109static enum MHD_Result
110ahc_echo (void *cls, 110ahc_echo (void *cls,
111 struct MHD_Connection *connection, 111 struct MHD_Connection *connection,
112 const char *url, 112 const char *url,
diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index 9b2cb51c..19a37155 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -86,7 +86,7 @@ static const char simple_response_text[] =
86 "<body>Simple response text</body></html>"; 86 "<body>Simple response text</body></html>";
87 87
88 88
89static int 89static enum MHD_Result
90ahc_echo (void *cls, 90ahc_echo (void *cls,
91 struct MHD_Connection *connection, 91 struct MHD_Connection *connection,
92 const char *url, 92 const char *url,
@@ -99,7 +99,7 @@ ahc_echo (void *cls,
99 static int aptr; 99 static int aptr;
100 struct ResponseContentCallbackParam *callback_param; 100 struct ResponseContentCallbackParam *callback_param;
101 struct MHD_Response *response; 101 struct MHD_Response *response;
102 int ret; 102 enum MHD_Result ret;
103 (void) cls; /* Unused. Silent compiler warning. */ 103 (void) cls; /* Unused. Silent compiler warning. */
104 (void) url; /* Unused. Silent compiler warning. */ 104 (void) url; /* Unused. Silent compiler warning. */
105 (void) version; /* Unused. Silent compiler warning. */ 105 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 6b2b20f6..eb974d3a 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -264,7 +264,7 @@ struct ResponseDataContext
264 * @param dirname name of the directory to list 264 * @param dirname name of the directory to list
265 * @return #MHD_YES on success, #MHD_NO on error 265 * @return #MHD_YES on success, #MHD_NO on error
266 */ 266 */
267static int 267static enum MHD_Result
268list_directory (struct ResponseDataContext *rdc, 268list_directory (struct ResponseDataContext *rdc,
269 const char *dirname) 269 const char *dirname)
270{ 270{
@@ -444,7 +444,7 @@ struct UploadContext
444 * @param size number of bytes in 'data' 444 * @param size number of bytes in 'data'
445 * @return #MHD_NO on allocation failure, #MHD_YES on success 445 * @return #MHD_NO on allocation failure, #MHD_YES on success
446 */ 446 */
447static int 447static enum MHD_Result
448do_append (char **ret, 448do_append (char **ret,
449 const char *data, 449 const char *data,
450 size_t size) 450 size_t size)
@@ -493,7 +493,7 @@ do_append (char **ret,
493 * @return #MHD_YES to continue iterating, 493 * @return #MHD_YES to continue iterating,
494 * #MHD_NO to abort the iteration 494 * #MHD_NO to abort the iteration
495 */ 495 */
496static int 496static enum MHD_Result
497process_upload_data (void *cls, 497process_upload_data (void *cls,
498 enum MHD_ValueKind kind, 498 enum MHD_ValueKind kind,
499 const char *key, 499 const char *key,
@@ -662,12 +662,12 @@ response_completed_callback (void *cls,
662 * Return the current directory listing. 662 * Return the current directory listing.
663 * 663 *
664 * @param connection connection to return the directory for 664 * @param connection connection to return the directory for
665 * @return MHD_YES on success, MHD_NO on error 665 * @return #MHD_YES on success, #MHD_NO on error
666 */ 666 */
667static int 667static enum MHD_Result
668return_directory_response (struct MHD_Connection *connection) 668return_directory_response (struct MHD_Connection *connection)
669{ 669{
670 int ret; 670 enum MHD_Result ret;
671 671
672 (void) pthread_mutex_lock (&mutex); 672 (void) pthread_mutex_lock (&mutex);
673 if (NULL == cached_directory_response) 673 if (NULL == cached_directory_response)
@@ -696,7 +696,7 @@ return_directory_response (struct MHD_Connection *connection)
696 * @param ptr our context 696 * @param ptr our context
697 * @return #MHD_YES on success, #MHD_NO to drop connection 697 * @return #MHD_YES on success, #MHD_NO to drop connection
698 */ 698 */
699static int 699static enum MHD_Result
700generate_page (void *cls, 700generate_page (void *cls,
701 struct MHD_Connection *connection, 701 struct MHD_Connection *connection,
702 const char *url, 702 const char *url,
@@ -706,7 +706,7 @@ generate_page (void *cls,
706 size_t *upload_data_size, void **ptr) 706 size_t *upload_data_size, void **ptr)
707{ 707{
708 struct MHD_Response *response; 708 struct MHD_Response *response;
709 int ret; 709 enum MHD_Result ret;
710 int fd; 710 int fd;
711 struct stat buf; 711 struct stat buf;
712 (void) cls; /* Unused. Silent compiler warning. */ 712 (void) cls; /* Unused. Silent compiler warning. */
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 591c4fc0..6e42f3a5 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -267,7 +267,7 @@ struct ResponseDataContext
267 * @param dirname name of the directory to list 267 * @param dirname name of the directory to list
268 * @return MHD_YES on success, MHD_NO on error 268 * @return MHD_YES on success, MHD_NO on error
269 */ 269 */
270static int 270static enum MHD_Result
271list_directory (struct ResponseDataContext *rdc, 271list_directory (struct ResponseDataContext *rdc,
272 const char *dirname) 272 const char *dirname)
273{ 273{
@@ -447,7 +447,7 @@ struct UploadContext
447 * @param size number of bytes in 'data' 447 * @param size number of bytes in 'data'
448 * @return #MHD_NO on allocation failure, #MHD_YES on success 448 * @return #MHD_NO on allocation failure, #MHD_YES on success
449 */ 449 */
450static int 450static enum MHD_Result
451do_append (char **ret, 451do_append (char **ret,
452 const char *data, 452 const char *data,
453 size_t size) 453 size_t size)
@@ -493,10 +493,10 @@ do_append (char **ret,
493 * specified offset 493 * specified offset
494 * @param off offset of data in the overall value 494 * @param off offset of data in the overall value
495 * @param size number of bytes in data available 495 * @param size number of bytes in data available
496 * @return MHD_YES to continue iterating, 496 * @return #MHD_YES to continue iterating,
497 * MHD_NO to abort the iteration 497 * #MHD_NO to abort the iteration
498 */ 498 */
499static int 499static enum MHD_Result
500process_upload_data (void *cls, 500process_upload_data (void *cls,
501 enum MHD_ValueKind kind, 501 enum MHD_ValueKind kind,
502 const char *key, 502 const char *key,
@@ -667,10 +667,10 @@ response_completed_callback (void *cls,
667 * @param connection connection to return the directory for 667 * @param connection connection to return the directory for
668 * @return MHD_YES on success, MHD_NO on error 668 * @return MHD_YES on success, MHD_NO on error
669 */ 669 */
670static int 670static enum MHD_Result
671return_directory_response (struct MHD_Connection *connection) 671return_directory_response (struct MHD_Connection *connection)
672{ 672{
673 int ret; 673 enum MHD_Result ret;
674 674
675 (void) pthread_mutex_lock (&mutex); 675 (void) pthread_mutex_lock (&mutex);
676 if (NULL == cached_directory_response) 676 if (NULL == cached_directory_response)
@@ -699,7 +699,7 @@ return_directory_response (struct MHD_Connection *connection)
699 * @param ptr our context 699 * @param ptr our context
700 * @return #MHD_YES on success, #MHD_NO to drop connection 700 * @return #MHD_YES on success, #MHD_NO to drop connection
701 */ 701 */
702static int 702static enum MHD_Result
703generate_page (void *cls, 703generate_page (void *cls,
704 struct MHD_Connection *connection, 704 struct MHD_Connection *connection,
705 const char *url, 705 const char *url,
@@ -709,7 +709,7 @@ generate_page (void *cls,
709 size_t *upload_data_size, void **ptr) 709 size_t *upload_data_size, void **ptr)
710{ 710{
711 struct MHD_Response *response; 711 struct MHD_Response *response;
712 int ret; 712 enum MHD_Result ret;
713 int fd; 713 int fd;
714 struct stat buf; 714 struct stat buf;
715 (void) cls; /* Unused. Silent compiler warning. */ 715 (void) cls; /* Unused. Silent compiler warning. */
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c
index 25fb4086..e3edf206 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -34,7 +34,7 @@
34 34
35#define MY_OPAQUE_STR "11733b200778ce33060f31c9af70a870ba96ddd4" 35#define MY_OPAQUE_STR "11733b200778ce33060f31c9af70a870ba96ddd4"
36 36
37static int 37static enum MHD_Result
38ahc_echo (void *cls, 38ahc_echo (void *cls,
39 struct MHD_Connection *connection, 39 struct MHD_Connection *connection,
40 const char *url, 40 const char *url,
@@ -46,7 +46,7 @@ ahc_echo (void *cls,
46 char *username; 46 char *username;
47 const char *password = "testpass"; 47 const char *password = "testpass";
48 const char *realm = "test@example.com"; 48 const char *realm = "test@example.com";
49 int ret; 49 enum MHD_Result ret;
50 (void) cls; /* Unused. Silent compiler warning. */ 50 (void) cls; /* Unused. Silent compiler warning. */
51 (void) url; /* Unused. Silent compiler warning. */ 51 (void) url; /* Unused. Silent compiler warning. */
52 (void) method; /* Unused. Silent compiler warning. */ 52 (void) method; /* Unused. Silent compiler warning. */
diff --git a/src/examples/dual_stack_example.c b/src/examples/dual_stack_example.c
index ffacec4a..15bafc44 100644
--- a/src/examples/dual_stack_example.c
+++ b/src/examples/dual_stack_example.c
@@ -28,7 +28,7 @@
28#define PAGE \ 28#define PAGE \
29 "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd demo</body></html>" 29 "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd demo</body></html>"
30 30
31static int 31static enum MHD_Result
32ahc_echo (void *cls, 32ahc_echo (void *cls,
33 struct MHD_Connection *connection, 33 struct MHD_Connection *connection,
34 const char *url, 34 const char *url,
@@ -39,7 +39,7 @@ ahc_echo (void *cls,
39 static int aptr; 39 static int aptr;
40 const char *me = cls; 40 const char *me = cls;
41 struct MHD_Response *response; 41 struct MHD_Response *response;
42 int ret; 42 enum MHD_Result ret;
43 (void) url; /* Unused. Silent compiler warning. */ 43 (void) url; /* Unused. Silent compiler warning. */
44 (void) version; /* Unused. Silent compiler warning. */ 44 (void) version; /* Unused. Silent compiler warning. */
45 (void) upload_data; /* Unused. Silent compiler warning. */ 45 (void) upload_data; /* Unused. Silent compiler warning. */
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c
index 46e6aad6..767810f9 100644
--- a/src/examples/fileserver_example.c
+++ b/src/examples/fileserver_example.c
@@ -41,7 +41,7 @@
41#define S_ISREG(x) (S_IFREG == (x & S_IFREG)) 41#define S_ISREG(x) (S_IFREG == (x & S_IFREG))
42#endif /* S_ISREG */ 42#endif /* S_ISREG */
43 43
44static int 44static enum MHD_Result
45ahc_echo (void *cls, 45ahc_echo (void *cls,
46 struct MHD_Connection *connection, 46 struct MHD_Connection *connection,
47 const char *url, 47 const char *url,
@@ -52,7 +52,7 @@ ahc_echo (void *cls,
52{ 52{
53 static int aptr; 53 static int aptr;
54 struct MHD_Response *response; 54 struct MHD_Response *response;
55 int ret; 55 enum MHD_Result ret;
56 int fd; 56 int fd;
57 struct stat buf; 57 struct stat buf;
58 (void) cls; /* Unused. Silent compiler warning. */ 58 (void) cls; /* Unused. Silent compiler warning. */
diff --git a/src/examples/fileserver_example_dirs.c b/src/examples/fileserver_example_dirs.c
index 2b544b69..e6c9ed1f 100644
--- a/src/examples/fileserver_example_dirs.c
+++ b/src/examples/fileserver_example_dirs.c
@@ -81,7 +81,7 @@ dir_reader (void *cls, uint64_t pos, char *buf, size_t max)
81} 81}
82 82
83 83
84static int 84static enum MHD_Result
85ahc_echo (void *cls, 85ahc_echo (void *cls,
86 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
87 const char *url, 87 const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
92{ 92{
93 static int aptr; 93 static int aptr;
94 struct MHD_Response *response; 94 struct MHD_Response *response;
95 int ret; 95 enum MHD_Result ret;
96 FILE *file; 96 FILE *file;
97 int fd; 97 int fd;
98 DIR *dir; 98 DIR *dir;
diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c
index 187cdf7e..7209751f 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -48,7 +48,7 @@ free_callback (void *cls)
48} 48}
49 49
50 50
51static int 51static enum MHD_Result
52ahc_echo (void *cls, 52ahc_echo (void *cls,
53 struct MHD_Connection *connection, 53 struct MHD_Connection *connection,
54 const char *url, 54 const char *url,
@@ -59,7 +59,7 @@ ahc_echo (void *cls,
59{ 59{
60 static int aptr; 60 static int aptr;
61 struct MHD_Response *response; 61 struct MHD_Response *response;
62 int ret; 62 enum MHD_Result ret;
63 FILE *file; 63 FILE *file;
64 int fd; 64 int fd;
65 struct stat buf; 65 struct stat buf;
diff --git a/src/examples/http_chunked_compression.c b/src/examples/http_chunked_compression.c
index ba71923b..07fd00ec 100644
--- a/src/examples/http_chunked_compression.c
+++ b/src/examples/http_chunked_compression.c
@@ -51,13 +51,13 @@ struct Holder
51 void *buf; 51 void *buf;
52}; 52};
53 53
54static int 54static enum MHD_Result
55compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset, 55compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset,
56 void **dest, size_t *dest_size, 56 void **dest, size_t *dest_size,
57 void *tmp) 57 void *tmp)
58{ 58{
59 unsigned int have; 59 unsigned int have;
60 int ret; 60 enum MHD_Result ret;
61 int flush; 61 int flush;
62 void *tmp_dest; 62 void *tmp_dest;
63 *dest = NULL; 63 *dest = NULL;
@@ -152,14 +152,14 @@ free_cb (void *cls)
152} 152}
153 153
154 154
155static int 155static enum MHD_Result
156ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const 156ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const
157 char *method, const char *version, 157 char *method, const char *version,
158 const char *upload_data, size_t *upload_size, void **ptr) 158 const char *upload_data, size_t *upload_size, void **ptr)
159{ 159{
160 struct Holder *holder; 160 struct Holder *holder;
161 struct MHD_Response *res; 161 struct MHD_Response *res;
162 int ret; 162 enum MHD_Result ret;
163 (void) cls; 163 (void) cls;
164 (void) url; 164 (void) url;
165 (void) method; 165 (void) method;
diff --git a/src/examples/http_compression.c b/src/examples/http_compression.c
index f7d8db21..0419a803 100644
--- a/src/examples/http_compression.c
+++ b/src/examples/http_compression.c
@@ -31,7 +31,7 @@
31 "hello, hello. This is a 'hello world' message for the world, " \ 31 "hello, hello. This is a 'hello world' message for the world, " \
32 "repeat, for the world.</body></html>" 32 "repeat, for the world.</body></html>"
33 33
34static int 34static enum MHD_Result
35can_compress (struct MHD_Connection *con) 35can_compress (struct MHD_Connection *con)
36{ 36{
37 const char *ae; 37 const char *ae;
@@ -60,7 +60,7 @@ can_compress (struct MHD_Connection *con)
60} 60}
61 61
62 62
63static int 63static enum MHD_Result
64body_compress (void **buf, 64body_compress (void **buf,
65 size_t *buf_size) 65 size_t *buf_size)
66{ 66{
@@ -90,7 +90,7 @@ body_compress (void **buf,
90} 90}
91 91
92 92
93static int 93static enum MHD_Result
94ahc_echo (void *cls, 94ahc_echo (void *cls,
95 struct MHD_Connection *connection, 95 struct MHD_Connection *connection,
96 const char *url, 96 const char *url,
@@ -99,8 +99,8 @@ ahc_echo (void *cls,
99 const char *upload_data, size_t *upload_data_size, void **ptr) 99 const char *upload_data, size_t *upload_data_size, void **ptr)
100{ 100{
101 struct MHD_Response *response; 101 struct MHD_Response *response;
102 int ret; 102 enum MHD_Result ret;
103 int comp; 103 enum MHD_Result comp;
104 size_t body_len; 104 size_t body_len;
105 char *body_str; 105 char *body_str;
106 (void) cls; /* Unused. Silent compiler warning. */ 106 (void) cls; /* Unused. Silent compiler warning. */
diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c
index 627bc739..5148c8b6 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -113,7 +113,7 @@ file_free_callback (void *cls)
113 113
114 114
115/* HTTP access handler call back */ 115/* HTTP access handler call back */
116static int 116static enum MHD_Result
117http_ahc (void *cls, 117http_ahc (void *cls,
118 struct MHD_Connection *connection, 118 struct MHD_Connection *connection,
119 const char *url, 119 const char *url,
@@ -124,7 +124,7 @@ http_ahc (void *cls,
124{ 124{
125 static int aptr; 125 static int aptr;
126 struct MHD_Response *response; 126 struct MHD_Response *response;
127 int ret; 127 enum MHD_Result ret;
128 FILE *file; 128 FILE *file;
129 int fd; 129 int fd;
130 struct stat buf; 130 struct stat buf;
diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c
index d6589cf9..a02b5d50 100644
--- a/src/examples/minimal_example.c
+++ b/src/examples/minimal_example.c
@@ -28,7 +28,7 @@
28#define PAGE \ 28#define PAGE \
29 "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd demo</body></html>" 29 "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd demo</body></html>"
30 30
31static int 31static enum MHD_Result
32ahc_echo (void *cls, 32ahc_echo (void *cls,
33 struct MHD_Connection *connection, 33 struct MHD_Connection *connection,
34 const char *url, 34 const char *url,
@@ -41,7 +41,7 @@ ahc_echo (void *cls,
41 static int aptr; 41 static int aptr;
42 const char *me = cls; 42 const char *me = cls;
43 struct MHD_Response *response; 43 struct MHD_Response *response;
44 int ret; 44 enum MHD_Result ret;
45 45
46 (void) url; /* Unused. Silent compiler warning. */ 46 (void) url; /* Unused. Silent compiler warning. */
47 (void) version; /* Unused. Silent compiler warning. */ 47 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/minimal_example_comet.c b/src/examples/minimal_example_comet.c
index 80c4258a..c36bf2ce 100644
--- a/src/examples/minimal_example_comet.c
+++ b/src/examples/minimal_example_comet.c
@@ -38,7 +38,7 @@ data_generator (void *cls, uint64_t pos, char *buf, size_t max)
38} 38}
39 39
40 40
41static int 41static enum MHD_Result
42ahc_echo (void *cls, 42ahc_echo (void *cls,
43 struct MHD_Connection *connection, 43 struct MHD_Connection *connection,
44 const char *url, 44 const char *url,
@@ -48,7 +48,7 @@ ahc_echo (void *cls,
48{ 48{
49 static int aptr; 49 static int aptr;
50 struct MHD_Response *response; 50 struct MHD_Response *response;
51 int ret; 51 enum MHD_Result ret;
52 (void) cls; /* Unused. Silent compiler warning. */ 52 (void) cls; /* Unused. Silent compiler warning. */
53 (void) url; /* Unused. Silent compiler warning. */ 53 (void) url; /* Unused. Silent compiler warning. */
54 (void) version; /* Unused. Silent compiler warning. */ 54 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/minimal_example_empty.c b/src/examples/minimal_example_empty.c
index 2de1cc8b..986a2504 100644
--- a/src/examples/minimal_example_empty.c
+++ b/src/examples/minimal_example_empty.c
@@ -26,7 +26,7 @@
26#include <microhttpd.h> 26#include <microhttpd.h>
27 27
28 28
29static int 29static enum MHD_Result
30ahc_echo (void *cls, 30ahc_echo (void *cls,
31 struct MHD_Connection *connection, 31 struct MHD_Connection *connection,
32 const char *url, 32 const char *url,
@@ -38,7 +38,7 @@ ahc_echo (void *cls,
38{ 38{
39 static int aptr; 39 static int aptr;
40 struct MHD_Response *response; 40 struct MHD_Response *response;
41 int ret; 41 enum MHD_Result ret;
42 42
43 (void) url; /* Unused. Silent compiler warning. */ 43 (void) url; /* Unused. Silent compiler warning. */
44 (void) version; /* Unused. Silent compiler warning. */ 44 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/minimal_example_empty_tls.c b/src/examples/minimal_example_empty_tls.c
index e3daca5f..0b9a0e25 100644
--- a/src/examples/minimal_example_empty_tls.c
+++ b/src/examples/minimal_example_empty_tls.c
@@ -26,7 +26,7 @@
26#include <microhttpd.h> 26#include <microhttpd.h>
27 27
28 28
29static int 29static enum MHD_Result
30ahc_echo (void *cls, 30ahc_echo (void *cls,
31 struct MHD_Connection *connection, 31 struct MHD_Connection *connection,
32 const char *url, 32 const char *url,
@@ -38,7 +38,7 @@ ahc_echo (void *cls,
38{ 38{
39 static int aptr; 39 static int aptr;
40 struct MHD_Response *response; 40 struct MHD_Response *response;
41 int ret; 41 enum MHD_Result ret;
42 42
43 (void) url; /* Unused. Silent compiler warning. */ 43 (void) url; /* Unused. Silent compiler warning. */
44 (void) version; /* Unused. Silent compiler warning. */ 44 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 166d8f22..9f4fbcf9 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -205,10 +205,10 @@ get_session (struct MHD_Connection *connection)
205 * @param connection connection to process 205 * @param connection connection to process
206 * @param MHD_YES on success, MHD_NO on failure 206 * @param MHD_YES on success, MHD_NO on failure
207 */ 207 */
208typedef int (*PageHandler)(const void *cls, 208typedef enum MHD_Result (*PageHandler)(const void *cls,
209 const char *mime, 209 const char *mime,
210 struct Session *session, 210 struct Session *session,
211 struct MHD_Connection *connection); 211 struct MHD_Connection *connection);
212 212
213 213
214/** 214/**
@@ -274,13 +274,13 @@ add_session_cookie (struct Session *session,
274 * @param session session handle 274 * @param session session handle
275 * @param connection connection to use 275 * @param connection connection to use
276 */ 276 */
277static int 277static enum MHD_Result
278serve_simple_form (const void *cls, 278serve_simple_form (const void *cls,
279 const char *mime, 279 const char *mime,
280 struct Session *session, 280 struct Session *session,
281 struct MHD_Connection *connection) 281 struct MHD_Connection *connection)
282{ 282{
283 int ret; 283 enum MHD_Result ret;
284 const char *form = cls; 284 const char *form = cls;
285 struct MHD_Response *response; 285 struct MHD_Response *response;
286 286
@@ -310,13 +310,13 @@ serve_simple_form (const void *cls,
310 * @param session session handle 310 * @param session session handle
311 * @param connection connection to use 311 * @param connection connection to use
312 */ 312 */
313static int 313static enum MHD_Result
314fill_v1_form (const void *cls, 314fill_v1_form (const void *cls,
315 const char *mime, 315 const char *mime,
316 struct Session *session, 316 struct Session *session,
317 struct MHD_Connection *connection) 317 struct MHD_Connection *connection)
318{ 318{
319 int ret; 319 enum MHD_Result ret;
320 size_t slen; 320 size_t slen;
321 char *reply; 321 char *reply;
322 struct MHD_Response *response; 322 struct MHD_Response *response;
@@ -359,13 +359,13 @@ fill_v1_form (const void *cls,
359 * @param session session handle 359 * @param session session handle
360 * @param connection connection to use 360 * @param connection connection to use
361 */ 361 */
362static int 362static enum MHD_Result
363fill_v1_v2_form (const void *cls, 363fill_v1_v2_form (const void *cls,
364 const char *mime, 364 const char *mime,
365 struct Session *session, 365 struct Session *session,
366 struct MHD_Connection *connection) 366 struct MHD_Connection *connection)
367{ 367{
368 int ret; 368 enum MHD_Result ret;
369 char *reply; 369 char *reply;
370 struct MHD_Response *response; 370 struct MHD_Response *response;
371 size_t slen; 371 size_t slen;
@@ -410,13 +410,13 @@ fill_v1_v2_form (const void *cls,
410 * @param session session handle 410 * @param session session handle
411 * @param connection connection to use 411 * @param connection connection to use
412 */ 412 */
413static int 413static enum MHD_Result
414not_found_page (const void *cls, 414not_found_page (const void *cls,
415 const char *mime, 415 const char *mime,
416 struct Session *session, 416 struct Session *session,
417 struct MHD_Connection *connection) 417 struct MHD_Connection *connection)
418{ 418{
419 int ret; 419 enum MHD_Result ret;
420 struct MHD_Response *response; 420 struct MHD_Response *response;
421 (void) cls; /* Unused. Silent compiler warning. */ 421 (void) cls; /* Unused. Silent compiler warning. */
422 (void) session; /* Unused. Silent compiler warning. */ 422 (void) session; /* Unused. Silent compiler warning. */
@@ -469,7 +469,7 @@ static struct Page pages[] = {
469 * @return MHD_YES to continue iterating, 469 * @return MHD_YES to continue iterating,
470 * MHD_NO to abort the iteration 470 * MHD_NO to abort the iteration
471 */ 471 */
472static int 472static enum MHD_Result
473post_iterator (void *cls, 473post_iterator (void *cls,
474 enum MHD_ValueKind kind, 474 enum MHD_ValueKind kind,
475 const char *key, 475 const char *key,
@@ -554,7 +554,7 @@ post_iterator (void *cls,
554 * MHS_NO if the socket must be closed due to a serious 554 * MHS_NO if the socket must be closed due to a serious
555 * error while handling the request 555 * error while handling the request
556 */ 556 */
557static int 557static enum MHD_Result
558create_response (void *cls, 558create_response (void *cls,
559 struct MHD_Connection *connection, 559 struct MHD_Connection *connection,
560 const char *url, 560 const char *url,
@@ -567,7 +567,7 @@ create_response (void *cls,
567 struct MHD_Response *response; 567 struct MHD_Response *response;
568 struct Request *request; 568 struct Request *request;
569 struct Session *session; 569 struct Session *session;
570 int ret; 570 enum MHD_Result ret;
571 unsigned int i; 571 unsigned int i;
572 (void) cls; /* Unused. Silent compiler warning. */ 572 (void) cls; /* Unused. Silent compiler warning. */
573 (void) version; /* Unused. Silent compiler warning. */ 573 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c
index 8abd8596..4bff891a 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -29,7 +29,7 @@
29#define PAGE \ 29#define PAGE \
30 "<html><head><title>libmicrohttpd demo</title></head><body>Query string for &quot;%s&quot; was &quot;%s&quot;</body></html>" 30 "<html><head><title>libmicrohttpd demo</title></head><body>Query string for &quot;%s&quot; was &quot;%s&quot;</body></html>"
31 31
32static int 32static enum MHD_Result
33ahc_echo (void *cls, 33ahc_echo (void *cls,
34 struct MHD_Connection *connection, 34 struct MHD_Connection *connection,
35 const char *url, 35 const char *url,
@@ -42,7 +42,7 @@ ahc_echo (void *cls,
42 const char *val; 42 const char *val;
43 char *me; 43 char *me;
44 struct MHD_Response *response; 44 struct MHD_Response *response;
45 int ret; 45 enum MHD_Result ret;
46 (void) url; /* Unused. Silent compiler warning. */ 46 (void) url; /* Unused. Silent compiler warning. */
47 (void) version; /* Unused. Silent compiler warning. */ 47 (void) version; /* Unused. Silent compiler warning. */
48 (void) upload_data; /* Unused. Silent compiler warning. */ 48 (void) upload_data; /* Unused. Silent compiler warning. */
diff --git a/src/examples/refuse_post_example.c b/src/examples/refuse_post_example.c
index 3a34f36d..7e100d9f 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -35,7 +35,7 @@ const char *askpage =
35#define BUSYPAGE \ 35#define BUSYPAGE \
36 "<html><head><title>Webserver busy</title></head><body>We are too busy to process POSTs right now.</body></html>" 36 "<html><head><title>Webserver busy</title></head><body>We are too busy to process POSTs right now.</body></html>"
37 37
38static int 38static enum MHD_Result
39ahc_echo (void *cls, 39ahc_echo (void *cls,
40 struct MHD_Connection *connection, 40 struct MHD_Connection *connection,
41 const char *url, 41 const char *url,
@@ -46,7 +46,7 @@ ahc_echo (void *cls,
46 static int aptr; 46 static int aptr;
47 const char *me = cls; 47 const char *me = cls;
48 struct MHD_Response *response; 48 struct MHD_Response *response;
49 int ret; 49 enum MHD_Result ret;
50 (void) cls; /* Unused. Silent compiler warning. */ 50 (void) cls; /* Unused. Silent compiler warning. */
51 (void) url; /* Unused. Silent compiler warning. */ 51 (void) url; /* Unused. Silent compiler warning. */
52 (void) version; /* Unused. Silent compiler warning. */ 52 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/suspend_resume_epoll.c b/src/examples/suspend_resume_epoll.c
index a69fdc4a..afa1169c 100644
--- a/src/examples/suspend_resume_epoll.c
+++ b/src/examples/suspend_resume_epoll.c
@@ -43,7 +43,7 @@ static int epfd;
43static struct epoll_event evt; 43static struct epoll_event evt;
44 44
45 45
46static int 46static enum MHD_Result
47ahc_echo (void *cls, 47ahc_echo (void *cls,
48 struct MHD_Connection *connection, 48 struct MHD_Connection *connection,
49 const char *url, 49 const char *url,
@@ -52,7 +52,7 @@ ahc_echo (void *cls,
52 const char *upload_data, size_t *upload_data_size, void **ptr) 52 const char *upload_data, size_t *upload_data_size, void **ptr)
53{ 53{
54 struct MHD_Response *response; 54 struct MHD_Response *response;
55 int ret; 55 enum MHD_Result ret;
56 struct Request*req; 56 struct Request*req;
57 struct itimerspec ts; 57 struct itimerspec ts;
58 58
diff --git a/src/examples/timeout.c b/src/examples/timeout.c
index cfb66950..b31ff21f 100644
--- a/src/examples/timeout.c
+++ b/src/examples/timeout.c
@@ -29,7 +29,7 @@
29 29
30#define PORT 8080 30#define PORT 8080
31 31
32static int 32static enum MHD_Result
33answer_to_connection (void *cls, 33answer_to_connection (void *cls,
34 struct MHD_Connection *connection, 34 struct MHD_Connection *connection,
35 const char *url, 35 const char *url,
@@ -41,7 +41,7 @@ answer_to_connection (void *cls,
41{ 41{
42 const char *page = "<html><body>Hello timeout!</body></html>"; 42 const char *page = "<html><body>Hello timeout!</body></html>";
43 struct MHD_Response *response; 43 struct MHD_Response *response;
44 int ret; 44 enum MHD_Result ret;
45 (void) cls; /* Unused. Silent compiler warning. */ 45 (void) cls; /* Unused. Silent compiler warning. */
46 (void) url; /* Unused. Silent compiler warning. */ 46 (void) url; /* Unused. Silent compiler warning. */
47 (void) version; /* Unused. Silent compiler warning. */ 47 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c
index 98675e09..85a06646 100644
--- a/src/examples/upgrade_example.c
+++ b/src/examples/upgrade_example.c
@@ -240,7 +240,7 @@ uh_cb (void *cls,
240} 240}
241 241
242 242
243static int 243static enum MHD_Result
244ahc_echo (void *cls, 244ahc_echo (void *cls,
245 struct MHD_Connection *connection, 245 struct MHD_Connection *connection,
246 const char *url, 246 const char *url,
@@ -252,7 +252,7 @@ ahc_echo (void *cls,
252{ 252{
253 static int aptr; 253 static int aptr;
254 struct MHD_Response *response; 254 struct MHD_Response *response;
255 int ret; 255 enum MHD_Result ret;
256 (void) cls; /* Unused. Silent compiler warning. */ 256 (void) cls; /* Unused. Silent compiler warning. */
257 (void) url; /* Unused. Silent compiler warning. */ 257 (void) url; /* Unused. Silent compiler warning. */
258 (void) version; /* Unused. Silent compiler warning. */ 258 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 5bf33547..00d4f9bd 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of libmicrohttpd 2 This file is part of libmicrohttpd
3 Copyright (C) 2006--2019 Christian Grothoff (and other contributing authors) 3 Copyright (C) 2006--2020 Christian Grothoff (and other contributing authors)
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public 6 modify it under the terms of the GNU Lesser General Public
@@ -135,14 +135,22 @@ typedef intptr_t ssize_t;
135#define MHD_VERSION 0x00097002 135#define MHD_VERSION 0x00097002
136 136
137/** 137/**
138 * MHD-internal return code for "YES". 138 * Operational results from MHD calls.
139 */ 139 */
140#define MHD_YES 1 140enum MHD_Result
141{
142 /**
143 * MHD result code for "NO".
144 */
145 MHD_NO = 0,
146
147 /**
148 * MHD result code for "YES".
149 */
150 MHD_YES = 1
151
152};
141 153
142/**
143 * MHD-internal return code for "NO".
144 */
145#define MHD_NO 0
146 154
147/** 155/**
148 * MHD digest auth internal code for an invalid nonce. 156 * MHD digest auth internal code for an invalid nonce.
@@ -2118,10 +2126,10 @@ typedef void
2118 * @param addrlen length of @a addr 2126 * @param addrlen length of @a addr
2119 * @return #MHD_YES if connection is allowed, #MHD_NO if not 2127 * @return #MHD_YES if connection is allowed, #MHD_NO if not
2120 */ 2128 */
2121typedef int 2129typedef enum MHD_Result
2122(*MHD_AcceptPolicyCallback) (void *cls, 2130(*MHD_AcceptPolicyCallback)(void *cls,
2123 const struct sockaddr *addr, 2131 const struct sockaddr *addr,
2124 socklen_t addrlen); 2132 socklen_t addrlen);
2125 2133
2126 2134
2127/** 2135/**
@@ -2163,15 +2171,15 @@ typedef int
2163 * #MHD_NO if the socket must be closed due to a serious 2171 * #MHD_NO if the socket must be closed due to a serious
2164 * error while handling the request 2172 * error while handling the request
2165 */ 2173 */
2166typedef int 2174typedef enum MHD_Result
2167(*MHD_AccessHandlerCallback) (void *cls, 2175(*MHD_AccessHandlerCallback)(void *cls,
2168 struct MHD_Connection *connection, 2176 struct MHD_Connection *connection,
2169 const char *url, 2177 const char *url,
2170 const char *method, 2178 const char *method,
2171 const char *version, 2179 const char *version,
2172 const char *upload_data, 2180 const char *upload_data,
2173 size_t *upload_data_size, 2181 size_t *upload_data_size,
2174 void **con_cls); 2182 void **con_cls);
2175 2183
2176 2184
2177/** 2185/**
@@ -2234,11 +2242,11 @@ typedef void
2234 * #MHD_NO to abort the iteration 2242 * #MHD_NO to abort the iteration
2235 * @ingroup request 2243 * @ingroup request
2236 */ 2244 */
2237typedef int 2245typedef enum MHD_Result
2238(*MHD_KeyValueIterator) (void *cls, 2246(*MHD_KeyValueIterator)(void *cls,
2239 enum MHD_ValueKind kind, 2247 enum MHD_ValueKind kind,
2240 const char *key, 2248 const char *key,
2241 const char *value); 2249 const char *value);
2242 2250
2243 2251
2244/** 2252/**
@@ -2259,13 +2267,13 @@ typedef int
2259 * #MHD_NO to abort the iteration 2267 * #MHD_NO to abort the iteration
2260 * @ingroup request 2268 * @ingroup request
2261 */ 2269 */
2262typedef int 2270typedef enum MHD_Result
2263(*MHD_KeyValueIteratorN) (void *cls, 2271(*MHD_KeyValueIteratorN)(void *cls,
2264 enum MHD_ValueKind kind, 2272 enum MHD_ValueKind kind,
2265 const char *key, 2273 const char *key,
2266 size_t key_size, 2274 size_t key_size,
2267 const char *value, 2275 const char *value,
2268 size_t value_size); 2276 size_t value_size);
2269 2277
2270 2278
2271/** 2279/**
@@ -2351,16 +2359,16 @@ typedef void
2351 * @return #MHD_YES to continue iterating, 2359 * @return #MHD_YES to continue iterating,
2352 * #MHD_NO to abort the iteration 2360 * #MHD_NO to abort the iteration
2353 */ 2361 */
2354typedef int 2362typedef enum MHD_Result
2355(*MHD_PostDataIterator) (void *cls, 2363(*MHD_PostDataIterator)(void *cls,
2356 enum MHD_ValueKind kind, 2364 enum MHD_ValueKind kind,
2357 const char *key, 2365 const char *key,
2358 const char *filename, 2366 const char *filename,
2359 const char *content_type, 2367 const char *content_type,
2360 const char *transfer_encoding, 2368 const char *transfer_encoding,
2361 const char *data, 2369 const char *data,
2362 uint64_t off, 2370 uint64_t off,
2363 size_t size); 2371 size_t size);
2364 2372
2365/* **************** Daemon handling functions ***************** */ 2373/* **************** Daemon handling functions ***************** */
2366 2374
@@ -2481,7 +2489,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
2481 * set to indicate further details about the error. 2489 * set to indicate further details about the error.
2482 * @ingroup specialized 2490 * @ingroup specialized
2483 */ 2491 */
2484_MHD_EXTERN int 2492_MHD_EXTERN enum MHD_Result
2485MHD_add_connection (struct MHD_Daemon *daemon, 2493MHD_add_connection (struct MHD_Daemon *daemon,
2486 MHD_socket client_socket, 2494 MHD_socket client_socket,
2487 const struct sockaddr *addr, 2495 const struct sockaddr *addr,
@@ -2517,7 +2525,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
2517 * fit fd_set. 2525 * fit fd_set.
2518 * @ingroup event 2526 * @ingroup event
2519 */ 2527 */
2520_MHD_EXTERN int 2528_MHD_EXTERN enum MHD_Result
2521MHD_get_fdset (struct MHD_Daemon *daemon, 2529MHD_get_fdset (struct MHD_Daemon *daemon,
2522 fd_set *read_fd_set, 2530 fd_set *read_fd_set,
2523 fd_set *write_fd_set, 2531 fd_set *write_fd_set,
@@ -2557,7 +2565,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
2557 * fit fd_set. 2565 * fit fd_set.
2558 * @ingroup event 2566 * @ingroup event
2559 */ 2567 */
2560_MHD_EXTERN int 2568_MHD_EXTERN enum MHD_Result
2561MHD_get_fdset2 (struct MHD_Daemon *daemon, 2569MHD_get_fdset2 (struct MHD_Daemon *daemon,
2562 fd_set *read_fd_set, 2570 fd_set *read_fd_set,
2563 fd_set *write_fd_set, 2571 fd_set *write_fd_set,
@@ -2613,7 +2621,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
2613 * necessitate the use of a timeout right now). 2621 * necessitate the use of a timeout right now).
2614 * @ingroup event 2622 * @ingroup event
2615 */ 2623 */
2616_MHD_EXTERN int 2624_MHD_EXTERN enum MHD_Result
2617MHD_get_timeout (struct MHD_Daemon *daemon, 2625MHD_get_timeout (struct MHD_Daemon *daemon,
2618 MHD_UNSIGNED_LONG_LONG *timeout); 2626 MHD_UNSIGNED_LONG_LONG *timeout);
2619 2627
@@ -2638,7 +2646,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
2638 * options for this call. 2646 * options for this call.
2639 * @ingroup event 2647 * @ingroup event
2640 */ 2648 */
2641_MHD_EXTERN int 2649_MHD_EXTERN enum MHD_Result
2642MHD_run (struct MHD_Daemon *daemon); 2650MHD_run (struct MHD_Daemon *daemon);
2643 2651
2644 2652
@@ -2664,7 +2672,7 @@ MHD_run (struct MHD_Daemon *daemon);
2664 * @return #MHD_NO on serious errors, #MHD_YES on success 2672 * @return #MHD_NO on serious errors, #MHD_YES on success
2665 * @ingroup event 2673 * @ingroup event
2666 */ 2674 */
2667_MHD_EXTERN int 2675_MHD_EXTERN enum MHD_Result
2668MHD_run_from_select (struct MHD_Daemon *daemon, 2676MHD_run_from_select (struct MHD_Daemon *daemon,
2669 const fd_set *read_fd_set, 2677 const fd_set *read_fd_set,
2670 const fd_set *write_fd_set, 2678 const fd_set *write_fd_set,
@@ -2737,7 +2745,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection,
2737 * #MHD_YES on success 2745 * #MHD_YES on success
2738 * @ingroup request 2746 * @ingroup request
2739 */ 2747 */
2740_MHD_EXTERN int 2748_MHD_EXTERN enum MHD_Result
2741MHD_set_connection_value (struct MHD_Connection *connection, 2749MHD_set_connection_value (struct MHD_Connection *connection,
2742 enum MHD_ValueKind kind, 2750 enum MHD_ValueKind kind,
2743 const char *key, 2751 const char *key,
@@ -2769,7 +2777,7 @@ MHD_set_connection_value (struct MHD_Connection *connection,
2769 * #MHD_YES on success 2777 * #MHD_YES on success
2770 * @ingroup request 2778 * @ingroup request
2771 */ 2779 */
2772int 2780_MHD_EXTERN enum MHD_Result
2773MHD_set_connection_value_n (struct MHD_Connection *connection, 2781MHD_set_connection_value_n (struct MHD_Connection *connection,
2774 enum MHD_ValueKind kind, 2782 enum MHD_ValueKind kind,
2775 const char *key, 2783 const char *key,
@@ -2846,7 +2854,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection,
2846 * #MHD_NO otherwise. 2854 * #MHD_NO otherwise.
2847 * @ingroup request 2855 * @ingroup request
2848 */ 2856 */
2849_MHD_EXTERN int 2857_MHD_EXTERN enum MHD_Result
2850MHD_lookup_connection_value_n (struct MHD_Connection *connection, 2858MHD_lookup_connection_value_n (struct MHD_Connection *connection,
2851 enum MHD_ValueKind kind, 2859 enum MHD_ValueKind kind,
2852 const char *key, 2860 const char *key,
@@ -2866,7 +2874,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection *connection,
2866 * #MHD_YES on success or if message has been queued 2874 * #MHD_YES on success or if message has been queued
2867 * @ingroup response 2875 * @ingroup response
2868 */ 2876 */
2869_MHD_EXTERN int 2877_MHD_EXTERN enum MHD_Result
2870MHD_queue_response (struct MHD_Connection *connection, 2878MHD_queue_response (struct MHD_Connection *connection,
2871 unsigned int status_code, 2879 unsigned int status_code,
2872 struct MHD_Response *response); 2880 struct MHD_Response *response);
@@ -2980,7 +2988,7 @@ enum MHD_ResponseOptions
2980 * @param ... #MHD_RO_END terminated list of options 2988 * @param ... #MHD_RO_END terminated list of options
2981 * @return #MHD_YES on success, #MHD_NO on error 2989 * @return #MHD_YES on success, #MHD_NO on error
2982 */ 2990 */
2983_MHD_EXTERN int 2991_MHD_EXTERN enum MHD_Result
2984MHD_set_response_options (struct MHD_Response *response, 2992MHD_set_response_options (struct MHD_Response *response,
2985 enum MHD_ResponseFlags flags, 2993 enum MHD_ResponseFlags flags,
2986 ...); 2994 ...);
@@ -3239,7 +3247,7 @@ struct MHD_UpgradeResponseHandle;
3239 * @param ... arguments to the action (depends on the action) 3247 * @param ... arguments to the action (depends on the action)
3240 * @return #MHD_NO on error, #MHD_YES on success 3248 * @return #MHD_NO on error, #MHD_YES on success
3241 */ 3249 */
3242_MHD_EXTERN int 3250_MHD_EXTERN enum MHD_Result
3243MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, 3251MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
3244 enum MHD_UpgradeAction action, 3252 enum MHD_UpgradeAction action,
3245 ...); 3253 ...);
@@ -3359,7 +3367,7 @@ MHD_destroy_response (struct MHD_Response *response);
3359 * or out of memory 3367 * or out of memory
3360 * @ingroup response 3368 * @ingroup response
3361 */ 3369 */
3362_MHD_EXTERN int 3370_MHD_EXTERN enum MHD_Result
3363MHD_add_response_header (struct MHD_Response *response, 3371MHD_add_response_header (struct MHD_Response *response,
3364 const char *header, 3372 const char *header,
3365 const char *content); 3373 const char *content);
@@ -3374,7 +3382,7 @@ MHD_add_response_header (struct MHD_Response *response,
3374 * @return #MHD_NO on error (i.e. invalid footer or content format). 3382 * @return #MHD_NO on error (i.e. invalid footer or content format).
3375 * @ingroup response 3383 * @ingroup response
3376 */ 3384 */
3377_MHD_EXTERN int 3385_MHD_EXTERN enum MHD_Result
3378MHD_add_response_footer (struct MHD_Response *response, 3386MHD_add_response_footer (struct MHD_Response *response,
3379 const char *footer, 3387 const char *footer,
3380 const char *content); 3388 const char *content);
@@ -3389,7 +3397,7 @@ MHD_add_response_footer (struct MHD_Response *response,
3389 * @return #MHD_NO on error (no such header known) 3397 * @return #MHD_NO on error (no such header known)
3390 * @ingroup response 3398 * @ingroup response
3391 */ 3399 */
3392_MHD_EXTERN int 3400_MHD_EXTERN enum MHD_Result
3393MHD_del_response_header (struct MHD_Response *response, 3401MHD_del_response_header (struct MHD_Response *response,
3394 const char *header, 3402 const char *header,
3395 const char *content); 3403 const char *content);
@@ -3470,7 +3478,7 @@ MHD_create_post_processor (struct MHD_Connection *connection,
3470 * (out-of-memory, iterator aborted, parse error) 3478 * (out-of-memory, iterator aborted, parse error)
3471 * @ingroup request 3479 * @ingroup request
3472 */ 3480 */
3473_MHD_EXTERN int 3481_MHD_EXTERN enum MHD_Result
3474MHD_post_process (struct MHD_PostProcessor *pp, 3482MHD_post_process (struct MHD_PostProcessor *pp,
3475 const char *post_data, size_t post_data_len); 3483 const char *post_data, size_t post_data_len);
3476 3484
@@ -3485,7 +3493,7 @@ MHD_post_process (struct MHD_PostProcessor *pp,
3485 * value of this function 3493 * value of this function
3486 * @ingroup request 3494 * @ingroup request
3487 */ 3495 */
3488_MHD_EXTERN int 3496_MHD_EXTERN enum MHD_Result
3489MHD_destroy_post_processor (struct MHD_PostProcessor *pp); 3497MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
3490 3498
3491 3499
@@ -3665,7 +3673,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
3665 * @return #MHD_YES on success, #MHD_NO otherwise 3673 * @return #MHD_YES on success, #MHD_NO otherwise
3666 * @ingroup authentication 3674 * @ingroup authentication
3667 */ 3675 */
3668_MHD_EXTERN int 3676_MHD_EXTERN enum MHD_Result
3669MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, 3677MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
3670 const char *realm, 3678 const char *realm,
3671 const char *opaque, 3679 const char *opaque,
@@ -3691,7 +3699,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
3691 * @ingroup authentication 3699 * @ingroup authentication
3692 * @deprecated use MHD_queue_auth_fail_response2() 3700 * @deprecated use MHD_queue_auth_fail_response2()
3693 */ 3701 */
3694_MHD_EXTERN int 3702_MHD_EXTERN enum MHD_Result
3695MHD_queue_auth_fail_response (struct MHD_Connection *connection, 3703MHD_queue_auth_fail_response (struct MHD_Connection *connection,
3696 const char *realm, 3704 const char *realm,
3697 const char *opaque, 3705 const char *opaque,
@@ -3777,7 +3785,7 @@ enum MHD_CONNECTION_OPTION
3777 * @return #MHD_YES on success, #MHD_NO if setting the option failed 3785 * @return #MHD_YES on success, #MHD_NO if setting the option failed
3778 * @ingroup specialized 3786 * @ingroup specialized
3779 */ 3787 */
3780_MHD_EXTERN int 3788_MHD_EXTERN enum MHD_Result
3781MHD_set_connection_option (struct MHD_Connection *connection, 3789MHD_set_connection_option (struct MHD_Connection *connection,
3782 enum MHD_CONNECTION_OPTION option, 3790 enum MHD_CONNECTION_OPTION option,
3783 ...); 3791 ...);
@@ -4042,7 +4050,7 @@ enum MHD_FEATURE
4042 * feature is not supported or feature is unknown. 4050 * feature is not supported or feature is unknown.
4043 * @ingroup specialized 4051 * @ingroup specialized
4044 */ 4052 */
4045_MHD_EXTERN int 4053_MHD_EXTERN enum MHD_Result
4046MHD_is_feature_supported (enum MHD_FEATURE feature); 4054MHD_is_feature_supported (enum MHD_FEATURE feature);
4047 4055
4048 4056
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 80a9bff0..44fc86a2 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -388,7 +388,7 @@ MHD_get_connection_values_n (struct MHD_Connection *connection,
388 * #MHD_YES on success 388 * #MHD_YES on success
389 * @ingroup request 389 * @ingroup request
390 */ 390 */
391static int 391static enum MHD_Result
392MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection, 392MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection,
393 enum MHD_ValueKind kind, 393 enum MHD_ValueKind kind,
394 const char *key, 394 const char *key,
@@ -449,7 +449,7 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection,
449 * #MHD_YES on success 449 * #MHD_YES on success
450 * @ingroup request 450 * @ingroup request
451 */ 451 */
452int 452enum MHD_Result
453MHD_set_connection_value_n (struct MHD_Connection *connection, 453MHD_set_connection_value_n (struct MHD_Connection *connection,
454 enum MHD_ValueKind kind, 454 enum MHD_ValueKind kind,
455 const char *key, 455 const char *key,
@@ -496,7 +496,7 @@ MHD_set_connection_value_n (struct MHD_Connection *connection,
496 * #MHD_YES on success 496 * #MHD_YES on success
497 * @ingroup request 497 * @ingroup request
498 */ 498 */
499int 499enum MHD_Result
500MHD_set_connection_value (struct MHD_Connection *connection, 500MHD_set_connection_value (struct MHD_Connection *connection,
501 enum MHD_ValueKind kind, 501 enum MHD_ValueKind kind,
502 const char *key, 502 const char *key,
@@ -562,7 +562,7 @@ MHD_lookup_connection_value (struct MHD_Connection *connection,
562 * #MHD_NO otherwise. 562 * #MHD_NO otherwise.
563 * @ingroup request 563 * @ingroup request
564 */ 564 */
565_MHD_EXTERN int 565_MHD_EXTERN enum MHD_Result
566MHD_lookup_connection_value_n (struct MHD_Connection *connection, 566MHD_lookup_connection_value_n (struct MHD_Connection *connection,
567 enum MHD_ValueKind kind, 567 enum MHD_ValueKind kind,
568 const char *key, 568 const char *key,
@@ -679,9 +679,9 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection,
679 * message for this connection? 679 * message for this connection?
680 * 680 *
681 * @param connection connection to test 681 * @param connection connection to test
682 * @return 0 if we don't need 100 CONTINUE, 1 if we do 682 * @return false if we don't need 100 CONTINUE, true if we do
683 */ 683 */
684static int 684static bool
685need_100_continue (struct MHD_Connection *connection) 685need_100_continue (struct MHD_Connection *connection)
686{ 686{
687 const char *expect; 687 const char *expect;
@@ -880,7 +880,7 @@ connection_close_error (struct MHD_Connection *connection,
880 * lock on the response will have been released already 880 * lock on the response will have been released already
881 * in this case). 881 * in this case).
882 */ 882 */
883static int 883static enum MHD_Result
884try_ready_normal_body (struct MHD_Connection *connection) 884try_ready_normal_body (struct MHD_Connection *connection)
885{ 885{
886 ssize_t ret; 886 ssize_t ret;
@@ -951,7 +951,7 @@ try_ready_normal_body (struct MHD_Connection *connection)
951 * @param connection the connection 951 * @param connection the connection
952 * @return #MHD_NO if readying the response failed 952 * @return #MHD_NO if readying the response failed
953 */ 953 */
954static int 954static enum MHD_Result
955try_ready_chunked_body (struct MHD_Connection *connection) 955try_ready_chunked_body (struct MHD_Connection *connection)
956{ 956{
957 ssize_t ret; 957 ssize_t ret;
@@ -1082,7 +1082,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
1082 * @return #MHD_YES if (based on the request), a keepalive is 1082 * @return #MHD_YES if (based on the request), a keepalive is
1083 * legal 1083 * legal
1084 */ 1084 */
1085static int 1085static enum MHD_Result
1086keepalive_possible (struct MHD_Connection *connection) 1086keepalive_possible (struct MHD_Connection *connection)
1087{ 1087{
1088 if (MHD_CONN_MUST_CLOSE == connection->keepalive) 1088 if (MHD_CONN_MUST_CLOSE == connection->keepalive)
@@ -1248,7 +1248,7 @@ try_grow_read_buffer (struct MHD_Connection *connection,
1248 * @param connection the connection 1248 * @param connection the connection
1249 * @return #MHD_YES on success, #MHD_NO on failure (out of memory) 1249 * @return #MHD_YES on success, #MHD_NO on failure (out of memory)
1250 */ 1250 */
1251static int 1251static enum MHD_Result
1252build_header_response (struct MHD_Connection *connection) 1252build_header_response (struct MHD_Connection *connection)
1253{ 1253{
1254 struct MHD_Response *response = connection->response; 1254 struct MHD_Response *response = connection->response;
@@ -1627,7 +1627,7 @@ transmit_error_response (struct MHD_Connection *connection,
1627 const char *message) 1627 const char *message)
1628{ 1628{
1629 struct MHD_Response *response; 1629 struct MHD_Response *response;
1630 int iret; 1630 enum MHD_Result iret;
1631 1631
1632 if (NULL == connection->version) 1632 if (NULL == connection->version)
1633 { 1633 {
@@ -1933,7 +1933,7 @@ get_next_header_line (struct MHD_Connection *connection,
1933 * @param value_size number of bytes in @a value 1933 * @param value_size number of bytes in @a value
1934 * @return #MHD_NO on failure (out of memory), #MHD_YES for success 1934 * @return #MHD_NO on failure (out of memory), #MHD_YES for success
1935 */ 1935 */
1936static int 1936static enum MHD_Result
1937connection_add_header (struct MHD_Connection *connection, 1937connection_add_header (struct MHD_Connection *connection,
1938 const char *key, 1938 const char *key,
1939 size_t key_size, 1939 size_t key_size,
@@ -1968,7 +1968,7 @@ connection_add_header (struct MHD_Connection *connection,
1968 * @param connection connection to parse header of 1968 * @param connection connection to parse header of
1969 * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory) 1969 * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory)
1970 */ 1970 */
1971static int 1971static enum MHD_Result
1972parse_cookie_header (struct MHD_Connection *connection) 1972parse_cookie_header (struct MHD_Connection *connection)
1973{ 1973{
1974 const char *hdr; 1974 const char *hdr;
@@ -2094,7 +2094,7 @@ parse_cookie_header (struct MHD_Connection *connection)
2094 * @param line_len length of the first @a line 2094 * @param line_len length of the first @a line
2095 * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed 2095 * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed
2096 */ 2096 */
2097static int 2097static enum MHD_Result
2098parse_initial_message_line (struct MHD_Connection *connection, 2098parse_initial_message_line (struct MHD_Connection *connection,
2099 char *line, 2099 char *line,
2100 size_t line_len) 2100 size_t line_len)
@@ -2485,7 +2485,7 @@ process_request_body (struct MHD_Connection *connection)
2485 * @param next_state the next state to transition to 2485 * @param next_state the next state to transition to
2486 * @return #MHD_NO if we are not done, #MHD_YES if we are 2486 * @return #MHD_NO if we are not done, #MHD_YES if we are
2487 */ 2487 */
2488static int 2488static enum MHD_Result
2489check_write_done (struct MHD_Connection *connection, 2489check_write_done (struct MHD_Connection *connection,
2490 enum MHD_CONNECTION_STATE next_state) 2490 enum MHD_CONNECTION_STATE next_state)
2491{ 2491{
@@ -2514,7 +2514,7 @@ check_write_done (struct MHD_Connection *connection,
2514 * @param line line from the header to process 2514 * @param line line from the header to process
2515 * @return #MHD_YES on success, #MHD_NO on error (malformed @a line) 2515 * @return #MHD_YES on success, #MHD_NO on error (malformed @a line)
2516 */ 2516 */
2517static int 2517static enum MHD_Result
2518process_header_line (struct MHD_Connection *connection, 2518process_header_line (struct MHD_Connection *connection,
2519 char *line) 2519 char *line)
2520{ 2520{
@@ -2573,7 +2573,7 @@ process_header_line (struct MHD_Connection *connection,
2573 * of the given kind 2573 * of the given kind
2574 * @return #MHD_YES if the line was processed successfully 2574 * @return #MHD_YES if the line was processed successfully
2575 */ 2575 */
2576static int 2576static enum MHD_Result
2577process_broken_line (struct MHD_Connection *connection, 2577process_broken_line (struct MHD_Connection *connection,
2578 char *line, 2578 char *line,
2579 enum MHD_ValueKind kind) 2579 enum MHD_ValueKind kind)
@@ -2681,7 +2681,7 @@ parse_connection_headers (struct MHD_Connection *connection)
2681 NULL, 2681 NULL,
2682 NULL)) ) 2682 NULL)) )
2683 { 2683 {
2684 int iret; 2684 enum MHD_Result iret;
2685 2685
2686 /* die, http 1.1 request without host and we are pedantic */ 2686 /* die, http 1.1 request without host and we are pedantic */
2687 connection->state = MHD_CONNECTION_FOOTERS_RECEIVED; 2687 connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
@@ -3272,13 +3272,13 @@ cleanup_connection (struct MHD_Connection *connection)
3272 * @return #MHD_YES if we should continue to process the 3272 * @return #MHD_YES if we should continue to process the
3273 * connection (not dead yet), #MHD_NO if it died 3273 * connection (not dead yet), #MHD_NO if it died
3274 */ 3274 */
3275int 3275enum MHD_Result
3276MHD_connection_handle_idle (struct MHD_Connection *connection) 3276MHD_connection_handle_idle (struct MHD_Connection *connection)
3277{ 3277{
3278 struct MHD_Daemon *daemon = connection->daemon; 3278 struct MHD_Daemon *daemon = connection->daemon;
3279 char *line; 3279 char *line;
3280 size_t line_len; 3280 size_t line_len;
3281 int ret; 3281 enum MHD_Result ret;
3282 3282
3283 connection->in_idle = true; 3283 connection->in_idle = true;
3284 while (! connection->suspended) 3284 while (! connection->suspended)
@@ -3763,7 +3763,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
3763 * @return #MHD_YES if we should continue to process the 3763 * @return #MHD_YES if we should continue to process the
3764 * connection (not dead yet), #MHD_NO if it died 3764 * connection (not dead yet), #MHD_NO if it died
3765 */ 3765 */
3766int 3766enum MHD_Result
3767MHD_connection_epoll_update_ (struct MHD_Connection *connection) 3767MHD_connection_epoll_update_ (struct MHD_Connection *connection)
3768{ 3768{
3769 struct MHD_Daemon *daemon = connection->daemon; 3769 struct MHD_Daemon *daemon = connection->daemon;
@@ -3888,7 +3888,7 @@ MHD_get_connection_info (struct MHD_Connection *connection,
3888 * @return #MHD_YES on success, #MHD_NO if setting the option failed 3888 * @return #MHD_YES on success, #MHD_NO if setting the option failed
3889 * @ingroup specialized 3889 * @ingroup specialized
3890 */ 3890 */
3891int 3891enum MHD_Result
3892MHD_set_connection_option (struct MHD_Connection *connection, 3892MHD_set_connection_option (struct MHD_Connection *connection,
3893 enum MHD_CONNECTION_OPTION option, 3893 enum MHD_CONNECTION_OPTION option,
3894 ...) 3894 ...)
@@ -3954,7 +3954,7 @@ MHD_set_connection_option (struct MHD_Connection *connection,
3954 * #MHD_YES on success or if message has been queued 3954 * #MHD_YES on success or if message has been queued
3955 * @ingroup response 3955 * @ingroup response
3956 */ 3956 */
3957int 3957enum MHD_Result
3958MHD_queue_response (struct MHD_Connection *connection, 3958MHD_queue_response (struct MHD_Connection *connection,
3959 unsigned int status_code, 3959 unsigned int status_code,
3960 struct MHD_Response *response) 3960 struct MHD_Response *response)
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 88f31dbd..29724a24 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -114,10 +114,10 @@ MHD_connection_handle_write (struct MHD_Connection *connection);
114 * recv(), send() and response. 114 * recv(), send() and response.
115 * 115 *
116 * @param connection connection to handle 116 * @param connection connection to handle
117 * @return MHD_YES if we should continue to process the 117 * @return #MHD_YES if we should continue to process the
118 * connection (not dead yet), MHD_NO if it died 118 * connection (not dead yet), #MHD_NO if it died
119 */ 119 */
120int 120enum MHD_Result
121MHD_connection_handle_idle (struct MHD_Connection *connection); 121MHD_connection_handle_idle (struct MHD_Connection *connection);
122 122
123 123
@@ -165,10 +165,10 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection);
165 * the epoll set if needed. 165 * the epoll set if needed.
166 * 166 *
167 * @param connection connection to process 167 * @param connection connection to process
168 * @return MHD_YES if we should continue to process the 168 * @return #MHD_YES if we should continue to process the
169 * connection (not dead yet), MHD_NO if it died 169 * connection (not dead yet), #MHD_NO if it died
170 */ 170 */
171int 171enum MHD_Result
172MHD_connection_epoll_update_ (struct MHD_Connection *connection); 172MHD_connection_epoll_update_ (struct MHD_Connection *connection);
173 173
174#endif 174#endif
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f7c138aa..660ee61e 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -113,7 +113,7 @@ close_all_connections (struct MHD_Daemon *daemon);
113 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 113 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
114 * @return #MHD_NO on serious errors, #MHD_YES on success 114 * @return #MHD_NO on serious errors, #MHD_YES on success
115 */ 115 */
116static int 116static enum MHD_Result
117MHD_epoll (struct MHD_Daemon *daemon, 117MHD_epoll (struct MHD_Daemon *daemon,
118 int may_block); 118 int may_block);
119 119
@@ -361,7 +361,7 @@ MHD_ip_addr_compare (const void *a1,
361 * @param key where to store the parsed address 361 * @param key where to store the parsed address
362 * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type) 362 * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type)
363 */ 363 */
364static int 364static enum MHD_Result
365MHD_ip_addr_to_key (const struct sockaddr *addr, 365MHD_ip_addr_to_key (const struct sockaddr *addr,
366 socklen_t addrlen, 366 socklen_t addrlen,
367 struct MHD_IPCount *key) 367 struct MHD_IPCount *key)
@@ -412,7 +412,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
412 * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit. 412 * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit.
413 * Also returns #MHD_NO if fails to allocate memory. 413 * Also returns #MHD_NO if fails to allocate memory.
414 */ 414 */
415static int 415static enum MHD_Result
416MHD_ip_limit_add (struct MHD_Daemon *daemon, 416MHD_ip_limit_add (struct MHD_Daemon *daemon,
417 const struct sockaddr *addr, 417 const struct sockaddr *addr,
418 socklen_t addrlen) 418 socklen_t addrlen)
@@ -420,7 +420,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
420 struct MHD_IPCount *key; 420 struct MHD_IPCount *key;
421 void **nodep; 421 void **nodep;
422 void *node; 422 void *node;
423 int result; 423 enum MHD_Result result;
424 424
425 daemon = MHD_get_master (daemon); 425 daemon = MHD_get_master (daemon);
426 /* Ignore if no connection limit assigned */ 426 /* Ignore if no connection limit assigned */
@@ -723,7 +723,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
723 * fit fd_set. 723 * fit fd_set.
724 * @ingroup event 724 * @ingroup event
725 */ 725 */
726int 726enum MHD_Result
727MHD_get_fdset (struct MHD_Daemon *daemon, 727MHD_get_fdset (struct MHD_Daemon *daemon,
728 fd_set *read_fd_set, 728 fd_set *read_fd_set,
729 fd_set *write_fd_set, 729 fd_set *write_fd_set,
@@ -976,7 +976,7 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
976 * fit fd_set. 976 * fit fd_set.
977 * @ingroup event 977 * @ingroup event
978 */ 978 */
979static int 979static enum MHD_Result
980internal_get_fdset2 (struct MHD_Daemon *daemon, 980internal_get_fdset2 (struct MHD_Daemon *daemon,
981 fd_set *read_fd_set, 981 fd_set *read_fd_set,
982 fd_set *write_fd_set, 982 fd_set *write_fd_set,
@@ -987,7 +987,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
987{ 987{
988 struct MHD_Connection *pos; 988 struct MHD_Connection *pos;
989 struct MHD_Connection *posn; 989 struct MHD_Connection *posn;
990 int result = MHD_YES; 990 enum MHD_Result result = MHD_YES;
991 MHD_socket ls; 991 MHD_socket ls;
992 992
993 if (daemon->shutdown) 993 if (daemon->shutdown)
@@ -1125,7 +1125,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
1125 * fit fd_set. 1125 * fit fd_set.
1126 * @ingroup event 1126 * @ingroup event
1127 */ 1127 */
1128int 1128enum MHD_Result
1129MHD_get_fdset2 (struct MHD_Daemon *daemon, 1129MHD_get_fdset2 (struct MHD_Daemon *daemon,
1130 fd_set *read_fd_set, 1130 fd_set *read_fd_set,
1131 fd_set *write_fd_set, 1131 fd_set *write_fd_set,
@@ -1191,13 +1191,13 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
1191 * #MHD_NO if a serious error was encountered and the 1191 * #MHD_NO if a serious error was encountered and the
1192 * connection is to be closed. 1192 * connection is to be closed.
1193 */ 1193 */
1194static int 1194static enum MHD_Result
1195call_handlers (struct MHD_Connection *con, 1195call_handlers (struct MHD_Connection *con,
1196 bool read_ready, 1196 bool read_ready,
1197 bool write_ready, 1197 bool write_ready,
1198 bool force_close) 1198 bool force_close)
1199{ 1199{
1200 int ret; 1200 enum MHD_Result ret;
1201 bool states_info_processed = false; 1201 bool states_info_processed = false;
1202 /* Fast track flag */ 1202 /* Fast track flag */
1203 bool on_fasttrack = (con->state == MHD_CONNECTION_INIT); 1203 bool on_fasttrack = (con->state == MHD_CONNECTION_INIT);
@@ -2369,7 +2369,7 @@ psk_gnutls_adapter (gnutls_session_t session,
2369 * The socket will be closed in any case; 'errno' is 2369 * The socket will be closed in any case; 'errno' is
2370 * set to indicate further details about the error. 2370 * set to indicate further details about the error.
2371 */ 2371 */
2372static int 2372static enum MHD_Result
2373internal_add_connection (struct MHD_Daemon *daemon, 2373internal_add_connection (struct MHD_Daemon *daemon,
2374 MHD_socket client_socket, 2374 MHD_socket client_socket,
2375 const struct sockaddr *addr, 2375 const struct sockaddr *addr,
@@ -2969,12 +2969,12 @@ MHD_resume_connection (struct MHD_Connection *connection)
2969 * @param daemon daemon context 2969 * @param daemon daemon context
2970 * @return #MHD_YES if a connection was actually resumed 2970 * @return #MHD_YES if a connection was actually resumed
2971 */ 2971 */
2972static int 2972static enum MHD_Result
2973resume_suspended_connections (struct MHD_Daemon *daemon) 2973resume_suspended_connections (struct MHD_Daemon *daemon)
2974{ 2974{
2975 struct MHD_Connection *pos; 2975 struct MHD_Connection *pos;
2976 struct MHD_Connection *prev = NULL; 2976 struct MHD_Connection *prev = NULL;
2977 int ret; 2977 enum MHD_Result ret;
2978 const bool used_thr_p_c = (0 != (daemon->options 2978 const bool used_thr_p_c = (0 != (daemon->options
2979 & MHD_USE_THREAD_PER_CONNECTION)); 2979 & MHD_USE_THREAD_PER_CONNECTION));
2980#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 2980#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
@@ -3124,7 +3124,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
3124 * set to indicate further details about the error. 3124 * set to indicate further details about the error.
3125 * @ingroup specialized 3125 * @ingroup specialized
3126 */ 3126 */
3127int 3127enum MHD_Result
3128MHD_add_connection (struct MHD_Daemon *daemon, 3128MHD_add_connection (struct MHD_Daemon *daemon,
3129 MHD_socket client_socket, 3129 MHD_socket client_socket,
3130 const struct sockaddr *addr, 3130 const struct sockaddr *addr,
@@ -3185,7 +3185,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
3185 * a return code of #MHD_NO only refers to the actual 3185 * a return code of #MHD_NO only refers to the actual
3186 * accept() system call. 3186 * accept() system call.
3187 */ 3187 */
3188static int 3188static enum MHD_Result
3189MHD_accept_connection (struct MHD_Daemon *daemon) 3189MHD_accept_connection (struct MHD_Daemon *daemon)
3190{ 3190{
3191#if HAVE_INET6 3191#if HAVE_INET6
@@ -3443,7 +3443,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
3443 * necessitate the use of a timeout right now). 3443 * necessitate the use of a timeout right now).
3444 * @ingroup event 3444 * @ingroup event
3445 */ 3445 */
3446int 3446enum MHD_Result
3447MHD_get_timeout (struct MHD_Daemon *daemon, 3447MHD_get_timeout (struct MHD_Daemon *daemon,
3448 MHD_UNSIGNED_LONG_LONG *timeout) 3448 MHD_UNSIGNED_LONG_LONG *timeout)
3449{ 3449{
@@ -3533,7 +3533,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
3533 * @return #MHD_NO on serious errors, #MHD_YES on success 3533 * @return #MHD_NO on serious errors, #MHD_YES on success
3534 * @ingroup event 3534 * @ingroup event
3535 */ 3535 */
3536static int 3536static enum MHD_Result
3537internal_run_from_select (struct MHD_Daemon *daemon, 3537internal_run_from_select (struct MHD_Daemon *daemon,
3538 const fd_set *read_fd_set, 3538 const fd_set *read_fd_set,
3539 const fd_set *write_fd_set, 3539 const fd_set *write_fd_set,
@@ -3637,7 +3637,7 @@ internal_run_from_select (struct MHD_Daemon *daemon,
3637 * @return #MHD_NO on serious errors, #MHD_YES on success 3637 * @return #MHD_NO on serious errors, #MHD_YES on success
3638 * @ingroup event 3638 * @ingroup event
3639 */ 3639 */
3640int 3640enum MHD_Result
3641MHD_run_from_select (struct MHD_Daemon *daemon, 3641MHD_run_from_select (struct MHD_Daemon *daemon,
3642 const fd_set *read_fd_set, 3642 const fd_set *read_fd_set,
3643 const fd_set *write_fd_set, 3643 const fd_set *write_fd_set,
@@ -3662,8 +3662,8 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
3662 if (0 != (daemon->options & MHD_USE_EPOLL)) 3662 if (0 != (daemon->options & MHD_USE_EPOLL))
3663 { 3663 {
3664#ifdef EPOLL_SUPPORT 3664#ifdef EPOLL_SUPPORT
3665 int ret = MHD_epoll (daemon, 3665 enum MHD_Result ret = MHD_epoll (daemon,
3666 MHD_NO); 3666 MHD_NO);
3667 3667
3668 MHD_cleanup_connections (daemon); 3668 MHD_cleanup_connections (daemon);
3669 return ret; 3669 return ret;
@@ -3691,7 +3691,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
3691 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 3691 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
3692 * @return #MHD_NO on serious errors, #MHD_YES on success 3692 * @return #MHD_NO on serious errors, #MHD_YES on success
3693 */ 3693 */
3694static int 3694static enum MHD_Result
3695MHD_select (struct MHD_Daemon *daemon, 3695MHD_select (struct MHD_Daemon *daemon,
3696 int may_block) 3696 int may_block)
3697{ 3697{
@@ -3860,7 +3860,7 @@ MHD_select (struct MHD_Daemon *daemon,
3860 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 3860 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
3861 * @return #MHD_NO on serious errors, #MHD_YES on success 3861 * @return #MHD_NO on serious errors, #MHD_YES on success
3862 */ 3862 */
3863static int 3863static enum MHD_Result
3864MHD_poll_all (struct MHD_Daemon *daemon, 3864MHD_poll_all (struct MHD_Daemon *daemon,
3865 int may_block) 3865 int may_block)
3866{ 3866{
@@ -4075,7 +4075,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
4075 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 4075 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
4076 * @return #MHD_NO on serious errors, #MHD_YES on success 4076 * @return #MHD_NO on serious errors, #MHD_YES on success
4077 */ 4077 */
4078static int 4078static enum MHD_Result
4079MHD_poll_listen_socket (struct MHD_Daemon *daemon, 4079MHD_poll_listen_socket (struct MHD_Daemon *daemon,
4080 int may_block) 4080 int may_block)
4081{ 4081{
@@ -4159,7 +4159,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
4159 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 4159 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
4160 * @return #MHD_NO on serious errors, #MHD_YES on success 4160 * @return #MHD_NO on serious errors, #MHD_YES on success
4161 */ 4161 */
4162static int 4162static enum MHD_Result
4163MHD_poll (struct MHD_Daemon *daemon, 4163MHD_poll (struct MHD_Daemon *daemon,
4164 int may_block) 4164 int may_block)
4165{ 4165{
@@ -4238,7 +4238,7 @@ is_urh_ready (struct MHD_UpgradeResponseHandle *const urh)
4238 * @remark To be called only from thread that process 4238 * @remark To be called only from thread that process
4239 * daemon's select()/poll()/etc. 4239 * daemon's select()/poll()/etc.
4240 */ 4240 */
4241static int 4241static enum MHD_Result
4242run_epoll_for_upgrade (struct MHD_Daemon *daemon) 4242run_epoll_for_upgrade (struct MHD_Daemon *daemon)
4243{ 4243{
4244 struct epoll_event events[MAX_EVENTS]; 4244 struct epoll_event events[MAX_EVENTS];
@@ -4357,7 +4357,7 @@ static const char *const epoll_itc_marker = "itc_marker";
4357 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking 4357 * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
4358 * @return #MHD_NO on serious errors, #MHD_YES on success 4358 * @return #MHD_NO on serious errors, #MHD_YES on success
4359 */ 4359 */
4360static int 4360static enum MHD_Result
4361MHD_epoll (struct MHD_Daemon *daemon, 4361MHD_epoll (struct MHD_Daemon *daemon,
4362 int may_block) 4362 int may_block)
4363{ 4363{
@@ -4673,7 +4673,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
4673 * options for this call. 4673 * options for this call.
4674 * @ingroup event 4674 * @ingroup event
4675 */ 4675 */
4676int 4676enum MHD_Result
4677MHD_run (struct MHD_Daemon *daemon) 4677MHD_run (struct MHD_Daemon *daemon)
4678{ 4678{
4679 if ( (daemon->shutdown) || 4679 if ( (daemon->shutdown) ||
@@ -4967,7 +4967,7 @@ typedef void
4967 * @param ap the options 4967 * @param ap the options
4968 * @return #MHD_YES on success, #MHD_NO on error 4968 * @return #MHD_YES on success, #MHD_NO on error
4969 */ 4969 */
4970static int 4970static enum MHD_Result
4971parse_options_va (struct MHD_Daemon *daemon, 4971parse_options_va (struct MHD_Daemon *daemon,
4972 const struct sockaddr **servaddr, 4972 const struct sockaddr **servaddr,
4973 va_list ap); 4973 va_list ap);
@@ -4981,13 +4981,13 @@ parse_options_va (struct MHD_Daemon *daemon,
4981 * @param ... the options 4981 * @param ... the options
4982 * @return #MHD_YES on success, #MHD_NO on error 4982 * @return #MHD_YES on success, #MHD_NO on error
4983 */ 4983 */
4984static int 4984static enum MHD_Result
4985parse_options (struct MHD_Daemon *daemon, 4985parse_options (struct MHD_Daemon *daemon,
4986 const struct sockaddr **servaddr, 4986 const struct sockaddr **servaddr,
4987 ...) 4987 ...)
4988{ 4988{
4989 va_list ap; 4989 va_list ap;
4990 int ret; 4990 enum MHD_Result ret;
4991 4991
4992 va_start (ap, servaddr); 4992 va_start (ap, servaddr);
4993 ret = parse_options_va (daemon, 4993 ret = parse_options_va (daemon,
@@ -5006,7 +5006,7 @@ parse_options (struct MHD_Daemon *daemon,
5006 * @param ap the options 5006 * @param ap the options
5007 * @return #MHD_YES on success, #MHD_NO on error 5007 * @return #MHD_YES on success, #MHD_NO on error
5008 */ 5008 */
5009static int 5009static enum MHD_Result
5010parse_options_va (struct MHD_Daemon *daemon, 5010parse_options_va (struct MHD_Daemon *daemon,
5011 const struct sockaddr **servaddr, 5011 const struct sockaddr **servaddr,
5012 va_list ap) 5012 va_list ap)
@@ -5016,7 +5016,7 @@ parse_options_va (struct MHD_Daemon *daemon,
5016 unsigned int i; 5016 unsigned int i;
5017 unsigned int uv; 5017 unsigned int uv;
5018#ifdef HTTPS_SUPPORT 5018#ifdef HTTPS_SUPPORT
5019 int ret; 5019 enum MHD_Result ret;
5020 const char *pstr; 5020 const char *pstr;
5021#if GNUTLS_VERSION_MAJOR >= 3 5021#if GNUTLS_VERSION_MAJOR >= 3
5022 gnutls_certificate_retrieve_function2 *pgcrf; 5022 gnutls_certificate_retrieve_function2 *pgcrf;
@@ -5614,7 +5614,7 @@ setup_epoll_fd (struct MHD_Daemon *daemon)
5614 * @param daemon daemon to initialize for epoll() 5614 * @param daemon daemon to initialize for epoll()
5615 * @return #MHD_YES on success, #MHD_NO on failure 5615 * @return #MHD_YES on success, #MHD_NO on failure
5616 */ 5616 */
5617static int 5617static enum MHD_Result
5618setup_epoll_to_listen (struct MHD_Daemon *daemon) 5618setup_epoll_to_listen (struct MHD_Daemon *daemon)
5619{ 5619{
5620 struct epoll_event event; 5620 struct epoll_event event;
@@ -7093,7 +7093,7 @@ MHD_get_version (void)
7093 * feature is not supported or feature is unknown. 7093 * feature is not supported or feature is unknown.
7094 * @ingroup specialized 7094 * @ingroup specialized
7095 */ 7095 */
7096_MHD_EXTERN int 7096enum MHD_Result
7097MHD_is_feature_supported (enum MHD_FEATURE feature) 7097MHD_is_feature_supported (enum MHD_FEATURE feature)
7098{ 7098{
7099 switch (feature) 7099 switch (feature)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index e5c66d56..49ce4dce 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -521,7 +521,7 @@ lookup_sub_value (char *dest,
521 * @param nc The nonce counter, zero to add the nonce to the array 521 * @param nc The nonce counter, zero to add the nonce to the array
522 * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array) 522 * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array)
523 */ 523 */
524static int 524static enum MHD_Result
525check_nonce_nc (struct MHD_Connection *connection, 525check_nonce_nc (struct MHD_Connection *connection,
526 const char *nonce, 526 const char *nonce,
527 uint64_t nc) 527 uint64_t nc)
@@ -743,7 +743,7 @@ calculate_nonce (uint32_t nonce_time,
743 * @return #MHD_YES if the key-value pair is in the headers, 743 * @return #MHD_YES if the key-value pair is in the headers,
744 * #MHD_NO if not 744 * #MHD_NO if not
745 */ 745 */
746static int 746static enum MHD_Result
747test_header (struct MHD_Connection *connection, 747test_header (struct MHD_Connection *connection,
748 const char *key, 748 const char *key,
749 size_t key_size, 749 size_t key_size,
@@ -790,14 +790,14 @@ test_header (struct MHD_Connection *connection,
790 * @return #MHD_YES if the arguments match, 790 * @return #MHD_YES if the arguments match,
791 * #MHD_NO if not 791 * #MHD_NO if not
792 */ 792 */
793static int 793static enum MHD_Result
794check_argument_match (struct MHD_Connection *connection, 794check_argument_match (struct MHD_Connection *connection,
795 const char *args) 795 const char *args)
796{ 796{
797 struct MHD_HTTP_Header *pos; 797 struct MHD_HTTP_Header *pos;
798 char *argb; 798 char *argb;
799 unsigned int num_headers; 799 unsigned int num_headers;
800 int ret; 800 enum MHD_Result ret;
801 801
802 argb = strdup (args); 802 argb = strdup (args);
803 if (NULL == argb) 803 if (NULL == argb)
@@ -1338,7 +1338,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection *connection,
1338 * @return #MHD_YES on success, #MHD_NO otherwise 1338 * @return #MHD_YES on success, #MHD_NO otherwise
1339 * @ingroup authentication 1339 * @ingroup authentication
1340 */ 1340 */
1341int 1341enum MHD_Result
1342MHD_queue_auth_fail_response2 (struct MHD_Connection *connection, 1342MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
1343 const char *realm, 1343 const char *realm,
1344 const char *opaque, 1344 const char *opaque,
@@ -1461,7 +1461,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
1461 * @return #MHD_YES on success, #MHD_NO otherwise 1461 * @return #MHD_YES on success, #MHD_NO otherwise
1462 * @ingroup authentication 1462 * @ingroup authentication
1463 */ 1463 */
1464int 1464enum MHD_Result
1465MHD_queue_auth_fail_response (struct MHD_Connection *connection, 1465MHD_queue_auth_fail_response (struct MHD_Connection *connection,
1466 const char *realm, 1466 const char *realm,
1467 const char *opaque, 1467 const char *opaque,
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index b8d8f540..ba601fa0 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -184,7 +184,7 @@ MHD_http_unescape (char *val)
184 * #MHD_YES for success (parsing succeeded, @a cb always 184 * #MHD_YES for success (parsing succeeded, @a cb always
185 * returned #MHD_YES) 185 * returned #MHD_YES)
186 */ 186 */
187int 187enum MHD_Result
188MHD_parse_arguments_ (struct MHD_Connection *connection, 188MHD_parse_arguments_ (struct MHD_Connection *connection,
189 enum MHD_ValueKind kind, 189 enum MHD_ValueKind kind,
190 char *args, 190 char *args,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 96e24780..4cec6787 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1910,7 +1910,7 @@ MHD_unescape_plus (char *arg);
1910 * @return #MHD_YES on success (continue to iterate) 1910 * @return #MHD_YES on success (continue to iterate)
1911 * #MHD_NO to signal failure (and abort iteration) 1911 * #MHD_NO to signal failure (and abort iteration)
1912 */ 1912 */
1913typedef int 1913typedef enum MHD_Result
1914(*MHD_ArgumentIterator_)(struct MHD_Connection *connection, 1914(*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
1915 const char *key, 1915 const char *key,
1916 size_t key_size, 1916 size_t key_size,
@@ -1933,7 +1933,7 @@ typedef int
1933 * #MHD_YES for success (parsing succeeded, @a cb always 1933 * #MHD_YES for success (parsing succeeded, @a cb always
1934 * returned #MHD_YES) 1934 * returned #MHD_YES)
1935 */ 1935 */
1936int 1936enum MHD_Result
1937MHD_parse_arguments_ (struct MHD_Connection *connection, 1937MHD_parse_arguments_ (struct MHD_Connection *connection,
1938 enum MHD_ValueKind kind, 1938 enum MHD_ValueKind kind,
1939 char *args, 1939 char *args,
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index b7f6b108..0069147b 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -176,7 +176,7 @@ struct MHD_PostProcessor
176 * Value data left over from previous iteration. 176 * Value data left over from previous iteration.
177 */ 177 */
178 char xbuf[2]; 178 char xbuf[2];
179 179
180 /** 180 /**
181 * Size of our buffer for the key. 181 * Size of our buffer for the key.
182 */ 182 */
@@ -220,9 +220,9 @@ struct MHD_PostProcessor
220 /** 220 /**
221 * Set if we still need to run the unescape logic 221 * Set if we still need to run the unescape logic
222 * on the key allocated at the end of this struct. 222 * on the key allocated at the end of this struct.
223 */ 223 */
224 bool must_unescape_key; 224 bool must_unescape_key;
225 225
226 /** 226 /**
227 * State of the parser. 227 * State of the parser.
228 */ 228 */
@@ -478,7 +478,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
478 (pp->state == PP_Callback) ) && 478 (pp->state == PP_Callback) ) &&
479 (pp->state != PP_Error) ) 479 (pp->state != PP_Error) )
480 { 480 {
481 switch (pp->state) { 481 switch (pp->state)
482 {
482 case PP_Error: 483 case PP_Error:
483 /* clearly impossible as per while loop invariant */ 484 /* clearly impossible as per while loop invariant */
484 abort (); 485 abort ();
@@ -520,7 +521,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
520 case PP_ProcessValue: 521 case PP_ProcessValue:
521 if (NULL == start_value) 522 if (NULL == start_value)
522 start_value = &post_data[poff]; 523 start_value = &post_data[poff];
523 switch (post_data[poff]) { 524 switch (post_data[poff])
525 {
524 case '=': 526 case '=':
525 /* case 'key==' */ 527 /* case 'key==' */
526 pp->state = PP_Error; 528 pp->state = PP_Error;
@@ -529,8 +531,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
529 /* case 'value&' */ 531 /* case 'value&' */
530 end_value = &post_data[poff]; 532 end_value = &post_data[poff];
531 poff++; 533 poff++;
532 if ( pp->must_ikvi || 534 if (pp->must_ikvi ||
533 (start_value != end_value) ) 535 (start_value != end_value) )
534 { 536 {
535 pp->state = PP_Callback; 537 pp->state = PP_Callback;
536 } 538 }
@@ -538,7 +540,7 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
538 { 540 {
539 pp->buffer_pos = 0; 541 pp->buffer_pos = 0;
540 pp->value_offset = 0; 542 pp->value_offset = 0;
541 pp->state = PP_Init; 543 pp->state = PP_Init;
542 } 544 }
543 continue; 545 continue;
544 case '\n': 546 case '\n':
@@ -576,7 +578,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
576 } 578 }
577 break; /* end PP_ProcessValue */ 579 break; /* end PP_ProcessValue */
578 case PP_Done: 580 case PP_Done:
579 switch (post_data[poff]) { 581 switch (post_data[poff])
582 {
580 case '\n': 583 case '\n':
581 case '\r': 584 case '\r':
582 poff++; 585 poff++;
@@ -632,9 +635,9 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
632 } 635 }
633 636
634 /* save remaining data for next iteration */ 637 /* save remaining data for next iteration */
635 if (NULL != start_key) 638 if (NULL != start_key)
636 { 639 {
637 if (NULL == end_key) 640 if (NULL == end_key)
638 end_key = &post_data[poff]; 641 end_key = &post_data[poff];
639 memcpy (&kbuf[pp->buffer_pos], 642 memcpy (&kbuf[pp->buffer_pos],
640 start_key, 643 start_key,
@@ -1366,7 +1369,7 @@ END:
1366 * (out-of-memory, iterator aborted, parse error) 1369 * (out-of-memory, iterator aborted, parse error)
1367 * @ingroup request 1370 * @ingroup request
1368 */ 1371 */
1369int 1372enum MHD_Result
1370MHD_post_process (struct MHD_PostProcessor *pp, 1373MHD_post_process (struct MHD_PostProcessor *pp,
1371 const char *post_data, 1374 const char *post_data,
1372 size_t post_data_len) 1375 size_t post_data_len)
@@ -1404,10 +1407,10 @@ MHD_post_process (struct MHD_PostProcessor *pp,
1404 * value of this function 1407 * value of this function
1405 * @ingroup request 1408 * @ingroup request
1406 */ 1409 */
1407int 1410enum MHD_Result
1408MHD_destroy_post_processor (struct MHD_PostProcessor *pp) 1411MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
1409{ 1412{
1410 int ret; 1413 enum MHD_Result ret;
1411 1414
1412 if (NULL == pp) 1415 if (NULL == pp)
1413 return MHD_YES; 1416 return MHD_YES;
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 5adfdfa9..abedefcf 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -78,7 +78,7 @@
78 * @param content value to add 78 * @param content value to add
79 * @return #MHD_NO on error (i.e. invalid header or content format). 79 * @return #MHD_NO on error (i.e. invalid header or content format).
80 */ 80 */
81static int 81static enum MHD_Result
82add_response_entry (struct MHD_Response *response, 82add_response_entry (struct MHD_Response *response,
83 enum MHD_ValueKind kind, 83 enum MHD_ValueKind kind,
84 const char *header, 84 const char *header,
@@ -129,7 +129,7 @@ add_response_entry (struct MHD_Response *response,
129 * @return #MHD_NO on error (i.e. invalid header or content format). 129 * @return #MHD_NO on error (i.e. invalid header or content format).
130 * @ingroup response 130 * @ingroup response
131 */ 131 */
132int 132enum MHD_Result
133MHD_add_response_header (struct MHD_Response *response, 133MHD_add_response_header (struct MHD_Response *response,
134 const char *header, 134 const char *header,
135 const char *content) 135 const char *content)
@@ -173,7 +173,7 @@ MHD_add_response_header (struct MHD_Response *response,
173 * @return #MHD_NO on error (i.e. invalid footer or content format). 173 * @return #MHD_NO on error (i.e. invalid footer or content format).
174 * @ingroup response 174 * @ingroup response
175 */ 175 */
176int 176enum MHD_Result
177MHD_add_response_footer (struct MHD_Response *response, 177MHD_add_response_footer (struct MHD_Response *response,
178 const char *footer, 178 const char *footer,
179 const char *content) 179 const char *content)
@@ -194,7 +194,7 @@ MHD_add_response_footer (struct MHD_Response *response,
194 * @return #MHD_NO on error (no such header known) 194 * @return #MHD_NO on error (no such header known)
195 * @ingroup response 195 * @ingroup response
196 */ 196 */
197int 197enum MHD_Result
198MHD_del_response_header (struct MHD_Response *response, 198MHD_del_response_header (struct MHD_Response *response,
199 const char *header, 199 const char *header,
200 const char *content) 200 const char *content)
@@ -412,13 +412,13 @@ MHD_create_response_from_callback (uint64_t size,
412 * @param ... #MHD_RO_END terminated list of options 412 * @param ... #MHD_RO_END terminated list of options
413 * @return #MHD_YES on success, #MHD_NO on error 413 * @return #MHD_YES on success, #MHD_NO on error
414 */ 414 */
415int 415enum MHD_Result
416MHD_set_response_options (struct MHD_Response *response, 416MHD_set_response_options (struct MHD_Response *response,
417 enum MHD_ResponseFlags flags, 417 enum MHD_ResponseFlags flags,
418 ...) 418 ...)
419{ 419{
420 va_list ap; 420 va_list ap;
421 int ret; 421 enum MHD_Result ret;
422 enum MHD_ResponseOptions ro; 422 enum MHD_ResponseOptions ro;
423 423
424 ret = MHD_YES; 424 ret = MHD_YES;
@@ -788,7 +788,7 @@ MHD_create_response_from_buffer_with_free_callback (size_t size,
788 * @param ... arguments to the action (depends on the action) 788 * @param ... arguments to the action (depends on the action)
789 * @return #MHD_NO on error, #MHD_YES on success 789 * @return #MHD_NO on error, #MHD_YES on success
790 */ 790 */
791_MHD_EXTERN int 791_MHD_EXTERN enum MHD_Result
792MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, 792MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
793 enum MHD_UpgradeAction action, 793 enum MHD_UpgradeAction action,
794 ...) 794 ...)
@@ -894,7 +894,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
894 * @return #MHD_YES on success, #MHD_NO on failure (will cause 894 * @return #MHD_YES on success, #MHD_NO on failure (will cause
895 * connection to be closed) 895 * connection to be closed)
896 */ 896 */
897int 897enum MHD_Result
898MHD_response_execute_upgrade_ (struct MHD_Response *response, 898MHD_response_execute_upgrade_ (struct MHD_Response *response,
899 struct MHD_Connection *connection) 899 struct MHD_Connection *connection)
900{ 900{
diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h
index 3f4717de..03448e56 100644
--- a/src/microhttpd/response.h
+++ b/src/microhttpd/response.h
@@ -49,7 +49,7 @@ MHD_increment_response_rc (struct MHD_Response *response);
49 * @return #MHD_YES on success, #MHD_NO on failure (will cause 49 * @return #MHD_YES on success, #MHD_NO on failure (will cause
50 * connection to be closed) 50 * connection to be closed)
51 */ 51 */
52int 52enum MHD_Result
53MHD_response_execute_upgrade_ (struct MHD_Response *response, 53MHD_response_execute_upgrade_ (struct MHD_Response *response,
54 struct MHD_Connection *connection); 54 struct MHD_Connection *connection);
55 55
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c
index 4f600ef0..430c8e18 100644
--- a/src/microhttpd/test_daemon.c
+++ b/src/microhttpd/test_daemon.c
@@ -52,7 +52,7 @@ testStartError ()
52} 52}
53 53
54 54
55static int 55static enum MHD_Result
56apc_nothing (void *cls, 56apc_nothing (void *cls,
57 const struct sockaddr *addr, 57 const struct sockaddr *addr,
58 socklen_t addrlen) 58 socklen_t addrlen)
@@ -63,7 +63,7 @@ apc_nothing (void *cls,
63} 63}
64 64
65 65
66static int 66static enum MHD_Result
67apc_all (void *cls, 67apc_all (void *cls,
68 const struct sockaddr *addr, 68 const struct sockaddr *addr,
69 socklen_t addrlen) 69 socklen_t addrlen)
@@ -74,7 +74,7 @@ apc_all (void *cls,
74} 74}
75 75
76 76
77static int 77static enum MHD_Result
78ahc_nothing (void *cls, 78ahc_nothing (void *cls,
79 struct MHD_Connection *connection, 79 struct MHD_Connection *connection,
80 const char *url, 80 const char *url,
diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c
index 2c37565c..e70171cc 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -92,7 +92,7 @@ mismatch (const char *a, const char *b)
92} 92}
93 93
94 94
95static int 95static enum MHD_Result
96value_checker (void *cls, 96value_checker (void *cls,
97 enum MHD_ValueKind kind, 97 enum MHD_ValueKind kind,
98 const char *key, 98 const char *key,
@@ -140,10 +140,10 @@ value_checker (void *cls,
140 fprintf (stderr, 140 fprintf (stderr,
141 "Wanted: `%s' `%s' `%s' `%s' `%s'\n", 141 "Wanted: `%s' `%s' `%s' `%s' `%s'\n",
142 want[idx], 142 want[idx],
143 want[idx+1], 143 want[idx + 1],
144 want[idx+2], 144 want[idx + 2],
145 want[idx+3], 145 want[idx + 3],
146 want[idx+4]); 146 want[idx + 4]);
147 fprintf (stderr, 147 fprintf (stderr,
148 "Unexpected result: %d/%d/%d/%d/%d/%d/%d\n", 148 "Unexpected result: %d/%d/%d/%d/%d/%d/%d\n",
149 (idx < 0), 149 (idx < 0),
@@ -155,7 +155,7 @@ value_checker (void *cls,
155 (0 != memcmp (data, &want[idx + 4][off], size))); 155 (0 != memcmp (data, &want[idx + 4][off], size)));
156 return MHD_NO; 156 return MHD_NO;
157 } 157 }
158 if ( ( (NULL == want[idx+4]) && 158 if ( ( (NULL == want[idx + 4]) &&
159 (0 == off + size) ) || 159 (0 == off + size) ) ||
160 (off + size == strlen (want[idx + 4])) ) 160 (off + size == strlen (want[idx + 4])) )
161 *want_off = idx + 5; 161 *want_off = idx + 5;
diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c
index 54936979..8692d443 100644
--- a/src/microhttpd/test_postprocessor_amp.c
+++ b/src/microhttpd/test_postprocessor_amp.c
@@ -7,7 +7,7 @@
7 7
8uint64_t num_errors; 8uint64_t num_errors;
9 9
10int 10enum MHD_Result
11check_post (void *cls, enum MHD_ValueKind kind, const char*key, 11check_post (void *cls, enum MHD_ValueKind kind, const char*key,
12 const char*filename, const char*content_type, 12 const char*filename, const char*content_type,
13 const char*content_encoding, const char*data, 13 const char*content_encoding, const char*data,
diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c
index 0e2a10d2..678de808 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -33,7 +33,7 @@
33#include <unistd.h> 33#include <unistd.h>
34#endif 34#endif
35 35
36static int 36static enum MHD_Result
37value_checker (void *cls, 37value_checker (void *cls,
38 enum MHD_ValueKind kind, 38 enum MHD_ValueKind kind,
39 const char *key, 39 const char *key,
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 7c76d221..fd9c2537 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -843,7 +843,7 @@ upgrade_cb (void *cls,
843 * #MHD_NO if the socket must be closed due to a serious 843 * #MHD_NO if the socket must be closed due to a serious
844 * error while handling the request 844 * error while handling the request
845 */ 845 */
846static int 846static enum MHD_Result
847ahc_upgrade (void *cls, 847ahc_upgrade (void *cls,
848 struct MHD_Connection *connection, 848 struct MHD_Connection *connection,
849 const char *url, 849 const char *url,
@@ -854,7 +854,7 @@ ahc_upgrade (void *cls,
854 void **con_cls) 854 void **con_cls)
855{ 855{
856 struct MHD_Response *resp; 856 struct MHD_Response *resp;
857 int ret; 857 enum MHD_Result ret;
858 (void) cls; 858 (void) cls;
859 (void) url; 859 (void) url;
860 (void) method; /* Unused. Silent compiler warning. */ 860 (void) method; /* Unused. Silent compiler warning. */
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c
index 89eba4b7..43c04b7f 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -867,7 +867,7 @@ upgrade_cb (void *cls,
867 * #MHD_NO if the socket must be closed due to a serious 867 * #MHD_NO if the socket must be closed due to a serious
868 * error while handling the request 868 * error while handling the request
869 */ 869 */
870static int 870static enum MHD_Result
871ahc_upgrade (void *cls, 871ahc_upgrade (void *cls,
872 struct MHD_Connection *connection, 872 struct MHD_Connection *connection,
873 const char *url, 873 const char *url,
@@ -878,7 +878,7 @@ ahc_upgrade (void *cls,
878 void **con_cls) 878 void **con_cls)
879{ 879{
880 struct MHD_Response *resp; 880 struct MHD_Response *resp;
881 int ret; 881 enum MHD_Result ret;
882 (void) cls; 882 (void) cls;
883 (void) url; 883 (void) url;
884 (void) method; /* Unused. Silent compiler warning. */ 884 (void) method; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c
index cfd75e8f..8e1ef1a8 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -38,7 +38,7 @@ extern const char srv_self_signed_cert_pem[];
38 38
39static int oneone; 39static int oneone;
40 40
41static int 41static enum MHD_Result
42ahc_echo (void *cls, 42ahc_echo (void *cls,
43 struct MHD_Connection *connection, 43 struct MHD_Connection *connection,
44 const char *url, 44 const char *url,
@@ -48,7 +48,7 @@ ahc_echo (void *cls,
48 void **unused) 48 void **unused)
49{ 49{
50 struct MHD_Response *response; 50 struct MHD_Response *response;
51 int ret; 51 enum MHD_Result ret;
52 (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ 52 (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */
53 (void) upload_data; (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ 53 (void) upload_data; (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */
54 54
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c
index c012fa46..b8de81a9 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -91,7 +91,7 @@ test_secure_get (FILE *test_fd,
91} 91}
92 92
93 93
94static int 94static enum MHD_Result
95ahc_empty (void *cls, 95ahc_empty (void *cls,
96 struct MHD_Connection *connection, 96 struct MHD_Connection *connection,
97 const char *url, 97 const char *url,
@@ -103,7 +103,7 @@ ahc_empty (void *cls,
103{ 103{
104 static int ptr; 104 static int ptr;
105 struct MHD_Response *response; 105 struct MHD_Response *response;
106 int ret; 106 enum MHD_Result ret;
107 (void) cls; 107 (void) cls;
108 (void) url; 108 (void) url;
109 (void) url; 109 (void) url;
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c
index e5bd73f5..d42f4463 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -39,7 +39,7 @@ extern const char srv_self_signed_cert_pem[];
39 39
40static int oneone; 40static int oneone;
41 41
42static int 42static enum MHD_Result
43ahc_echo (void *cls, 43ahc_echo (void *cls,
44 struct MHD_Connection *connection, 44 struct MHD_Connection *connection,
45 const char *url, 45 const char *url,
@@ -51,7 +51,7 @@ ahc_echo (void *cls,
51 static int ptr; 51 static int ptr;
52 const char *me = cls; 52 const char *me = cls;
53 struct MHD_Response *response; 53 struct MHD_Response *response;
54 int ret; 54 enum MHD_Result ret;
55 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 55 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
56 56
57 if (0 != strcmp (me, method)) 57 if (0 != strcmp (me, method))
diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c
index e961edc4..f8b37cff 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -41,14 +41,15 @@ struct MHD_Daemon *d;
41 * HTTP access handler call back 41 * HTTP access handler call back
42 * used to query negotiated security parameters 42 * used to query negotiated security parameters
43 */ 43 */
44static int 44static enum MHD_Result
45query_session_ahc (void *cls, struct MHD_Connection *connection, 45query_session_ahc (void *cls, struct MHD_Connection *connection,
46 const char *url, const char *method, 46 const char *url, const char *method,
47 const char *version, const char *upload_data, 47 const char *version, const char *upload_data,
48 size_t *upload_data_size, void **ptr) 48 size_t *upload_data_size, void **ptr)
49{ 49{
50 struct MHD_Response *response; 50 struct MHD_Response *response;
51 int ret; 51 enum MHD_Result ret;
52 int gret;
52 (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ 53 (void) cls; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */
53 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 54 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
54 55
@@ -59,11 +60,11 @@ query_session_ahc (void *cls, struct MHD_Connection *connection,
59 } 60 }
60 61
61 if (GNUTLS_TLS1_1 != 62 if (GNUTLS_TLS1_1 !=
62 (ret = MHD_get_connection_info 63 (gret = MHD_get_connection_info
63 (connection, 64 (connection,
64 MHD_CONNECTION_INFO_PROTOCOL)->protocol)) 65 MHD_CONNECTION_INFO_PROTOCOL)->protocol))
65 { 66 {
66 if (GNUTLS_TLS1_2 == ret) 67 if (GNUTLS_TLS1_2 == gret)
67 { 68 {
68 /* as usual, TLS implementations sometimes don't 69 /* as usual, TLS implementations sometimes don't
69 quite do what was asked, just mildly complain... */ 70 quite do what was asked, just mildly complain... */
@@ -76,8 +77,8 @@ query_session_ahc (void *cls, struct MHD_Connection *connection,
76 fprintf (stderr, 77 fprintf (stderr,
77 "Error: requested protocol mismatch (wanted %d, got %d)\n", 78 "Error: requested protocol mismatch (wanted %d, got %d)\n",
78 GNUTLS_TLS1_1, 79 GNUTLS_TLS1_1,
79 ret); 80 gret);
80 return -1; 81 return MHD_NO;
81 } 82 }
82 } 83 }
83 84
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index c0c6a4f8..1d24c701 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -176,7 +176,7 @@ copyBuffer (void *ptr,
176/** 176/**
177 * HTTP access handler call back 177 * HTTP access handler call back
178 */ 178 */
179int 179enum MHD_Result
180http_ahc (void *cls, 180http_ahc (void *cls,
181 struct MHD_Connection *connection, 181 struct MHD_Connection *connection,
182 const char *url, 182 const char *url,
@@ -188,7 +188,7 @@ http_ahc (void *cls,
188{ 188{
189 static int aptr; 189 static int aptr;
190 struct MHD_Response *response; 190 struct MHD_Response *response;
191 int ret; 191 enum MHD_Result ret;
192 (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */ 192 (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */
193 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 193 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
194 194
@@ -211,7 +211,7 @@ http_ahc (void *cls,
211 211
212 212
213/* HTTP access handler call back */ 213/* HTTP access handler call back */
214int 214enum MHD_Result
215http_dummy_ahc (void *cls, 215http_dummy_ahc (void *cls,
216 struct MHD_Connection *connection, 216 struct MHD_Connection *connection,
217 const char *url, 217 const char *url,
diff --git a/src/testcurl/https/tls_test_common.h b/src/testcurl/https/tls_test_common.h
index 36f5ffa5..fd2a47b1 100644
--- a/src/testcurl/https/tls_test_common.h
+++ b/src/testcurl/https/tls_test_common.h
@@ -95,12 +95,12 @@ print_test_result (int test_outcome, char *test_name);
95size_t 95size_t
96copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx); 96copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx);
97 97
98int 98enum MHD_Result
99http_ahc (void *cls, struct MHD_Connection *connection, 99http_ahc (void *cls, struct MHD_Connection *connection,
100 const char *url, const char *method, const char *upload_data, 100 const char *url, const char *method, const char *upload_data,
101 const char *version, size_t *upload_data_size, void **ptr); 101 const char *version, size_t *upload_data_size, void **ptr);
102 102
103int 103enum MHD_Result
104http_dummy_ahc (void *cls, struct MHD_Connection *connection, 104http_dummy_ahc (void *cls, struct MHD_Connection *connection,
105 const char *url, const char *method, const char *upload_data, 105 const char *url, const char *method, const char *upload_data,
106 const char *version, size_t *upload_data_size, 106 const char *version, size_t *upload_data_size,
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 53992b17..eb33ea0c 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -151,7 +151,7 @@ copyBuffer (void *ptr,
151} 151}
152 152
153 153
154static int 154static enum MHD_Result
155ahc_echo (void *cls, 155ahc_echo (void *cls,
156 struct MHD_Connection *connection, 156 struct MHD_Connection *connection,
157 const char *url, 157 const char *url,
@@ -162,7 +162,7 @@ ahc_echo (void *cls,
162{ 162{
163 static int ptr; 163 static int ptr;
164 const char *me = cls; 164 const char *me = cls;
165 int ret; 165 enum MHD_Result ret;
166 (void) url; (void) version; /* Unused. Silent compiler warning. */ 166 (void) url; (void) version; /* Unused. Silent compiler warning. */
167 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 167 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
168 168
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c
index 12c57dae..0471143c 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -146,7 +146,7 @@ copyBuffer (void *ptr,
146} 146}
147 147
148 148
149static int 149static enum MHD_Result
150ahc_echo (void *cls, 150ahc_echo (void *cls,
151 struct MHD_Connection *connection, 151 struct MHD_Connection *connection,
152 const char *url, 152 const char *url,
@@ -157,7 +157,7 @@ ahc_echo (void *cls,
157{ 157{
158 static int ptr; 158 static int ptr;
159 const char *me = cls; 159 const char *me = cls;
160 int ret; 160 enum MHD_Result ret;
161 (void) url; (void) version; /* Unused. Silent compiler warning. */ 161 (void) url; (void) version; /* Unused. Silent compiler warning. */
162 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 162 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
163 163
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index 2e2be470..d9dfecef 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -58,7 +58,7 @@ called_twice (void *cls, uint64_t pos, char *buf, size_t max)
58} 58}
59 59
60 60
61static int 61static enum MHD_Result
62callback (void *cls, 62callback (void *cls,
63 struct MHD_Connection *connection, 63 struct MHD_Connection *connection,
64 const char *url, 64 const char *url,
@@ -70,7 +70,7 @@ callback (void *cls,
70{ 70{
71 struct callback_closure *cbc = calloc (1, sizeof(struct callback_closure)); 71 struct callback_closure *cbc = calloc (1, sizeof(struct callback_closure));
72 struct MHD_Response *r; 72 struct MHD_Response *r;
73 int ret; 73 enum MHD_Result ret;
74 74
75 (void) cls; 75 (void) cls;
76 (void) url; /* Unused. Silent compiler warning. */ 76 (void) url; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c
index 750fddc8..6716f491 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -134,7 +134,7 @@ copyBuffer (void *ptr,
134} 134}
135 135
136 136
137static int 137static enum MHD_Result
138ahc_echo (void *cls, 138ahc_echo (void *cls,
139 struct MHD_Connection *connection, 139 struct MHD_Connection *connection,
140 const char *url, 140 const char *url,
@@ -146,7 +146,7 @@ ahc_echo (void *cls,
146{ 146{
147 static int ptr; 147 static int ptr;
148 const char *me = cls; 148 const char *me = cls;
149 int ret; 149 enum MHD_Result ret;
150 (void) url; (void) version; /* Unused. Silent compiler warning. */ 150 (void) url; (void) version; /* Unused. Silent compiler warning. */
151 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 151 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
152 152
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index 8854cde7..ae62311b 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
81} 81}
82 82
83 83
84static int 84static enum MHD_Result
85ahc_echo (void *cls, 85ahc_echo (void *cls,
86 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
87 const char *url, 87 const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
92{ 92{
93 int *done = cls; 93 int *done = cls;
94 struct MHD_Response *response; 94 struct MHD_Response *response;
95 int ret; 95 enum MHD_Result ret;
96 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 96 (void) version; (void) unused; /* Unused. Silent compiler warning. */
97 97
98 if (0 != strcasecmp ("DELETE", method)) 98 if (0 != strcasecmp ("DELETE", method))
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
index 4de006b7..9b33eb9b 100644
--- a/src/testcurl/test_digestauth.c
+++ b/src/testcurl/test_digestauth.c
@@ -76,7 +76,7 @@ copyBuffer (void *ptr,
76} 76}
77 77
78 78
79static int 79static enum MHD_Result
80ahc_echo (void *cls, 80ahc_echo (void *cls,
81 struct MHD_Connection *connection, 81 struct MHD_Connection *connection,
82 const char *url, 82 const char *url,
@@ -90,7 +90,7 @@ ahc_echo (void *cls,
90 char *username; 90 char *username;
91 const char *password = "testpass"; 91 const char *password = "testpass";
92 const char *realm = "test@example.com"; 92 const char *realm = "test@example.com";
93 int ret; 93 enum MHD_Result ret;
94 (void) cls; (void) url; /* Unused. Silent compiler warning. */ 94 (void) cls; (void) url; /* Unused. Silent compiler warning. */
95 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 95 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
96 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ 96 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c
index 3482d14d..ffeabd0c 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -77,7 +77,7 @@ copyBuffer (void *ptr,
77} 77}
78 78
79 79
80static int 80static enum MHD_Result
81ahc_echo (void *cls, 81ahc_echo (void *cls,
82 struct MHD_Connection *connection, 82 struct MHD_Connection *connection,
83 const char *url, 83 const char *url,
@@ -91,7 +91,7 @@ ahc_echo (void *cls,
91 char *username; 91 char *username;
92 const char *password = "testpass"; 92 const char *password = "testpass";
93 const char *realm = "test@example.com"; 93 const char *realm = "test@example.com";
94 int ret; 94 enum MHD_Result ret;
95 (void) cls; (void) url; /* Unused. Silent compiler warning. */ 95 (void) cls; (void) url; /* Unused. Silent compiler warning. */
96 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 96 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
97 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ 97 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c
index f1927d1a..70d5f644 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -71,7 +71,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
71} 71}
72 72
73 73
74static int 74static enum MHD_Result
75ahc_echo (void *cls, 75ahc_echo (void *cls,
76 struct MHD_Connection *connection, 76 struct MHD_Connection *connection,
77 const char *url, 77 const char *url,
@@ -84,7 +84,7 @@ ahc_echo (void *cls,
84 char *username; 84 char *username;
85 const char *password = "testpass"; 85 const char *password = "testpass";
86 const char *realm = "test@example.com"; 86 const char *realm = "test@example.com";
87 int ret; 87 enum MHD_Result ret;
88 (void) cls; (void) url; /* Unused. Silent compiler warning. */ 88 (void) cls; (void) url; /* Unused. Silent compiler warning. */
89 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 89 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
90 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ 90 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index 3ab05d9a..91efdefd 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -98,7 +98,7 @@ log_cb (void *cls,
98} 98}
99 99
100 100
101static int 101static enum MHD_Result
102ahc_echo (void *cls, 102ahc_echo (void *cls,
103 struct MHD_Connection *connection, 103 struct MHD_Connection *connection,
104 const char *url, 104 const char *url,
@@ -110,7 +110,7 @@ ahc_echo (void *cls,
110 static int ptr; 110 static int ptr;
111 const char *me = cls; 111 const char *me = cls;
112 struct MHD_Response *response; 112 struct MHD_Response *response;
113 int ret; 113 enum MHD_Result ret;
114 const char *v; 114 const char *v;
115 (void) version; 115 (void) version;
116 (void) upload_data; 116 (void) upload_data;
@@ -714,7 +714,7 @@ testStopRace (int poll_flag)
714} 714}
715 715
716 716
717static int 717static enum MHD_Result
718ahc_empty (void *cls, 718ahc_empty (void *cls,
719 struct MHD_Connection *connection, 719 struct MHD_Connection *connection,
720 const char *url, 720 const char *url,
@@ -726,7 +726,7 @@ ahc_empty (void *cls,
726{ 726{
727 static int ptr; 727 static int ptr;
728 struct MHD_Response *response; 728 struct MHD_Response *response;
729 int ret; 729 enum MHD_Result ret;
730 (void) cls; 730 (void) cls;
731 (void) url; 731 (void) url;
732 (void) url; 732 (void) url;
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 7be1db60..aa60e2f8 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -106,7 +106,7 @@ crcf (void *ptr)
106} 106}
107 107
108 108
109static int 109static enum MHD_Result
110ahc_echo (void *cls, 110ahc_echo (void *cls,
111 struct MHD_Connection *connection, 111 struct MHD_Connection *connection,
112 const char *url, 112 const char *url,
@@ -118,7 +118,7 @@ ahc_echo (void *cls,
118 const char *me = cls; 118 const char *me = cls;
119 struct MHD_Response *response; 119 struct MHD_Response *response;
120 struct MHD_Response **responseptr; 120 struct MHD_Response **responseptr;
121 int ret; 121 enum MHD_Result ret;
122 122
123 (void) url; 123 (void) url;
124 (void) version; /* Unused. Silent compiler warning. */ 124 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_get_response_cleanup.c b/src/testcurl/test_get_response_cleanup.c
index 14c2f240..026fd254 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -116,7 +116,7 @@ push_free_callback (void *cls)
116} 116}
117 117
118 118
119static int 119static enum MHD_Result
120ahc_echo (void *cls, 120ahc_echo (void *cls,
121 struct MHD_Connection *connection, 121 struct MHD_Connection *connection,
122 const char *url, 122 const char *url,
@@ -128,7 +128,7 @@ ahc_echo (void *cls,
128 static int ptr; 128 static int ptr;
129 const char *me = cls; 129 const char *me = cls;
130 struct MHD_Response *response; 130 struct MHD_Response *response;
131 int ret; 131 enum MHD_Result ret;
132 (void) url; (void) version; /* Unused. Silent compiler warning. */ 132 (void) url; (void) version; /* Unused. Silent compiler warning. */
133 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 133 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
134 134
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index ad102f0b..0095731e 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -75,7 +75,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
75} 75}
76 76
77 77
78static int 78static enum MHD_Result
79ahc_echo (void *cls, 79ahc_echo (void *cls,
80 struct MHD_Connection *connection, 80 struct MHD_Connection *connection,
81 const char *url, 81 const char *url,
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
87 static int ptr; 87 static int ptr;
88 const char *me = cls; 88 const char *me = cls;
89 struct MHD_Response *response; 89 struct MHD_Response *response;
90 int ret; 90 enum MHD_Result ret;
91 int fd; 91 int fd;
92 (void) url; (void) version; /* Unused. Silent compiler warning. */ 92 (void) url; (void) version; /* Unused. Silent compiler warning. */
93 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 93 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
@@ -490,7 +490,7 @@ testExternalGet ()
490 if (cbc.pos != strlen (TESTSTR)) 490 if (cbc.pos != strlen (TESTSTR))
491 { 491 {
492 fprintf (stderr, 492 fprintf (stderr,
493 "Got %.*s instead of %S!\n", 493 "Got %.*s instead of %s!\n",
494 (int) cbc.pos, 494 (int) cbc.pos,
495 cbc.buf, 495 cbc.buf,
496 TESTSTR); 496 TESTSTR);
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c
index 60570886..3b61f827 100644
--- a/src/testcurl/test_iplimit.c
+++ b/src/testcurl/test_iplimit.c
@@ -74,7 +74,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
74} 74}
75 75
76 76
77static int 77static enum MHD_Result
78ahc_echo (void *cls, 78ahc_echo (void *cls,
79 struct MHD_Connection *connection, 79 struct MHD_Connection *connection,
80 const char *url, 80 const char *url,
@@ -86,7 +86,7 @@ ahc_echo (void *cls,
86 static int ptr; 86 static int ptr;
87 const char *me = cls; 87 const char *me = cls;
88 struct MHD_Response *response; 88 struct MHD_Response *response;
89 int ret; 89 enum MHD_Result ret;
90 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 90 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
91 91
92 if (0 != strcmp (me, method)) 92 if (0 != strcmp (me, method))
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index b52246ef..d93942e4 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -118,7 +118,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
118} 118}
119 119
120 120
121static int 121static enum MHD_Result
122ahc_echo (void *cls, 122ahc_echo (void *cls,
123 struct MHD_Connection *connection, 123 struct MHD_Connection *connection,
124 const char *url, 124 const char *url,
@@ -129,7 +129,7 @@ ahc_echo (void *cls,
129{ 129{
130 int *done = cls; 130 int *done = cls;
131 struct MHD_Response *response; 131 struct MHD_Response *response;
132 int ret; 132 enum MHD_Result ret;
133 static size_t processed; 133 static size_t processed;
134 (void) version; /* Unused. Silent compiler warning. */ 134 (void) version; /* Unused. Silent compiler warning. */
135 135
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index 17d8904b..54030c21 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -46,7 +46,7 @@
46 46
47static int oneone; 47static int oneone;
48 48
49static int 49static enum MHD_Result
50apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen) 50apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen)
51{ 51{
52 (void) cls; (void) addr; (void) addrlen; /* Unused. Silent compiler warning. */ 52 (void) cls; (void) addr; (void) addrlen; /* Unused. Silent compiler warning. */
@@ -69,7 +69,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
69} 69}
70 70
71 71
72static int 72static enum MHD_Result
73ahc_echo (void *cls, 73ahc_echo (void *cls,
74 struct MHD_Connection *connection, 74 struct MHD_Connection *connection,
75 const char *url, 75 const char *url,
@@ -80,7 +80,7 @@ ahc_echo (void *cls,
80{ 80{
81 const char *me = cls; 81 const char *me = cls;
82 struct MHD_Response *response; 82 struct MHD_Response *response;
83 int ret; 83 enum MHD_Result ret;
84 (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 84 (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
85 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ 85 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */
86 86
diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c
index d4c291ea..8a786cc2 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -59,7 +59,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
59} 59}
60 60
61 61
62static int 62static enum MHD_Result
63ahc_echo (void *cls, 63ahc_echo (void *cls,
64 struct MHD_Connection *connection, 64 struct MHD_Connection *connection,
65 const char *url, 65 const char *url,
@@ -71,7 +71,7 @@ ahc_echo (void *cls,
71 static int ptr; 71 static int ptr;
72 const char *me = cls; 72 const char *me = cls;
73 struct MHD_Response *response; 73 struct MHD_Response *response;
74 int ret; 74 enum MHD_Result ret;
75 const char *hdr; 75 const char *hdr;
76 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 76 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
77 77
diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c
index 86327b0d..6be3ab30 100644
--- a/src/testcurl/test_patch.c
+++ b/src/testcurl/test_patch.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
81} 81}
82 82
83 83
84static int 84static enum MHD_Result
85ahc_echo (void *cls, 85ahc_echo (void *cls,
86 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
87 const char *url, 87 const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
92{ 92{
93 int *done = cls; 93 int *done = cls;
94 struct MHD_Response *response; 94 struct MHD_Response *response;
95 int ret; 95 enum MHD_Result ret;
96 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 96 (void) version; (void) unused; /* Unused. Silent compiler warning. */
97 97
98 if (0 != strcasecmp ("PATCH", method)) 98 if (0 != strcasecmp ("PATCH", method))
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index 97c9bcc9..675f8db6 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -97,7 +97,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
97 * in that it fails to support incremental processing. 97 * in that it fails to support incremental processing.
98 * (to be fixed in the future) 98 * (to be fixed in the future)
99 */ 99 */
100static int 100static enum MHD_Result
101post_iterator (void *cls, 101post_iterator (void *cls,
102 enum MHD_ValueKind kind, 102 enum MHD_ValueKind kind,
103 const char *key, 103 const char *key,
@@ -120,7 +120,7 @@ post_iterator (void *cls,
120} 120}
121 121
122 122
123static int 123static enum MHD_Result
124ahc_echo (void *cls, 124ahc_echo (void *cls,
125 struct MHD_Connection *connection, 125 struct MHD_Connection *connection,
126 const char *url, 126 const char *url,
@@ -132,7 +132,7 @@ ahc_echo (void *cls,
132 static int eok; 132 static int eok;
133 struct MHD_Response *response; 133 struct MHD_Response *response;
134 struct MHD_PostProcessor *pp; 134 struct MHD_PostProcessor *pp;
135 int ret; 135 enum MHD_Result ret;
136 (void) cls; (void) version; /* Unused. Silent compiler warning. */ 136 (void) cls; (void) version; /* Unused. Silent compiler warning. */
137 137
138 if (0 != strcasecmp ("POST", method)) 138 if (0 != strcasecmp ("POST", method))
@@ -562,7 +562,7 @@ testExternalPost ()
562} 562}
563 563
564 564
565static int 565static enum MHD_Result
566ahc_cancel (void *cls, 566ahc_cancel (void *cls,
567 struct MHD_Connection *connection, 567 struct MHD_Connection *connection,
568 const char *url, 568 const char *url,
@@ -572,7 +572,7 @@ ahc_cancel (void *cls,
572 void **unused) 572 void **unused)
573{ 573{
574 struct MHD_Response *response; 574 struct MHD_Response *response;
575 int ret; 575 enum MHD_Result ret;
576 (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */ 576 (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */
577 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 577 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
578 578
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index 38f9de6e..0eaf2730 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -72,7 +72,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
72} 72}
73 73
74 74
75static int 75static enum MHD_Result
76ahc_echo (void *cls, 76ahc_echo (void *cls,
77 struct MHD_Connection *connection, 77 struct MHD_Connection *connection,
78 const char *url, 78 const char *url,
@@ -83,7 +83,7 @@ ahc_echo (void *cls,
83{ 83{
84 static int marker; 84 static int marker;
85 struct MHD_Response *response; 85 struct MHD_Response *response;
86 int ret; 86 enum MHD_Result ret;
87 (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */ 87 (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */
88 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 88 (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
89 89
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index 25e6d0e4..18a0fc62 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -93,7 +93,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
93 * in that it fails to support incremental processing. 93 * in that it fails to support incremental processing.
94 * (to be fixed in the future) 94 * (to be fixed in the future)
95 */ 95 */
96static int 96static enum MHD_Result
97post_iterator (void *cls, 97post_iterator (void *cls,
98 enum MHD_ValueKind kind, 98 enum MHD_ValueKind kind,
99 const char *key, 99 const char *key,
@@ -119,7 +119,7 @@ post_iterator (void *cls,
119} 119}
120 120
121 121
122static int 122static enum MHD_Result
123ahc_echo (void *cls, 123ahc_echo (void *cls,
124 struct MHD_Connection *connection, 124 struct MHD_Connection *connection,
125 const char *url, 125 const char *url,
@@ -131,7 +131,7 @@ ahc_echo (void *cls,
131 static int eok; 131 static int eok;
132 struct MHD_Response *response; 132 struct MHD_Response *response;
133 struct MHD_PostProcessor *pp; 133 struct MHD_PostProcessor *pp;
134 int ret; 134 enum MHD_Result ret;
135 (void) cls; (void) version; /* Unused. Silent compiler warning. */ 135 (void) cls; (void) version; /* Unused. Silent compiler warning. */
136 136
137 if (0 != strcmp ("POST", method)) 137 if (0 != strcmp ("POST", method))
diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c
index dc50396d..f7e03531 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -60,7 +60,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
60} 60}
61 61
62 62
63static int 63static enum MHD_Result
64ahc_echo (void *cls, 64ahc_echo (void *cls,
65 struct MHD_Connection *connection, 65 struct MHD_Connection *connection,
66 const char *url, 66 const char *url,
@@ -72,7 +72,7 @@ ahc_echo (void *cls,
72 static int ptr; 72 static int ptr;
73 const char *me = cls; 73 const char *me = cls;
74 struct MHD_Response *response; 74 struct MHD_Response *response;
75 int ret; 75 enum MHD_Result ret;
76 const char *hdr; 76 const char *hdr;
77 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 77 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
78 78
diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c
index 34200082..5784f5b7 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -66,7 +66,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
66} 66}
67 67
68 68
69static int 69static enum MHD_Result
70kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) 70kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
71{ 71{
72 if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) && 72 if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) &&
@@ -80,7 +80,7 @@ kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
80} 80}
81 81
82 82
83static int 83static enum MHD_Result
84ahc_echo (void *cls, 84ahc_echo (void *cls,
85 struct MHD_Connection *connection, 85 struct MHD_Connection *connection,
86 const char *url, 86 const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
92 static int ptr; 92 static int ptr;
93 const char *me = cls; 93 const char *me = cls;
94 struct MHD_Response *response; 94 struct MHD_Response *response;
95 int ret; 95 enum MHD_Result ret;
96 const char *hdr; 96 const char *hdr;
97 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 97 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
98 98
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 2326310a..c582a418 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
81} 81}
82 82
83 83
84static int 84static enum MHD_Result
85ahc_echo (void *cls, 85ahc_echo (void *cls,
86 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
87 const char *url, 87 const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
92{ 92{
93 int *done = cls; 93 int *done = cls;
94 struct MHD_Response *response; 94 struct MHD_Response *response;
95 int ret; 95 enum MHD_Result ret;
96 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 96 (void) version; (void) unused; /* Unused. Silent compiler warning. */
97 97
98 if (0 != strcasecmp ("PUT", method)) 98 if (0 != strcasecmp ("PUT", method))
diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c
index 0824b286..e393523d 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
81} 81}
82 82
83 83
84static int 84static enum MHD_Result
85ahc_echo (void *cls, 85ahc_echo (void *cls,
86 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
87 const char *url, 87 const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
92{ 92{
93 int *done = cls; 93 int *done = cls;
94 struct MHD_Response *response; 94 struct MHD_Response *response;
95 int ret; 95 enum MHD_Result ret;
96 int have; 96 int have;
97 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 97 (void) version; (void) unused; /* Unused. Silent compiler warning. */
98 98
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index 8a79a3c4..ac0ade30 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -70,7 +70,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
70} 70}
71 71
72 72
73static int 73static enum MHD_Result
74ahc_echo (void *cls, 74ahc_echo (void *cls,
75 struct MHD_Connection *connection, 75 struct MHD_Connection *connection,
76 const char *url, 76 const char *url,
@@ -82,7 +82,7 @@ ahc_echo (void *cls,
82 static int ptr; 82 static int ptr;
83 const char *me = cls; 83 const char *me = cls;
84 struct MHD_Response *response; 84 struct MHD_Response *response;
85 int ret; 85 enum MHD_Result ret;
86 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 86 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
87 87
88 if (0 != strcmp (me, method)) 88 if (0 != strcmp (me, method))
diff --git a/src/testcurl/test_quiesce_stream.c b/src/testcurl/test_quiesce_stream.c
index cb1e71cb..5a3e601e 100644
--- a/src/testcurl/test_quiesce_stream.c
+++ b/src/testcurl/test_quiesce_stream.c
@@ -132,7 +132,7 @@ free_crc_data (void *crc_data)
132} 132}
133 133
134 134
135static int 135static enum MHD_Result
136http_AccessHandlerCallback (void *cls, 136http_AccessHandlerCallback (void *cls,
137 struct MHD_Connection *connection, 137 struct MHD_Connection *connection,
138 const char *url, 138 const char *url,
@@ -142,7 +142,7 @@ http_AccessHandlerCallback (void *cls,
142 size_t *upload_data_size, 142 size_t *upload_data_size,
143 void **con_cls) 143 void **con_cls)
144{ 144{
145 int ret; 145 enum MHD_Result ret;
146 (void) cls; (void) url; /* Unused. Silent compiler warning. */ 146 (void) cls; (void) url; /* Unused. Silent compiler warning. */
147 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 147 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
148 (void) upload_data_size; /* Unused. Silent compiler warning. */ 148 (void) upload_data_size; /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c
index 17940020..5541ae30 100644
--- a/src/testcurl/test_termination.c
+++ b/src/testcurl/test_termination.c
@@ -47,7 +47,7 @@
47#include <windows.h> 47#include <windows.h>
48#endif 48#endif
49 49
50static int 50static enum MHD_Result
51connection_handler (void *cls, 51connection_handler (void *cls,
52 struct MHD_Connection *connection, 52 struct MHD_Connection *connection,
53 const char *url, 53 const char *url,
@@ -76,7 +76,7 @@ connection_handler (void *cls,
76 struct MHD_Response *response = 76 struct MHD_Response *response =
77 MHD_create_response_from_buffer (strlen ("Response"), "Response", 77 MHD_create_response_from_buffer (strlen ("Response"), "Response",
78 MHD_RESPMEM_PERSISTENT); 78 MHD_RESPMEM_PERSISTENT);
79 int ret = MHD_queue_response (connection, MHD_HTTP_OK, response); 79 enum MHD_Result ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
80 MHD_destroy_response (response); 80 MHD_destroy_response (response);
81 81
82 return ret; 82 return ret;
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index db1c1e6a..018195f4 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -121,7 +121,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
121} 121}
122 122
123 123
124static int 124static enum MHD_Result
125ahc_echo (void *cls, 125ahc_echo (void *cls,
126 struct MHD_Connection *connection, 126 struct MHD_Connection *connection,
127 const char *url, 127 const char *url,
@@ -132,7 +132,7 @@ ahc_echo (void *cls,
132{ 132{
133 int *done = cls; 133 int *done = cls;
134 struct MHD_Response *response; 134 struct MHD_Response *response;
135 int ret; 135 enum MHD_Result ret;
136 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 136 (void) version; (void) unused; /* Unused. Silent compiler warning. */
137 137
138 if (0 != strcmp ("PUT", method)) 138 if (0 != strcmp ("PUT", method))
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index e8770330..d089ab22 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -69,7 +69,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
69} 69}
70 70
71 71
72static int 72static enum MHD_Result
73test_values (void *cls, 73test_values (void *cls,
74 enum MHD_ValueKind kind, 74 enum MHD_ValueKind kind,
75 const char *key, 75 const char *key,
@@ -89,7 +89,7 @@ test_values (void *cls,
89} 89}
90 90
91 91
92static int 92static enum MHD_Result
93ahc_echo (void *cls, 93ahc_echo (void *cls,
94 struct MHD_Connection *connection, 94 struct MHD_Connection *connection,
95 const char *url, 95 const char *url,
@@ -101,7 +101,7 @@ ahc_echo (void *cls,
101 static int ptr; 101 static int ptr;
102 const char *me = cls; 102 const char *me = cls;
103 struct MHD_Response *response; 103 struct MHD_Response *response;
104 int ret; 104 enum MHD_Result ret;
105 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 105 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
106 106
107 if (0 != strcmp (me, method)) 107 if (0 != strcmp (me, method))
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index 83d92ab3..9ef0d4f7 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -60,7 +60,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
60} 60}
61 61
62 62
63static int 63static enum MHD_Result
64ahc_echo (void *cls, 64ahc_echo (void *cls,
65 struct MHD_Connection *connection, 65 struct MHD_Connection *connection,
66 const char *url, 66 const char *url,
@@ -72,7 +72,7 @@ ahc_echo (void *cls,
72 static int ptr; 72 static int ptr;
73 const char *me = cls; 73 const char *me = cls;
74 struct MHD_Response *response; 74 struct MHD_Response *response;
75 int ret; 75 enum MHD_Result ret;
76 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ 76 (void) version; (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */
77 77
78 if (0 != strcmp (me, method)) 78 if (0 != strcmp (me, method))
diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c
index 8ad7dd6b..9a6536c0 100644
--- a/src/testzzuf/test_get_chunked.c
+++ b/src/testzzuf/test_get_chunked.c
@@ -89,7 +89,7 @@ crcf (void *ptr)
89} 89}
90 90
91 91
92static int 92static enum MHD_Result
93ahc_echo (void *cls, 93ahc_echo (void *cls,
94 struct MHD_Connection *connection, 94 struct MHD_Connection *connection,
95 const char *url, 95 const char *url,
@@ -101,7 +101,7 @@ ahc_echo (void *cls,
101 const char *me = cls; 101 const char *me = cls;
102 struct MHD_Response *response; 102 struct MHD_Response *response;
103 struct MHD_Response **responseptr; 103 struct MHD_Response **responseptr;
104 int ret; 104 enum MHD_Result ret;
105 105
106 (void) url; 106 (void) url;
107 (void) version; /* Unused. Silent compiler warning. */ 107 (void) version; /* Unused. Silent compiler warning. */
diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c
index 6595ad4e..add99234 100644
--- a/src/testzzuf/test_long_header.c
+++ b/src/testzzuf/test_long_header.c
@@ -47,7 +47,7 @@
47 47
48static int oneone; 48static int oneone;
49 49
50static int 50static enum MHD_Result
51apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen) 51apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen)
52{ 52{
53 (void) cls; (void) addr; (void) addrlen; /* Unused. Silent compiler warning. */ 53 (void) cls; (void) addr; (void) addrlen; /* Unused. Silent compiler warning. */
@@ -70,7 +70,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
70} 70}
71 71
72 72
73static int 73static enum MHD_Result
74ahc_echo (void *cls, 74ahc_echo (void *cls,
75 struct MHD_Connection *connection, 75 struct MHD_Connection *connection,
76 const char *url, 76 const char *url,
@@ -81,7 +81,7 @@ ahc_echo (void *cls,
81{ 81{
82 const char *me = cls; 82 const char *me = cls;
83 struct MHD_Response *response; 83 struct MHD_Response *response;
84 int ret; 84 enum MHD_Result ret;
85 (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 85 (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
86 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */ 86 (void) upload_data_size; (void) unused; /* Unused. Silent compiler warning. */
87 87
@@ -128,6 +128,11 @@ testLongUrlGet ()
128 128
129 c = curl_easy_init (); 129 c = curl_easy_init ();
130 url = malloc (VERY_LONG); 130 url = malloc (VERY_LONG);
131 if (NULL == url)
132 {
133 zzuf_socat_stop ();
134 return 1;
135 }
131 memset (url, 'a', VERY_LONG); 136 memset (url, 'a', VERY_LONG);
132 url[VERY_LONG - 1] = '\0'; 137 url[VERY_LONG - 1] = '\0';
133 memcpy (url, "http://127.0.0.1:11081/", 138 memcpy (url, "http://127.0.0.1:11081/",
@@ -189,6 +194,12 @@ testLongHeaderGet ()
189 fprintf (stderr, "."); 194 fprintf (stderr, ".");
190 c = curl_easy_init (); 195 c = curl_easy_init ();
191 url = malloc (VERY_LONG); 196 url = malloc (VERY_LONG);
197 if (NULL == url)
198 {
199 zzuf_socat_stop ();
200 curl_easy_cleanup (c);
201 return 16;
202 }
192 memset (url, 'a', VERY_LONG); 203 memset (url, 'a', VERY_LONG);
193 url[VERY_LONG - 1] = '\0'; 204 url[VERY_LONG - 1] = '\0';
194 url[VERY_LONG / 2] = ':'; 205 url[VERY_LONG / 2] = ':';
diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c
index 637423c8..e3d8512c 100644
--- a/src/testzzuf/test_post.c
+++ b/src/testzzuf/test_post.c
@@ -84,7 +84,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
84 * in that it fails to support incremental processing. 84 * in that it fails to support incremental processing.
85 * (to be fixed in the future) 85 * (to be fixed in the future)
86 */ 86 */
87static int 87static enum MHD_Result
88post_iterator (void *cls, 88post_iterator (void *cls,
89 enum MHD_ValueKind kind, 89 enum MHD_ValueKind kind,
90 const char *key, 90 const char *key,
@@ -107,7 +107,7 @@ post_iterator (void *cls,
107} 107}
108 108
109 109
110static int 110static enum MHD_Result
111ahc_echo (void *cls, 111ahc_echo (void *cls,
112 struct MHD_Connection *connection, 112 struct MHD_Connection *connection,
113 const char *url, 113 const char *url,
@@ -119,7 +119,7 @@ ahc_echo (void *cls,
119 static int eok; 119 static int eok;
120 struct MHD_Response *response; 120 struct MHD_Response *response;
121 struct MHD_PostProcessor *pp; 121 struct MHD_PostProcessor *pp;
122 int ret; 122 enum MHD_Result ret;
123 (void) cls; (void) version; /* Unused. Silent compiler warning. */ 123 (void) cls; (void) version; /* Unused. Silent compiler warning. */
124 124
125 if (0 != strcmp ("POST", method)) 125 if (0 != strcmp ("POST", method))
diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c
index a253b96d..f994ab24 100644
--- a/src/testzzuf/test_post_form.c
+++ b/src/testzzuf/test_post_form.c
@@ -82,7 +82,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
82 * in that it fails to support incremental processing. 82 * in that it fails to support incremental processing.
83 * (to be fixed in the future) 83 * (to be fixed in the future)
84 */ 84 */
85static int 85static enum MHD_Result
86post_iterator (void *cls, 86post_iterator (void *cls,
87 enum MHD_ValueKind kind, 87 enum MHD_ValueKind kind,
88 const char *key, 88 const char *key,
@@ -110,7 +110,7 @@ post_iterator (void *cls,
110} 110}
111 111
112 112
113static int 113static enum MHD_Result
114ahc_echo (void *cls, 114ahc_echo (void *cls,
115 struct MHD_Connection *connection, 115 struct MHD_Connection *connection,
116 const char *url, 116 const char *url,
@@ -122,7 +122,7 @@ ahc_echo (void *cls,
122 static int eok; 122 static int eok;
123 struct MHD_Response *response; 123 struct MHD_Response *response;
124 struct MHD_PostProcessor *pp; 124 struct MHD_PostProcessor *pp;
125 int ret; 125 enum MHD_Result ret;
126 (void) cls; (void) version; /* Unused. Silent compiler warning. */ 126 (void) cls; (void) version; /* Unused. Silent compiler warning. */
127 127
128 if (0 != strcmp ("POST", method)) 128 if (0 != strcmp ("POST", method))
diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c
index 2c79c759..4658d0d4 100644
--- a/src/testzzuf/test_put.c
+++ b/src/testzzuf/test_put.c
@@ -76,7 +76,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
76} 76}
77 77
78 78
79static int 79static enum MHD_Result
80ahc_echo (void *cls, 80ahc_echo (void *cls,
81 struct MHD_Connection *connection, 81 struct MHD_Connection *connection,
82 const char *url, 82 const char *url,
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
87{ 87{
88 int *done = cls; 88 int *done = cls;
89 struct MHD_Response *response; 89 struct MHD_Response *response;
90 int ret; 90 enum MHD_Result ret;
91 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 91 (void) version; (void) unused; /* Unused. Silent compiler warning. */
92 92
93 if (0 != strcmp ("PUT", method)) 93 if (0 != strcmp ("PUT", method))
diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c
index 29108008..35196843 100644
--- a/src/testzzuf/test_put_chunked.c
+++ b/src/testzzuf/test_put_chunked.c
@@ -76,7 +76,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
76} 76}
77 77
78 78
79static int 79static enum MHD_Result
80ahc_echo (void *cls, 80ahc_echo (void *cls,
81 struct MHD_Connection *connection, 81 struct MHD_Connection *connection,
82 const char *url, 82 const char *url,
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
87{ 87{
88 int *done = cls; 88 int *done = cls;
89 struct MHD_Response *response; 89 struct MHD_Response *response;
90 int ret; 90 enum MHD_Result ret;
91 int have; 91 int have;
92 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 92 (void) version; (void) unused; /* Unused. Silent compiler warning. */
93 93
diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c
index 56b076c5..abda22cb 100644
--- a/src/testzzuf/test_put_large.c
+++ b/src/testzzuf/test_put_large.c
@@ -84,7 +84,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
84} 84}
85 85
86 86
87static int 87static enum MHD_Result
88ahc_echo (void *cls, 88ahc_echo (void *cls,
89 struct MHD_Connection *connection, 89 struct MHD_Connection *connection,
90 const char *url, 90 const char *url,
@@ -95,7 +95,7 @@ ahc_echo (void *cls,
95{ 95{
96 int *done = cls; 96 int *done = cls;
97 struct MHD_Response *response; 97 struct MHD_Response *response;
98 int ret; 98 enum MHD_Result ret;
99 (void) version; (void) unused; /* Unused. Silent compiler warning. */ 99 (void) version; (void) unused; /* Unused. Silent compiler warning. */
100 100
101 if (0 != strcmp ("PUT", method)) 101 if (0 != strcmp ("PUT", method))
@@ -376,6 +376,8 @@ main (int argc, char *const *argv)
376 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 376 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
377 return 2; 377 return 2;
378 put_buffer = malloc (PUT_SIZE); 378 put_buffer = malloc (PUT_SIZE);
379 if (0 == put_buffer)
380 return 77;
379 memset (put_buffer, 1, PUT_SIZE); 381 memset (put_buffer, 1, PUT_SIZE);
380 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) 382 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
381 { 383 {