diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-25 20:33:19 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-06-25 20:33:19 +0300 |
commit | 9d1596d3108ff237dbe368942296a0f6fbba47f8 (patch) | |
tree | bb6ac83244c81ce1e4063cbe4c35b15d13e01b39 /src | |
parent | a7b7a32ec6dd493e00573da4b2f343f02feb0aa7 (diff) | |
download | libmicrohttpd-9d1596d3108ff237dbe368942296a0f6fbba47f8.tar.gz libmicrohttpd-9d1596d3108ff237dbe368942296a0f6fbba47f8.zip |
Make testsuite parallel build compatible (part 2)
Diffstat (limited to 'src')
-rw-r--r-- | src/testcurl/https/test_empty_response.c | 19 | ||||
-rw-r--r-- | src/testcurl/https/test_https_get.c | 36 | ||||
-rw-r--r-- | src/testcurl/https/test_https_get_parallel.c | 24 | ||||
-rw-r--r-- | src/testcurl/https/test_https_get_parallel_threads.c | 20 | ||||
-rw-r--r-- | src/testcurl/https/test_https_get_select.c | 19 | ||||
-rw-r--r-- | src/testcurl/https/test_https_multi_daemon.c | 40 | ||||
-rw-r--r-- | src/testcurl/https/test_https_session_info.c | 25 | ||||
-rw-r--r-- | src/testcurl/https/test_https_sni.c | 30 | ||||
-rw-r--r-- | src/testcurl/https/test_https_time_out.c | 21 | ||||
-rw-r--r-- | src/testcurl/https/test_tls_authentication.c | 18 | ||||
-rw-r--r-- | src/testcurl/https/test_tls_extensions.c | 32 | ||||
-rw-r--r-- | src/testcurl/https/test_tls_options.c | 14 | ||||
-rw-r--r-- | src/testcurl/https/tls_test_common.c | 34 | ||||
-rw-r--r-- | src/testcurl/https/tls_test_common.h | 12 | ||||
-rw-r--r-- | src/testcurl/test_options.c | 6 |
15 files changed, 271 insertions, 79 deletions
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c index 44ca08a4..70baf832 100644 --- a/src/testcurl/https/test_empty_response.c +++ b/src/testcurl/https/test_empty_response.c | |||
@@ -77,19 +77,33 @@ testInternalSelectGet () | |||
77 | struct CURLMsg *msg; | 77 | struct CURLMsg *msg; |
78 | time_t start; | 78 | time_t start; |
79 | struct timeval tv; | 79 | struct timeval tv; |
80 | int port; | ||
81 | |||
82 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
83 | port = 0; | ||
84 | else | ||
85 | port = 3000; | ||
80 | 86 | ||
81 | multi = NULL; | 87 | multi = NULL; |
82 | cbc.buf = buf; | 88 | cbc.buf = buf; |
83 | cbc.size = 2048; | 89 | cbc.size = 2048; |
84 | cbc.pos = 0; | 90 | cbc.pos = 0; |
85 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | MHD_USE_INTERNAL_POLLING_THREAD, | 91 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | MHD_USE_INTERNAL_POLLING_THREAD, |
86 | 1082, NULL, NULL, &ahc_echo, "GET", | 92 | port, NULL, NULL, &ahc_echo, "GET", |
87 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 93 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
88 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 94 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
89 | MHD_OPTION_END); | 95 | MHD_OPTION_END); |
90 | if (d == NULL) | 96 | if (d == NULL) |
91 | return 256; | 97 | return 256; |
92 | 98 | ||
99 | if (0 == port) | ||
100 | { | ||
101 | const union MHD_DaemonInfo *dinfo; | ||
102 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
103 | if (NULL == dinfo || 0 == dinfo->port) | ||
104 | { MHD_stop_daemon (d); return 32; } | ||
105 | port = (int)dinfo->port; | ||
106 | } | ||
93 | char *aes256_sha = "AES256-SHA"; | 107 | char *aes256_sha = "AES256-SHA"; |
94 | if (curl_uses_nss_ssl() == 0) | 108 | if (curl_uses_nss_ssl() == 0) |
95 | { | 109 | { |
@@ -97,7 +111,8 @@ testInternalSelectGet () | |||
97 | } | 111 | } |
98 | 112 | ||
99 | c = curl_easy_init (); | 113 | c = curl_easy_init (); |
100 | curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1:1082/hello_world"); | 114 | curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1/hello_world"); |
115 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | ||
101 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 116 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
102 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 117 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
103 | /* TLS options */ | 118 | /* TLS options */ |
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c index b8cfacbe..dfbf5dbc 100644 --- a/src/testcurl/https/test_https_get.c +++ b/src/testcurl/https/test_https_get.c | |||
@@ -47,9 +47,15 @@ test_cipher_option (FILE * test_fd, | |||
47 | { | 47 | { |
48 | int ret; | 48 | int ret; |
49 | struct MHD_Daemon *d; | 49 | struct MHD_Daemon *d; |
50 | int port; | ||
51 | |||
52 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
53 | port = 0; | ||
54 | else | ||
55 | port = 3040; | ||
50 | 56 | ||
51 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 57 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
52 | MHD_USE_ERROR_LOG, 4233, | 58 | MHD_USE_ERROR_LOG, port, |
53 | NULL, NULL, &http_ahc, NULL, | 59 | NULL, NULL, &http_ahc, NULL, |
54 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 60 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
55 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 61 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
@@ -60,8 +66,16 @@ test_cipher_option (FILE * test_fd, | |||
60 | fprintf (stderr, MHD_E_SERVER_INIT); | 66 | fprintf (stderr, MHD_E_SERVER_INIT); |
61 | return -1; | 67 | return -1; |
62 | } | 68 | } |
69 | if (0 == port) | ||
70 | { | ||
71 | const union MHD_DaemonInfo *dinfo; | ||
72 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
73 | if (NULL == dinfo || 0 == dinfo->port) | ||
74 | { MHD_stop_daemon (d); return -1; } | ||
75 | port = (int)dinfo->port; | ||
76 | } | ||
63 | 77 | ||
64 | ret = test_https_transfer (test_fd, cipher_suite, proto_version); | 78 | ret = test_https_transfer (test_fd, port, cipher_suite, proto_version); |
65 | 79 | ||
66 | MHD_stop_daemon (d); | 80 | MHD_stop_daemon (d); |
67 | return ret; | 81 | return ret; |
@@ -76,9 +90,15 @@ test_secure_get (FILE * test_fd, | |||
76 | { | 90 | { |
77 | int ret; | 91 | int ret; |
78 | struct MHD_Daemon *d; | 92 | struct MHD_Daemon *d; |
93 | int port; | ||
94 | |||
95 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
96 | port = 0; | ||
97 | else | ||
98 | port = 3041; | ||
79 | 99 | ||
80 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 100 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
81 | MHD_USE_ERROR_LOG, 4233, | 101 | MHD_USE_ERROR_LOG, port, |
82 | NULL, NULL, &http_ahc, NULL, | 102 | NULL, NULL, &http_ahc, NULL, |
83 | MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, | 103 | MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, |
84 | MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, | 104 | MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, |
@@ -89,8 +109,16 @@ test_secure_get (FILE * test_fd, | |||
89 | fprintf (stderr, MHD_E_SERVER_INIT); | 109 | fprintf (stderr, MHD_E_SERVER_INIT); |
90 | return -1; | 110 | return -1; |
91 | } | 111 | } |
112 | if (0 == port) | ||
113 | { | ||
114 | const union MHD_DaemonInfo *dinfo; | ||
115 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
116 | if (NULL == dinfo || 0 == dinfo->port) | ||
117 | { MHD_stop_daemon (d); return -1; } | ||
118 | port = (int)dinfo->port; | ||
119 | } | ||
92 | 120 | ||
93 | ret = test_https_transfer (test_fd, cipher_suite, proto_version); | 121 | ret = test_https_transfer (test_fd, port, cipher_suite, proto_version); |
94 | 122 | ||
95 | MHD_stop_daemon (d); | 123 | MHD_stop_daemon (d); |
96 | return ret; | 124 | return ret; |
diff --git a/src/testcurl/https/test_https_get_parallel.c b/src/testcurl/https/test_https_get_parallel.c index 96529c43..89fd6a05 100644 --- a/src/testcurl/https/test_https_get_parallel.c +++ b/src/testcurl/https/test_https_get_parallel.c | |||
@@ -62,7 +62,7 @@ https_transfer_thread_adapter (void *args) | |||
62 | 62 | ||
63 | /* time spread incomming requests */ | 63 | /* time spread incomming requests */ |
64 | usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX)); | 64 | usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX)); |
65 | ret = test_https_transfer (NULL, | 65 | ret = test_https_transfer (NULL, cargs->port, |
66 | cargs->cipher_suite, cargs->proto_version); | 66 | cargs->cipher_suite, cargs->proto_version); |
67 | if (ret == 0) | 67 | if (ret == 0) |
68 | return NULL; | 68 | return NULL; |
@@ -78,12 +78,12 @@ https_transfer_thread_adapter (void *args) | |||
78 | * TODO : make client_count a parameter - number of curl client threads to spawn | 78 | * TODO : make client_count a parameter - number of curl client threads to spawn |
79 | */ | 79 | */ |
80 | static int | 80 | static int |
81 | test_single_client (void *cls, const char *cipher_suite, | 81 | test_single_client (void *cls, int port, const char *cipher_suite, |
82 | int curl_proto_version) | 82 | int curl_proto_version) |
83 | { | 83 | { |
84 | void *client_thread_ret; | 84 | void *client_thread_ret; |
85 | struct https_test_data client_args = | 85 | struct https_test_data client_args = |
86 | { NULL, cipher_suite, curl_proto_version }; | 86 | { NULL, port, cipher_suite, curl_proto_version }; |
87 | 87 | ||
88 | client_thread_ret = https_transfer_thread_adapter (&client_args); | 88 | client_thread_ret = https_transfer_thread_adapter (&client_args); |
89 | if (client_thread_ret != NULL) | 89 | if (client_thread_ret != NULL) |
@@ -100,7 +100,7 @@ test_single_client (void *cls, const char *cipher_suite, | |||
100 | * TODO : make client_count a parameter - numver of curl client threads to spawn | 100 | * TODO : make client_count a parameter - numver of curl client threads to spawn |
101 | */ | 101 | */ |
102 | static int | 102 | static int |
103 | test_parallel_clients (void * cls, const char *cipher_suite, | 103 | test_parallel_clients (void * cls, int port, const char *cipher_suite, |
104 | int curl_proto_version) | 104 | int curl_proto_version) |
105 | { | 105 | { |
106 | int i; | 106 | int i; |
@@ -108,7 +108,7 @@ test_parallel_clients (void * cls, const char *cipher_suite, | |||
108 | void *client_thread_ret; | 108 | void *client_thread_ret; |
109 | pthread_t client_arr[client_count]; | 109 | pthread_t client_arr[client_count]; |
110 | struct https_test_data client_args = | 110 | struct https_test_data client_args = |
111 | { NULL, cipher_suite, curl_proto_version }; | 111 | { NULL, port, cipher_suite, curl_proto_version }; |
112 | 112 | ||
113 | for (i = 0; i < client_count; ++i) | 113 | for (i = 0; i < client_count; ++i) |
114 | { | 114 | { |
@@ -137,6 +137,12 @@ main (int argc, char *const *argv) | |||
137 | { | 137 | { |
138 | unsigned int errorCount = 0; | 138 | unsigned int errorCount = 0; |
139 | const char *aes256_sha = "AES256-SHA"; | 139 | const char *aes256_sha = "AES256-SHA"; |
140 | int port; | ||
141 | |||
142 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
143 | port = 0; | ||
144 | else | ||
145 | port = 3020; | ||
140 | 146 | ||
141 | /* initialize random seed used by curl clients */ | 147 | /* initialize random seed used by curl clients */ |
142 | unsigned int iseed = (unsigned int) time (NULL); | 148 | unsigned int iseed = (unsigned int) time (NULL); |
@@ -157,7 +163,7 @@ main (int argc, char *const *argv) | |||
157 | #ifdef EPOLL_SUPPORT | 163 | #ifdef EPOLL_SUPPORT |
158 | errorCount += | 164 | errorCount += |
159 | test_wrap ("single threaded daemon, single client, epoll", &test_single_client, | 165 | test_wrap ("single threaded daemon, single client, epoll", &test_single_client, |
160 | NULL, | 166 | NULL, port, |
161 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, | 167 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, |
162 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, | 168 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, |
163 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, | 169 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, |
@@ -165,7 +171,7 @@ main (int argc, char *const *argv) | |||
165 | #endif | 171 | #endif |
166 | errorCount += | 172 | errorCount += |
167 | test_wrap ("single threaded daemon, single client", &test_single_client, | 173 | test_wrap ("single threaded daemon, single client", &test_single_client, |
168 | NULL, | 174 | NULL, port, |
169 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, | 175 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, |
170 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, | 176 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, |
171 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, | 177 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, |
@@ -173,7 +179,7 @@ main (int argc, char *const *argv) | |||
173 | #ifdef EPOLL_SUPPORT | 179 | #ifdef EPOLL_SUPPORT |
174 | errorCount += | 180 | errorCount += |
175 | test_wrap ("single threaded daemon, parallel clients, epoll", | 181 | test_wrap ("single threaded daemon, parallel clients, epoll", |
176 | &test_parallel_clients, NULL, | 182 | &test_parallel_clients, NULL, port, |
177 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, | 183 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_EPOLL, |
178 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, | 184 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, |
179 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, | 185 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, |
@@ -181,7 +187,7 @@ main (int argc, char *const *argv) | |||
181 | #endif | 187 | #endif |
182 | errorCount += | 188 | errorCount += |
183 | test_wrap ("single threaded daemon, parallel clients", | 189 | test_wrap ("single threaded daemon, parallel clients", |
184 | &test_parallel_clients, NULL, | 190 | &test_parallel_clients, NULL, port, |
185 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, | 191 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, |
186 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, | 192 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, |
187 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, | 193 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, |
diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c index 862b9512..f577edd9 100644 --- a/src/testcurl/https/test_https_get_parallel_threads.c +++ b/src/testcurl/https/test_https_get_parallel_threads.c | |||
@@ -63,7 +63,7 @@ https_transfer_thread_adapter (void *args) | |||
63 | 63 | ||
64 | /* time spread incomming requests */ | 64 | /* time spread incomming requests */ |
65 | usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX)); | 65 | usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX)); |
66 | ret = test_https_transfer (cargs->cls, | 66 | ret = test_https_transfer (cargs->cls, cargs->port, |
67 | cargs->cipher_suite, cargs->proto_version); | 67 | cargs->cipher_suite, cargs->proto_version); |
68 | if (ret == 0) | 68 | if (ret == 0) |
69 | return NULL; | 69 | return NULL; |
@@ -78,12 +78,12 @@ https_transfer_thread_adapter (void *args) | |||
78 | * TODO : make client_count a parameter - numver of curl client threads to spawn | 78 | * TODO : make client_count a parameter - numver of curl client threads to spawn |
79 | */ | 79 | */ |
80 | static int | 80 | static int |
81 | test_single_client (void *cls, const char *cipher_suite, | 81 | test_single_client (void *cls, int port, const char *cipher_suite, |
82 | int curl_proto_version) | 82 | int curl_proto_version) |
83 | { | 83 | { |
84 | void *client_thread_ret; | 84 | void *client_thread_ret; |
85 | struct https_test_data client_args = | 85 | struct https_test_data client_args = |
86 | { NULL, cipher_suite, curl_proto_version }; | 86 | { NULL, port, cipher_suite, curl_proto_version }; |
87 | 87 | ||
88 | client_thread_ret = https_transfer_thread_adapter (&client_args); | 88 | client_thread_ret = https_transfer_thread_adapter (&client_args); |
89 | if (client_thread_ret != NULL) | 89 | if (client_thread_ret != NULL) |
@@ -100,7 +100,7 @@ test_single_client (void *cls, const char *cipher_suite, | |||
100 | * TODO : make client_count a parameter - numver of curl client threads to spawn | 100 | * TODO : make client_count a parameter - numver of curl client threads to spawn |
101 | */ | 101 | */ |
102 | static int | 102 | static int |
103 | test_parallel_clients (void *cls, const char *cipher_suite, | 103 | test_parallel_clients (void *cls, int port, const char *cipher_suite, |
104 | int curl_proto_version) | 104 | int curl_proto_version) |
105 | { | 105 | { |
106 | int i; | 106 | int i; |
@@ -108,7 +108,7 @@ test_parallel_clients (void *cls, const char *cipher_suite, | |||
108 | void *client_thread_ret; | 108 | void *client_thread_ret; |
109 | pthread_t client_arr[client_count]; | 109 | pthread_t client_arr[client_count]; |
110 | struct https_test_data client_args = | 110 | struct https_test_data client_args = |
111 | { NULL, cipher_suite, curl_proto_version }; | 111 | { NULL, port, cipher_suite, curl_proto_version }; |
112 | 112 | ||
113 | for (i = 0; i < client_count; ++i) | 113 | for (i = 0; i < client_count; ++i) |
114 | { | 114 | { |
@@ -138,6 +138,12 @@ main (int argc, char *const *argv) | |||
138 | { | 138 | { |
139 | unsigned int errorCount = 0; | 139 | unsigned int errorCount = 0; |
140 | const char *ssl_version; | 140 | const char *ssl_version; |
141 | int port; | ||
142 | |||
143 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
144 | port = 0; | ||
145 | else | ||
146 | port = 3010; | ||
141 | 147 | ||
142 | /* initialize random seed used by curl clients */ | 148 | /* initialize random seed used by curl clients */ |
143 | unsigned int iseed = (unsigned int) time (NULL); | 149 | unsigned int iseed = (unsigned int) time (NULL); |
@@ -175,7 +181,7 @@ main (int argc, char *const *argv) | |||
175 | 181 | ||
176 | errorCount += | 182 | errorCount += |
177 | test_wrap ("multi threaded daemon, single client", &test_single_client, | 183 | test_wrap ("multi threaded daemon, single client", &test_single_client, |
178 | NULL, | 184 | NULL, port, |
179 | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, | 185 | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, |
180 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, | 186 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, |
181 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, | 187 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, |
@@ -183,7 +189,7 @@ main (int argc, char *const *argv) | |||
183 | 189 | ||
184 | errorCount += | 190 | errorCount += |
185 | test_wrap ("multi threaded daemon, parallel client", | 191 | test_wrap ("multi threaded daemon, parallel client", |
186 | &test_parallel_clients, NULL, | 192 | &test_parallel_clients, NULL, port, |
187 | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, | 193 | MHD_USE_TLS | MHD_USE_ERROR_LOG | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD, |
188 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, | 194 | aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, |
189 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, | 195 | srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, |
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c index d3191b8d..df19396e 100644 --- a/src/testcurl/https/test_https_get_select.c +++ b/src/testcurl/https/test_https_get_select.c | |||
@@ -97,24 +97,39 @@ testExternalGet (int flags) | |||
97 | time_t start; | 97 | time_t start; |
98 | struct timeval tv; | 98 | struct timeval tv; |
99 | const char *aes256_sha = "AES256-SHA"; | 99 | const char *aes256_sha = "AES256-SHA"; |
100 | int port; | ||
101 | |||
102 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
103 | port = 0; | ||
104 | else | ||
105 | port = 3030; | ||
100 | 106 | ||
101 | multi = NULL; | 107 | multi = NULL; |
102 | cbc.buf = buf; | 108 | cbc.buf = buf; |
103 | cbc.size = 2048; | 109 | cbc.size = 2048; |
104 | cbc.pos = 0; | 110 | cbc.pos = 0; |
105 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | flags, | 111 | d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_TLS | flags, |
106 | 1082, NULL, NULL, &ahc_echo, "GET", | 112 | port, NULL, NULL, &ahc_echo, "GET", |
107 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 113 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
108 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 114 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
109 | MHD_OPTION_END); | 115 | MHD_OPTION_END); |
110 | if (d == NULL) | 116 | if (d == NULL) |
111 | return 256; | 117 | return 256; |
118 | if (0 == port) | ||
119 | { | ||
120 | const union MHD_DaemonInfo *dinfo; | ||
121 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
122 | if (NULL == dinfo || 0 == dinfo->port) | ||
123 | { MHD_stop_daemon (d); return 32; } | ||
124 | port = (int)dinfo->port; | ||
125 | } | ||
112 | 126 | ||
113 | if (curl_uses_nss_ssl() == 0) | 127 | if (curl_uses_nss_ssl() == 0) |
114 | aes256_sha = "rsa_aes_256_sha"; | 128 | aes256_sha = "rsa_aes_256_sha"; |
115 | 129 | ||
116 | c = curl_easy_init (); | 130 | c = curl_easy_init (); |
117 | curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1:1082/hello_world"); | 131 | curl_easy_setopt (c, CURLOPT_URL, "https://127.0.0.1/hello_world"); |
132 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | ||
118 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); | 133 | curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer); |
119 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); | 134 | curl_easy_setopt (c, CURLOPT_WRITEDATA, &cbc); |
120 | /* TLS options */ | 135 | /* TLS options */ |
diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c index 99b1bfd4..b1c61ba3 100644 --- a/src/testcurl/https/test_https_multi_daemon.c +++ b/src/testcurl/https/test_https_multi_daemon.c | |||
@@ -47,13 +47,21 @@ test_concurent_daemon_pair (void *cls, | |||
47 | const char *cipher_suite, | 47 | const char *cipher_suite, |
48 | int proto_version) | 48 | int proto_version) |
49 | { | 49 | { |
50 | |||
51 | int ret; | 50 | int ret; |
52 | struct MHD_Daemon *d1; | 51 | struct MHD_Daemon *d1; |
53 | struct MHD_Daemon *d2; | 52 | struct MHD_Daemon *d2; |
53 | int port1, port2; | ||
54 | |||
55 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
56 | port1 = port2 = 0; | ||
57 | else | ||
58 | { | ||
59 | port1 = 3050; | ||
60 | port2 = 3051; | ||
61 | } | ||
54 | 62 | ||
55 | d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 63 | d1 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
56 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, | 64 | MHD_USE_ERROR_LOG, port1, |
57 | NULL, NULL, &http_ahc, NULL, | 65 | NULL, NULL, &http_ahc, NULL, |
58 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 66 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
59 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 67 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
@@ -64,9 +72,17 @@ test_concurent_daemon_pair (void *cls, | |||
64 | fprintf (stderr, MHD_E_SERVER_INIT); | 72 | fprintf (stderr, MHD_E_SERVER_INIT); |
65 | return -1; | 73 | return -1; |
66 | } | 74 | } |
75 | if (0 == port1) | ||
76 | { | ||
77 | const union MHD_DaemonInfo *dinfo; | ||
78 | dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT); | ||
79 | if (NULL == dinfo || 0 == dinfo->port) | ||
80 | { MHD_stop_daemon (d1); return -1; } | ||
81 | port1 = (int)dinfo->port; | ||
82 | } | ||
67 | 83 | ||
68 | d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 84 | d2 = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
69 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT + 1, | 85 | MHD_USE_ERROR_LOG, port2, |
70 | NULL, NULL, &http_ahc, NULL, | 86 | NULL, NULL, &http_ahc, NULL, |
71 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 87 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
72 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 88 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
@@ -78,16 +94,28 @@ test_concurent_daemon_pair (void *cls, | |||
78 | fprintf (stderr, MHD_E_SERVER_INIT); | 94 | fprintf (stderr, MHD_E_SERVER_INIT); |
79 | return -1; | 95 | return -1; |
80 | } | 96 | } |
97 | if (0 == port2) | ||
98 | { | ||
99 | const union MHD_DaemonInfo *dinfo; | ||
100 | dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT); | ||
101 | if (NULL == dinfo || 0 == dinfo->port) | ||
102 | { | ||
103 | MHD_stop_daemon (d1); | ||
104 | MHD_stop_daemon (d2); | ||
105 | return -1; | ||
106 | } | ||
107 | port2 = (int)dinfo->port; | ||
108 | } | ||
81 | 109 | ||
82 | ret = | 110 | ret = |
83 | test_daemon_get (NULL, cipher_suite, proto_version, DEAMON_TEST_PORT, 0); | 111 | test_daemon_get (NULL, cipher_suite, proto_version, port1, 0); |
84 | ret += | 112 | ret += |
85 | test_daemon_get (NULL, cipher_suite, proto_version, | 113 | test_daemon_get (NULL, cipher_suite, proto_version, |
86 | DEAMON_TEST_PORT + 1, 0); | 114 | port2, 0); |
87 | 115 | ||
88 | MHD_stop_daemon (d2); | 116 | MHD_stop_daemon (d2); |
89 | ret += | 117 | ret += |
90 | test_daemon_get (NULL, cipher_suite, proto_version, DEAMON_TEST_PORT, 0); | 118 | test_daemon_get (NULL, cipher_suite, proto_version, port1, 0); |
91 | MHD_stop_daemon (d1); | 119 | MHD_stop_daemon (d1); |
92 | return ret; | 120 | return ret; |
93 | } | 121 | } |
diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c index fe2d0724..eb821240 100644 --- a/src/testcurl/https/test_https_session_info.c +++ b/src/testcurl/https/test_https_session_info.c | |||
@@ -100,17 +100,21 @@ test_query_session () | |||
100 | struct CBC cbc; | 100 | struct CBC cbc; |
101 | CURLcode errornum; | 101 | CURLcode errornum; |
102 | char url[256]; | 102 | char url[256]; |
103 | int port; | ||
104 | |||
105 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
106 | port = 0; | ||
107 | else | ||
108 | port = 3060; | ||
103 | 109 | ||
104 | if (NULL == (cbc.buf = malloc (sizeof (char) * 255))) | 110 | if (NULL == (cbc.buf = malloc (sizeof (char) * 255))) |
105 | return 16; | 111 | return 16; |
106 | cbc.size = 255; | 112 | cbc.size = 255; |
107 | cbc.pos = 0; | 113 | cbc.pos = 0; |
108 | 114 | ||
109 | gen_test_file_url (url, DEAMON_TEST_PORT); | ||
110 | |||
111 | /* setup test */ | 115 | /* setup test */ |
112 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 116 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
113 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, | 117 | MHD_USE_ERROR_LOG, port, |
114 | NULL, NULL, &query_session_ahc, NULL, | 118 | NULL, NULL, &query_session_ahc, NULL, |
115 | MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", | 119 | MHD_OPTION_HTTPS_PRIORITIES, "NORMAL:+ARCFOUR-128", |
116 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 120 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
@@ -122,6 +126,14 @@ test_query_session () | |||
122 | free (cbc.buf); | 126 | free (cbc.buf); |
123 | return 2; | 127 | return 2; |
124 | } | 128 | } |
129 | if (0 == port) | ||
130 | { | ||
131 | const union MHD_DaemonInfo *dinfo; | ||
132 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
133 | if (NULL == dinfo || 0 == dinfo->port) | ||
134 | { MHD_stop_daemon (d); return 32; } | ||
135 | port = (int)dinfo->port; | ||
136 | } | ||
125 | 137 | ||
126 | const char *aes256_sha = "AES256-SHA"; | 138 | const char *aes256_sha = "AES256-SHA"; |
127 | if (curl_uses_nss_ssl() == 0) | 139 | if (curl_uses_nss_ssl() == 0) |
@@ -129,6 +141,7 @@ test_query_session () | |||
129 | aes256_sha = "rsa_aes_256_sha"; | 141 | aes256_sha = "rsa_aes_256_sha"; |
130 | } | 142 | } |
131 | 143 | ||
144 | gen_test_file_url (url, port); | ||
132 | c = curl_easy_init (); | 145 | c = curl_easy_init (); |
133 | #if DEBUG_HTTPS_TEST | 146 | #if DEBUG_HTTPS_TEST |
134 | curl_easy_setopt (c, CURLOPT_VERBOSE, 1); | 147 | curl_easy_setopt (c, CURLOPT_VERBOSE, 1); |
@@ -172,6 +185,7 @@ test_query_session () | |||
172 | int | 185 | int |
173 | main (int argc, char *const *argv) | 186 | main (int argc, char *const *argv) |
174 | { | 187 | { |
188 | #if LIBCURL_VERSION_NUM >= 0x072200 | ||
175 | unsigned int errorCount = 0; | 189 | unsigned int errorCount = 0; |
176 | const char *ssl_version; | 190 | const char *ssl_version; |
177 | 191 | ||
@@ -200,10 +214,11 @@ main (int argc, char *const *argv) | |||
200 | curl_global_cleanup (); | 214 | curl_global_cleanup (); |
201 | return 77; | 215 | return 77; |
202 | } | 216 | } |
203 | #if LIBCURL_VERSION_NUM >= 0x072200 | ||
204 | errorCount += test_query_session (); | 217 | errorCount += test_query_session (); |
205 | #endif | ||
206 | print_test_result (errorCount, argv[0]); | 218 | print_test_result (errorCount, argv[0]); |
207 | curl_global_cleanup (); | 219 | curl_global_cleanup (); |
208 | return errorCount != 0 ? 1 : 0; | 220 | return errorCount != 0 ? 1 : 0; |
221 | #else /* LIBCURL_VERSION_NUM < 0x072200 */ | ||
222 | return 77; | ||
223 | #endif /* LIBCURL_VERSION_NUM < 0x072200 */ | ||
209 | } | 224 | } |
diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c index 71805ba8..6c1da540 100644 --- a/src/testcurl/https/test_https_sni.c +++ b/src/testcurl/https/test_https_sni.c | |||
@@ -180,13 +180,14 @@ sni_callback (gnutls_session_t session, | |||
180 | 180 | ||
181 | /* perform a HTTP GET request via SSL/TLS */ | 181 | /* perform a HTTP GET request via SSL/TLS */ |
182 | static int | 182 | static int |
183 | do_get (const char *url) | 183 | do_get (const char *url, int port) |
184 | { | 184 | { |
185 | CURL *c; | 185 | CURL *c; |
186 | struct CBC cbc; | 186 | struct CBC cbc; |
187 | CURLcode errornum; | 187 | CURLcode errornum; |
188 | size_t len; | 188 | size_t len; |
189 | struct curl_slist *dns_info; | 189 | struct curl_slist *dns_info; |
190 | char buf[256]; | ||
190 | 191 | ||
191 | len = strlen (test_data); | 192 | len = strlen (test_data); |
192 | if (NULL == (cbc.buf = malloc (sizeof (char) * len))) | 193 | if (NULL == (cbc.buf = malloc (sizeof (char) * len))) |
@@ -202,6 +203,7 @@ do_get (const char *url) | |||
202 | curl_easy_setopt (c, CURLOPT_VERBOSE, 1); | 203 | curl_easy_setopt (c, CURLOPT_VERBOSE, 1); |
203 | #endif | 204 | #endif |
204 | curl_easy_setopt (c, CURLOPT_URL, url); | 205 | curl_easy_setopt (c, CURLOPT_URL, url); |
206 | curl_easy_setopt (c, CURLOPT_PORT, (long)port); | ||
205 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); | 207 | curl_easy_setopt (c, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
206 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 10L); | 208 | curl_easy_setopt (c, CURLOPT_TIMEOUT, 10L); |
207 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 10L); | 209 | curl_easy_setopt (c, CURLOPT_CONNECTTIMEOUT, 10L); |
@@ -212,8 +214,10 @@ do_get (const char *url) | |||
212 | /* TODO merge into send_curl_req */ | 214 | /* TODO merge into send_curl_req */ |
213 | curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); | 215 | curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0); |
214 | curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 2); | 216 | curl_easy_setopt (c, CURLOPT_SSL_VERIFYHOST, 2); |
215 | dns_info = curl_slist_append (NULL, "host1:4233:127.0.0.1"); | 217 | sprintf(buf, "host1:%d:127.0.0.1", port); |
216 | dns_info = curl_slist_append (dns_info, "host2:4233:127.0.0.1"); | 218 | dns_info = curl_slist_append (NULL, buf); |
219 | sprintf(buf, "host2:%d:127.0.0.1", port); | ||
220 | dns_info = curl_slist_append (dns_info, buf); | ||
217 | curl_easy_setopt (c, CURLOPT_RESOLVE, dns_info); | 221 | curl_easy_setopt (c, CURLOPT_RESOLVE, dns_info); |
218 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); | 222 | curl_easy_setopt (c, CURLOPT_FAILONERROR, 1); |
219 | 223 | ||
@@ -250,6 +254,12 @@ main (int argc, char *const *argv) | |||
250 | { | 254 | { |
251 | unsigned int error_count = 0; | 255 | unsigned int error_count = 0; |
252 | struct MHD_Daemon *d; | 256 | struct MHD_Daemon *d; |
257 | int port; | ||
258 | |||
259 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
260 | port = 0; | ||
261 | else | ||
262 | port = 3060; | ||
253 | 263 | ||
254 | #ifdef MHD_HTTPS_REQUIRE_GRYPT | 264 | #ifdef MHD_HTTPS_REQUIRE_GRYPT |
255 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); | 265 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); |
@@ -272,7 +282,7 @@ main (int argc, char *const *argv) | |||
272 | load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key"); | 282 | load_keys ("host1", ABS_SRCDIR "/host1.crt", ABS_SRCDIR "/host1.key"); |
273 | load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key"); | 283 | load_keys ("host2", ABS_SRCDIR "/host2.crt", ABS_SRCDIR "/host2.key"); |
274 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, | 284 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG, |
275 | 4233, | 285 | port, |
276 | NULL, NULL, | 286 | NULL, NULL, |
277 | &http_ahc, NULL, | 287 | &http_ahc, NULL, |
278 | MHD_OPTION_HTTPS_CERT_CALLBACK, &sni_callback, | 288 | MHD_OPTION_HTTPS_CERT_CALLBACK, &sni_callback, |
@@ -282,9 +292,17 @@ main (int argc, char *const *argv) | |||
282 | fprintf (stderr, MHD_E_SERVER_INIT); | 292 | fprintf (stderr, MHD_E_SERVER_INIT); |
283 | return -1; | 293 | return -1; |
284 | } | 294 | } |
285 | if (0 != do_get ("https://host1:4233/")) | 295 | if (0 == port) |
296 | { | ||
297 | const union MHD_DaemonInfo *dinfo; | ||
298 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
299 | if (NULL == dinfo || 0 == dinfo->port) | ||
300 | { MHD_stop_daemon (d); return -1; } | ||
301 | port = (int)dinfo->port; | ||
302 | } | ||
303 | if (0 != do_get ("https://host1/", port)) | ||
286 | error_count++; | 304 | error_count++; |
287 | if (0 != do_get ("https://host2:4233/")) | 305 | if (0 != do_get ("https://host2/", port)) |
288 | error_count++; | 306 | error_count++; |
289 | 307 | ||
290 | MHD_stop_daemon (d); | 308 | MHD_stop_daemon (d); |
diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c index a1908e49..4330334b 100644 --- a/src/testcurl/https/test_https_time_out.c +++ b/src/testcurl/https/test_https_time_out.c | |||
@@ -47,7 +47,7 @@ extern const char srv_self_signed_cert_pem[]; | |||
47 | static const int TIME_OUT = 3; | 47 | static const int TIME_OUT = 3; |
48 | 48 | ||
49 | static int | 49 | static int |
50 | test_tls_session_time_out (gnutls_session_t session) | 50 | test_tls_session_time_out (gnutls_session_t session, int port) |
51 | { | 51 | { |
52 | int ret; | 52 | int ret; |
53 | MHD_socket sd; | 53 | MHD_socket sd; |
@@ -62,7 +62,7 @@ test_tls_session_time_out (gnutls_session_t session) | |||
62 | 62 | ||
63 | memset (&sa, '\0', sizeof (struct sockaddr_in)); | 63 | memset (&sa, '\0', sizeof (struct sockaddr_in)); |
64 | sa.sin_family = AF_INET; | 64 | sa.sin_family = AF_INET; |
65 | sa.sin_port = htons (DEAMON_TEST_PORT); | 65 | sa.sin_port = htons (port); |
66 | sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 66 | sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
67 | 67 | ||
68 | gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) (intptr_t) sd); | 68 | gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) (intptr_t) sd); |
@@ -109,7 +109,12 @@ main (int argc, char *const *argv) | |||
109 | gnutls_datum_t key; | 109 | gnutls_datum_t key; |
110 | gnutls_datum_t cert; | 110 | gnutls_datum_t cert; |
111 | gnutls_certificate_credentials_t xcred; | 111 | gnutls_certificate_credentials_t xcred; |
112 | int port; | ||
112 | 113 | ||
114 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
115 | port = 0; | ||
116 | else | ||
117 | port = 3070; | ||
113 | 118 | ||
114 | #ifdef MHD_HTTPS_REQUIRE_GRYPT | 119 | #ifdef MHD_HTTPS_REQUIRE_GRYPT |
115 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); | 120 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); |
@@ -121,7 +126,7 @@ main (int argc, char *const *argv) | |||
121 | gnutls_global_set_log_level (11); | 126 | gnutls_global_set_log_level (11); |
122 | 127 | ||
123 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 128 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
124 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, | 129 | MHD_USE_ERROR_LOG, port, |
125 | NULL, NULL, &http_dummy_ahc, NULL, | 130 | NULL, NULL, &http_dummy_ahc, NULL, |
126 | MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT, | 131 | MHD_OPTION_CONNECTION_TIMEOUT, TIME_OUT, |
127 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 132 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
@@ -133,13 +138,21 @@ main (int argc, char *const *argv) | |||
133 | fprintf (stderr, MHD_E_SERVER_INIT); | 138 | fprintf (stderr, MHD_E_SERVER_INIT); |
134 | return -1; | 139 | return -1; |
135 | } | 140 | } |
141 | if (0 == port) | ||
142 | { | ||
143 | const union MHD_DaemonInfo *dinfo; | ||
144 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
145 | if (NULL == dinfo || 0 == dinfo->port) | ||
146 | { MHD_stop_daemon (d); return -1; } | ||
147 | port = (int)dinfo->port; | ||
148 | } | ||
136 | 149 | ||
137 | if (0 != setup_session (&session, &key, &cert, &xcred)) | 150 | if (0 != setup_session (&session, &key, &cert, &xcred)) |
138 | { | 151 | { |
139 | fprintf (stderr, "failed to setup session\n"); | 152 | fprintf (stderr, "failed to setup session\n"); |
140 | return 1; | 153 | return 1; |
141 | } | 154 | } |
142 | errorCount += test_tls_session_time_out (session); | 155 | errorCount += test_tls_session_time_out (session, port); |
143 | teardown_session (session, &key, &cert, xcred); | 156 | teardown_session (session, &key, &cert, xcred); |
144 | 157 | ||
145 | print_test_result (errorCount, argv[0]); | 158 | print_test_result (errorCount, argv[0]); |
diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c index 20576a61..e3bc2626 100644 --- a/src/testcurl/https/test_tls_authentication.c +++ b/src/testcurl/https/test_tls_authentication.c | |||
@@ -50,9 +50,15 @@ test_secure_get (void * cls, char *cipher_suite, int proto_version) | |||
50 | { | 50 | { |
51 | int ret; | 51 | int ret; |
52 | struct MHD_Daemon *d; | 52 | struct MHD_Daemon *d; |
53 | int port; | ||
54 | |||
55 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
56 | port = 0; | ||
57 | else | ||
58 | port = 3070; | ||
53 | 59 | ||
54 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 60 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
55 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, | 61 | MHD_USE_ERROR_LOG, port, |
56 | NULL, NULL, &http_ahc, NULL, | 62 | NULL, NULL, &http_ahc, NULL, |
57 | MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, | 63 | MHD_OPTION_HTTPS_MEM_KEY, srv_signed_key_pem, |
58 | MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, | 64 | MHD_OPTION_HTTPS_MEM_CERT, srv_signed_cert_pem, |
@@ -63,8 +69,16 @@ test_secure_get (void * cls, char *cipher_suite, int proto_version) | |||
63 | fprintf (stderr, MHD_E_SERVER_INIT); | 69 | fprintf (stderr, MHD_E_SERVER_INIT); |
64 | return -1; | 70 | return -1; |
65 | } | 71 | } |
72 | if (0 == port) | ||
73 | { | ||
74 | const union MHD_DaemonInfo *dinfo; | ||
75 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
76 | if (NULL == dinfo || 0 == dinfo->port) | ||
77 | { MHD_stop_daemon (d); return -1; } | ||
78 | port = (int)dinfo->port; | ||
79 | } | ||
66 | 80 | ||
67 | ret = test_daemon_get (NULL, cipher_suite, proto_version, DEAMON_TEST_PORT, 0); | 81 | ret = test_daemon_get (NULL, cipher_suite, proto_version, port, 0); |
68 | 82 | ||
69 | MHD_stop_daemon (d); | 83 | MHD_stop_daemon (d); |
70 | return ret; | 84 | return ret; |
diff --git a/src/testcurl/https/test_tls_extensions.c b/src/testcurl/https/test_tls_extensions.c index 69deb3a4..a7bb6d4e 100644 --- a/src/testcurl/https/test_tls_extensions.c +++ b/src/testcurl/https/test_tls_extensions.c | |||
@@ -42,13 +42,14 @@ extern const char srv_self_signed_cert_pem[]; | |||
42 | * Test daemon response to TLS client hello requests containing extensions | 42 | * Test daemon response to TLS client hello requests containing extensions |
43 | * | 43 | * |
44 | * @param session | 44 | * @param session |
45 | * @param port | ||
45 | * @param exten_t - the type of extension being appended to client hello request | 46 | * @param exten_t - the type of extension being appended to client hello request |
46 | * @param ext_count - the number of consecutive extension replicas inserted into request | 47 | * @param ext_count - the number of consecutive extension replicas inserted into request |
47 | * @param ext_length - the length of each appended extension | 48 | * @param ext_length - the length of each appended extension |
48 | * @return 0 on successful test completion, -1 otherwise | 49 | * @return 0 on successful test completion, -1 otherwise |
49 | */ | 50 | */ |
50 | static int | 51 | static int |
51 | test_hello_extension (gnutls_session_t session, extensions_t exten_t, | 52 | test_hello_extension (gnutls_session_t session, int port, extensions_t exten_t, |
52 | int ext_count, int ext_length) | 53 | int ext_count, int ext_length) |
53 | { | 54 | { |
54 | int i, ret = 0, pos = 0; | 55 | int i, ret = 0, pos = 0; |
@@ -84,7 +85,7 @@ test_hello_extension (gnutls_session_t session, extensions_t exten_t, | |||
84 | } | 85 | } |
85 | memset (&sa, '\0', sizeof (struct sockaddr_in)); | 86 | memset (&sa, '\0', sizeof (struct sockaddr_in)); |
86 | sa.sin_family = AF_INET; | 87 | sa.sin_family = AF_INET; |
87 | sa.sin_port = htons (DEAMON_TEST_PORT); | 88 | sa.sin_port = htons (port); |
88 | sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); | 89 | sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK); |
89 | 90 | ||
90 | enum MHD_GNUTLS_Protocol hver; | 91 | enum MHD_GNUTLS_Protocol hver; |
@@ -167,7 +168,7 @@ test_hello_extension (gnutls_session_t session, extensions_t exten_t, | |||
167 | 168 | ||
168 | gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd); | 169 | gnutls_transport_set_ptr (session, (MHD_gnutls_transport_ptr_t) (long) sd); |
169 | 170 | ||
170 | if (gen_test_file_url (url, DEAMON_TEST_PORT)) | 171 | if (gen_test_file_url (url, port)) |
171 | { | 172 | { |
172 | ret = -1; | 173 | ret = -1; |
173 | goto cleanup; | 174 | goto cleanup; |
@@ -210,11 +211,16 @@ main (int argc, char *const *argv) | |||
210 | gnutls_datum_t key; | 211 | gnutls_datum_t key; |
211 | gnutls_datum_t cert; | 212 | gnutls_datum_t cert; |
212 | gnutls_certificate_credentials_t xcred; | 213 | gnutls_certificate_credentials_t xcred; |
213 | |||
214 | const int ext_arr[] = { | 214 | const int ext_arr[] = { |
215 | GNUTLS_EXTENSION_SERVER_NAME, | 215 | GNUTLS_EXTENSION_SERVER_NAME, |
216 | -1 | 216 | -1 |
217 | }; | 217 | }; |
218 | int port; | ||
219 | |||
220 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
221 | port = 0; | ||
222 | else | ||
223 | port = 3080; | ||
218 | 224 | ||
219 | #ifdef MHD_HTTPS_REQUIRE_GRYPT | 225 | #ifdef MHD_HTTPS_REQUIRE_GRYPT |
220 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); | 226 | gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0); |
@@ -237,7 +243,7 @@ main (int argc, char *const *argv) | |||
237 | } | 243 | } |
238 | 244 | ||
239 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | | 245 | d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | |
240 | MHD_USE_ERROR_LOG, DEAMON_TEST_PORT, | 246 | MHD_USE_ERROR_LOG, port, |
241 | NULL, NULL, &http_ahc, NULL, | 247 | NULL, NULL, &http_ahc, NULL, |
242 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 248 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
243 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, | 249 | MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem, |
@@ -248,26 +254,34 @@ main (int argc, char *const *argv) | |||
248 | fprintf (stderr, "%s\n", MHD_E_SERVER_INIT); | 254 | fprintf (stderr, "%s\n", MHD_E_SERVER_INIT); |
249 | return -1; | 255 | return -1; |
250 | } | 256 | } |
257 | if (0 == port) | ||
258 | { | ||
259 | const union MHD_DaemonInfo *dinfo; | ||
260 | dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); | ||
261 | if (NULL == dinfo || 0 == dinfo->port) | ||
262 | { MHD_stop_daemon (d); return -1; } | ||
263 | port = (int)dinfo->port; | ||
264 | } | ||
251 | 265 | ||
252 | i = 0; | 266 | i = 0; |
253 | setup_session (&session, &key, &cert, &xcred); | 267 | setup_session (&session, &key, &cert, &xcred); |
254 | errorCount += test_hello_extension (session, ext_arr[i], 1, 16); | 268 | errorCount += test_hello_extension (session, port, ext_arr[i], 1, 16); |
255 | teardown_session (session, &key, &cert, xcred); | 269 | teardown_session (session, &key, &cert, xcred); |
256 | #if 1 | 270 | #if 1 |
257 | i = 0; | 271 | i = 0; |
258 | while (ext_arr[i] != -1) | 272 | while (ext_arr[i] != -1) |
259 | { | 273 | { |
260 | setup_session (&session, &key, &cert, &xcred); | 274 | setup_session (&session, &key, &cert, &xcred); |
261 | errorCount += test_hello_extension (session, ext_arr[i], 1, 16); | 275 | errorCount += test_hello_extension (session, port, ext_arr[i], 1, 16); |
262 | teardown_session (session, &key, &cert, xcred); | 276 | teardown_session (session, &key, &cert, xcred); |
263 | 277 | ||
264 | setup_session (&session, &key, &cert, &xcred); | 278 | setup_session (&session, &key, &cert, &xcred); |
265 | errorCount += test_hello_extension (session, ext_arr[i], 3, 8); | 279 | errorCount += test_hello_extension (session, port, ext_arr[i], 3, 8); |
266 | teardown_session (session, &key, &cert, xcred); | 280 | teardown_session (session, &key, &cert, xcred); |
267 | 281 | ||
268 | /* this test specifically tests the issue raised in CVE-2008-1948 */ | 282 | /* this test specifically tests the issue raised in CVE-2008-1948 */ |
269 | setup_session (&session, &key, &cert, &xcred); | 283 | setup_session (&session, &key, &cert, &xcred); |
270 | errorCount += test_hello_extension (session, ext_arr[i], 6, 0); | 284 | errorCount += test_hello_extension (session, port, ext_arr[i], 6, 0); |
271 | teardown_session (session, &key, &cert, xcred); | 285 | teardown_session (session, &key, &cert, xcred); |
272 | i++; | 286 | i++; |
273 | } | 287 | } |
diff --git a/src/testcurl/https/test_tls_options.c b/src/testcurl/https/test_tls_options.c index 95f6b3ce..a0f053a0 100644 --- a/src/testcurl/https/test_tls_options.c +++ b/src/testcurl/https/test_tls_options.c | |||
@@ -43,7 +43,7 @@ int curl_check_version (const char *req_version, ...); | |||
43 | * | 43 | * |
44 | */ | 44 | */ |
45 | static int | 45 | static int |
46 | test_unmatching_ssl_version (void * cls, const char *cipher_suite, | 46 | test_unmatching_ssl_version (void * cls, int port, const char *cipher_suite, |
47 | int curl_req_ssl_version) | 47 | int curl_req_ssl_version) |
48 | { | 48 | { |
49 | struct CBC cbc; | 49 | struct CBC cbc; |
@@ -57,7 +57,7 @@ test_unmatching_ssl_version (void * cls, const char *cipher_suite, | |||
57 | cbc.pos = 0; | 57 | cbc.pos = 0; |
58 | 58 | ||
59 | char url[255]; | 59 | char url[255]; |
60 | if (gen_test_file_url (url, DEAMON_TEST_PORT)) | 60 | if (gen_test_file_url (url, port)) |
61 | { | 61 | { |
62 | free (cbc.buf); | 62 | free (cbc.buf); |
63 | fprintf (stderr, "Internal error in gen_test_file_url\n"); | 63 | fprintf (stderr, "Internal error in gen_test_file_url\n"); |
@@ -86,6 +86,12 @@ main (int argc, char *const *argv) | |||
86 | const char *ssl_version; | 86 | const char *ssl_version; |
87 | int daemon_flags = | 87 | int daemon_flags = |
88 | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG; | 88 | MHD_USE_THREAD_PER_CONNECTION | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS | MHD_USE_ERROR_LOG; |
89 | int port; | ||
90 | |||
91 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | ||
92 | port = 0; | ||
93 | else | ||
94 | port = 3010; | ||
89 | 95 | ||
90 | #ifdef MHD_HTTPS_REQUIRE_GRYPT | 96 | #ifdef MHD_HTTPS_REQUIRE_GRYPT |
91 | gcry_control (GCRYCTL_DISABLE_SECMEM, 0); | 97 | gcry_control (GCRYCTL_DISABLE_SECMEM, 0); |
@@ -127,7 +133,7 @@ main (int argc, char *const *argv) | |||
127 | 133 | ||
128 | if (0 != | 134 | if (0 != |
129 | test_wrap ("TLS1.0-AES-SHA1", | 135 | test_wrap ("TLS1.0-AES-SHA1", |
130 | &test_https_transfer, NULL, daemon_flags, | 136 | &test_https_transfer, NULL, port, daemon_flags, |
131 | aes128_sha, | 137 | aes128_sha, |
132 | CURL_SSLVERSION_TLSv1, | 138 | CURL_SSLVERSION_TLSv1, |
133 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 139 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
@@ -142,7 +148,7 @@ main (int argc, char *const *argv) | |||
142 | "The following handshake should fail (and print an error message)...\n"); | 148 | "The following handshake should fail (and print an error message)...\n"); |
143 | if (0 != | 149 | if (0 != |
144 | test_wrap ("TLS1.0 vs SSL3", | 150 | test_wrap ("TLS1.0 vs SSL3", |
145 | &test_unmatching_ssl_version, NULL, daemon_flags, | 151 | &test_unmatching_ssl_version, NULL, port, daemon_flags, |
146 | aes256_sha, | 152 | aes256_sha, |
147 | CURL_SSLVERSION_SSLv3, | 153 | CURL_SSLVERSION_SSLv3, |
148 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, | 154 | MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem, |
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c index 50cc318b..63cb1013 100644 --- a/src/testcurl/https/tls_test_common.c +++ b/src/testcurl/https/tls_test_common.c | |||
@@ -318,7 +318,7 @@ gen_test_file_url (char *url, int port) | |||
318 | * test HTTPS file transfer | 318 | * test HTTPS file transfer |
319 | */ | 319 | */ |
320 | int | 320 | int |
321 | test_https_transfer (void *cls, const char *cipher_suite, int proto_version) | 321 | test_https_transfer (void *cls, int port, const char *cipher_suite, int proto_version) |
322 | { | 322 | { |
323 | int len; | 323 | int len; |
324 | int ret = 0; | 324 | int ret = 0; |
@@ -334,7 +334,7 @@ test_https_transfer (void *cls, const char *cipher_suite, int proto_version) | |||
334 | cbc.size = len; | 334 | cbc.size = len; |
335 | cbc.pos = 0; | 335 | cbc.pos = 0; |
336 | 336 | ||
337 | if (gen_test_file_url (url, DEAMON_TEST_PORT)) | 337 | if (gen_test_file_url (url, port)) |
338 | { | 338 | { |
339 | ret = -1; | 339 | ret = -1; |
340 | goto cleanup; | 340 | goto cleanup; |
@@ -366,21 +366,33 @@ cleanup: | |||
366 | * @param d | 366 | * @param d |
367 | * @param daemon_flags | 367 | * @param daemon_flags |
368 | * @param arg_list | 368 | * @param arg_list |
369 | * @return | 369 | * @return port number on success or zero on failure |
370 | */ | 370 | */ |
371 | int | 371 | int |
372 | setup_testcase (struct MHD_Daemon **d, int daemon_flags, va_list arg_list) | 372 | setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list arg_list) |
373 | { | 373 | { |
374 | *d = MHD_start_daemon_va (daemon_flags, DEAMON_TEST_PORT, | 374 | *d = MHD_start_daemon_va (daemon_flags, port, |
375 | NULL, NULL, &http_ahc, NULL, arg_list); | 375 | NULL, NULL, &http_ahc, NULL, arg_list); |
376 | 376 | ||
377 | if (*d == NULL) | 377 | if (*d == NULL) |
378 | { | 378 | { |
379 | fprintf (stderr, MHD_E_SERVER_INIT); | 379 | fprintf (stderr, MHD_E_SERVER_INIT); |
380 | return -1; | 380 | return 0; |
381 | } | 381 | } |
382 | 382 | ||
383 | return 0; | 383 | if (0 == port) |
384 | { | ||
385 | const union MHD_DaemonInfo *dinfo; | ||
386 | dinfo = MHD_get_daemon_info (*d, MHD_DAEMON_INFO_BIND_PORT); | ||
387 | if (NULL == dinfo || 0 == dinfo->port) | ||
388 | { | ||
389 | MHD_stop_daemon (*d); | ||
390 | return 0; | ||
391 | } | ||
392 | port = (int)dinfo->port; | ||
393 | } | ||
394 | |||
395 | return port; | ||
384 | } | 396 | } |
385 | 397 | ||
386 | void | 398 | void |
@@ -454,8 +466,9 @@ teardown_session (gnutls_session_t session, | |||
454 | /* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ | 466 | /* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ |
455 | int | 467 | int |
456 | test_wrap (const char *test_name, int | 468 | test_wrap (const char *test_name, int |
457 | (*test_function) (void * cls, const char *cipher_suite, | 469 | (*test_function) (void * cls, int port, const char *cipher_suite, |
458 | int proto_version), void * cls, | 470 | int proto_version), void * cls, |
471 | int port, | ||
459 | int daemon_flags, const char *cipher_suite, int proto_version, ...) | 472 | int daemon_flags, const char *cipher_suite, int proto_version, ...) |
460 | { | 473 | { |
461 | int ret; | 474 | int ret; |
@@ -463,7 +476,8 @@ test_wrap (const char *test_name, int | |||
463 | struct MHD_Daemon *d; | 476 | struct MHD_Daemon *d; |
464 | 477 | ||
465 | va_start (arg_list, proto_version); | 478 | va_start (arg_list, proto_version); |
466 | if (setup_testcase (&d, daemon_flags, arg_list) != 0) | 479 | port = setup_testcase (&d, port, daemon_flags, arg_list); |
480 | if (0 == port) | ||
467 | { | 481 | { |
468 | va_end (arg_list); | 482 | va_end (arg_list); |
469 | fprintf (stderr, "Failed to setup testcase %s\n", test_name); | 483 | fprintf (stderr, "Failed to setup testcase %s\n", test_name); |
@@ -472,7 +486,7 @@ test_wrap (const char *test_name, int | |||
472 | #if 0 | 486 | #if 0 |
473 | fprintf (stdout, "running test: %s ", test_name); | 487 | fprintf (stdout, "running test: %s ", test_name); |
474 | #endif | 488 | #endif |
475 | ret = test_function (NULL, cipher_suite, proto_version); | 489 | ret = test_function (NULL, port, cipher_suite, proto_version); |
476 | #if 0 | 490 | #if 0 |
477 | if (ret == 0) | 491 | if (ret == 0) |
478 | { | 492 | { |
diff --git a/src/testcurl/https/tls_test_common.h b/src/testcurl/https/tls_test_common.h index 1d324760..a59c43f4 100644 --- a/src/testcurl/https/tls_test_common.h +++ b/src/testcurl/https/tls_test_common.h | |||
@@ -32,8 +32,6 @@ | |||
32 | #define DEBUG_HTTPS_TEST 0 | 32 | #define DEBUG_HTTPS_TEST 0 |
33 | #define CURL_VERBOS_LEVEL 0 | 33 | #define CURL_VERBOS_LEVEL 0 |
34 | 34 | ||
35 | #define DEAMON_TEST_PORT 4233 | ||
36 | |||
37 | #define test_data "Hello World\n" | 35 | #define test_data "Hello World\n" |
38 | #define ca_cert_file_name "tmp_ca_cert.pem" | 36 | #define ca_cert_file_name "tmp_ca_cert.pem" |
39 | 37 | ||
@@ -51,6 +49,7 @@ | |||
51 | struct https_test_data | 49 | struct https_test_data |
52 | { | 50 | { |
53 | void *cls; | 51 | void *cls; |
52 | int port; | ||
54 | const char *cipher_suite; | 53 | const char *cipher_suite; |
55 | int proto_version; | 54 | int proto_version; |
56 | }; | 55 | }; |
@@ -114,10 +113,10 @@ send_curl_req (char *url, struct CBC *cbc, const char *cipher_suite, | |||
114 | int proto_version); | 113 | int proto_version); |
115 | 114 | ||
116 | int | 115 | int |
117 | test_https_transfer (void *cls, const char *cipher_suite, int proto_version); | 116 | test_https_transfer (void *cls, int port, const char *cipher_suite, int proto_version); |
118 | 117 | ||
119 | int | 118 | int |
120 | setup_testcase (struct MHD_Daemon **d, int daemon_flags, va_list arg_list); | 119 | setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list arg_list); |
121 | 120 | ||
122 | void teardown_testcase (struct MHD_Daemon *d); | 121 | void teardown_testcase (struct MHD_Daemon *d); |
123 | 122 | ||
@@ -135,7 +134,8 @@ teardown_session (gnutls_session_t session, | |||
135 | 134 | ||
136 | int | 135 | int |
137 | test_wrap (const char *test_name, int | 136 | test_wrap (const char *test_name, int |
138 | (*test_function) (void * cls, const char *cipher_suite, | 137 | (*test_function) (void * cls, int port, const char *cipher_suite, |
139 | int proto_version), void *test_function_cls, | 138 | int proto_version), void * cls, |
139 | int port, | ||
140 | int daemon_flags, const char *cipher_suite, int proto_version, ...); | 140 | int daemon_flags, const char *cipher_suite, int proto_version, ...); |
141 | #endif /* TLS_TEST_COMMON_H_ */ | 141 | #endif /* TLS_TEST_COMMON_H_ */ |
diff --git a/src/testcurl/test_options.c b/src/testcurl/test_options.c index 317968e5..004fe615 100644 --- a/src/testcurl/test_options.c +++ b/src/testcurl/test_options.c | |||
@@ -47,8 +47,8 @@ ahc_echo (void *cls, | |||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | int | 50 | static int |
51 | test_wrap (char *test_name, int (*test) (void)) | 51 | test_wrap_loc (char *test_name, int (*test) (void)) |
52 | { | 52 | { |
53 | int ret; | 53 | int ret; |
54 | 54 | ||
@@ -119,7 +119,7 @@ main (int argc, char *const *argv) | |||
119 | { | 119 | { |
120 | unsigned int errorCount = 0; | 120 | unsigned int errorCount = 0; |
121 | 121 | ||
122 | errorCount += test_wrap ("ip addr option", &test_ip_addr_option); | 122 | errorCount += test_wrap_loc ("ip addr option", &test_ip_addr_option); |
123 | 123 | ||
124 | return errorCount != 0; | 124 | return errorCount != 0; |
125 | } | 125 | } |