aboutsummaryrefslogtreecommitdiff
path: root/src/testzzuf/daemontest_large_put.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testzzuf/daemontest_large_put.c')
-rw-r--r--src/testzzuf/daemontest_large_put.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/testzzuf/daemontest_large_put.c b/src/testzzuf/daemontest_large_put.c
index ecba637b..2a80bdb4 100644
--- a/src/testzzuf/daemontest_large_put.c
+++ b/src/testzzuf/daemontest_large_put.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file daemontest_put.c 22 * @file daemontest_large_put.c
23 * @brief Testcase for libmicrohttpd PUT operations 23 * @brief Testcase for libmicrohttpd PUT operations
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
@@ -54,7 +54,7 @@ static int oneone;
54 * MHD default buffer limit and the test code is not 54 * MHD default buffer limit and the test code is not
55 * written for incremental upload processing... 55 * written for incremental upload processing...
56 */ 56 */
57#define PUT_SIZE (512 * 1024) 57#define PUT_SIZE (256 * 1024)
58 58
59static char *put_buffer; 59static char *put_buffer;
60 60
@@ -123,7 +123,6 @@ ahc_echo (void *cls,
123 } 123 }
124 else 124 else
125 { 125 {
126 printf ("Invalid upload data!\n");
127 return MHD_NO; 126 return MHD_NO;
128 } 127 }
129 *done = 1; 128 *done = 1;
@@ -151,8 +150,8 @@ testInternalPut ()
151 cbc.buf = buf; 150 cbc.buf = buf;
152 cbc.size = 2048; 151 cbc.size = 2048;
153 cbc.pos = 0; 152 cbc.pos = 0;
154 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, 153 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY /* | MHD_USE_DEBUG */ ,
155 1080, 154 11080,
156 NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); 155 NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
157 if (d == NULL) 156 if (d == NULL)
158 return 1; 157 return 1;
@@ -162,7 +161,7 @@ testInternalPut ()
162 fprintf (stderr, "."); 161 fprintf (stderr, ".");
163 162
164 c = curl_easy_init (); 163 c = curl_easy_init ();
165 curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1080/hello_world"); 164 curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11081/hello_world");
166 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 165 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);
167 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); 166 curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc);
168 curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer); 167 curl_easy_setopt (c, CURLOPT_READFUNCTION, &putBuffer);
@@ -184,6 +183,7 @@ testInternalPut ()
184 curl_easy_cleanup (c); 183 curl_easy_cleanup (c);
185 } 184 }
186 fprintf (stderr, "\n"); 185 fprintf (stderr, "\n");
186 zzuf_socat_stop ();
187 MHD_stop_daemon (d); 187 MHD_stop_daemon (d);
188 return 0; 188 return 0;
189} 189}
@@ -202,14 +202,11 @@ testMultithreadedPut ()
202 cbc.buf = buf; 202 cbc.buf = buf;
203 cbc.size = 2048; 203 cbc.size = 2048;
204 cbc.pos = 0; 204 cbc.pos = 0;
205 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, 205 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION /* | MHD_USE_DEBUG */ ,
206 11080, 206 11080,
207 NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END); 207 NULL, NULL, &ahc_echo, &done_flag, MHD_OPTION_END);
208 if (d == NULL) 208 if (d == NULL)
209 { 209 return 16;
210 free (cbc.buf);
211 return 16;
212 }
213 zzuf_socat_start (); 210 zzuf_socat_start ();
214 for (i = 0; i < LOOP_COUNT; i++) 211 for (i = 0; i < LOOP_COUNT; i++)
215 { 212 {
@@ -268,7 +265,7 @@ testExternalPut ()
268 cbc.size = 2048; 265 cbc.size = 2048;
269 cbc.pos = 0; 266 cbc.pos = 0;
270 multi = NULL; 267 multi = NULL;
271 d = MHD_start_daemon (MHD_NO_FLAG | MHD_USE_DEBUG, 268 d = MHD_start_daemon (MHD_NO_FLAG /* | MHD_USE_DEBUG */ ,
272 11080, 269 11080,
273 NULL, NULL, &ahc_echo, &done_flag, 270 NULL, NULL, &ahc_echo, &done_flag,
274 MHD_OPTION_CONNECTION_MEMORY_LIMIT, 271 MHD_OPTION_CONNECTION_MEMORY_LIMIT,
@@ -278,7 +275,6 @@ testExternalPut ()
278 multi = curl_multi_init (); 275 multi = curl_multi_init ();
279 if (multi == NULL) 276 if (multi == NULL)
280 { 277 {
281 curl_easy_cleanup (c);
282 MHD_stop_daemon (d); 278 MHD_stop_daemon (d);
283 return 512; 279 return 512;
284 } 280 }
@@ -319,7 +315,7 @@ testExternalPut ()
319 return 1024; 315 return 1024;
320 } 316 }
321 start = time (NULL); 317 start = time (NULL);
322 while ((time (NULL) - start < 5) && (multi != NULL)) 318 while ((time (NULL) - start < 5) && (c != NULL))
323 { 319 {
324 max = 0; 320 max = 0;
325 FD_ZERO (&rs); 321 FD_ZERO (&rs);