aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/https
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-31 13:06:08 +0100
committerChristian Grothoff <christian@grothoff.org>2019-10-31 13:06:08 +0100
commit7389c3452884ad29faf5a2d6856aebd364ffae6b (patch)
tree71246e22c8513c0dcbf79b837cb9c084c29e434c /src/testcurl/https
parente0a076284525eaf2ec4cb356a40cccc25e24f2b1 (diff)
downloadlibmicrohttpd-7389c3452884ad29faf5a2d6856aebd364ffae6b.tar.gz
libmicrohttpd-7389c3452884ad29faf5a2d6856aebd364ffae6b.zip
tighten formatting rules
Diffstat (limited to 'src/testcurl/https')
-rw-r--r--src/testcurl/https/test_empty_response.c10
-rw-r--r--src/testcurl/https/test_https_get.c8
-rw-r--r--src/testcurl/https/test_https_get_parallel_threads.c1
-rw-r--r--src/testcurl/https/test_https_get_select.c10
-rw-r--r--src/testcurl/https/test_https_multi_daemon.c4
-rw-r--r--src/testcurl/https/test_https_session_info.c4
-rw-r--r--src/testcurl/https/test_https_sni.c8
-rw-r--r--src/testcurl/https/test_https_time_out.c2
-rw-r--r--src/testcurl/https/test_tls_authentication.c3
-rw-r--r--src/testcurl/https/test_tls_extensions.c5
-rw-r--r--src/testcurl/https/tls_test_common.c8
11 files changed, 36 insertions, 27 deletions
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c
index 41026896..6f29fbe5 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -101,7 +101,7 @@ testInternalSelectGet ()
101 { 101 {
102 const union MHD_DaemonInfo *dinfo; 102 const union MHD_DaemonInfo *dinfo;
103 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 103 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
104 if ((NULL == dinfo) ||(0 == dinfo->port) ) 104 if ((NULL == dinfo) || (0 == dinfo->port) )
105 { 105 {
106 MHD_stop_daemon (d); return 32; 106 MHD_stop_daemon (d); return 32;
107 } 107 }
@@ -177,10 +177,10 @@ testInternalSelectGet ()
177 if (EINTR != errno) 177 if (EINTR != errno)
178 abort (); 178 abort ();
179#else 179#else
180 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 180 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
181 ws. 181 ws.
182 fd_count) 182 fd_count)
183 ||(0 != es.fd_count) ) 183 || (0 != es.fd_count) )
184 abort (); 184 abort ();
185 Sleep (1000); 185 Sleep (1000);
186#endif 186#endif
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c
index 8f62e46c..c012fa46 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -74,7 +74,7 @@ test_secure_get (FILE *test_fd,
74 { 74 {
75 const union MHD_DaemonInfo *dinfo; 75 const union MHD_DaemonInfo *dinfo;
76 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 76 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
77 if ((NULL == dinfo) ||(0 == dinfo->port) ) 77 if ((NULL == dinfo) || (0 == dinfo->port) )
78 { 78 {
79 MHD_stop_daemon (d); return -1; 79 MHD_stop_daemon (d); return -1;
80 } 80 }
@@ -148,8 +148,8 @@ curlExcessFound (CURL *c,
148 (void) c; /* Unused. Silence compiler warning. */ 148 (void) c; /* Unused. Silence compiler warning. */
149 149
150 if ((CURLINFO_TEXT == type) 150 if ((CURLINFO_TEXT == type)
151 &&(size >= str_size) 151 && (size >= str_size)
152 &&(0 == strncmp (excess_found, data, str_size))) 152 && (0 == strncmp (excess_found, data, str_size)))
153 *(int *) cls = 1; 153 *(int *) cls = 1;
154 return 0; 154 return 0;
155} 155}
@@ -189,7 +189,7 @@ testEmptyGet (int poll_flag)
189 { 189 {
190 const union MHD_DaemonInfo *dinfo; 190 const union MHD_DaemonInfo *dinfo;
191 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 191 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
192 if ((NULL == dinfo) ||(0 == dinfo->port) ) 192 if ((NULL == dinfo) || (0 == dinfo->port) )
193 { 193 {
194 MHD_stop_daemon (d); return 32; 194 MHD_stop_daemon (d); return 32;
195 } 195 }
diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c
index 8ca976c2..3fc0e189 100644
--- a/src/testcurl/https/test_https_get_parallel_threads.c
+++ b/src/testcurl/https/test_https_get_parallel_threads.c
@@ -70,6 +70,7 @@ https_transfer_thread_adapter (void *args)
70 return &nonnull; 70 return &nonnull;
71} 71}
72 72
73
73/** 74/**
74 * Test non-parallel requests. 75 * Test non-parallel requests.
75 * 76 *
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c
index ce74c1d7..e5bd73f5 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -118,7 +118,7 @@ testExternalGet (int flags)
118 { 118 {
119 const union MHD_DaemonInfo *dinfo; 119 const union MHD_DaemonInfo *dinfo;
120 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 120 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
121 if ((NULL == dinfo) ||(0 == dinfo->port) ) 121 if ((NULL == dinfo) || (0 == dinfo->port) )
122 { 122 {
123 MHD_stop_daemon (d); return 32; 123 MHD_stop_daemon (d); return 32;
124 } 124 }
@@ -201,10 +201,10 @@ testExternalGet (int flags)
201 if (EINTR != errno) 201 if (EINTR != errno)
202 abort (); 202 abort ();
203#else 203#else
204 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 204 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
205 ws. 205 ws.
206 fd_count) 206 fd_count)
207 ||(0 != es.fd_count) ) 207 || (0 != es.fd_count) )
208 abort (); 208 abort ();
209 Sleep (1000); 209 Sleep (1000);
210#endif 210#endif
diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c
index de153ff6..598d5592 100644
--- a/src/testcurl/https/test_https_multi_daemon.c
+++ b/src/testcurl/https/test_https_multi_daemon.c
@@ -78,7 +78,7 @@ test_concurent_daemon_pair (void *cls,
78 { 78 {
79 const union MHD_DaemonInfo *dinfo; 79 const union MHD_DaemonInfo *dinfo;
80 dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT); 80 dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT);
81 if ((NULL == dinfo) ||(0 == dinfo->port) ) 81 if ((NULL == dinfo) || (0 == dinfo->port) )
82 { 82 {
83 MHD_stop_daemon (d1); return -1; 83 MHD_stop_daemon (d1); return -1;
84 } 84 }
@@ -103,7 +103,7 @@ test_concurent_daemon_pair (void *cls,
103 { 103 {
104 const union MHD_DaemonInfo *dinfo; 104 const union MHD_DaemonInfo *dinfo;
105 dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT); 105 dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT);
106 if ((NULL == dinfo) ||(0 == dinfo->port) ) 106 if ((NULL == dinfo) || (0 == dinfo->port) )
107 { 107 {
108 MHD_stop_daemon (d1); 108 MHD_stop_daemon (d1);
109 MHD_stop_daemon (d2); 109 MHD_stop_daemon (d2);
diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c
index b692af15..e961edc4 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -132,7 +132,7 @@ test_query_session ()
132 { 132 {
133 const union MHD_DaemonInfo *dinfo; 133 const union MHD_DaemonInfo *dinfo;
134 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 134 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
135 if ((NULL == dinfo) ||(0 == dinfo->port) ) 135 if ((NULL == dinfo) || (0 == dinfo->port) )
136 { 136 {
137 MHD_stop_daemon (d); 137 MHD_stop_daemon (d);
138 free (cbc.buf); 138 free (cbc.buf);
@@ -188,6 +188,8 @@ test_query_session ()
188 free (cbc.buf); 188 free (cbc.buf);
189 return 0; 189 return 0;
190} 190}
191
192
191#endif 193#endif
192 194
193int 195int
diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c
index 16576656..6effd313 100644
--- a/src/testcurl/https/test_https_sni.c
+++ b/src/testcurl/https/test_https_sni.c
@@ -120,7 +120,6 @@ load_keys (const char *hostname,
120} 120}
121 121
122 122
123
124/** 123/**
125 * @param session the session we are giving a cert for 124 * @param session the session we are giving a cert for
126 * @param req_ca_dn NULL on server side 125 * @param req_ca_dn NULL on server side
@@ -297,7 +296,7 @@ main (int argc, char *const *argv)
297 { 296 {
298 const union MHD_DaemonInfo *dinfo; 297 const union MHD_DaemonInfo *dinfo;
299 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 298 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
300 if ((NULL == dinfo) ||(0 == dinfo->port) ) 299 if ((NULL == dinfo) || (0 == dinfo->port) )
301 { 300 {
302 MHD_stop_daemon (d); return -1; 301 MHD_stop_daemon (d); return -1;
303 } 302 }
@@ -318,10 +317,13 @@ main (int argc, char *const *argv)
318 317
319#else 318#else
320 319
321int main (void) 320int
321main (void)
322{ 322{
323 fprintf (stderr, 323 fprintf (stderr,
324 "SNI not supported by GnuTLS < 3.0\n"); 324 "SNI not supported by GnuTLS < 3.0\n");
325 return 77; 325 return 77;
326} 326}
327
328
327#endif 329#endif
diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c
index d2f4d92c..7721d486 100644
--- a/src/testcurl/https/test_https_time_out.c
+++ b/src/testcurl/https/test_https_time_out.c
@@ -144,7 +144,7 @@ main (int argc, char *const *argv)
144 { 144 {
145 const union MHD_DaemonInfo *dinfo; 145 const union MHD_DaemonInfo *dinfo;
146 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 146 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
147 if ((NULL == dinfo) ||(0 == dinfo->port) ) 147 if ((NULL == dinfo) || (0 == dinfo->port) )
148 { 148 {
149 MHD_stop_daemon (d); return -1; 149 MHD_stop_daemon (d); return -1;
150 } 150 }
diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c
index 51fb5331..7ca75138 100644
--- a/src/testcurl/https/test_tls_authentication.c
+++ b/src/testcurl/https/test_tls_authentication.c
@@ -38,7 +38,6 @@ extern const char srv_signed_cert_pem[];
38extern const char srv_signed_key_pem[]; 38extern const char srv_signed_key_pem[];
39 39
40 40
41
42/* perform a HTTP GET request via SSL/TLS */ 41/* perform a HTTP GET request via SSL/TLS */
43static int 42static int
44test_secure_get (void *cls, char *cipher_suite, int proto_version) 43test_secure_get (void *cls, char *cipher_suite, int proto_version)
@@ -70,7 +69,7 @@ test_secure_get (void *cls, char *cipher_suite, int proto_version)
70 { 69 {
71 const union MHD_DaemonInfo *dinfo; 70 const union MHD_DaemonInfo *dinfo;
72 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 71 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
73 if ((NULL == dinfo) ||(0 == dinfo->port) ) 72 if ((NULL == dinfo) || (0 == dinfo->port) )
74 { 73 {
75 MHD_stop_daemon (d); return -1; 74 MHD_stop_daemon (d); return -1;
76 } 75 }
diff --git a/src/testcurl/https/test_tls_extensions.c b/src/testcurl/https/test_tls_extensions.c
index f5095359..338fcd91 100644
--- a/src/testcurl/https/test_tls_extensions.c
+++ b/src/testcurl/https/test_tls_extensions.c
@@ -132,8 +132,7 @@ test_hello_extension (gnutls_session_t session, int port, extensions_t exten_t,
132 * len = ciphersuite data + 2 bytes ciphersuite length \ 132 * len = ciphersuite data + 2 bytes ciphersuite length \
133 * 1 byte compression length + 1 byte compression data + \ 133 * 1 byte compression length + 1 byte compression data + \
134 * 2 bytes extension length, extensions data 134 * 2 bytes extension length, extensions data
135 */ 135 */ciphersuite_len = MHD__gnutls_copy_ciphersuites (session, extdata,
136 ciphersuite_len = MHD__gnutls_copy_ciphersuites (session, extdata,
137 sizeof (extdata)); 136 sizeof (extdata));
138 exten_data_len = ext_count * (2 + 2 + ext_length); 137 exten_data_len = ext_count * (2 + 2 + ext_length);
139 datalen += ciphersuite_len + 2 + 2 + exten_data_len; 138 datalen += ciphersuite_len + 2 + 2 + exten_data_len;
@@ -259,7 +258,7 @@ main (int argc, char *const *argv)
259 { 258 {
260 const union MHD_DaemonInfo *dinfo; 259 const union MHD_DaemonInfo *dinfo;
261 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 260 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
262 if ((NULL == dinfo) ||(0 == dinfo->port) ) 261 if ((NULL == dinfo) || (0 == dinfo->port) )
263 { 262 {
264 MHD_stop_daemon (d); return -1; 263 MHD_stop_daemon (d); return -1;
265 } 264 }
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index 9d988451..f68f5979 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -232,6 +232,7 @@ http_dummy_ahc (void *cls,
232 return 0; 232 return 0;
233} 233}
234 234
235
235/** 236/**
236 * send a test http request to the daemon 237 * send a test http request to the daemon
237 * @param url 238 * @param url
@@ -414,6 +415,7 @@ cleanup:
414 return ret; 415 return ret;
415} 416}
416 417
418
417/** 419/**
418 * setup test case 420 * setup test case
419 * 421 *
@@ -439,7 +441,7 @@ setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list
439 { 441 {
440 const union MHD_DaemonInfo *dinfo; 442 const union MHD_DaemonInfo *dinfo;
441 dinfo = MHD_get_daemon_info (*d, MHD_DAEMON_INFO_BIND_PORT); 443 dinfo = MHD_get_daemon_info (*d, MHD_DAEMON_INFO_BIND_PORT);
442 if ((NULL == dinfo) ||(0 == dinfo->port) ) 444 if ((NULL == dinfo) || (0 == dinfo->port) )
443 { 445 {
444 MHD_stop_daemon (*d); 446 MHD_stop_daemon (*d);
445 return 0; 447 return 0;
@@ -450,12 +452,14 @@ setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list
450 return port; 452 return port;
451} 453}
452 454
455
453void 456void
454teardown_testcase (struct MHD_Daemon *d) 457teardown_testcase (struct MHD_Daemon *d)
455{ 458{
456 MHD_stop_daemon (d); 459 MHD_stop_daemon (d);
457} 460}
458 461
462
459int 463int
460setup_session (gnutls_session_t *session, 464setup_session (gnutls_session_t *session,
461 gnutls_datum_t *key, 465 gnutls_datum_t *key,
@@ -501,6 +505,7 @@ setup_session (gnutls_session_t *session,
501 return 0; 505 return 0;
502} 506}
503 507
508
504int 509int
505teardown_session (gnutls_session_t session, 510teardown_session (gnutls_session_t session,
506 gnutls_datum_t *key, 511 gnutls_datum_t *key,
@@ -518,6 +523,7 @@ teardown_session (gnutls_session_t session,
518 return 0; 523 return 0;
519} 524}
520 525
526
521/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ 527/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */
522int 528int
523test_wrap (const char *test_name, int 529test_wrap (const char *test_name, int