aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/https/tls_test_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/https/tls_test_common.c')
-rw-r--r--src/testcurl/https/tls_test_common.c61
1 files changed, 45 insertions, 16 deletions
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index eb7cb14c..9d988451 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -62,7 +62,8 @@ setup_ca_cert ()
62 */ 62 */
63int 63int
64test_daemon_get (void *cls, 64test_daemon_get (void *cls,
65 const char *cipher_suite, int proto_version, 65 const char *cipher_suite,
66 int proto_version,
66 int port, 67 int port,
67 int ver_peer) 68 int ver_peer)
68{ 69{
@@ -71,7 +72,7 @@ test_daemon_get (void *cls,
71 CURLcode errornum; 72 CURLcode errornum;
72 char url[255]; 73 char url[255];
73 size_t len; 74 size_t len;
74 (void) cls; /* Unused. Silent compiler warning. */ 75 (void) cls; /* Unused. Silence compiler warning. */
75 76
76 len = strlen (test_data); 77 len = strlen (test_data);
77 if (NULL == (cbc.buf = malloc (sizeof (char) * len))) 78 if (NULL == (cbc.buf = malloc (sizeof (char) * len)))
@@ -138,20 +139,29 @@ test_daemon_get (void *cls,
138 139
139 140
140void 141void
141print_test_result (int test_outcome, char *test_name) 142print_test_result (int test_outcome,
143 char *test_name)
142{ 144{
143 if (test_outcome != 0) 145 if (test_outcome != 0)
144 fprintf (stderr, "running test: %s [fail: %u]\n", test_name, (unsigned 146 fprintf (stderr,
145 int) 147 "running test: %s [fail: %u]\n",
148 test_name, (unsigned
149 int)
146 test_outcome); 150 test_outcome);
147#if 0 151#if 0
148 else 152 else
149 fprintf (stdout, "running test: %s [pass]\n", test_name); 153 fprintf (stdout,
154 "running test: %s [pass]\n",
155 test_name);
150#endif 156#endif
151} 157}
152 158
159
153size_t 160size_t
154copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 161copyBuffer (void *ptr,
162 size_t size,
163 size_t nmemb,
164 void *ctx)
155{ 165{
156 struct CBC *cbc = ctx; 166 struct CBC *cbc = ctx;
157 167
@@ -162,13 +172,19 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
162 return size * nmemb; 172 return size * nmemb;
163} 173}
164 174
175
165/** 176/**
166 * HTTP access handler call back 177 * HTTP access handler call back
167 */ 178 */
168int 179int
169http_ahc (void *cls, struct MHD_Connection *connection, 180http_ahc (void *cls,
170 const char *url, const char *method, const char *version, 181 struct MHD_Connection *connection,
171 const char *upload_data, size_t *upload_data_size, void **ptr) 182 const char *url,
183 const char *method,
184 const char *version,
185 const char *upload_data,
186 size_t *upload_data_size,
187 void **ptr)
172{ 188{
173 static int aptr; 189 static int aptr;
174 struct MHD_Response *response; 190 struct MHD_Response *response;
@@ -193,15 +209,26 @@ http_ahc (void *cls, struct MHD_Connection *connection,
193 return ret; 209 return ret;
194} 210}
195 211
212
196/* HTTP access handler call back */ 213/* HTTP access handler call back */
197int 214int
198http_dummy_ahc (void *cls, struct MHD_Connection *connection, 215http_dummy_ahc (void *cls,
199 const char *url, const char *method, const char *version, 216 struct MHD_Connection *connection,
200 const char *upload_data, size_t *upload_data_size, 217 const char *url,
218 const char *method,
219 const char *version,
220 const char *upload_data,
221 size_t *upload_data_size,
201 void **ptr) 222 void **ptr)
202{ 223{
203 (void) cls; (void) connection; (void) url; (void) method; (void) version; /* Unused. Silent compiler warning. */ 224 (void) cls;
204 (void) upload_data; (void) upload_data_size; (void) ptr; /* Unused. Silent compiler warning. */ 225 (void) connection;
226 (void) url;
227 (void) method;
228 (void) version; /* Unused. Silent compiler warning. */
229 (void) upload_data;
230 (void) upload_data_size;
231 (void) ptr; /* Unused. Silent compiler warning. */
205 return 0; 232 return 0;
206} 233}
207 234
@@ -215,7 +242,9 @@ http_dummy_ahc (void *cls, struct MHD_Connection *connection,
215 */ 242 */
216/* TODO have test wrap consider a NULL cbc */ 243/* TODO have test wrap consider a NULL cbc */
217int 244int
218send_curl_req (char *url, struct CBC *cbc, const char *cipher_suite, 245send_curl_req (char *url,
246 struct CBC *cbc,
247 const char *cipher_suite,
219 int proto_version) 248 int proto_version)
220{ 249{
221 CURL *c; 250 CURL *c;