Skip to contentSkip to conversation

busybox: add upstream post-1.26.2 fixes

PATCH New Peter Korsgaard 1 participant 2 messages Oct 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 busybox: add upstream post-1.26.2 fixes

---
 ...r-brain-damaged-HTTP-servers.-Closes-9471.patch |  87 ++++
 ...rly-use-CDF-to-find-compressed-files.-Clo.patch | 494 ++++++++++++++++++++
 .../0005-typo-fix-in-config-help-text.patch        |  27 ++
 ...e-now-pointless-lseek-which-returns-curre.patch |  50 ++
 ...t-use-CDF.extra_len-read-local-file-heade.patch | 509 +++++++++++++++++++++
 ...0008-httpd-fix-handling-of-range-requests.patch |  27 ++
 6 files changed, 1194 insertions(+)
 create mode 100644 package/busybox/0003-wget-fix-for-brain-damaged-HTTP-servers.-Closes-9471.patch
 create mode 100644 package/busybox/0004-unzip-properly-use-CDF-to-find-compressed-files.-Clo.patch
 create mode 100644 package/busybox/0005-typo-fix-in-config-help-text.patch
 create mode 100644 package/busybox/0006-unzip-remove-now-pointless-lseek-which-returns-curre.patch
 create mode 100644 package/busybox/0007-unzip-do-not-use-CDF.extra_len-read-local-file-heade.patch
 create mode 100644 package/busybox/0008-httpd-fix-handling-of-range-requests.patch
package/busybox/0003-wget-fix-for-brain-damaged-HTTP-servers.-Closes-9471.patch new file +87 -0
new file mode 100644
index 0000000000..a39bc894ed
@@ -0,0 +1,87 @@
+From dac762a702d01c8c2d42135795cc9bf23ff324a2 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Wed, 11 Jan 2017 20:16:45 +0100
+Subject: [PATCH] wget: fix for brain-damaged HTTP servers. Closes 9471
+
+write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget\r\nConnection: close\r\n\r\n", 74) = 74
+shutdown(3, SHUT_WR)    = 0
+alarm(900)              = 900
+read(3, "", 1024)       = 0
+write(2, "wget: error getting response\n", 29) = 29
+exit(1)
+
+The peer simply does not return anything. It closes its connection.
+
+Probably it detects wget closing its writing end: shutdown(3, SHUT_WR).
+
+The point it, closing write side of the socket is _valid_ for HTTP.
+wget sent the full request, it won't be sending anything more:
+it will only receive the response, and that's it.
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+Signed-off-by: Peter Korsgaard <[email protected]>
+---
+ networking/wget.c | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/networking/wget.c b/networking/wget.c
+index b082a0f59..afb09f587 100644
+--- a/networking/wget.c
++++ b/networking/wget.c
+@@ -141,6 +141,8 @@
+ #endif
+ 
+ 
++#define SSL_SUPPORTED (ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER)
++
+ struct host_info {
+ 	char *allocated;
+ 	const char *path;
+@@ -151,7 +153,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
+ 
+@@ -452,7 +454,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;
+@@ -1093,12 +1095,20 @@ 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);
++
++/* Tried doing this unconditionally.
++ * Cloudflare and nginx/1.11.5 are shocked to see SHUT_WR on non-HTTPS.
++ */
++#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
+
package/busybox/0004-unzip-properly-use-CDF-to-find-compressed-files.-Clo.patch new file +494 -0

494 lines not on this page · raw message

package/busybox/0005-typo-fix-in-config-help-text.patch new file +27 -0
new file mode 100644
index 0000000000..33b91707ec
@@ -0,0 +1,27 @@
+From f8692dc6a0035788a83821fa18b987d8748f97a7 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Thu, 5 Jan 2017 11:47:28 +0100
+Subject: [PATCH] typo fix in config help text
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+Signed-off-by: Peter Korsgaard <[email protected]>
+---
+ archival/unzip.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/archival/unzip.c b/archival/unzip.c
+index edef22f75..f1726439d 100644
+--- a/archival/unzip.c
++++ b/archival/unzip.c
+@@ -31,7 +31,7 @@
+ //config:	depends on UNZIP
+ //config:	help
+ //config:	  If you know that you only need to deal with simple
+-//config:	  ZIP files without deleted/updated files, SFX archves etc,
++//config:	  ZIP files without deleted/updated files, SFX archives etc,
+ //config:	  you can reduce code size by unselecting this option.
+ //config:	  To support less trivial ZIPs, say Y.
+ 
+-- 
+2.11.0
+
package/busybox/0006-unzip-remove-now-pointless-lseek-which-returns-curre.patch new file +50 -0

50 lines not on this page · raw message

package/busybox/0007-unzip-do-not-use-CDF.extra_len-read-local-file-heade.patch new file +509 -0

509 lines not on this page · raw message

package/busybox/0008-httpd-fix-handling-of-range-requests.patch new file +27 -0
new file mode 100644
index 0000000000..3b9d70f742
@@ -0,0 +1,27 @@
+From 4316dff48aacb29307e1b52cb761fef603759b9d Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <[email protected]>
+Date: Mon, 18 Sep 2017 13:09:11 +0200
+Subject: [PATCH] httpd: fix handling of range requests
+
+Signed-off-by: Denys Vlasenko <[email protected]>
+Signed-off-by: Peter Korsgaard <[email protected]>
+---
+ networking/httpd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/networking/httpd.c b/networking/httpd.c
+index d301d598d..84d819723 100644
+--- a/networking/httpd.c
++++ b/networking/httpd.c
+@@ -2337,7 +2337,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
+ 			if (STRNCASECMP(iobuf, "Range:") == 0) {
+ 				/* We know only bytes=NNN-[MMM] */
+ 				char *s = skip_whitespace(iobuf + sizeof("Range:")-1);
+-				if (is_prefixed_with(s, "bytes=") == 0) {
++				if (is_prefixed_with(s, "bytes=")) {
+ 					s += sizeof("bytes=")-1;
+ 					range_start = BB_STRTOOFF(s, &s, 10);
+ 					if (s[0] != '-' || range_start < 0) {
+-- 
+2.11.0
+
Signature · 1 line
2.11.0