diff options
Diffstat (limited to 'src/daemon/daemontest_put.c')
-rw-r--r-- | src/daemon/daemontest_put.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/daemon/daemontest_put.c b/src/daemon/daemontest_put.c index 822f44a1..00538757 100644 --- a/src/daemon/daemontest_put.c +++ b/src/daemon/daemontest_put.c | |||
@@ -86,11 +86,11 @@ static int ahc_echo(void * cls, | |||
86 | struct MHD_Response * response; | 86 | struct MHD_Response * response; |
87 | int ret; | 87 | int ret; |
88 | 88 | ||
89 | if (0 != strcmp("PUT", method)) | 89 | if (0 != strcmp("PUT", method)) |
90 | return MHD_NO; /* unexpected method */ | 90 | return MHD_NO; /* unexpected method */ |
91 | if ((*done) == 0) { | 91 | if ((*done) == 0) { |
92 | if (*upload_data_size != 8) | 92 | if (*upload_data_size != 8) |
93 | return MHD_YES; /* not yet ready */ | 93 | return MHD_YES; /* not yet ready */ |
94 | if (0 == memcmp(upload_data, | 94 | if (0 == memcmp(upload_data, |
95 | "Hello123", | 95 | "Hello123", |
96 | 8)) { | 96 | 8)) { |
@@ -170,18 +170,18 @@ static int testInternalPut() { | |||
170 | // crashes on my system! | 170 | // crashes on my system! |
171 | curl_easy_setopt(c, | 171 | curl_easy_setopt(c, |
172 | CURLOPT_NOSIGNAL, | 172 | CURLOPT_NOSIGNAL, |
173 | 1); | 173 | 1); |
174 | if (CURLE_OK != curl_easy_perform(c)) { | 174 | if (CURLE_OK != curl_easy_perform(c)) { |
175 | curl_easy_cleanup(c); | 175 | curl_easy_cleanup(c); |
176 | MHD_stop_daemon(d); | 176 | MHD_stop_daemon(d); |
177 | return 2; | 177 | return 2; |
178 | } | 178 | } |
179 | curl_easy_cleanup(c); | 179 | curl_easy_cleanup(c); |
180 | if (cbc.pos != strlen("/hello_world")) { | 180 | if (cbc.pos != strlen("/hello_world")) { |
181 | MHD_stop_daemon(d); | 181 | MHD_stop_daemon(d); |
182 | return 4; | 182 | return 4; |
183 | } | 183 | } |
184 | 184 | ||
185 | if (0 != strncmp("/hello_world", | 185 | if (0 != strncmp("/hello_world", |
186 | cbc.buf, | 186 | cbc.buf, |
187 | strlen("/hello_world"))) { | 187 | strlen("/hello_world"))) { |
@@ -189,7 +189,7 @@ static int testInternalPut() { | |||
189 | return 8; | 189 | return 8; |
190 | } | 190 | } |
191 | MHD_stop_daemon(d); | 191 | MHD_stop_daemon(d); |
192 | 192 | ||
193 | return 0; | 193 | return 0; |
194 | } | 194 | } |
195 | 195 | ||
@@ -248,17 +248,17 @@ static int testMultithreadedPut() { | |||
248 | // crashes on my system! | 248 | // crashes on my system! |
249 | curl_easy_setopt(c, | 249 | curl_easy_setopt(c, |
250 | CURLOPT_NOSIGNAL, | 250 | CURLOPT_NOSIGNAL, |
251 | 1); | 251 | 1); |
252 | if (CURLE_OK != curl_easy_perform(c)) { | 252 | if (CURLE_OK != curl_easy_perform(c)) { |
253 | curl_easy_cleanup(c); | 253 | curl_easy_cleanup(c); |
254 | MHD_stop_daemon(d); | 254 | MHD_stop_daemon(d); |
255 | return 32; | 255 | return 32; |
256 | } | 256 | } |
257 | curl_easy_cleanup(c); | 257 | curl_easy_cleanup(c); |
258 | if (cbc.pos != strlen("/hello_world")) { | 258 | if (cbc.pos != strlen("/hello_world")) { |
259 | MHD_stop_daemon(d); | 259 | MHD_stop_daemon(d); |
260 | return 64; | 260 | return 64; |
261 | } | 261 | } |
262 | if (0 != strncmp("/hello_world", | 262 | if (0 != strncmp("/hello_world", |
263 | cbc.buf, | 263 | cbc.buf, |
264 | strlen("/hello_world"))) { | 264 | strlen("/hello_world"))) { |
@@ -266,7 +266,7 @@ static int testMultithreadedPut() { | |||
266 | return 128; | 266 | return 128; |
267 | } | 267 | } |
268 | MHD_stop_daemon(d); | 268 | MHD_stop_daemon(d); |
269 | 269 | ||
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | 272 | ||
@@ -337,20 +337,20 @@ static int testExternalPut() { | |||
337 | // crashes on my system! | 337 | // crashes on my system! |
338 | curl_easy_setopt(c, | 338 | curl_easy_setopt(c, |
339 | CURLOPT_NOSIGNAL, | 339 | CURLOPT_NOSIGNAL, |
340 | 1); | 340 | 1); |
341 | 341 | ||
342 | 342 | ||
343 | multi = curl_multi_init(); | 343 | multi = curl_multi_init(); |
344 | if (multi == NULL) { | 344 | if (multi == NULL) { |
345 | curl_easy_cleanup(c); | 345 | curl_easy_cleanup(c); |
346 | MHD_stop_daemon(d); | 346 | MHD_stop_daemon(d); |
347 | return 512; | 347 | return 512; |
348 | } | 348 | } |
349 | mret = curl_multi_add_handle(multi, c); | 349 | mret = curl_multi_add_handle(multi, c); |
350 | if (mret != CURLM_OK) { | 350 | if (mret != CURLM_OK) { |
351 | curl_multi_cleanup(multi); | 351 | curl_multi_cleanup(multi); |
352 | curl_easy_cleanup(c); | 352 | curl_easy_cleanup(c); |
353 | MHD_stop_daemon(d); | 353 | MHD_stop_daemon(d); |
354 | return 1024; | 354 | return 1024; |
355 | } | 355 | } |
356 | start = time(NULL); | 356 | start = time(NULL); |
@@ -369,9 +369,9 @@ static int testExternalPut() { | |||
369 | if (mret != CURLM_OK) { | 369 | if (mret != CURLM_OK) { |
370 | curl_multi_remove_handle(multi, c); | 370 | curl_multi_remove_handle(multi, c); |
371 | curl_multi_cleanup(multi); | 371 | curl_multi_cleanup(multi); |
372 | curl_easy_cleanup(c); | 372 | curl_easy_cleanup(c); |
373 | MHD_stop_daemon(d); | 373 | MHD_stop_daemon(d); |
374 | return 2048; | 374 | return 2048; |
375 | } | 375 | } |
376 | if (MHD_YES != MHD_get_fdset(d, | 376 | if (MHD_YES != MHD_get_fdset(d, |
377 | &rs, | 377 | &rs, |
@@ -380,8 +380,8 @@ static int testExternalPut() { | |||
380 | &max)) { | 380 | &max)) { |
381 | curl_multi_remove_handle(multi, c); | 381 | curl_multi_remove_handle(multi, c); |
382 | curl_multi_cleanup(multi); | 382 | curl_multi_cleanup(multi); |
383 | curl_easy_cleanup(c); | 383 | curl_easy_cleanup(c); |
384 | MHD_stop_daemon(d); | 384 | MHD_stop_daemon(d); |
385 | return 4096; | 385 | return 4096; |
386 | } | 386 | } |
387 | tv.tv_sec = 0; | 387 | tv.tv_sec = 0; |
@@ -390,7 +390,7 @@ static int testExternalPut() { | |||
390 | &rs, | 390 | &rs, |
391 | &ws, | 391 | &ws, |
392 | &es, | 392 | &es, |
393 | &tv); | 393 | &tv); |
394 | curl_multi_perform(multi, &running); | 394 | curl_multi_perform(multi, &running); |
395 | if (running == 0) { | 395 | if (running == 0) { |
396 | msg = curl_multi_info_read(multi, | 396 | msg = curl_multi_info_read(multi, |
@@ -415,15 +415,15 @@ static int testExternalPut() { | |||
415 | } | 415 | } |
416 | if (multi != NULL) { | 416 | if (multi != NULL) { |
417 | curl_multi_remove_handle(multi, c); | 417 | curl_multi_remove_handle(multi, c); |
418 | curl_easy_cleanup(c); | 418 | curl_easy_cleanup(c); |
419 | curl_multi_cleanup(multi); | 419 | curl_multi_cleanup(multi); |
420 | } | 420 | } |
421 | MHD_stop_daemon(d); | 421 | MHD_stop_daemon(d); |
422 | if (cbc.pos != strlen("/hello_world")) | 422 | if (cbc.pos != strlen("/hello_world")) |
423 | return 8192; | 423 | return 8192; |
424 | if (0 != strncmp("/hello_world", | 424 | if (0 != strncmp("/hello_world", |
425 | cbc.buf, | 425 | cbc.buf, |
426 | strlen("/hello_world"))) | 426 | strlen("/hello_world"))) |
427 | return 16384; | 427 | return 16384; |
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
@@ -434,14 +434,14 @@ int main(int argc, | |||
434 | char * const * argv) { | 434 | char * const * argv) { |
435 | unsigned int errorCount = 0; | 435 | unsigned int errorCount = 0; |
436 | 436 | ||
437 | if (0 != curl_global_init(CURL_GLOBAL_WIN32)) | 437 | if (0 != curl_global_init(CURL_GLOBAL_WIN32)) |
438 | return 2; | 438 | return 2; |
439 | errorCount += testInternalPut(); | 439 | errorCount += testInternalPut(); |
440 | errorCount += testMultithreadedPut(); | 440 | errorCount += testMultithreadedPut(); |
441 | errorCount += testExternalPut(); | 441 | errorCount += testExternalPut(); |
442 | if (errorCount != 0) | 442 | if (errorCount != 0) |
443 | fprintf(stderr, | 443 | fprintf(stderr, |
444 | "Error (code: %u)\n", | 444 | "Error (code: %u)\n", |
445 | errorCount); | 445 | errorCount); |
446 | curl_global_cleanup(); | 446 | curl_global_cleanup(); |
447 | return errorCount != 0; /* 0 == pass */ | 447 | return errorCount != 0; /* 0 == pass */ |