vim: Update to latest patch level
[termux-packages] / packages / busybox / wget.c.patch
1 Apply fix for https://bugs.busybox.net/show_bug.cgi?id=9471 from git
2
3 diff --git a/networking/wget.c b/networking/wget.c
4 index c82086878..d5a92a950 100644
5 --- a/networking/wget.c
6 +++ b/networking/wget.c
7 @@ -137,6 +137,8 @@
8 #endif
9
10
11 +#define SSL_SUPPORTED (ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER)
12 +
13 struct host_info {
14 char *allocated;
15 const char *path;
16 @@ -147,7 +149,7 @@ struct host_info {
17 };
18 static const char P_FTP[] ALIGN1 = "ftp";
19 static const char P_HTTP[] ALIGN1 = "http";
20 -#if ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER
21 +#if SSL_SUPPORTED
22 static const char P_HTTPS[] ALIGN1 = "https";
23 #endif
24
25 @@ -448,7 +450,7 @@ static void parse_url(const char *src_url, struct host_info *h)
26 if (strcmp(url, P_FTP) == 0) {
27 h->port = bb_lookup_port(P_FTP, "tcp", 21);
28 } else
29 -#if ENABLE_FEATURE_WGET_OPENSSL || ENABLE_FEATURE_WGET_SSL_HELPER
30 +#if SSL_SUPPORTED
31 if (strcmp(url, P_HTTPS) == 0) {
32 h->port = bb_lookup_port(P_HTTPS, "tcp", 443);
33 h->protocol = P_HTTPS;
34 @@ -1089,12 +1091,17 @@ static void download_one_url(const char *url)
35 }
36
37 fflush(sfp);
38 - /* If we use SSL helper, keeping our end of the socket open for writing
39 - * makes our end (i.e. the same fd!) readable (EAGAIN instead of EOF)
40 - * even after child closes its copy of the fd.
41 - * This helps:
42 - */
43 - shutdown(fileno(sfp), SHUT_WR);
44 +
45 +#if SSL_SUPPORTED
46 + if (target.protocol == P_HTTPS) {
47 + /* If we use SSL helper, keeping our end of the socket open for writing
48 + * makes our end (i.e. the same fd!) readable (EAGAIN instead of EOF)
49 + * even after child closes its copy of the fd.
50 + * This helps:
51 + */
52 + shutdown(fileno(sfp), SHUT_WR);
53 + }
54 +#endif
55
56 /*
57 * Retrieve HTTP response line and check for "200" status code.