diff options
author | Brent Cook <busterb@gmail.com> | 2020-10-06 19:41:18 -0500 |
---|---|---|
committer | Brent Cook <busterb@gmail.com> | 2020-10-06 19:41:18 -0500 |
commit | db8b30ae510793c65681d8786f94669e40d821a1 (patch) | |
tree | a3e3d353998efdbbc28a008d3ebf9aacabcdaafb /libtls-standalone/tests/test.c | |
parent | b9918fc1ecfa74d6d3d9a3c533603a9677108d24 (diff) | |
parent | 85eea94598ff4b543777df4bf34d44ef5dfc06c6 (diff) | |
download | portable-db8b30ae510793c65681d8786f94669e40d821a1.tar.gz portable-db8b30ae510793c65681d8786f94669e40d821a1.tar.bz2 portable-db8b30ae510793c65681d8786f94669e40d821a1.zip |
Land #611, remove libtls-standalone
Diffstat (limited to 'libtls-standalone/tests/test.c')
-rw-r--r-- | libtls-standalone/tests/test.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/libtls-standalone/tests/test.c b/libtls-standalone/tests/test.c deleted file mode 100644 index 4069332..0000000 --- a/libtls-standalone/tests/test.c +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <tls.h> | ||
3 | |||
4 | int main() | ||
5 | { | ||
6 | struct tls *tls; | ||
7 | struct tls_config *tls_config; | ||
8 | ssize_t written, read; | ||
9 | char buf[4096]; | ||
10 | |||
11 | if (tls_init() != 0) { | ||
12 | fprintf(stderr, "tls_init failed"); | ||
13 | return 1; | ||
14 | } | ||
15 | |||
16 | if ((tls = tls_client()) == NULL) | ||
17 | goto err; | ||
18 | |||
19 | if ((tls_config = tls_config_new()) == NULL) | ||
20 | goto err; | ||
21 | |||
22 | if (tls_config_set_ciphers(tls_config, "compat") != 0) | ||
23 | goto err; | ||
24 | |||
25 | tls_config_insecure_noverifycert(tls_config); | ||
26 | tls_config_insecure_noverifyname(tls_config); | ||
27 | |||
28 | if (tls_configure(tls, tls_config) != 0) | ||
29 | goto err; | ||
30 | |||
31 | if (tls_connect(tls, "google.com", "443") != 0) | ||
32 | goto err; | ||
33 | |||
34 | if ((written = tls_write(tls, "GET /\r\n", 7)) < 0) | ||
35 | goto err; | ||
36 | |||
37 | if ((read = tls_read(tls, buf, sizeof(buf))) < 0) | ||
38 | goto err; | ||
39 | |||
40 | buf[read - 1] = '\0'; | ||
41 | puts(buf); | ||
42 | |||
43 | if (tls_close(tls) != 0) | ||
44 | goto err; | ||
45 | |||
46 | return 0; | ||
47 | |||
48 | err: | ||
49 | fprintf(stderr, "%s\n", tls_error(tls)); | ||
50 | return 1; | ||
51 | } | ||