12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "libbb.h"
- int ssl_client_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int ssl_client_main(int argc UNUSED_PARAM, char **argv)
- {
- tls_state_t *tls;
- const char *sni = NULL;
- int opt;
-
- tls = new_tls_state();
- opt = getopt32(argv, "s:#r:#n:", &tls->ofd, &tls->ifd, &sni);
- if (!(opt & 2)) {
-
- tls->ifd = tls->ofd;
- }
- if (!(opt & 3)) {
- if (!argv[1])
- bb_show_usage();
-
-
-
-
- if (!sni)
- sni = argv[1];
- tls->ifd = tls->ofd = create_and_connect_stream_or_die(argv[1], 443);
- }
- tls_handshake(tls, sni);
- tls_run_copy_loop(tls);
- return EXIT_SUCCESS;
- }
|