# HG changeset patch # User Pascal Bellard # Date 1485333112 -3600 # Node ID 1bf436c396bcda1dafc28168818c722d2f7dc98f # Parent 9d5829b82b92f57fe57b089d842af384ef5d4908 busybox: add buf 9471 fix (for wget) diff -r 9d5829b82b92 -r 1bf436c396bc busybox/receipt --- a/busybox/receipt Wed Jan 25 03:21:58 2017 +0200 +++ b/busybox/receipt Wed Jan 25 09:31:52 2017 +0100 @@ -46,6 +46,7 @@ ftpd.u shutdown.u scriptreplay.u +bug9471.u EOT cp $stuff/$PACKAGE-${VERSION%.*}.config .config } diff -r 9d5829b82b92 -r 1bf436c396bc busybox/stuff/busybox-1.26-bug9471.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/busybox/stuff/busybox-1.26-bug9471.u Wed Jan 25 09:31:52 2017 +0100 @@ -0,0 +1,28 @@ +--- busybox-1.26.2/networking/wget.c ++++ busybox-1.26.2/networking/wget.c +@@ -1093,12 +1093,19 @@ + } + + 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 ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER ++ 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.