summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-09-02 15:30:26 +0000
committerBernhard Reutner-Fischer2006-09-02 15:30:26 +0000
commitbfbc4ebf4045b834ed080e7b6f0ebe2c789fb5f1 (patch)
tree4d9e3ec01f0509f3e6b6e4ccaf9f0ce227011ae7 /networking
parent686298d6fb155deb4490eb609a19c59d97b1e2f6 (diff)
downloadbusybox-bfbc4ebf4045b834ed080e7b6f0ebe2c789fb5f1.zip
busybox-bfbc4ebf4045b834ed080e7b6f0ebe2c789fb5f1.tar.gz
- patch from Csaba Henk to make the "User-Agent" header field configurable.
Diffstat (limited to 'networking')
-rw-r--r--networking/wget.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 42fbeaf..7555152 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -132,6 +132,7 @@ static char *base64enc(unsigned char *p, char *buf, int len) {
#define WGET_OPT_HEADER 16
#define WGET_OPT_PREFIX 32
#define WGET_OPT_PROXY 64
+#define WGET_OPT_USER_AGENT 128
#if ENABLE_FEATURE_WGET_LONG_OPTIONS
static const struct option wget_long_options[] = {
@@ -142,6 +143,7 @@ static const struct option wget_long_options[] = {
{ "header", 1, NULL, 131 },
{ "directory-prefix",1, NULL, 'P' },
{ "proxy", 1, NULL, 'Y' },
+ { "user-agent", 1, NULL, 'U' },
{ 0, 0, 0, 0 }
};
#endif
@@ -172,6 +174,7 @@ int wget_main(int argc, char **argv)
int quiet_flag = FALSE; /* Be verry, verry quiet... */
int use_proxy = 1; /* Use proxies if env vars are set */
char *proxy_flag = "on"; /* Use proxies if env vars are set */
+ char *user_agent = "Wget"; /* Content of the "User-Agent" header field */
/*
* Crack command line.
@@ -180,9 +183,9 @@ int wget_main(int argc, char **argv)
#if ENABLE_FEATURE_WGET_LONG_OPTIONS
bb_applet_long_options = wget_long_options;
#endif
- opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:",
+ opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:U:",
&fname_out, &headers_llist,
- &dir_prefix, &proxy_flag);
+ &dir_prefix, &proxy_flag, &user_agent);
if (opt & WGET_OPT_CONTINUE) {
++do_continue;
}
@@ -317,7 +320,8 @@ int wget_main(int argc, char **argv)
fprintf(sfp, "GET /%s HTTP/1.1\r\n", target.path);
}
- fprintf(sfp, "Host: %s\r\nUser-Agent: Wget\r\n", target.host);
+ fprintf(sfp, "Host: %s\r\nUser-Agent: %s\r\n", target.host,
+ user_agent);
#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
if (target.user) {