summaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/networking/wget.c b/networking/wget.c
index fa4d21afd..d907cee30 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -486,6 +486,9 @@ static int ftpcmd(const char *s1, const char *s2, FILE *fp)
486 fprintf(stderr, "--> %s%s\n\n", s1, s2); 486 fprintf(stderr, "--> %s%s\n\n", s1, s2);
487 fflush(fp); 487 fflush(fp);
488 log_io("> %s%s", s1, s2); 488 log_io("> %s%s", s1, s2);
489#if ENABLE_PLATFORM_MINGW32
490 fseek(fp, 0L, SEEK_CUR);
491#endif
489 } 492 }
490 493
491 /* Read until "Nxx something" is received */ 494 /* Read until "Nxx something" is received */
@@ -493,6 +496,9 @@ static int ftpcmd(const char *s1, const char *s2, FILE *fp)
493 do { 496 do {
494 fgets_trim_sanitize(fp, "%s\n"); 497 fgets_trim_sanitize(fp, "%s\n");
495 } while (!isdigit(G.wget_buf[0]) || G.wget_buf[3] != ' '); 498 } while (!isdigit(G.wget_buf[0]) || G.wget_buf[3] != ' ');
499#if ENABLE_PLATFORM_MINGW32
500 fseek(fp, 0L, SEEK_CUR);
501#endif
496 502
497 G.wget_buf[3] = '\0'; 503 G.wget_buf[3] = '\0';
498 result = xatoi_positive(G.wget_buf); 504 result = xatoi_positive(G.wget_buf);
@@ -716,6 +722,7 @@ static int spawn_https_helper_openssl(const char *host, unsigned port)
716#endif 722#endif
717 723
718#if ENABLE_FEATURE_WGET_HTTPS 724#if ENABLE_FEATURE_WGET_HTTPS
725# if !ENABLE_PLATFORM_MINGW32
719static void spawn_ssl_client(const char *host, int network_fd, int flags) 726static void spawn_ssl_client(const char *host, int network_fd, int flags)
720{ 727{
721 int sp[2]; 728 int sp[2];
@@ -770,6 +777,32 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags)
770 close(sp[1]); 777 close(sp[1]);
771 xmove_fd(sp[0], network_fd); 778 xmove_fd(sp[0], network_fd);
772} 779}
780# else
781static void spawn_ssl_client(const char *host, int network_fd, int flags)
782{
783 int fd1;
784 char *servername, *p, *cmd;
785
786 servername = xstrdup(host);
787 p = strrchr(servername, ':');
788 if (p) *p = '\0';
789
790 fflush_all();
791
792 cmd = xasprintf("%s --busybox ssl_client -h %p -n %s%s",
793 bb_busybox_exec_path,
794 (void *)_get_osfhandle(network_fd), servername,
795 flags & TLSLOOP_EXIT_ON_LOCAL_EOF ? " -e" : "");
796
797 if ( (fd1=mingw_popen_fd(cmd, "b", -1, NULL)) == -1 ) {
798 bb_perror_msg_and_die("can't execute ssl_client");
799 }
800
801 free(cmd);
802 free(servername);
803 xmove_fd(fd1, network_fd);
804}
805# endif
773#endif 806#endif
774 807
775static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_sockaddr *lsa) 808static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_sockaddr *lsa)