diff options
Diffstat (limited to 'src/testcurl/test_post.c')
-rw-r--r-- | src/testcurl/test_post.c | 560 |
1 files changed, 290 insertions, 270 deletions
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c index 03452a2f..b665139a 100644 --- a/src/testcurl/test_post.c +++ b/src/testcurl/test_post.c | |||
@@ -45,10 +45,10 @@ | |||
45 | 45 | ||
46 | #include "mhd_has_in_name.h" | 46 | #include "mhd_has_in_name.h" |
47 | 47 | ||
48 | #if defined(CPU_COUNT) && (CPU_COUNT+0) < 2 | 48 | #if defined(CPU_COUNT) && (CPU_COUNT + 0) < 2 |
49 | #undef CPU_COUNT | 49 | #undef CPU_COUNT |
50 | #endif | 50 | #endif |
51 | #if !defined(CPU_COUNT) | 51 | #if ! defined(CPU_COUNT) |
52 | #define CPU_COUNT 2 | 52 | #define CPU_COUNT 2 |
53 | #endif | 53 | #endif |
54 | 54 | ||
@@ -66,12 +66,12 @@ struct CBC | |||
66 | 66 | ||
67 | static void | 67 | static void |
68 | completed_cb (void *cls, | 68 | completed_cb (void *cls, |
69 | struct MHD_Connection *connection, | 69 | struct MHD_Connection *connection, |
70 | void **con_cls, | 70 | void **con_cls, |
71 | enum MHD_RequestTerminationCode toe) | 71 | enum MHD_RequestTerminationCode toe) |
72 | { | 72 | { |
73 | struct MHD_PostProcessor *pp = *con_cls; | 73 | struct MHD_PostProcessor *pp = *con_cls; |
74 | (void)cls;(void)connection;(void)toe; /* Unused. Silent compiler warning. */ | 74 | (void) cls; (void) connection; (void) toe; /* Unused. Silent compiler warning. */ |
75 | 75 | ||
76 | if (NULL != pp) | 76 | if (NULL != pp) |
77 | MHD_destroy_post_processor (pp); | 77 | MHD_destroy_post_processor (pp); |
@@ -107,8 +107,8 @@ post_iterator (void *cls, | |||
107 | const char *value, uint64_t off, size_t size) | 107 | const char *value, uint64_t off, size_t size) |
108 | { | 108 | { |
109 | int *eok = cls; | 109 | int *eok = cls; |
110 | (void)kind;(void)filename;(void)content_type; /* Unused. Silent compiler warning. */ | 110 | (void) kind; (void) filename; (void) content_type; /* Unused. Silent compiler warning. */ |
111 | (void)transfer_encoding;(void)off; /* Unused. Silent compiler warning. */ | 111 | (void) transfer_encoding; (void) off; /* Unused. Silent compiler warning. */ |
112 | 112 | ||
113 | if ((0 == strcasecmp (key, "name")) && | 113 | if ((0 == strcasecmp (key, "name")) && |
114 | (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) | 114 | (size == strlen ("daniel")) && (0 == strncmp (value, "daniel", size))) |
@@ -133,32 +133,32 @@ ahc_echo (void *cls, | |||
133 | struct MHD_Response *response; | 133 | struct MHD_Response *response; |
134 | struct MHD_PostProcessor *pp; | 134 | struct MHD_PostProcessor *pp; |
135 | int ret; | 135 | int 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)) |
139 | { | 139 | { |
140 | printf ("METHOD: %s\n", method); | 140 | printf ("METHOD: %s\n", method); |
141 | return MHD_NO; /* unexpected method */ | 141 | return MHD_NO; /* unexpected method */ |
142 | } | 142 | } |
143 | pp = *unused; | 143 | pp = *unused; |
144 | if (pp == NULL) | 144 | if (pp == NULL) |
145 | { | 145 | { |
146 | eok = 0; | 146 | eok = 0; |
147 | pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); | 147 | pp = MHD_create_post_processor (connection, 1024, &post_iterator, &eok); |
148 | *unused = pp; | 148 | *unused = pp; |
149 | } | 149 | } |
150 | MHD_post_process (pp, upload_data, *upload_data_size); | 150 | MHD_post_process (pp, upload_data, *upload_data_size); |
151 | if ((eok == 3) && (0 == *upload_data_size)) | 151 | if ((eok == 3) && (0 == *upload_data_size)) |
152 | { | 152 | { |
153 | response = MHD_create_response_from_buffer (strlen (url), | 153 | response = MHD_create_response_from_buffer (strlen (url), |
154 | (void *) url, | 154 | (void *) url, |
155 | MHD_RESPMEM_MUST_COPY); | 155 | MHD_RESPMEM_MUST_COPY); |
156 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 156 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |
157 | MHD_destroy_response (response); | 157 | MHD_destroy_response (response); |
158 | MHD_destroy_post_processor (pp); | 158 | MHD_destroy_post_processor (pp); |
159 | *unused = NULL; | 159 | *unused = NULL; |
160 | return ret; | 160 | return ret; |
161 | } | 161 | } |
162 | *upload_data_size = 0; | 162 | *upload_data_size = 0; |
163 | return MHD_YES; | 163 | return MHD_YES; |
164 | } | 164 | } |
@@ -177,32 +177,34 @@ testInternalPost () | |||
177 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 177 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
178 | port = 0; | 178 | port = 0; |
179 | else | 179 | else |
180 | { | 180 | { |
181 | port = 1370; | 181 | port = 1370; |
182 | if (oneone) | 182 | if (oneone) |
183 | port += 10; | 183 | port += 10; |
184 | } | 184 | } |
185 | 185 | ||
186 | cbc.buf = buf; | 186 | cbc.buf = buf; |
187 | cbc.size = 2048; | 187 | cbc.size = 2048; |
188 | cbc.pos = 0; | 188 | cbc.pos = 0; |
189 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, | 189 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, |
190 | port, NULL, NULL, &ahc_echo, NULL, | 190 | port, NULL, NULL, &ahc_echo, NULL, |
191 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, | 191 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, |
192 | MHD_OPTION_END); | 192 | MHD_OPTION_END); |
193 | if (d == NULL) | 193 | if (d == NULL) |
194 | return 1; | 194 | return 1; |
195 | if (0 == port) | 195 | if (0 == port) |
196 | { | ||
197 | const union MHD_DaemonInfo *dinfo; | ||
198 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
199 | if ((NULL == dinfo) ||(0 == dinfo->port) ) | ||
196 | { | 200 | { |
197 | const union MHD_DaemonInfo *dinfo; | 201 | MHD_stop_daemon (d); return 32; |
198 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
199 | if (NULL == dinfo || 0 == dinfo->port) | ||
200 | { MHD_stop_daemon (d); return 32; } | ||
201 | port = (int)dinfo->port; | ||
202 | } | 202 | } |
203 | port = (int) dinfo->port; | ||
204 | } | ||
203 | c = curl_easy_init (); | 205 | c = curl_easy_init (); |
204 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); | 206 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); |
205 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | 207 | curl_easy_setopt (c, CURLOPT_PORT, (long) port); |
206 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 208 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
207 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 209 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
208 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); | 210 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); |
@@ -220,14 +222,14 @@ testInternalPost () | |||
220 | * crashes on my system! */ | 222 | * crashes on my system! */ |
221 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); | 223 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); |
222 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 224 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
223 | { | 225 | { |
224 | fprintf (stderr, | 226 | fprintf (stderr, |
225 | "curl_easy_perform failed: `%s'\n", | 227 | "curl_easy_perform failed: `%s'\n", |
226 | curl_easy_strerror (errornum)); | 228 | curl_easy_strerror (errornum)); |
227 | curl_easy_cleanup (c); | 229 | curl_easy_cleanup (c); |
228 | MHD_stop_daemon (d); | 230 | MHD_stop_daemon (d); |
229 | return 2; | 231 | return 2; |
230 | } | 232 | } |
231 | curl_easy_cleanup (c); | 233 | curl_easy_cleanup (c); |
232 | MHD_stop_daemon (d); | 234 | MHD_stop_daemon (d); |
233 | if (cbc.pos != strlen ("/hello_world")) | 235 | if (cbc.pos != strlen ("/hello_world")) |
@@ -250,32 +252,35 @@ testMultithreadedPost () | |||
250 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 252 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
251 | port = 0; | 253 | port = 0; |
252 | else | 254 | else |
253 | { | 255 | { |
254 | port = 1371; | 256 | port = 1371; |
255 | if (oneone) | 257 | if (oneone) |
256 | port += 10; | 258 | port += 10; |
257 | } | 259 | } |
258 | 260 | ||
259 | cbc.buf = buf; | 261 | cbc.buf = buf; |
260 | cbc.size = 2048; | 262 | cbc.size = 2048; |
261 | cbc.pos = 0; | 263 | cbc.pos = 0; |
262 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, | 264 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
265 | | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, | ||
263 | port, NULL, NULL, &ahc_echo, NULL, | 266 | port, NULL, NULL, &ahc_echo, NULL, |
264 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, | 267 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, |
265 | MHD_OPTION_END); | 268 | MHD_OPTION_END); |
266 | if (d == NULL) | 269 | if (d == NULL) |
267 | return 16; | 270 | return 16; |
268 | if (0 == port) | 271 | if (0 == port) |
272 | { | ||
273 | const union MHD_DaemonInfo *dinfo; | ||
274 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
275 | if ((NULL == dinfo) ||(0 == dinfo->port) ) | ||
269 | { | 276 | { |
270 | const union MHD_DaemonInfo *dinfo; | 277 | MHD_stop_daemon (d); return 32; |
271 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
272 | if (NULL == dinfo || 0 == dinfo->port) | ||
273 | { MHD_stop_daemon (d); return 32; } | ||
274 | port = (int)dinfo->port; | ||
275 | } | 278 | } |
279 | port = (int) dinfo->port; | ||
280 | } | ||
276 | c = curl_easy_init (); | 281 | c = curl_easy_init (); |
277 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); | 282 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); |
278 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | 283 | curl_easy_setopt (c, CURLOPT_PORT, (long) port); |
279 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 284 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
280 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 285 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
281 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); | 286 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); |
@@ -293,14 +298,14 @@ testMultithreadedPost () | |||
293 | * crashes on my system! */ | 298 | * crashes on my system! */ |
294 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); | 299 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); |
295 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 300 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
296 | { | 301 | { |
297 | fprintf (stderr, | 302 | fprintf (stderr, |
298 | "curl_easy_perform failed: `%s'\n", | 303 | "curl_easy_perform failed: `%s'\n", |
299 | curl_easy_strerror (errornum)); | 304 | curl_easy_strerror (errornum)); |
300 | curl_easy_cleanup (c); | 305 | curl_easy_cleanup (c); |
301 | MHD_stop_daemon (d); | 306 | MHD_stop_daemon (d); |
302 | return 32; | 307 | return 32; |
303 | } | 308 | } |
304 | curl_easy_cleanup (c); | 309 | curl_easy_cleanup (c); |
305 | MHD_stop_daemon (d); | 310 | MHD_stop_daemon (d); |
306 | if (cbc.pos != strlen ("/hello_world")) | 311 | if (cbc.pos != strlen ("/hello_world")) |
@@ -323,11 +328,11 @@ testMultithreadedPoolPost () | |||
323 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 328 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
324 | port = 0; | 329 | port = 0; |
325 | else | 330 | else |
326 | { | 331 | { |
327 | port = 1372; | 332 | port = 1372; |
328 | if (oneone) | 333 | if (oneone) |
329 | port += 10; | 334 | port += 10; |
330 | } | 335 | } |
331 | 336 | ||
332 | cbc.buf = buf; | 337 | cbc.buf = buf; |
333 | cbc.size = 2048; | 338 | cbc.size = 2048; |
@@ -335,21 +340,23 @@ testMultithreadedPoolPost () | |||
335 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, | 340 | d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, |
336 | port, NULL, NULL, &ahc_echo, NULL, | 341 | port, NULL, NULL, &ahc_echo, NULL, |
337 | MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, | 342 | MHD_OPTION_THREAD_POOL_SIZE, CPU_COUNT, |
338 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, | 343 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, |
339 | MHD_OPTION_END); | 344 | MHD_OPTION_END); |
340 | if (d == NULL) | 345 | if (d == NULL) |
341 | return 16; | 346 | return 16; |
342 | if (0 == port) | 347 | if (0 == port) |
348 | { | ||
349 | const union MHD_DaemonInfo *dinfo; | ||
350 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
351 | if ((NULL == dinfo) ||(0 == dinfo->port) ) | ||
343 | { | 352 | { |
344 | const union MHD_DaemonInfo *dinfo; | 353 | MHD_stop_daemon (d); return 32; |
345 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
346 | if (NULL == dinfo || 0 == dinfo->port) | ||
347 | { MHD_stop_daemon (d); return 32; } | ||
348 | port = (int)dinfo->port; | ||
349 | } | 354 | } |
355 | port = (int) dinfo->port; | ||
356 | } | ||
350 | c = curl_easy_init (); | 357 | c = curl_easy_init (); |
351 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); | 358 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); |
352 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | 359 | curl_easy_setopt (c, CURLOPT_PORT, (long) port); |
353 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 360 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
354 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 361 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
355 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); | 362 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); |
@@ -367,14 +374,14 @@ testMultithreadedPoolPost () | |||
367 | * crashes on my system! */ | 374 | * crashes on my system! */ |
368 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); | 375 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); |
369 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | 376 | if (CURLE_OK != (errornum = curl_easy_perform (c))) |
370 | { | 377 | { |
371 | fprintf (stderr, | 378 | fprintf (stderr, |
372 | "curl_easy_perform failed: `%s'\n", | 379 | "curl_easy_perform failed: `%s'\n", |
373 | curl_easy_strerror (errornum)); | 380 | curl_easy_strerror (errornum)); |
374 | curl_easy_cleanup (c); | 381 | curl_easy_cleanup (c); |
375 | MHD_stop_daemon (d); | 382 | MHD_stop_daemon (d); |
376 | return 32; | 383 | return 32; |
377 | } | 384 | } |
378 | curl_easy_cleanup (c); | 385 | curl_easy_cleanup (c); |
379 | MHD_stop_daemon (d); | 386 | MHD_stop_daemon (d); |
380 | if (cbc.pos != strlen ("/hello_world")) | 387 | if (cbc.pos != strlen ("/hello_world")) |
@@ -411,11 +418,11 @@ testExternalPost () | |||
411 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 418 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
412 | port = 0; | 419 | port = 0; |
413 | else | 420 | else |
414 | { | 421 | { |
415 | port = 1373; | 422 | port = 1373; |
416 | if (oneone) | 423 | if (oneone) |
417 | port += 10; | 424 | port += 10; |
418 | } | 425 | } |
419 | 426 | ||
420 | multi = NULL; | 427 | multi = NULL; |
421 | cbc.buf = buf; | 428 | cbc.buf = buf; |
@@ -423,21 +430,23 @@ testExternalPost () | |||
423 | cbc.pos = 0; | 430 | cbc.pos = 0; |
424 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, | 431 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, |
425 | port, NULL, NULL, &ahc_echo, NULL, | 432 | port, NULL, NULL, &ahc_echo, NULL, |
426 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, | 433 | MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL, |
427 | MHD_OPTION_END); | 434 | MHD_OPTION_END); |
428 | if (d == NULL) | 435 | if (d == NULL) |
429 | return 256; | 436 | return 256; |
430 | if (0 == port) | 437 | if (0 == port) |
438 | { | ||
439 | const union MHD_DaemonInfo *dinfo; | ||
440 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
441 | if ((NULL == dinfo) ||(0 == dinfo->port) ) | ||
431 | { | 442 | { |
432 | const union MHD_DaemonInfo *dinfo; | 443 | MHD_stop_daemon (d); return 32; |
433 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
434 | if (NULL == dinfo || 0 == dinfo->port) | ||
435 | { MHD_stop_daemon (d); return 32; } | ||
436 | port = (int)dinfo->port; | ||
437 | } | 444 | } |
445 | port = (int) dinfo->port; | ||
446 | } | ||
438 | c = curl_easy_init (); | 447 | c = curl_easy_init (); |
439 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); | 448 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); |
440 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | 449 | curl_easy_setopt (c, CURLOPT_PORT, (long) port); |
441 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 450 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
442 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 451 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
443 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); | 452 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, POST_DATA); |
@@ -458,85 +467,88 @@ testExternalPost () | |||
458 | 467 | ||
459 | multi = curl_multi_init (); | 468 | multi = curl_multi_init (); |
460 | if (multi == NULL) | 469 | if (multi == NULL) |
470 | { | ||
471 | curl_easy_cleanup (c); | ||
472 | MHD_stop_daemon (d); | ||
473 | return 512; | ||
474 | } | ||
475 | mret = curl_multi_add_handle (multi, c); | ||
476 | if (mret != CURLM_OK) | ||
477 | { | ||
478 | curl_multi_cleanup (multi); | ||
479 | curl_easy_cleanup (c); | ||
480 | MHD_stop_daemon (d); | ||
481 | return 1024; | ||
482 | } | ||
483 | start = time (NULL); | ||
484 | while ((time (NULL) - start < 5) && (multi != NULL)) | ||
485 | { | ||
486 | maxsock = MHD_INVALID_SOCKET; | ||
487 | maxposixs = -1; | ||
488 | FD_ZERO (&rs); | ||
489 | FD_ZERO (&ws); | ||
490 | FD_ZERO (&es); | ||
491 | curl_multi_perform (multi, &running); | ||
492 | mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); | ||
493 | if (mret != CURLM_OK) | ||
461 | { | 494 | { |
495 | curl_multi_remove_handle (multi, c); | ||
496 | curl_multi_cleanup (multi); | ||
462 | curl_easy_cleanup (c); | 497 | curl_easy_cleanup (c); |
463 | MHD_stop_daemon (d); | 498 | MHD_stop_daemon (d); |
464 | return 512; | 499 | return 2048; |
465 | } | 500 | } |
466 | mret = curl_multi_add_handle (multi, c); | 501 | if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) |
467 | if (mret != CURLM_OK) | ||
468 | { | 502 | { |
503 | curl_multi_remove_handle (multi, c); | ||
469 | curl_multi_cleanup (multi); | 504 | curl_multi_cleanup (multi); |
470 | curl_easy_cleanup (c); | 505 | curl_easy_cleanup (c); |
471 | MHD_stop_daemon (d); | 506 | MHD_stop_daemon (d); |
472 | return 1024; | 507 | return 4096; |
473 | } | 508 | } |
474 | start = time (NULL); | 509 | tv.tv_sec = 0; |
475 | while ((time (NULL) - start < 5) && (multi != NULL)) | 510 | tv.tv_usec = 1000; |
511 | if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) | ||
476 | { | 512 | { |
477 | maxsock = MHD_INVALID_SOCKET; | ||
478 | maxposixs = -1; | ||
479 | FD_ZERO (&rs); | ||
480 | FD_ZERO (&ws); | ||
481 | FD_ZERO (&es); | ||
482 | curl_multi_perform (multi, &running); | ||
483 | mret = curl_multi_fdset (multi, &rs, &ws, &es, &maxposixs); | ||
484 | if (mret != CURLM_OK) | ||
485 | { | ||
486 | curl_multi_remove_handle (multi, c); | ||
487 | curl_multi_cleanup (multi); | ||
488 | curl_easy_cleanup (c); | ||
489 | MHD_stop_daemon (d); | ||
490 | return 2048; | ||
491 | } | ||
492 | if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &maxsock)) | ||
493 | { | ||
494 | curl_multi_remove_handle (multi, c); | ||
495 | curl_multi_cleanup (multi); | ||
496 | curl_easy_cleanup (c); | ||
497 | MHD_stop_daemon (d); | ||
498 | return 4096; | ||
499 | } | ||
500 | tv.tv_sec = 0; | ||
501 | tv.tv_usec = 1000; | ||
502 | if (-1 == select (maxposixs + 1, &rs, &ws, &es, &tv)) | ||
503 | { | ||
504 | #ifdef MHD_POSIX_SOCKETS | 513 | #ifdef MHD_POSIX_SOCKETS |
505 | if (EINTR != errno) | 514 | if (EINTR != errno) |
506 | abort (); | 515 | abort (); |
507 | #else | 516 | #else |
508 | if (WSAEINVAL != WSAGetLastError() || 0 != rs.fd_count || 0 != ws.fd_count || 0 != es.fd_count) | 517 | if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != |
509 | abort (); | 518 | ws.fd_count) |
510 | Sleep (1000); | 519 | ||(0 != es.fd_count) ) |
520 | abort (); | ||
521 | Sleep (1000); | ||
511 | #endif | 522 | #endif |
512 | } | ||
513 | curl_multi_perform (multi, &running); | ||
514 | if (running == 0) | ||
515 | { | ||
516 | msg = curl_multi_info_read (multi, &running); | ||
517 | if (msg == NULL) | ||
518 | break; | ||
519 | if (msg->msg == CURLMSG_DONE) | ||
520 | { | ||
521 | if (msg->data.result != CURLE_OK) | ||
522 | printf ("%s failed at %s:%d: `%s'\n", | ||
523 | "curl_multi_perform", | ||
524 | __FILE__, | ||
525 | __LINE__, curl_easy_strerror (msg->data.result)); | ||
526 | curl_multi_remove_handle (multi, c); | ||
527 | curl_multi_cleanup (multi); | ||
528 | curl_easy_cleanup (c); | ||
529 | c = NULL; | ||
530 | multi = NULL; | ||
531 | } | ||
532 | } MHD_run (d); | ||
533 | } | 523 | } |
534 | if (multi != NULL) | 524 | curl_multi_perform (multi, &running); |
525 | if (running == 0) | ||
535 | { | 526 | { |
536 | curl_multi_remove_handle (multi, c); | 527 | msg = curl_multi_info_read (multi, &running); |
537 | curl_easy_cleanup (c); | 528 | if (msg == NULL) |
538 | curl_multi_cleanup (multi); | 529 | break; |
530 | if (msg->msg == CURLMSG_DONE) | ||
531 | { | ||
532 | if (msg->data.result != CURLE_OK) | ||
533 | printf ("%s failed at %s:%d: `%s'\n", | ||
534 | "curl_multi_perform", | ||
535 | __FILE__, | ||
536 | __LINE__, curl_easy_strerror (msg->data.result)); | ||
537 | curl_multi_remove_handle (multi, c); | ||
538 | curl_multi_cleanup (multi); | ||
539 | curl_easy_cleanup (c); | ||
540 | c = NULL; | ||
541 | multi = NULL; | ||
542 | } | ||
539 | } | 543 | } |
544 | MHD_run (d); | ||
545 | } | ||
546 | if (multi != NULL) | ||
547 | { | ||
548 | curl_multi_remove_handle (multi, c); | ||
549 | curl_easy_cleanup (c); | ||
550 | curl_multi_cleanup (multi); | ||
551 | } | ||
540 | MHD_stop_daemon (d); | 552 | MHD_stop_daemon (d); |
541 | if (cbc.pos != strlen ("/hello_world")) | 553 | if (cbc.pos != strlen ("/hello_world")) |
542 | return 8192; | 554 | return 8192; |
@@ -548,43 +560,43 @@ testExternalPost () | |||
548 | 560 | ||
549 | static int | 561 | static int |
550 | ahc_cancel (void *cls, | 562 | ahc_cancel (void *cls, |
551 | struct MHD_Connection *connection, | 563 | struct MHD_Connection *connection, |
552 | const char *url, | 564 | const char *url, |
553 | const char *method, | 565 | const char *method, |
554 | const char *version, | 566 | const char *version, |
555 | const char *upload_data, size_t *upload_data_size, | 567 | const char *upload_data, size_t *upload_data_size, |
556 | void **unused) | 568 | void **unused) |
557 | { | 569 | { |
558 | struct MHD_Response *response; | 570 | struct MHD_Response *response; |
559 | int ret; | 571 | int ret; |
560 | (void)cls;(void)url;(void)version; /* Unused. Silent compiler warning. */ | 572 | (void) cls; (void) url; (void) version; /* Unused. Silent compiler warning. */ |
561 | (void)upload_data;(void)upload_data_size; /* Unused. Silent compiler warning. */ | 573 | (void) upload_data; (void) upload_data_size; /* Unused. Silent compiler warning. */ |
562 | 574 | ||
563 | if (0 != strcasecmp ("POST", method)) | 575 | if (0 != strcasecmp ("POST", method)) |
564 | { | 576 | { |
565 | fprintf (stderr, | 577 | fprintf (stderr, |
566 | "Unexpected method `%s'\n", method); | 578 | "Unexpected method `%s'\n", method); |
567 | return MHD_NO; | 579 | return MHD_NO; |
568 | } | 580 | } |
569 | 581 | ||
570 | if (*unused == NULL) | 582 | if (*unused == NULL) |
571 | { | 583 | { |
572 | *unused = "wibble"; | 584 | *unused = "wibble"; |
573 | /* We don't want the body. Send a 500. */ | 585 | /* We don't want the body. Send a 500. */ |
574 | response = MHD_create_response_from_buffer (0, NULL, | 586 | response = MHD_create_response_from_buffer (0, NULL, |
575 | MHD_RESPMEM_PERSISTENT); | 587 | MHD_RESPMEM_PERSISTENT); |
576 | ret = MHD_queue_response(connection, 500, response); | 588 | ret = MHD_queue_response (connection, 500, response); |
577 | if (ret != MHD_YES) | 589 | if (ret != MHD_YES) |
578 | fprintf(stderr, "Failed to queue response\n"); | 590 | fprintf (stderr, "Failed to queue response\n"); |
579 | MHD_destroy_response(response); | 591 | MHD_destroy_response (response); |
580 | return ret; | 592 | return ret; |
581 | } | 593 | } |
582 | else | 594 | else |
583 | { | 595 | { |
584 | fprintf(stderr, | 596 | fprintf (stderr, |
585 | "In ahc_cancel again. This should not happen.\n"); | 597 | "In ahc_cancel again. This should not happen.\n"); |
586 | return MHD_NO; | 598 | return MHD_NO; |
587 | } | 599 | } |
588 | } | 600 | } |
589 | 601 | ||
590 | struct CRBC | 602 | struct CRBC |
@@ -596,7 +608,7 @@ struct CRBC | |||
596 | 608 | ||
597 | 609 | ||
598 | static size_t | 610 | static size_t |
599 | readBuffer(void *p, size_t size, size_t nmemb, void *opaque) | 611 | readBuffer (void *p, size_t size, size_t nmemb, void *opaque) |
600 | { | 612 | { |
601 | struct CRBC *data = opaque; | 613 | struct CRBC *data = opaque; |
602 | size_t required = size * nmemb; | 614 | size_t required = size * nmemb; |
@@ -605,18 +617,18 @@ readBuffer(void *p, size_t size, size_t nmemb, void *opaque) | |||
605 | if (required > left) | 617 | if (required > left) |
606 | required = left; | 618 | required = left; |
607 | 619 | ||
608 | memcpy(p, data->buffer + data->pos, required); | 620 | memcpy (p, data->buffer + data->pos, required); |
609 | data->pos += required; | 621 | data->pos += required; |
610 | 622 | ||
611 | return required/size; | 623 | return required / size; |
612 | } | 624 | } |
613 | 625 | ||
614 | 626 | ||
615 | static size_t | 627 | static size_t |
616 | slowReadBuffer(void *p, size_t size, size_t nmemb, void *opaque) | 628 | slowReadBuffer (void *p, size_t size, size_t nmemb, void *opaque) |
617 | { | 629 | { |
618 | (void)sleep(1); | 630 | (void) sleep (1); |
619 | return readBuffer(p, size, nmemb, opaque); | 631 | return readBuffer (p, size, nmemb, opaque); |
620 | } | 632 | } |
621 | 633 | ||
622 | 634 | ||
@@ -628,7 +640,7 @@ slowReadBuffer(void *p, size_t size, size_t nmemb, void *opaque) | |||
628 | 640 | ||
629 | 641 | ||
630 | static int | 642 | static int |
631 | testMultithreadedPostCancelPart(int flags) | 643 | testMultithreadedPostCancelPart (int flags) |
632 | { | 644 | { |
633 | struct MHD_Daemon *d; | 645 | struct MHD_Daemon *d; |
634 | CURL *c; | 646 | CURL *c; |
@@ -645,44 +657,48 @@ testMultithreadedPostCancelPart(int flags) | |||
645 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 657 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
646 | port = 0; | 658 | port = 0; |
647 | else | 659 | else |
648 | { | 660 | { |
649 | port = 1374; | 661 | port = 1374; |
650 | if (oneone) | 662 | if (oneone) |
651 | port += 10; | 663 | port += 10; |
652 | } | 664 | } |
653 | 665 | ||
654 | /* Don't test features that aren't available with HTTP/1.0 in | 666 | /* Don't test features that aren't available with HTTP/1.0 in |
655 | * HTTP/1.0 mode. */ | 667 | * HTTP/1.0 mode. */ |
656 | if (!oneone && (flags & (FLAG_EXPECT_CONTINUE | FLAG_CHUNKED))) | 668 | if (! oneone && (flags & (FLAG_EXPECT_CONTINUE | FLAG_CHUNKED))) |
657 | return 0; | 669 | return 0; |
658 | 670 | ||
659 | cbc.buf = buf; | 671 | cbc.buf = buf; |
660 | cbc.size = 2048; | 672 | cbc.size = 2048; |
661 | cbc.pos = 0; | 673 | cbc.pos = 0; |
662 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, | 674 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION |
675 | | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, | ||
663 | port, NULL, NULL, &ahc_cancel, NULL, | 676 | port, NULL, NULL, &ahc_cancel, NULL, |
664 | MHD_OPTION_END); | 677 | MHD_OPTION_END); |
665 | if (d == NULL) | 678 | if (d == NULL) |
666 | return 32768; | 679 | return 32768; |
667 | if (0 == port) | 680 | if (0 == port) |
681 | { | ||
682 | const union MHD_DaemonInfo *dinfo; | ||
683 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
684 | if ((NULL == dinfo) ||(0 == dinfo->port) ) | ||
668 | { | 685 | { |
669 | const union MHD_DaemonInfo *dinfo; | 686 | MHD_stop_daemon (d); return 32; |
670 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
671 | if (NULL == dinfo || 0 == dinfo->port) | ||
672 | { MHD_stop_daemon (d); return 32; } | ||
673 | port = (int)dinfo->port; | ||
674 | } | 687 | } |
688 | port = (int) dinfo->port; | ||
689 | } | ||
675 | 690 | ||
676 | crbc.buffer = "Test content"; | 691 | crbc.buffer = "Test content"; |
677 | crbc.size = strlen(crbc.buffer); | 692 | crbc.size = strlen (crbc.buffer); |
678 | crbc.pos = 0; | 693 | crbc.pos = 0; |
679 | 694 | ||
680 | c = curl_easy_init (); | 695 | c = curl_easy_init (); |
681 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); | 696 | curl_easy_setopt (c, CURLOPT_URL, "http://127.0.0.1/hello_world"); |
682 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | 697 | curl_easy_setopt (c, CURLOPT_PORT, (long) port); |
683 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 698 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
684 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 699 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
685 | curl_easy_setopt (c, CURLOPT_READFUNCTION, (flags & FLAG_SLOW_READ) ? &slowReadBuffer : &readBuffer); | 700 | curl_easy_setopt (c, CURLOPT_READFUNCTION, (flags & FLAG_SLOW_READ) ? |
701 | &slowReadBuffer : &readBuffer); | ||
686 | curl_easy_setopt (c, CURLOPT_READDATA, &crbc); | 702 | curl_easy_setopt (c, CURLOPT_READDATA, &crbc); |
687 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, NULL); | 703 | curl_easy_setopt (c, CURLOPT_POSTFIELDS, NULL); |
688 | curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, crbc.size); | 704 | curl_easy_setopt (c, CURLOPT_POSTFIELDSIZE, crbc.size); |
@@ -700,68 +716,72 @@ testMultithreadedPostCancelPart(int flags) | |||
700 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); | 716 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); |
701 | 717 | ||
702 | if (flags & FLAG_CHUNKED) | 718 | if (flags & FLAG_CHUNKED) |
703 | headers = curl_slist_append(headers, "Transfer-Encoding: chunked"); | 719 | headers = curl_slist_append (headers, "Transfer-Encoding: chunked"); |
704 | if (!(flags & FLAG_FORM_DATA)) | 720 | if (! (flags & FLAG_FORM_DATA)) |
705 | headers = curl_slist_append(headers, "Content-Type: application/octet-stream"); | 721 | headers = curl_slist_append (headers, |
722 | "Content-Type: application/octet-stream"); | ||
706 | if (flags & FLAG_EXPECT_CONTINUE) | 723 | if (flags & FLAG_EXPECT_CONTINUE) |
707 | headers = curl_slist_append(headers, "Expect: 100-Continue"); | 724 | headers = curl_slist_append (headers, "Expect: 100-Continue"); |
708 | curl_easy_setopt(c, CURLOPT_HTTPHEADER, headers); | 725 | curl_easy_setopt (c, CURLOPT_HTTPHEADER, headers); |
709 | 726 | ||
710 | if (CURLE_HTTP_RETURNED_ERROR != (errornum = curl_easy_perform (c))) | 727 | if (CURLE_HTTP_RETURNED_ERROR != (errornum = curl_easy_perform (c))) |
711 | { | 728 | { |
712 | #ifdef _WIN32 | 729 | #ifdef _WIN32 |
713 | curl_version_info_data *curlverd = curl_version_info(CURLVERSION_NOW); | 730 | curl_version_info_data *curlverd = curl_version_info (CURLVERSION_NOW); |
714 | if (0 != (flags & FLAG_SLOW_READ) && CURLE_RECV_ERROR == errornum && | 731 | if ((0 != (flags & FLAG_SLOW_READ)) &&(CURLE_RECV_ERROR == errornum) && |
715 | (curlverd == NULL || curlverd->ares_num < 0x073100) ) | 732 | ((curlverd == NULL) ||(curlverd->ares_num < 0x073100) ) ) |
716 | { /* libcurl up to version 7.49.0 didn't have workaround for WinSock bug */ | 733 | { /* libcurl up to version 7.49.0 didn't have workaround for WinSock bug */ |
717 | fprintf (stderr, "Ignored curl_easy_perform expected failure on W32 with \"slow read\".\n"); | 734 | fprintf (stderr, |
718 | result = 0; | 735 | "Ignored curl_easy_perform expected failure on W32 with \"slow read\".\n"); |
719 | } | 736 | result = 0; |
720 | else | 737 | } |
738 | else | ||
721 | #else /* ! _WIN32 */ | 739 | #else /* ! _WIN32 */ |
722 | if(1) | 740 | if (1) |
723 | #endif /* ! _WIN32 */ | 741 | #endif /* ! _WIN32 */ |
724 | { | ||
725 | fprintf (stderr, | ||
726 | "flibbet curl_easy_perform didn't fail as expected: `%s' %d\n", | ||
727 | curl_easy_strerror (errornum), errornum); | ||
728 | result = 65536; | ||
729 | } | ||
730 | curl_easy_cleanup (c); | ||
731 | MHD_stop_daemon (d); | ||
732 | curl_slist_free_all(headers); | ||
733 | return result; | ||
734 | } | ||
735 | |||
736 | if (CURLE_OK != (cc = curl_easy_getinfo(c, CURLINFO_RESPONSE_CODE, &response_code))) | ||
737 | { | 742 | { |
738 | fprintf(stderr, "curl_easy_getinfo failed: '%s'\n", curl_easy_strerror(errornum)); | 743 | fprintf (stderr, |
744 | "flibbet curl_easy_perform didn't fail as expected: `%s' %d\n", | ||
745 | curl_easy_strerror (errornum), errornum); | ||
739 | result = 65536; | 746 | result = 65536; |
740 | } | 747 | } |
741 | 748 | curl_easy_cleanup (c); | |
742 | if (!result && (response_code != 500)) | 749 | MHD_stop_daemon (d); |
743 | { | 750 | curl_slist_free_all (headers); |
744 | fprintf(stderr, "Unexpected response code: %ld\n", response_code); | 751 | return result; |
745 | result = 131072; | 752 | } |
746 | } | 753 | |
747 | 754 | if (CURLE_OK != (cc = curl_easy_getinfo (c, CURLINFO_RESPONSE_CODE, | |
748 | if (!result && (cbc.pos != 0)) | 755 | &response_code))) |
756 | { | ||
757 | fprintf (stderr, "curl_easy_getinfo failed: '%s'\n", curl_easy_strerror ( | ||
758 | errornum)); | ||
759 | result = 65536; | ||
760 | } | ||
761 | |||
762 | if (! result && (response_code != 500)) | ||
763 | { | ||
764 | fprintf (stderr, "Unexpected response code: %ld\n", response_code); | ||
765 | result = 131072; | ||
766 | } | ||
767 | |||
768 | if (! result && (cbc.pos != 0)) | ||
749 | result = 262144; | 769 | result = 262144; |
750 | 770 | ||
751 | curl_easy_cleanup (c); | 771 | curl_easy_cleanup (c); |
752 | MHD_stop_daemon (d); | 772 | MHD_stop_daemon (d); |
753 | curl_slist_free_all(headers); | 773 | curl_slist_free_all (headers); |
754 | return result; | 774 | return result; |
755 | } | 775 | } |
756 | 776 | ||
757 | 777 | ||
758 | static int | 778 | static int |
759 | testMultithreadedPostCancel() | 779 | testMultithreadedPostCancel () |
760 | { | 780 | { |
761 | int result = 0; | 781 | int result = 0; |
762 | int flags; | 782 | int flags; |
763 | for(flags = 0; flags < FLAG_COUNT; ++flags) | 783 | for (flags = 0; flags < FLAG_COUNT; ++flags) |
764 | result |= testMultithreadedPostCancelPart(flags); | 784 | result |= testMultithreadedPostCancelPart (flags); |
765 | return result; | 785 | return result; |
766 | } | 786 | } |
767 | 787 | ||
@@ -770,20 +790,20 @@ int | |||
770 | main (int argc, char *const *argv) | 790 | main (int argc, char *const *argv) |
771 | { | 791 | { |
772 | unsigned int errorCount = 0; | 792 | unsigned int errorCount = 0; |
773 | (void)argc; /* Unused. Silent compiler warning. */ | 793 | (void) argc; /* Unused. Silent compiler warning. */ |
774 | 794 | ||
775 | if (NULL == argv || 0 == argv[0]) | 795 | if ((NULL == argv)||(0 == argv[0])) |
776 | return 99; | 796 | return 99; |
777 | oneone = has_in_name (argv[0], "11"); | 797 | oneone = has_in_name (argv[0], "11"); |
778 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) | 798 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) |
779 | return 2; | 799 | return 2; |
780 | if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_THREADS)) | 800 | if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) |
781 | { | 801 | { |
782 | errorCount += testMultithreadedPostCancel (); | 802 | errorCount += testMultithreadedPostCancel (); |
783 | errorCount += testInternalPost (); | 803 | errorCount += testInternalPost (); |
784 | errorCount += testMultithreadedPost (); | 804 | errorCount += testMultithreadedPost (); |
785 | errorCount += testMultithreadedPoolPost (); | 805 | errorCount += testMultithreadedPoolPost (); |
786 | } | 806 | } |
787 | errorCount += testExternalPost (); | 807 | errorCount += testExternalPost (); |
788 | if (errorCount != 0) | 808 | if (errorCount != 0) |
789 | fprintf (stderr, "Error (code: %u)\n", errorCount); | 809 | fprintf (stderr, "Error (code: %u)\n", errorCount); |