255
testMultithreadedPoolPost ()
257
struct MHD_Daemon *d;
262
struct curl_httppost *pd;
267
d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
268
1081, NULL, NULL, &ahc_echo, NULL,
269
MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END);
272
c = curl_easy_init ();
273
curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/hello_world");
274
curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer);
275
curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
277
curl_easy_setopt (c, CURLOPT_HTTPPOST, pd);
278
curl_easy_setopt (c, CURLOPT_FAILONERROR, 1);
279
curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L);
281
curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
283
curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
284
curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 5L);
285
// NOTE: use of CONNECTTIMEOUT without also
286
// setting NOSIGNAL results in really weird
287
// crashes on my system!
288
curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1);
289
if (CURLE_OK != (errornum = curl_easy_perform (c)))
292
"curl_easy_perform failed: `%s'\n",
293
curl_easy_strerror (errornum));
294
curl_easy_cleanup (c);
299
curl_easy_cleanup (c);
302
if (cbc.pos != strlen ("/hello_world"))
304
if (0 != strncmp ("/hello_world", cbc.buf, strlen ("/hello_world")))
256
310
testExternalPost ()
395
449
errorCount += testInternalPost ();
396
450
errorCount += testMultithreadedPost ();
451
errorCount += testMultithreadedPoolPost ();
397
452
errorCount += testExternalPost ();
398
453
if (errorCount != 0)
399
454
fprintf (stderr, "Error (code: %u)\n", errorCount);