diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-09-30 20:26:31 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-09-30 20:26:31 +0300 |
commit | 5b3cd84e62b430c34b5cf2cef20e49b11155a69d (patch) | |
tree | 5f61bb6d3bb9d5d6b51b0d5c6daf0be28c4f215a /src/testcurl | |
parent | adf9e8cec417d60fe7ae65dcff8e1cea961c6586 (diff) | |
download | libmicrohttpd-5b3cd84e62b430c34b5cf2cef20e49b11155a69d.tar.gz libmicrohttpd-5b3cd84e62b430c34b5cf2cef20e49b11155a69d.zip |
test_options: really use this test instead of just compiling,
moved to src/microhttpd as it does not depend on libcurl
Diffstat (limited to 'src/testcurl')
-rw-r--r-- | src/testcurl/Makefile.am | 8 | ||||
-rw-r--r-- | src/testcurl/test_options.c | 135 |
2 files changed, 0 insertions, 143 deletions
diff --git a/src/testcurl/Makefile.am b/src/testcurl/Makefile.am index 7d315d5b..10fae873 100644 --- a/src/testcurl/Makefile.am +++ b/src/testcurl/Makefile.am | |||
@@ -70,9 +70,6 @@ if HAVE_POSTPROCESSOR | |||
70 | test_post_loop11 | 70 | test_post_loop11 |
71 | endif | 71 | endif |
72 | 72 | ||
73 | noinst_PROGRAMS = \ | ||
74 | test_options | ||
75 | |||
76 | if ENABLE_DAUTH | 73 | if ENABLE_DAUTH |
77 | check_PROGRAMS += \ | 74 | check_PROGRAMS += \ |
78 | test_digestauth test_digestauth_with_arguments | 75 | test_digestauth test_digestauth_with_arguments |
@@ -99,11 +96,6 @@ test_concurrent_stop_LDADD = \ | |||
99 | $(top_builddir)/src/microhttpd/libmicrohttpd.la \ | 96 | $(top_builddir)/src/microhttpd/libmicrohttpd.la \ |
100 | $(PTHREAD_LIBS) @LIBCURL@ | 97 | $(PTHREAD_LIBS) @LIBCURL@ |
101 | 98 | ||
102 | test_options_SOURCES = \ | ||
103 | test_options.c | ||
104 | test_options_LDADD = \ | ||
105 | $(top_builddir)/src/microhttpd/libmicrohttpd.la | ||
106 | |||
107 | test_get_SOURCES = \ | 99 | test_get_SOURCES = \ |
108 | test_get.c | 100 | test_get.c |
109 | test_get_LDADD = \ | 101 | test_get_LDADD = \ |
diff --git a/src/testcurl/test_options.c b/src/testcurl/test_options.c deleted file mode 100644 index 3198c731..00000000 --- a/src/testcurl/test_options.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2007 Christian Grothoff | ||
4 | |||
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 | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | libmicrohttpd is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
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 | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file mhds_get_test.c | ||
23 | * @brief Testcase for libmicrohttpd HTTPS GET operations | ||
24 | * @author Sagie Amir | ||
25 | */ | ||
26 | |||
27 | #include "platform.h" | ||
28 | #include "microhttpd.h" | ||
29 | #include "mhd_sockets.h" | ||
30 | |||
31 | #define MHD_E_MEM "Error: memory error\n" | ||
32 | #define MHD_E_SERVER_INIT "Error: failed to start server\n" | ||
33 | |||
34 | const int DEBUG_GNUTLS_LOG_LEVEL = 0; | ||
35 | const char *test_file_name = "https_test_file"; | ||
36 | const char test_file_data[] = "Hello World\n"; | ||
37 | |||
38 | static int | ||
39 | ahc_echo (void *cls, | ||
40 | struct MHD_Connection *connection, | ||
41 | const char *url, | ||
42 | const char *method, | ||
43 | const char *version, | ||
44 | const char *upload_data, size_t *upload_data_size, | ||
45 | void **unused) | ||
46 | { | ||
47 | (void)cls; | ||
48 | (void)connection; | ||
49 | (void)url; | ||
50 | (void)method; | ||
51 | (void)version; | ||
52 | (void)upload_data; | ||
53 | (void)upload_data_size; | ||
54 | (void)unused; | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static int | ||
60 | test_wrap_loc (char *test_name, int (*test) (void)) | ||
61 | { | ||
62 | int ret; | ||
63 | |||
64 | fprintf (stdout, "running test: %s ", test_name); | ||
65 | ret = test (); | ||
66 | if (ret == 0) | ||
67 | { | ||
68 | fprintf (stdout, "[pass]\n"); | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | fprintf (stdout, "[fail]\n"); | ||
73 | } | ||
74 | return ret; | ||
75 | } | ||
76 | |||
77 | |||
78 | /** | ||
79 | * Test daemon initialization with the MHD_OPTION_SOCK_ADDR option | ||
80 | */ | ||
81 | static int | ||
82 | test_ip_addr_option () | ||
83 | { | ||
84 | struct MHD_Daemon *d; | ||
85 | struct sockaddr_in daemon_ip_addr; | ||
86 | #if HAVE_INET6 | ||
87 | struct sockaddr_in6 daemon_ip_addr6; | ||
88 | #endif | ||
89 | |||
90 | memset (&daemon_ip_addr, 0, sizeof (struct sockaddr_in)); | ||
91 | daemon_ip_addr.sin_family = AF_INET; | ||
92 | daemon_ip_addr.sin_port = 0; | ||
93 | daemon_ip_addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | ||
94 | |||
95 | #if HAVE_INET6 | ||
96 | memset (&daemon_ip_addr6, 0, sizeof (struct sockaddr_in6)); | ||
97 | daemon_ip_addr6.sin6_family = AF_INET6; | ||
98 | daemon_ip_addr6.sin6_port = 0; | ||
99 | daemon_ip_addr6.sin6_addr = in6addr_loopback; | ||
100 | #endif | ||
101 | |||
102 | d = MHD_start_daemon (MHD_USE_ERROR_LOG, 0, | ||
103 | NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, | ||
104 | &daemon_ip_addr, MHD_OPTION_END); | ||
105 | |||
106 | if (d == 0) | ||
107 | return -1; | ||
108 | |||
109 | MHD_stop_daemon (d); | ||
110 | |||
111 | #if HAVE_INET6 | ||
112 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 0, | ||
113 | NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR, | ||
114 | &daemon_ip_addr6, MHD_OPTION_END); | ||
115 | |||
116 | if (d == 0) | ||
117 | return -1; | ||
118 | |||
119 | MHD_stop_daemon (d); | ||
120 | #endif | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | /* setup a temporary transfer test file */ | ||
126 | int | ||
127 | main (int argc, char *const *argv) | ||
128 | { | ||
129 | unsigned int errorCount = 0; | ||
130 | (void)argc; (void)argv; /* Unused. Silent compiler warning. */ | ||
131 | |||
132 | errorCount += test_wrap_loc ("ip addr option", &test_ip_addr_option); | ||
133 | |||
134 | return errorCount != 0; | ||
135 | } | ||