aboutsummaryrefslogtreecommitdiff
path: root/src/testzzuf/test_post_form.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testzzuf/test_post_form.c')
-rw-r--r--src/testzzuf/test_post_form.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c
index 873c7fef..34bc0114 100644
--- a/src/testzzuf/test_post_form.c
+++ b/src/testzzuf/test_post_form.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file daemontest_post.c 22 * @file test_post_form.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 */
@@ -48,6 +48,21 @@ struct CBC
48 size_t size; 48 size_t size;
49}; 49};
50 50
51
52static void
53completed_cb (void *cls,
54 struct MHD_Connection *connection,
55 void **con_cls,
56 enum MHD_RequestTerminationCode toe)
57{
58 struct MHD_PostProcessor *pp = *con_cls;
59
60 if (NULL != pp)
61 MHD_destroy_post_processor (pp);
62 *con_cls = NULL;
63}
64
65
51static size_t 66static size_t
52copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 67copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
53{ 68{
@@ -90,6 +105,7 @@ post_iterator (void *cls,
90 return MHD_YES; 105 return MHD_YES;
91} 106}
92 107
108
93static int 109static int
94ahc_echo (void *cls, 110ahc_echo (void *cls,
95 struct MHD_Connection *connection, 111 struct MHD_Connection *connection,
@@ -161,7 +177,9 @@ testInternalPost ()
161 cbc.size = 2048; 177 cbc.size = 2048;
162 cbc.pos = 0; 178 cbc.pos = 0;
163 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ , 179 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ ,
164 11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 180 11080, NULL, NULL, &ahc_echo, NULL,
181 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
182 MHD_OPTION_END);
165 if (d == NULL) 183 if (d == NULL)
166 return 1; 184 return 1;
167 zzuf_socat_start (); 185 zzuf_socat_start ();
@@ -195,6 +213,7 @@ testInternalPost ()
195 return 0; 213 return 0;
196} 214}
197 215
216
198static int 217static int
199testMultithreadedPost () 218testMultithreadedPost ()
200{ 219{
@@ -209,7 +228,9 @@ testMultithreadedPost ()
209 cbc.size = 2048; 228 cbc.size = 2048;
210 cbc.pos = 0; 229 cbc.pos = 0;
211 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ , 230 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ ,
212 11080, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 231 11080, NULL, NULL, &ahc_echo, NULL,
232 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
233 MHD_OPTION_END);
213 if (d == NULL) 234 if (d == NULL)
214 return 16; 235 return 16;
215 zzuf_socat_start (); 236 zzuf_socat_start ();
@@ -268,7 +289,9 @@ testExternalPost ()
268 cbc.size = 2048; 289 cbc.size = 2048;
269 cbc.pos = 0; 290 cbc.pos = 0;
270 d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_DEBUG */ , 291 d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_DEBUG */ ,
271 1082, NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 292 1082, NULL, NULL, &ahc_echo, NULL,
293 MHD_OPTION_NOTIFY_COMPLETED, &completed_cb, NULL,
294 MHD_OPTION_END);
272 if (d == NULL) 295 if (d == NULL)
273 return 256; 296 return 256;
274 multi = curl_multi_init (); 297 multi = curl_multi_init ();