aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_postform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/test_postform.c')
-rw-r--r--src/testcurl/test_postform.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index c02cf636..3b63f840 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file daemontest_post.c 22 * @file test_postform.c
23 * @brief Testcase for libmicrohttpd POST operations using multipart/postform data 23 * @brief Testcase for libmicrohttpd POST operations using multipart/postform data
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
@@ -45,6 +45,21 @@ struct CBC
45 size_t size; 45 size_t size;
46}; 46};
47 47
48
49static void
50completed_cb (void *cls,
51 struct MHD_Connection *connection,
52 void **con_cls,
53 enum MHD_RequestTerminationCode toe)
54{
55 struct MHD_PostProcessor *pp = *con_cls;
56
57 if (NULL != pp)
58 MHD_destroy_post_processor (pp);
59 *con_cls = NULL;
60}
61
62
48static size_t 63static size_t
49copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 64copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
50{ 65{
@@ -57,6 +72,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
57 return size * nmemb; 72 return size * nmemb;
58} 73}
59 74
75
60/** 76/**
61 * Note that this post_iterator is not perfect 77 * Note that this post_iterator is not perfect
62 * in that it fails to support incremental processing. 78 * in that it fails to support incremental processing.
@@ -85,6 +101,7 @@ post_iterator (void *cls,
85 return MHD_YES; 101 return MHD_YES;
86} 102}
87 103
104
88static int 105static int
89ahc_echo (void *cls, 106ahc_echo (void *cls,
90 struct MHD_Connection *connection, 107 struct MHD_Connection *connection,
@@ -157,7 +174,9 @@ testInternalPost ()
157 cbc.size = 2048; 174 cbc.size = 2048;
158 cbc.pos = 0; 175 cbc.pos = 0;
159 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 176 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
160 1080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 177 1080, NULL, NULL, &ahc_echo, NULL,
178 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
179 MHD_OPTION_END);
161 if (d == NULL) 180 if (d == NULL)
162 return 1; 181 return 1;
163 c = curl_easy_init (); 182 c = curl_easy_init ();
@@ -211,7 +230,9 @@ testMultithreadedPost ()
211 cbc.size = 2048; 230 cbc.size = 2048;
212 cbc.pos = 0; 231 cbc.pos = 0;
213 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 232 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG,
214 1081, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 233 1081, NULL, NULL, &ahc_echo, NULL,
234 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
235 MHD_OPTION_END);
215 if (d == NULL) 236 if (d == NULL)
216 return 16; 237 return 16;
217 c = curl_easy_init (); 238 c = curl_easy_init ();
@@ -266,7 +287,9 @@ testMultithreadedPoolPost ()
266 cbc.pos = 0; 287 cbc.pos = 0;
267 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 288 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG,
268 1081, NULL, NULL, &ahc_echo, NULL, 289 1081, NULL, NULL, &ahc_echo, NULL,
269 MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END); 290 MHD_OPTION_THREAD_POOL_SIZE, 4,
291 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
292 MHD_OPTION_END);
270 if (d == NULL) 293 if (d == NULL)
271 return 16; 294 return 16;
272 c = curl_easy_init (); 295 c = curl_easy_init ();
@@ -330,7 +353,9 @@ testExternalPost ()
330 cbc.size = 2048; 353 cbc.size = 2048;
331 cbc.pos = 0; 354 cbc.pos = 0;
332 d = MHD_start_daemon (MHD_USE_DEBUG, 355 d = MHD_start_daemon (MHD_USE_DEBUG,
333 1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 356 1082, NULL, NULL, &ahc_echo, NULL,
357 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
358 MHD_OPTION_END);
334 if (d == NULL) 359 if (d == NULL)
335 return 256; 360 return 256;
336 c = curl_easy_init (); 361 c = curl_easy_init ();