diff options
Diffstat (limited to 'src/testcurl')
-rw-r--r-- | src/testcurl/Makefile.am | 14 | ||||
-rw-r--r-- | src/testcurl/daemontest_get_sendfile.c | 463 | ||||
-rw-r--r-- | src/testcurl/https/mhds_get_test.c | 36 | ||||
-rw-r--r-- | src/testcurl/https/tls_daemon_options_test.c | 44 |
4 files changed, 513 insertions, 44 deletions
diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am index 1e9fe19d..c7124a19 100644 --- a/src/testcurl/Makefile.am +++ b/src/testcurl/Makefile.am | |||
@@ -16,6 +16,7 @@ $(LIBCURL_CPPFLAGS) | |||
16 | 16 | ||
17 | check_PROGRAMS = \ | 17 | check_PROGRAMS = \ |
18 | daemontest_get \ | 18 | daemontest_get \ |
19 | daemontest_get_sendfile \ | ||
19 | daemontest_post \ | 20 | daemontest_post \ |
20 | daemontest_postform \ | 21 | daemontest_postform \ |
21 | daemontest_post_loop \ | 22 | daemontest_post_loop \ |
@@ -25,6 +26,7 @@ check_PROGRAMS = \ | |||
25 | daemontest_parse_cookies \ | 26 | daemontest_parse_cookies \ |
26 | daemontest_large_put \ | 27 | daemontest_large_put \ |
27 | daemontest_get11 \ | 28 | daemontest_get11 \ |
29 | daemontest_get_sendfile11 \ | ||
28 | daemontest_post11 \ | 30 | daemontest_post11 \ |
29 | daemontest_postform11 \ | 31 | daemontest_postform11 \ |
30 | daemontest_post_loop11 \ | 32 | daemontest_post_loop11 \ |
@@ -57,6 +59,12 @@ daemontest_get_LDADD = \ | |||
57 | $(top_builddir)/src/daemon/libmicrohttpd.la \ | 59 | $(top_builddir)/src/daemon/libmicrohttpd.la \ |
58 | @LIBCURL@ | 60 | @LIBCURL@ |
59 | 61 | ||
62 | daemontest_get_sendfile_SOURCES = \ | ||
63 | daemontest_get_sendfile.c | ||
64 | daemontest_get_sendfile_LDADD = \ | ||
65 | $(top_builddir)/src/daemon/libmicrohttpd.la \ | ||
66 | @LIBCURL@ | ||
67 | |||
60 | daemontest_get_chunked_SOURCES = \ | 68 | daemontest_get_chunked_SOURCES = \ |
61 | daemontest_get_chunked.c | 69 | daemontest_get_chunked.c |
62 | daemontest_get_chunked_LDADD = \ | 70 | daemontest_get_chunked_LDADD = \ |
@@ -117,6 +125,12 @@ daemontest_get11_LDADD = \ | |||
117 | $(top_builddir)/src/daemon/libmicrohttpd.la \ | 125 | $(top_builddir)/src/daemon/libmicrohttpd.la \ |
118 | @LIBCURL@ | 126 | @LIBCURL@ |
119 | 127 | ||
128 | daemontest_get_sendfile11_SOURCES = \ | ||
129 | daemontest_get_sendfile.c | ||
130 | daemontest_get_sendfile11_LDADD = \ | ||
131 | $(top_builddir)/src/daemon/libmicrohttpd.la \ | ||
132 | @LIBCURL@ | ||
133 | |||
120 | daemontest_post11_SOURCES = \ | 134 | daemontest_post11_SOURCES = \ |
121 | daemontest_post.c | 135 | daemontest_post.c |
122 | daemontest_post11_LDADD = \ | 136 | daemontest_post11_LDADD = \ |
diff --git a/src/testcurl/daemontest_get_sendfile.c b/src/testcurl/daemontest_get_sendfile.c new file mode 100644 index 00000000..8116c3c9 --- /dev/null +++ b/src/testcurl/daemontest_get_sendfile.c | |||
@@ -0,0 +1,463 @@ | |||
1 | /* DO NOT CHANGE THIS LINE */ | ||
2 | /* | ||
3 | This file is part of libmicrohttpd | ||
4 | (C) 2007, 2009 Christian Grothoff | ||
5 | |||
6 | libmicrohttpd is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 2, or (at your | ||
9 | option) any later version. | ||
10 | |||
11 | libmicrohttpd is distributed in the hope that it will be useful, but | ||
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with libmicrohttpd; see the file COPYING. If not, write to the | ||
18 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | Boston, MA 02111-1307, USA. | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file daemontest_get_sendfile.c | ||
24 | * @brief Testcase for libmicrohttpd response from FD | ||
25 | * @author Christian Grothoff | ||
26 | */ | ||
27 | |||
28 | #include "MHD_config.h" | ||
29 | #include "platform.h" | ||
30 | #include <curl/curl.h> | ||
31 | #include <microhttpd.h> | ||
32 | #include <stdlib.h> | ||
33 | #include <string.h> | ||
34 | #include <time.h> | ||
35 | #include <sys/socket.h> | ||
36 | #include <sys/types.h> | ||
37 | #include <fcntl.h> | ||
38 | |||
39 | #ifndef WINDOWS | ||
40 | #include <unistd.h> | ||
41 | #endif | ||
42 | |||
43 | #define TESTSTR "/* DO NOT CHANGE THIS LINE */" | ||
44 | |||
45 | static int oneone; | ||
46 | |||
47 | struct CBC | ||
48 | { | ||
49 | char *buf; | ||
50 | size_t pos; | ||
51 | size_t size; | ||
52 | }; | ||
53 | |||
54 | static size_t | ||
55 | copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) | ||
56 | { | ||
57 | struct CBC *cbc = ctx; | ||
58 | |||
59 | if (cbc->pos + size * nmemb > cbc->size) | ||
60 | return 0; /* overflow */ | ||
61 | memcpy (&cbc->buf[cbc->pos], ptr, size * nmemb); | ||
62 | cbc->pos += size * nmemb; | ||
63 | return size * nmemb; | ||
64 | } | ||
65 | |||
66 | |||
67 | static int | ||
68 | ahc_echo (void *cls, | ||
69 | struct MHD_Connection *connection, | ||
70 | const char *url, | ||
71 | const char *method, | ||
72 | const char *version, | ||
73 | const char *upload_data, size_t *upload_data_size, | ||
74 | void **unused) | ||
75 | { | ||
76 | static int ptr; | ||
77 | const char *me = cls; | ||
78 | struct MHD_Response *response; | ||
79 | int ret; | ||
80 | int fd; | ||
81 | |||
82 | if (0 != strcmp (me, method)) | ||
83 | return MHD_NO; /* unexpected method */ | ||
84 | if (&ptr != *unused) | ||
85 | { | ||
86 | *unused = &ptr; | ||
87 | return MHD_YES; | ||
88 | } | ||
89 | *unused = NULL; | ||
90 | fd = open ("daemontest_get_sendfile.c", O_RDONLY); | ||
91 | if (fd == -1) | ||
92 | abort (); | ||
93 | response = MHD_create_response_from_fd (strlen (TESTSTR), fd); | ||
94 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | ||
95 | MHD_destroy_response (response); | ||
96 | if (ret == MHD_NO) | ||
97 | abort (); | ||
98 | return ret; | ||
99 | } | ||
100 | |||
101 | |||
102 | static int | ||
103 | testInternalGet () | ||
104 | { | ||
105 | struct MHD_Daemon *d; | ||
106 | CURL *c; | ||
107 | char buf[2048]; | ||
108 | struct CBC cbc; | ||
109 | CURLcode errornum; | ||
110 | |||
111 | cbc.buf = buf; | ||
112 | cbc.size = 2048; | ||
113 | cbc.pos = 0; | ||
114 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, | ||
115 | 11080, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | ||
116 | if (d == NULL) | ||
117 | return 1; | ||
118 | c = curl_easy_init (); | ||
119 | curl_easy_setopt (c, CURLOPT_URL, "http://localhost:11080/"); | ||
120 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | ||
121 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | ||
122 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); | ||
123 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); | ||
124 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); | ||
125 | if (oneone) | ||
126 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | ||
127 | else | ||
128 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | ||
129 | /* NOTE: use of CONNECTTIMEOUT without also | ||
130 | setting NOSIGNAL results in really weird | ||
131 | crashes on my system!*/ | ||
132 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | ||
133 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | ||
134 | { | ||
135 | fprintf (stderr, | ||
136 | "curl_easy_perform failed: `%s'\n", | ||
137 | curl_easy_strerror (errornum)); | ||
138 | curl_easy_cleanup (c); | ||
139 | MHD_stop_daemon (d); | ||
140 | return 2; | ||
141 | } | ||
142 | curl_easy_cleanup (c); | ||
143 | MHD_stop_daemon (d); | ||
144 | if (cbc.pos != strlen (TESTSTR)) | ||
145 | return 4; | ||
146 | if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) | ||
147 | return 8; | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static int | ||
152 | testMultithreadedGet () | ||
153 | { | ||
154 | struct MHD_Daemon *d; | ||
155 | CURL *c; | ||
156 | char buf[2048]; | ||
157 | struct CBC cbc; | ||
158 | CURLcode errornum; | ||
159 | |||
160 | cbc.buf = buf; | ||
161 | cbc.size = 2048; | ||
162 | cbc.pos = 0; | ||
163 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_DEBUG, | ||
164 | 1081, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | ||
165 | if (d == NULL) | ||
166 | return 16; | ||
167 | c = curl_easy_init (); | ||
168 | curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/"); | ||
169 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | ||
170 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | ||
171 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); | ||
172 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); | ||
173 | if (oneone) | ||
174 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | ||
175 | else | ||
176 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | ||
177 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); | ||
178 | /* NOTE: use of CONNECTTIMEOUT without also | ||
179 | setting NOSIGNAL results in really weird | ||
180 | crashes on my system! */ | ||
181 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | ||
182 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | ||
183 | { | ||
184 | fprintf (stderr, | ||
185 | "curl_easy_perform failed: `%s'\n", | ||
186 | curl_easy_strerror (errornum)); | ||
187 | curl_easy_cleanup (c); | ||
188 | MHD_stop_daemon (d); | ||
189 | return 32; | ||
190 | } | ||
191 | curl_easy_cleanup (c); | ||
192 | MHD_stop_daemon (d); | ||
193 | if (cbc.pos != strlen (TESTSTR)) | ||
194 | return 64; | ||
195 | if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) | ||
196 | return 128; | ||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static int | ||
201 | testMultithreadedPoolGet () | ||
202 | { | ||
203 | struct MHD_Daemon *d; | ||
204 | CURL *c; | ||
205 | char buf[2048]; | ||
206 | struct CBC cbc; | ||
207 | CURLcode errornum; | ||
208 | |||
209 | cbc.buf = buf; | ||
210 | cbc.size = 2048; | ||
211 | cbc.pos = 0; | ||
212 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, | ||
213 | 1081, NULL, NULL, &ahc_echo, "GET", | ||
214 | MHD_OPTION_THREAD_POOL_SIZE, 4, MHD_OPTION_END); | ||
215 | if (d == NULL) | ||
216 | return 16; | ||
217 | c = curl_easy_init (); | ||
218 | curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1081/"); | ||
219 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | ||
220 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | ||
221 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); | ||
222 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); | ||
223 | if (oneone) | ||
224 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | ||
225 | else | ||
226 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | ||
227 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); | ||
228 | /* NOTE: use of CONNECTTIMEOUT without also | ||
229 | setting NOSIGNAL results in really weird | ||
230 | crashes on my system!*/ | ||
231 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | ||
232 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | ||
233 | { | ||
234 | fprintf (stderr, | ||
235 | "curl_easy_perform failed: `%s'\n", | ||
236 | curl_easy_strerror (errornum)); | ||
237 | curl_easy_cleanup (c); | ||
238 | MHD_stop_daemon (d); | ||
239 | return 32; | ||
240 | } | ||
241 | curl_easy_cleanup (c); | ||
242 | MHD_stop_daemon (d); | ||
243 | if (cbc.pos != strlen (TESTSTR)) | ||
244 | return 64; | ||
245 | if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) | ||
246 | return 128; | ||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | static int | ||
251 | testExternalGet () | ||
252 | { | ||
253 | struct MHD_Daemon *d; | ||
254 | CURL *c; | ||
255 | char buf[2048]; | ||
256 | struct CBC cbc; | ||
257 | CURLM *multi; | ||
258 | CURLMcode mret; | ||
259 | fd_set rs; | ||
260 | fd_set ws; | ||
261 | fd_set es; | ||
262 | int max; | ||
263 | int running; | ||
264 | struct CURLMsg *msg; | ||
265 | time_t start; | ||
266 | struct timeval tv; | ||
267 | |||
268 | multi = NULL; | ||
269 | cbc.buf = buf; | ||
270 | cbc.size = 2048; | ||
271 | cbc.pos = 0; | ||
272 | d = MHD_start_daemon (MHD_USE_DEBUG, | ||
273 | 1082, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); | ||
274 | if (d == NULL) | ||
275 | return 256; | ||
276 | c = curl_easy_init (); | ||
277 | curl_easy_setopt (c, CURLOPT_URL, "http://localhost:1082/"); | ||
278 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | ||
279 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | ||
280 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); | ||
281 | if (oneone) | ||
282 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | ||
283 | else | ||
284 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | ||
285 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); | ||
286 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); | ||
287 | /* NOTE: use of CONNECTTIMEOUT without also | ||
288 | setting NOSIGNAL results in really weird | ||
289 | crashes on my system! */ | ||
290 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | ||
291 | |||
292 | |||
293 | multi = curl_multi_init (); | ||
294 | if (multi == NULL) | ||
295 | { | ||
296 | curl_easy_cleanup (c); | ||
297 | MHD_stop_daemon (d); | ||
298 | return 512; | ||
299 | } | ||
300 | mret = curl_multi_add_handle (multi, c); | ||
301 | if (mret != CURLM_OK) | ||
302 | { | ||
303 | curl_multi_cleanup (multi); | ||
304 | curl_easy_cleanup (c); | ||
305 | MHD_stop_daemon (d); | ||
306 | return 1024; | ||
307 | } | ||
308 | start = time (NULL); | ||
309 | while ((time (NULL) - start < 5) && (multi != NULL)) | ||
310 | { | ||
311 | max = 0; | ||
312 | FD_ZERO (&rs); | ||
313 | FD_ZERO (&ws); | ||
314 | FD_ZERO (&es); | ||
315 | curl_multi_perform (multi, &running); | ||
316 | mret = curl_multi_fdset (multi, &rs, &ws, &es, &max); | ||
317 | if (mret != CURLM_OK) | ||
318 | { | ||
319 | curl_multi_remove_handle (multi, c); | ||
320 | curl_multi_cleanup (multi); | ||
321 | curl_easy_cleanup (c); | ||
322 | MHD_stop_daemon (d); | ||
323 | return 2048; | ||
324 | } | ||
325 | if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) | ||
326 | { | ||
327 | curl_multi_remove_handle (multi, c); | ||
328 | curl_multi_cleanup (multi); | ||
329 | curl_easy_cleanup (c); | ||
330 | MHD_stop_daemon (d); | ||
331 | return 4096; | ||
332 | } | ||
333 | tv.tv_sec = 0; | ||
334 | tv.tv_usec = 1000; | ||
335 | select (max + 1, &rs, &ws, &es, &tv); | ||
336 | curl_multi_perform (multi, &running); | ||
337 | if (running == 0) | ||
338 | { | ||
339 | msg = curl_multi_info_read (multi, &running); | ||
340 | if (msg == NULL) | ||
341 | break; | ||
342 | if (msg->msg == CURLMSG_DONE) | ||
343 | { | ||
344 | if (msg->data.result != CURLE_OK) | ||
345 | printf ("%s failed at %s:%d: `%s'\n", | ||
346 | "curl_multi_perform", | ||
347 | __FILE__, | ||
348 | __LINE__, curl_easy_strerror (msg->data.result)); | ||
349 | curl_multi_remove_handle (multi, c); | ||
350 | curl_multi_cleanup (multi); | ||
351 | curl_easy_cleanup (c); | ||
352 | c = NULL; | ||
353 | multi = NULL; | ||
354 | } | ||
355 | } | ||
356 | MHD_run (d); | ||
357 | } | ||
358 | if (multi != NULL) | ||
359 | { | ||
360 | curl_multi_remove_handle (multi, c); | ||
361 | curl_easy_cleanup (c); | ||
362 | curl_multi_cleanup (multi); | ||
363 | } | ||
364 | MHD_stop_daemon (d); | ||
365 | if (cbc.pos != strlen (TESTSTR)) | ||
366 | return 8192; | ||
367 | if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) | ||
368 | return 16384; | ||
369 | return 0; | ||
370 | } | ||
371 | |||
372 | static int | ||
373 | testUnknownPortGet () | ||
374 | { | ||
375 | struct MHD_Daemon *d; | ||
376 | const union MHD_DaemonInfo *di; | ||
377 | CURL *c; | ||
378 | char buf[2048]; | ||
379 | struct CBC cbc; | ||
380 | CURLcode errornum; | ||
381 | |||
382 | struct sockaddr_in addr; | ||
383 | socklen_t addr_len = sizeof(addr); | ||
384 | memset(&addr, 0, sizeof(addr)); | ||
385 | addr.sin_family = AF_INET; | ||
386 | addr.sin_port = 0; | ||
387 | addr.sin_addr.s_addr = INADDR_ANY; | ||
388 | |||
389 | cbc.buf = buf; | ||
390 | cbc.size = 2048; | ||
391 | cbc.pos = 0; | ||
392 | d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG, | ||
393 | 1, NULL, NULL, &ahc_echo, "GET", | ||
394 | MHD_OPTION_SOCK_ADDR, &addr, | ||
395 | MHD_OPTION_END); | ||
396 | if (d == NULL) | ||
397 | return 32768; | ||
398 | |||
399 | di = MHD_get_daemon_info (d, MHD_DAEMON_INFO_LISTEN_FD); | ||
400 | if (di == NULL) | ||
401 | return 65536; | ||
402 | |||
403 | if (0 != getsockname(di->listen_fd, &addr, &addr_len)) | ||
404 | return 131072; | ||
405 | |||
406 | if (addr.sin_family != AF_INET) | ||
407 | return 26214; | ||
408 | |||
409 | snprintf(buf, sizeof(buf), "http://localhost:%hu/", | ||
410 | ntohs(addr.sin_port)); | ||
411 | |||
412 | c = curl_easy_init (); | ||
413 | curl_easy_setopt (c, CURLOPT_URL, buf); | ||
414 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | ||
415 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | ||
416 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); | ||
417 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 150L); | ||
418 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 15L); | ||
419 | if (oneone) | ||
420 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | ||
421 | else | ||
422 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | ||
423 | /* NOTE: use of CONNECTTIMEOUT without also | ||
424 | setting NOSIGNAL results in really weird | ||
425 | crashes on my system! */ | ||
426 | curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1); | ||
427 | if (CURLE_OK != (errornum = curl_easy_perform (c))) | ||
428 | { | ||
429 | fprintf (stderr, | ||
430 | "curl_easy_perform failed: `%s'\n", | ||
431 | curl_easy_strerror (errornum)); | ||
432 | curl_easy_cleanup (c); | ||
433 | MHD_stop_daemon (d); | ||
434 | return 524288; | ||
435 | } | ||
436 | curl_easy_cleanup (c); | ||
437 | MHD_stop_daemon (d); | ||
438 | if (cbc.pos != strlen (TESTSTR)) | ||
439 | return 1048576; | ||
440 | if (0 != strncmp (TESTSTR, cbc.buf, strlen (TESTSTR))) | ||
441 | return 2097152; | ||
442 | return 0; | ||
443 | } | ||
444 | |||
445 | |||
446 | int | ||
447 | main (int argc, char *const *argv) | ||
448 | { | ||
449 | unsigned int errorCount = 0; | ||
450 | |||
451 | oneone = NULL != strstr (argv[0], "11"); | ||
452 | if (0 != curl_global_init (CURL_GLOBAL_WIN32)) | ||
453 | return 2; | ||
454 | errorCount += testInternalGet (); | ||
455 | errorCount += testMultithreadedGet (); | ||
456 | errorCount += testMultithreadedPoolGet (); | ||
457 | errorCount += testExternalGet (); | ||
458 | errorCount += testUnknownPortGet (); | ||
459 | if (errorCount != 0) | ||
460 | fprintf (stderr, "Error (code: %u)\n", errorCount); | ||
461 | curl_global_cleanup (); | ||
462 | return errorCount != 0; /* 0 == pass */ | ||
463 | } | ||
diff --git a/src/testcurl/https/mhds_get_test.c b/src/testcurl/https/mhds_get_test.c index eef3f2b2..7fdf1a4e 100644 --- a/src/testcurl/https/mhds_get_test.c +++ b/src/testcurl/https/mhds_get_test.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Christian Grothoff | 3 | (C) 2007 Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 2, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | libmicrohttpd is distributed in the hope that it will be useful, but | 10 | libmicrohttpd is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with libmicrohttpd; see the file COPYING. If not, write to the | 16 | along with libmicrohttpd; see the file COPYING. If not, write to the |
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file mhds_get_test.c | 22 | * @file mhds_get_test.c |
diff --git a/src/testcurl/https/tls_daemon_options_test.c b/src/testcurl/https/tls_daemon_options_test.c index 2d859428..3e269122 100644 --- a/src/testcurl/https/tls_daemon_options_test.c +++ b/src/testcurl/https/tls_daemon_options_test.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Christian Grothoff | 3 | (C) 2007, 2010 Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 2, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | libmicrohttpd is distributed in the hope that it will be useful, but | 10 | libmicrohttpd is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with libmicrohttpd; see the file COPYING. If not, write to the | 16 | along with libmicrohttpd; see the file COPYING. If not, write to the |
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file tls_daemon_options_test.c | 22 | * @file tls_daemon_options_test.c |
@@ -103,7 +103,6 @@ main (int argc, char *const *argv) | |||
103 | fprintf (stderr, "Error: %s\n", strerror (errno)); | 103 | fprintf (stderr, "Error: %s\n", strerror (errno)); |
104 | return -1; | 104 | return -1; |
105 | } | 105 | } |
106 | #if 0 | ||
107 | errorCount += | 106 | errorCount += |
108 | test_wrap ("TLS1.0-AES-SHA1", | 107 | test_wrap ("TLS1.0-AES-SHA1", |
109 | &test_https_transfer, test_fd, daemon_flags, | 108 | &test_https_transfer, test_fd, daemon_flags, |
@@ -113,8 +112,6 @@ main (int argc, char *const *argv) | |||
113 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 112 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
114 | MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL", | 113 | MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL", |
115 | MHD_OPTION_END); | 114 | MHD_OPTION_END); |
116 | #endif | ||
117 | #if 0 | ||
118 | errorCount += | 115 | errorCount += |
119 | test_wrap ("TLS1.0-AES-SHA1", | 116 | test_wrap ("TLS1.0-AES-SHA1", |
120 | &test_https_transfer, test_fd, daemon_flags, | 117 | &test_https_transfer, test_fd, daemon_flags, |
@@ -134,8 +131,6 @@ main (int argc, char *const *argv) | |||
134 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 131 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
135 | MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-SSL3.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL", | 132 | MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-SSL3.0:+AES-128-CBC:+SHA1:+RSA:+COMP-NULL", |
136 | MHD_OPTION_END); | 133 | MHD_OPTION_END); |
137 | #endif | ||
138 | |||
139 | #if 0 | 134 | #if 0 |
140 | /* manual inspection of the handshake suggests that CURL will | 135 | /* manual inspection of the handshake suggests that CURL will |
141 | request TLSv1, we send back "SSL3" and CURL takes it *despite* | 136 | request TLSv1, we send back "SSL3" and CURL takes it *despite* |
@@ -152,7 +147,6 @@ main (int argc, char *const *argv) | |||
152 | MHD_OPTION_CIPHER_ALGORITHM, "SSL3", MHD_OPTION_END); | 147 | MHD_OPTION_CIPHER_ALGORITHM, "SSL3", MHD_OPTION_END); |
153 | #endif | 148 | #endif |
154 | 149 | ||
155 | #if 1 | ||
156 | errorCount += | 150 | errorCount += |
157 | test_wrap ("TLS1.0 vs SSL3", | 151 | test_wrap ("TLS1.0 vs SSL3", |
158 | &test_unmatching_ssl_version, test_fd, daemon_flags, | 152 | &test_unmatching_ssl_version, test_fd, daemon_flags, |
@@ -162,8 +156,6 @@ main (int argc, char *const *argv) | |||
162 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 156 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
163 | MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+AES-256-CBC:+SHA1:+RSA:+COMP-NULL", | 157 | MHD_OPTION_HTTPS_PRIORITIES, "NONE:+VERS-TLS1.0:+AES-256-CBC:+SHA1:+RSA:+COMP-NULL", |
164 | MHD_OPTION_END); | 158 | MHD_OPTION_END); |
165 | #endif | ||
166 | |||
167 | curl_global_cleanup (); | 159 | curl_global_cleanup (); |
168 | fclose (test_fd); | 160 | fclose (test_fd); |
169 | remove (TEST_FILE_NAME); | 161 | remove (TEST_FILE_NAME); |