summaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-03-15 10:32:23 +0000
committerRon Yorston <rmy@pobox.com>2018-03-15 10:39:20 +0000
commit7cc082e2370da69c8783812c251190d316ce82b3 (patch)
tree8a6224f8dd28fb1ffd3e6ef111efcc8b82f429b8 /networking/wget.c
parentf011d7284d8cabe5d453b43d4df44d0423db22c8 (diff)
downloadbusybox-w32-7cc082e2370da69c8783812c251190d316ce82b3.tar.gz
busybox-w32-7cc082e2370da69c8783812c251190d316ce82b3.tar.bz2
busybox-w32-7cc082e2370da69c8783812c251190d316ce82b3.zip
wget: add support for https
Allow wget to support https URLs. Changes are: - Add mingw_popen2 which uses a named pipe to allow bidirectional communication with a child process; - Modify ssl_client to accept a WIN32 handle instead of a file descriptor as an argument; - Allow tls_get_random to open /dev/urandom; - Using the above changes implement a WIN32 version of spawn_ssl_client in wget. This closes GitHub issue #75. Also, enable authentication in wget.
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 150bc8e12..776894dca 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -714,6 +714,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
714#endif 714#endif
715 715
716#if ENABLE_FEATURE_WGET_HTTPS 716#if ENABLE_FEATURE_WGET_HTTPS
717# if !ENABLE_PLATFORM_MINGW32
717static void spawn_ssl_client(const char *host, int network_fd, int flags) 718static void spawn_ssl_client(const char *host, int network_fd, int flags)
718{ 719{
719 int sp[2]; 720 int sp[2];
@@ -763,6 +764,32 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
763 close(sp[1]); 764 close(sp[1]);
764 xmove_fd(sp[0], network_fd); 765 xmove_fd(sp[0], network_fd);
765} 766}
767# else
768static void spawn_ssl_client(const char *host, int network_fd, int flags)
769{
770 int fd1;
771 pid_t pid;
772 char *servername, *p, *cmd;
773
774 servername = xstrdup(host);
775 p = strrchr(servername, ':');
776 if (p) *p = '\0';
777
778 fflush_all();
779
780 cmd = xasprintf("%s ssl_client -h %p -n %s%s", bb_busybox_exec_path,
781 (void *)_get_osfhandle(network_fd), servername,
782 flags & TLSLOOP_EXIT_ON_LOCAL_EOF ? " -e" : "");
783
784 if ( (fd1=mingw_popen2(cmd, &pid)) == -1 ) {
785 bb_perror_msg_and_die("can't execute ssl_client");
786 }
787
788 free(cmd);
789 free(servername);
790 xmove_fd(fd1, network_fd);
791}
792# endif
766#endif 793#endif
767 794
768static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_sockaddr *lsa) 795static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_sockaddr *lsa)