aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/daemontest_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/daemontest_get.c')
-rw-r--r--src/daemon/daemontest_get.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/daemon/daemontest_get.c b/src/daemon/daemontest_get.c
index d3b6c5bc..d4030b06 100644
--- a/src/daemon/daemontest_get.c
+++ b/src/daemon/daemontest_get.c
@@ -125,18 +125,18 @@ static int testInternalGet() {
125 // crashes on my system! 125 // crashes on my system!
126 curl_easy_setopt(c, 126 curl_easy_setopt(c,
127 CURLOPT_NOSIGNAL, 127 CURLOPT_NOSIGNAL,
128 1); 128 1);
129 if (CURLE_OK != curl_easy_perform(c)) { 129 if (CURLE_OK != curl_easy_perform(c)) {
130 curl_easy_cleanup(c); 130 curl_easy_cleanup(c);
131 MHD_stop_daemon(d); 131 MHD_stop_daemon(d);
132 return 2; 132 return 2;
133 } 133 }
134 curl_easy_cleanup(c); 134 curl_easy_cleanup(c);
135 if (cbc.pos != strlen("/hello_world")) { 135 if (cbc.pos != strlen("/hello_world")) {
136 MHD_stop_daemon(d); 136 MHD_stop_daemon(d);
137 return 4; 137 return 4;
138 } 138 }
139 139
140 if (0 != strncmp("/hello_world", 140 if (0 != strncmp("/hello_world",
141 cbc.buf, 141 cbc.buf,
142 strlen("/hello_world"))) { 142 strlen("/hello_world"))) {
@@ -144,7 +144,7 @@ static int testInternalGet() {
144 return 8; 144 return 8;
145 } 145 }
146 MHD_stop_daemon(d); 146 MHD_stop_daemon(d);
147 147
148 return 0; 148 return 0;
149} 149}
150 150
@@ -189,16 +189,16 @@ static int testMultithreadedGet() {
189 // crashes on my system! 189 // crashes on my system!
190 curl_easy_setopt(c, 190 curl_easy_setopt(c,
191 CURLOPT_NOSIGNAL, 191 CURLOPT_NOSIGNAL,
192 1); 192 1);
193 if (CURLE_OK != curl_easy_perform(c)) { 193 if (CURLE_OK != curl_easy_perform(c)) {
194 MHD_stop_daemon(d); 194 MHD_stop_daemon(d);
195 return 32; 195 return 32;
196 } 196 }
197 curl_easy_cleanup(c); 197 curl_easy_cleanup(c);
198 if (cbc.pos != strlen("/hello_world")) { 198 if (cbc.pos != strlen("/hello_world")) {
199 MHD_stop_daemon(d); 199 MHD_stop_daemon(d);
200 return 64; 200 return 64;
201 } 201 }
202 if (0 != strncmp("/hello_world", 202 if (0 != strncmp("/hello_world",
203 cbc.buf, 203 cbc.buf,
204 strlen("/hello_world"))) { 204 strlen("/hello_world"))) {
@@ -206,7 +206,7 @@ static int testMultithreadedGet() {
206 return 128; 206 return 128;
207 } 207 }
208 MHD_stop_daemon(d); 208 MHD_stop_daemon(d);
209 209
210 return 0; 210 return 0;
211} 211}
212 212
@@ -263,20 +263,20 @@ static int testExternalGet() {
263 // crashes on my system! 263 // crashes on my system!
264 curl_easy_setopt(c, 264 curl_easy_setopt(c,
265 CURLOPT_NOSIGNAL, 265 CURLOPT_NOSIGNAL,
266 1); 266 1);
267 267
268 268
269 multi = curl_multi_init(); 269 multi = curl_multi_init();
270 if (multi == NULL) { 270 if (multi == NULL) {
271 curl_easy_cleanup(c); 271 curl_easy_cleanup(c);
272 MHD_stop_daemon(d); 272 MHD_stop_daemon(d);
273 return 512; 273 return 512;
274 } 274 }
275 mret = curl_multi_add_handle(multi, c); 275 mret = curl_multi_add_handle(multi, c);
276 if (mret != CURLM_OK) { 276 if (mret != CURLM_OK) {
277 curl_multi_cleanup(multi); 277 curl_multi_cleanup(multi);
278 curl_easy_cleanup(c); 278 curl_easy_cleanup(c);
279 MHD_stop_daemon(d); 279 MHD_stop_daemon(d);
280 return 1024; 280 return 1024;
281 } 281 }
282 start = time(NULL); 282 start = time(NULL);
@@ -295,9 +295,9 @@ static int testExternalGet() {
295 if (mret != CURLM_OK) { 295 if (mret != CURLM_OK) {
296 curl_multi_remove_handle(multi, c); 296 curl_multi_remove_handle(multi, c);
297 curl_multi_cleanup(multi); 297 curl_multi_cleanup(multi);
298 curl_easy_cleanup(c); 298 curl_easy_cleanup(c);
299 MHD_stop_daemon(d); 299 MHD_stop_daemon(d);
300 return 2048; 300 return 2048;
301 } 301 }
302 if (MHD_YES != MHD_get_fdset(d, 302 if (MHD_YES != MHD_get_fdset(d,
303 &rs, 303 &rs,
@@ -306,8 +306,8 @@ static int testExternalGet() {
306 &max)) { 306 &max)) {
307 curl_multi_remove_handle(multi, c); 307 curl_multi_remove_handle(multi, c);
308 curl_multi_cleanup(multi); 308 curl_multi_cleanup(multi);
309 curl_easy_cleanup(c); 309 curl_easy_cleanup(c);
310 MHD_stop_daemon(d); 310 MHD_stop_daemon(d);
311 return 4096; 311 return 4096;
312 } 312 }
313 tv.tv_sec = 0; 313 tv.tv_sec = 0;
@@ -316,7 +316,7 @@ static int testExternalGet() {
316 &rs, 316 &rs,
317 &ws, 317 &ws,
318 &es, 318 &es,
319 &tv); 319 &tv);
320 curl_multi_perform(multi, &running); 320 curl_multi_perform(multi, &running);
321 if (running == 0) { 321 if (running == 0) {
322 msg = curl_multi_info_read(multi, 322 msg = curl_multi_info_read(multi,
@@ -341,15 +341,15 @@ static int testExternalGet() {
341 } 341 }
342 if (multi != NULL) { 342 if (multi != NULL) {
343 curl_multi_remove_handle(multi, c); 343 curl_multi_remove_handle(multi, c);
344 curl_easy_cleanup(c); 344 curl_easy_cleanup(c);
345 curl_multi_cleanup(multi); 345 curl_multi_cleanup(multi);
346 } 346 }
347 MHD_stop_daemon(d); 347 MHD_stop_daemon(d);
348 if (cbc.pos != strlen("/hello_world")) 348 if (cbc.pos != strlen("/hello_world"))
349 return 8192; 349 return 8192;
350 if (0 != strncmp("/hello_world", 350 if (0 != strncmp("/hello_world",
351 cbc.buf, 351 cbc.buf,
352 strlen("/hello_world"))) 352 strlen("/hello_world")))
353 return 16384; 353 return 16384;
354 return 0; 354 return 0;
355} 355}
@@ -360,14 +360,14 @@ int main(int argc,
360 char * const * argv) { 360 char * const * argv) {
361 unsigned int errorCount = 0; 361 unsigned int errorCount = 0;
362 362
363 if (0 != curl_global_init(CURL_GLOBAL_WIN32)) 363 if (0 != curl_global_init(CURL_GLOBAL_WIN32))
364 return 2; 364 return 2;
365 errorCount += testInternalGet(); 365 errorCount += testInternalGet();
366 errorCount += testMultithreadedGet(); 366 errorCount += testMultithreadedGet();
367 errorCount += testExternalGet(); 367 errorCount += testExternalGet();
368 if (errorCount != 0) 368 if (errorCount != 0)
369 fprintf(stderr, 369 fprintf(stderr,
370 "Error (code: %u)\n", 370 "Error (code: %u)\n",
371 errorCount); 371 errorCount);
372 curl_global_cleanup(); 372 curl_global_cleanup();
373 return errorCount != 0; /* 0 == pass */ 373 return errorCount != 0; /* 0 == pass */