aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_post.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/test_post.c')
-rw-r--r--src/testcurl/test_post.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index f889afd8..acc97e77 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file daemontest_post.c 22 * @file test_postx.c
23 * @brief Testcase for libmicrohttpd POST operations using URL-encoding 23 * @brief Testcase for libmicrohttpd POST operations using URL-encoding
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
@@ -47,6 +47,21 @@ struct CBC
47 size_t size; 47 size_t size;
48}; 48};
49 49
50
51static void
52completed_cb (void *cls,
53 struct MHD_Connection *connection,
54 void **con_cls,
55 enum MHD_RequestTerminationCode toe)
56{
57 struct MHD_PostProcessor *pp = *con_cls;
58
59 if (NULL != pp)
60 MHD_destroy_post_processor (pp);
61 *con_cls = NULL;
62}
63
64
50static size_t 65static size_t
51copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 66copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
52{ 67{
@@ -59,6 +74,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
59 return size * nmemb; 74 return size * nmemb;
60} 75}
61 76
77
62/** 78/**
63 * Note that this post_iterator is not perfect 79 * Note that this post_iterator is not perfect
64 * in that it fails to support incremental processing. 80 * in that it fails to support incremental processing.
@@ -140,7 +156,9 @@ testInternalPost ()
140 cbc.size = 2048; 156 cbc.size = 2048;
141 cbc.pos = 0; 157 cbc.pos = 0;
142 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 158 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
143 1080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 159 1080, NULL, NULL, &ahc_echo, NULL,
160 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
161 MHD_OPTION_END);
144 if (d == NULL) 162 if (d == NULL)
145 return 1; 163 return 1;
146 c = curl_easy_init (); 164 c = curl_easy_init ();
@@ -192,7 +210,9 @@ testMultithreadedPost ()
192 cbc.size = 2048; 210 cbc.size = 2048;
193 cbc.pos = 0; 211 cbc.pos = 0;
194 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 212 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
195 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 213 1081, NULL, NULL, &ahc_echo, NULL,
214 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
215 MHD_OPTION_END);
196 if (d == NULL) 216 if (d == NULL)
197 return 16; 217 return 16;
198 c = curl_easy_init (); 218 c = curl_easy_init ();
@@ -245,7 +265,9 @@ testMultithreadedPoolPost ()
245 cbc.pos = 0; 265 cbc.pos = 0;
246 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 266 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
247 1081, NULL, NULL, &ahc_echo, NULL, 267 1081, NULL, NULL, &ahc_echo, NULL,
248 MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END); 268 MHD_OPTION_THREAD_POOL_SIZE, 4,
269 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
270 MHD_OPTION_END);
249 if (d == NULL) 271 if (d == NULL)
250 return 16; 272 return 16;
251 c = curl_easy_init (); 273 c = curl_easy_init ();
@@ -307,7 +329,9 @@ testExternalPost ()
307 cbc.size = 2048; 329 cbc.size = 2048;
308 cbc.pos = 0; 330 cbc.pos = 0;
309 d = MHD_start_daemon (MHD_USE_DEBUG, 331 d = MHD_start_daemon (MHD_USE_DEBUG,
310 1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 332 1082, NULL, NULL, &ahc_echo, NULL,
333 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
334 MHD_OPTION_END);
311 if (d == NULL) 335 if (d == NULL)
312 return 256; 336 return 256;
313 c = curl_easy_init (); 337 c = curl_easy_init ();
@@ -507,7 +531,9 @@ testMultithreadedPostCancelPart(int flags)
507 cbc.size = 2048; 531 cbc.size = 2048;
508 cbc.pos = 0; 532 cbc.pos = 0;
509 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 533 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
510 1081, NULL, NULL, &ahc_cancel, NULL, MHD_OPTION_END); 534 1081, NULL, NULL, &ahc_cancel, NULL,
535 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
536 MHD_OPTION_END);
511 if (d == NULL) 537 if (d == NULL)
512 return 32768; 538 return 32768;
513 539