From 13a113cb271b8680578c90d0c7958099fa5f71a0 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 17 Jan 2017 19:36:30 +0100 Subject: [PATCH] busybox: Backport fix to wget --- packages/busybox/wget.c.patch | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 packages/busybox/wget.c.patch diff --git a/packages/busybox/wget.c.patch b/packages/busybox/wget.c.patch new file mode 100644 index 00000000..35a9e41a --- /dev/null +++ b/packages/busybox/wget.c.patch @@ -0,0 +1,57 @@ +Apply fix for https://bugs.busybox.net/show_bug.cgi?id=9471 from git + +diff --git a/networking/wget.c b/networking/wget.c +index c82086878..d5a92a950 100644 +--- a/networking/wget.c ++++ b/networking/wget.c +@@ -137,6 +137,8 @@ + #endif + + ++#define SSL_SUPPORTED (ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER) ++ + struct host_info { + char *allocated; + const char *path; +@@ -147,7 +149,7 @@ struct host_info { + }; + static const char P_FTP[] ALIGN1 = "ftp"; + static const char P_HTTP[] ALIGN1 = "http"; +-#if ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER ++#if SSL_SUPPORTED + static const char P_HTTPS[] ALIGN1 = "https"; + #endif + +@@ -448,7 +450,7 @@ static void parse_url(const char *src_url, struct host_info *h) + if (strcmp(url, P_FTP) == 0) { + h->port = bb_lookup_port(P_FTP, "tcp", 21); + } else +-#if ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER ++#if SSL_SUPPORTED + if (strcmp(url, P_HTTPS) == 0) { + h->port = bb_lookup_port(P_HTTPS, "tcp", 443); + h->protocol = P_HTTPS; +@@ -1089,12 +1091,17 @@ static void download_one_url(const char *url) + } + + fflush(sfp); +- /* If we use SSL helper, keeping our end of the socket open for writing +- * makes our end (i.e. the same fd!) readable (EAGAIN instead of EOF) +- * even after child closes its copy of the fd. +- * This helps: +- */ +- shutdown(fileno(sfp), SHUT_WR); ++ ++#if SSL_SUPPORTED ++ if (target.protocol == P_HTTPS) { ++ /* If we use SSL helper, keeping our end of the socket open for writing ++ * makes our end (i.e. the same fd!) readable (EAGAIN instead of EOF) ++ * even after child closes its copy of the fd. ++ * This helps: ++ */ ++ shutdown(fileno(sfp), SHUT_WR); ++ } ++#endif + + /* + * Retrieve HTTP response line and check for "200" status code. -- 2.11.0