aports/main/busybox/0001-wget-add-header-Accept.patch
Sören Tempel 531e69840c main/busybox: upgrade to 1.37.0
Not a lot of big changes in this release, mostly code shrinks and bug
fixes here and there. Hence, I don't expect too much breakage. Most patches
applied as is and didn't require any changes either. Nonetheless, I
rebased the entire patchset and removed patches that were backported.

The 0001-modutils-check-ELF-header-before-calling-finit_modul.patch
should be superseded by an upstream modutils change which checks that
if the loaded module file path ends in .ko and if not attempts to
uncompress it first. Thereby preventing compressed modules to be
passed to the kernel and causing a weird error to be emitted. Therefore,
this patch was removed

See: https://git.busybox.net/busybox/commit/?id=af5277f883e8fc2e0236aa9ecc5115ecaffd0ccb
2024-10-20 10:16:15 +00:00

75 lines
3.1 KiB
Diff

From dc39a6edc4a04ff40667fb366766710078f9f9d7 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 11 Mar 2024 12:47:15 +0100
Subject: [PATCH] wget: add header Accept: */*
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some servers (like https://netfilter.org) returns failure if the Accept
header is missing. Both GNU wget and curl adds this header, so make
busybox do the same.
fixes: https://bugs.busybox.net/show_bug.cgi?id=15982
function old new delta
wget_main 3120 3144 +24
.rodata 79296 79310 +14
wget_user_headers 76 84 +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 46/0) Total: 46 bytes
text data bss dec hex filename
825278 14260 2008 841546 cd74a busybox_old
825324 14260 2008 841592 cd778 busybox_unstripped
---
networking/wget.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/networking/wget.c b/networking/wget.c
index ec3767793..0cc25da17 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -212,14 +212,16 @@ enum {
HDR_USER_AGENT = (1<<1),
HDR_RANGE = (1<<2),
HDR_CONTENT_TYPE = (1<<3),
- HDR_AUTH = (1<<4) * ENABLE_FEATURE_WGET_AUTHENTICATION,
- HDR_PROXY_AUTH = (1<<5) * ENABLE_FEATURE_WGET_AUTHENTICATION,
+ HDR_ACCEPT = (1<<4),
+ HDR_AUTH = (1<<5) * ENABLE_FEATURE_WGET_AUTHENTICATION,
+ HDR_PROXY_AUTH = (1<<6) * ENABLE_FEATURE_WGET_AUTHENTICATION,
};
static const char wget_user_headers[] ALIGN1 =
"Host:\0"
"User-Agent:\0"
"Range:\0"
"Content-Type:\0"
+ "Accept:\0"
# if ENABLE_FEATURE_WGET_AUTHENTICATION
"Authorization:\0"
"Proxy-Authorization:\0"
@@ -229,6 +231,7 @@ static const char wget_user_headers[] ALIGN1 =
# define USR_HEADER_USER_AGENT (G.user_headers & HDR_USER_AGENT)
# define USR_HEADER_RANGE (G.user_headers & HDR_RANGE)
# define USR_HEADER_CONTENT_TYPE (G.user_headers & HDR_CONTENT_TYPE)
+# define USR_HEADER_ACCEPT (G.user_headers & HDR_ACCEPT)
# define USR_HEADER_AUTH (G.user_headers & HDR_AUTH)
# define USR_HEADER_PROXY_AUTH (G.user_headers & HDR_PROXY_AUTH)
#else /* No long options, no user-headers :( */
@@ -236,6 +239,7 @@ static const char wget_user_headers[] ALIGN1 =
# define USR_HEADER_USER_AGENT 0
# define USR_HEADER_RANGE 0
# define USR_HEADER_CONTENT_TYPE 0
+# define USR_HEADER_ACCEPT 0
# define USR_HEADER_AUTH 0
# define USR_HEADER_PROXY_AUTH 0
#endif
@@ -1234,6 +1238,8 @@ static void download_one_url(const char *url)
SENDFMT(sfp, "Host: %s\r\n", target.host);
if (!USR_HEADER_USER_AGENT)
SENDFMT(sfp, "User-Agent: %s\r\n", G.user_agent);
+ if (!USR_HEADER_ACCEPT)
+ SENDFMT(sfp, "Accept: */*\r\n");
/* Ask server to close the connection as soon as we are done
* (IOW: we do not intend to send more requests)