aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/daemontest_post.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2007-06-16 07:33:00 +0000
committerChristian Grothoff <christian@grothoff.org>2007-06-16 07:33:00 +0000
commit05f894a55d9547c1bc08580d6a1b50bcc5a119f7 (patch)
tree2216421cb1ffb0df5efa944d3faabcc481163774 /src/daemon/daemontest_post.c
parent463188499e46a7cb8e8eace837403331cde79109 (diff)
downloadlibmicrohttpd-05f894a55d9547c1bc08580d6a1b50bcc5a119f7.tar.gz
libmicrohttpd-05f894a55d9547c1bc08580d6a1b50bcc5a119f7.zip
removing whitespace
Diffstat (limited to 'src/daemon/daemontest_post.c')
-rw-r--r--src/daemon/daemontest_post.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/daemon/daemontest_post.c b/src/daemon/daemontest_post.c
index 5e46bac3..c74a3a02 100644
--- a/src/daemon/daemontest_post.c
+++ b/src/daemon/daemontest_post.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file daemontest_post.c 22 * @file daemontest_post.c
23 * @brief Testcase for libmicrohttpd POST operations 23 * @brief Testcase for libmicrohttpd POST operations
24 * TODO: use curl_formadd to produce POST data and 24 * TODO: use curl_formadd to produce POST data and
25 * add that to the CURL operation; then check 25 * add that to the CURL operation; then check
26 * on the server side if the headers arrive 26 * on the server side if the headers arrive
27 * nicely (need to implement parsing POST data 27 * nicely (need to implement parsing POST data
@@ -137,18 +137,18 @@ static int testInternalPost() {
137 // crashes on my system! 137 // crashes on my system!
138 curl_easy_setopt(c, 138 curl_easy_setopt(c,
139 CURLOPT_NOSIGNAL, 139 CURLOPT_NOSIGNAL,
140 1); 140 1);
141 if (CURLE_OK != curl_easy_perform(c)) { 141 if (CURLE_OK != curl_easy_perform(c)) {
142 curl_easy_cleanup(c); 142 curl_easy_cleanup(c);
143 MHD_stop_daemon(d); 143 MHD_stop_daemon(d);
144 return 2; 144 return 2;
145 } 145 }
146 curl_easy_cleanup(c); 146 curl_easy_cleanup(c);
147 if (cbc.pos != strlen("/hello_world")) { 147 if (cbc.pos != strlen("/hello_world")) {
148 MHD_stop_daemon(d); 148 MHD_stop_daemon(d);
149 return 4; 149 return 4;
150 } 150 }
151 151
152 if (0 != strncmp("/hello_world", 152 if (0 != strncmp("/hello_world",
153 cbc.buf, 153 cbc.buf,
154 strlen("/hello_world"))) { 154 strlen("/hello_world"))) {
@@ -156,7 +156,7 @@ static int testInternalPost() {
156 return 8; 156 return 8;
157 } 157 }
158 MHD_stop_daemon(d); 158 MHD_stop_daemon(d);
159 159
160 return 0; 160 return 0;
161} 161}
162 162
@@ -207,17 +207,17 @@ static int testMultithreadedPost() {
207 // crashes on my system! 207 // crashes on my system!
208 curl_easy_setopt(c, 208 curl_easy_setopt(c,
209 CURLOPT_NOSIGNAL, 209 CURLOPT_NOSIGNAL,
210 1); 210 1);
211 if (CURLE_OK != curl_easy_perform(c)) { 211 if (CURLE_OK != curl_easy_perform(c)) {
212 curl_easy_cleanup(c); 212 curl_easy_cleanup(c);
213 MHD_stop_daemon(d); 213 MHD_stop_daemon(d);
214 return 32; 214 return 32;
215 } 215 }
216 curl_easy_cleanup(c); 216 curl_easy_cleanup(c);
217 if (cbc.pos != strlen("/hello_world")) { 217 if (cbc.pos != strlen("/hello_world")) {
218 MHD_stop_daemon(d); 218 MHD_stop_daemon(d);
219 return 64; 219 return 64;
220 } 220 }
221 if (0 != strncmp("/hello_world", 221 if (0 != strncmp("/hello_world",
222 cbc.buf, 222 cbc.buf,
223 strlen("/hello_world"))) { 223 strlen("/hello_world"))) {
@@ -225,7 +225,7 @@ static int testMultithreadedPost() {
225 return 128; 225 return 128;
226 } 226 }
227 MHD_stop_daemon(d); 227 MHD_stop_daemon(d);
228 228
229 return 0; 229 return 0;
230} 230}
231 231
@@ -288,20 +288,20 @@ static int testExternalPost() {
288 // crashes on my system! 288 // crashes on my system!
289 curl_easy_setopt(c, 289 curl_easy_setopt(c,
290 CURLOPT_NOSIGNAL, 290 CURLOPT_NOSIGNAL,
291 1); 291 1);
292 292
293 293
294 multi = curl_multi_init(); 294 multi = curl_multi_init();
295 if (multi == NULL) { 295 if (multi == NULL) {
296 curl_easy_cleanup(c); 296 curl_easy_cleanup(c);
297 MHD_stop_daemon(d); 297 MHD_stop_daemon(d);
298 return 512; 298 return 512;
299 } 299 }
300 mret = curl_multi_add_handle(multi, c); 300 mret = curl_multi_add_handle(multi, c);
301 if (mret != CURLM_OK) { 301 if (mret != CURLM_OK) {
302 curl_multi_cleanup(multi); 302 curl_multi_cleanup(multi);
303 curl_easy_cleanup(c); 303 curl_easy_cleanup(c);
304 MHD_stop_daemon(d); 304 MHD_stop_daemon(d);
305 return 1024; 305 return 1024;
306 } 306 }
307 start = time(NULL); 307 start = time(NULL);
@@ -320,9 +320,9 @@ static int testExternalPost() {
320 if (mret != CURLM_OK) { 320 if (mret != CURLM_OK) {
321 curl_multi_remove_handle(multi, c); 321 curl_multi_remove_handle(multi, c);
322 curl_multi_cleanup(multi); 322 curl_multi_cleanup(multi);
323 curl_easy_cleanup(c); 323 curl_easy_cleanup(c);
324 MHD_stop_daemon(d); 324 MHD_stop_daemon(d);
325 return 2048; 325 return 2048;
326 } 326 }
327 if (MHD_YES != MHD_get_fdset(d, 327 if (MHD_YES != MHD_get_fdset(d,
328 &rs, 328 &rs,
@@ -331,8 +331,8 @@ static int testExternalPost() {
331 &max)) { 331 &max)) {
332 curl_multi_remove_handle(multi, c); 332 curl_multi_remove_handle(multi, c);
333 curl_multi_cleanup(multi); 333 curl_multi_cleanup(multi);
334 curl_easy_cleanup(c); 334 curl_easy_cleanup(c);
335 MHD_stop_daemon(d); 335 MHD_stop_daemon(d);
336 return 4096; 336 return 4096;
337 } 337 }
338 tv.tv_sec = 0; 338 tv.tv_sec = 0;
@@ -341,7 +341,7 @@ static int testExternalPost() {
341 &rs, 341 &rs,
342 &ws, 342 &ws,
343 &es, 343 &es,
344 &tv); 344 &tv);
345 curl_multi_perform(multi, &running); 345 curl_multi_perform(multi, &running);
346 if (running == 0) { 346 if (running == 0) {
347 msg = curl_multi_info_read(multi, 347 msg = curl_multi_info_read(multi,
@@ -366,15 +366,15 @@ static int testExternalPost() {
366 } 366 }
367 if (multi != NULL) { 367 if (multi != NULL) {
368 curl_multi_remove_handle(multi, c); 368 curl_multi_remove_handle(multi, c);
369 curl_easy_cleanup(c); 369 curl_easy_cleanup(c);
370 curl_multi_cleanup(multi); 370 curl_multi_cleanup(multi);
371 } 371 }
372 MHD_stop_daemon(d); 372 MHD_stop_daemon(d);
373 if (cbc.pos != strlen("/hello_world")) 373 if (cbc.pos != strlen("/hello_world"))
374 return 8192; 374 return 8192;
375 if (0 != strncmp("/hello_world", 375 if (0 != strncmp("/hello_world",
376 cbc.buf, 376 cbc.buf,
377 strlen("/hello_world"))) 377 strlen("/hello_world")))
378 return 16384; 378 return 16384;
379 return 0; 379 return 0;
380} 380}
@@ -385,14 +385,14 @@ int main(int argc,
385 char * const * argv) { 385 char * const * argv) {
386 unsigned int errorCount = 0; 386 unsigned int errorCount = 0;
387 387
388 if (0 != curl_global_init(CURL_GLOBAL_WIN32)) 388 if (0 != curl_global_init(CURL_GLOBAL_WIN32))
389 return 2; 389 return 2;
390 errorCount += testInternalPost(); 390 errorCount += testInternalPost();
391 errorCount += testMultithreadedPost(); 391 errorCount += testMultithreadedPost();
392 errorCount += testExternalPost(); 392 errorCount += testExternalPost();
393 if (errorCount != 0) 393 if (errorCount != 0)
394 fprintf(stderr, 394 fprintf(stderr,
395 "Error (code: %u)\n", 395 "Error (code: %u)\n",
396 errorCount); 396 errorCount);
397 curl_global_cleanup(); 397 curl_global_cleanup();
398 return errorCount != 0; /* 0 == pass */ 398 return errorCount != 0; /* 0 == pass */