aboutsummaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 42fbeaf99..755515262 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -132,6 +132,7 @@ static char *base64enc(unsigned char *p, char *buf, int len) {
132#define WGET_OPT_HEADER 16 132#define WGET_OPT_HEADER 16
133#define WGET_OPT_PREFIX 32 133#define WGET_OPT_PREFIX 32
134#define WGET_OPT_PROXY 64 134#define WGET_OPT_PROXY 64
135#define WGET_OPT_USER_AGENT 128
135 136
136#if ENABLE_FEATURE_WGET_LONG_OPTIONS 137#if ENABLE_FEATURE_WGET_LONG_OPTIONS
137static const struct option wget_long_options[] = { 138static const struct option wget_long_options[] = {
@@ -142,6 +143,7 @@ static const struct option wget_long_options[] = {
142 { "header", 1, NULL, 131 }, 143 { "header", 1, NULL, 131 },
143 { "directory-prefix",1, NULL, 'P' }, 144 { "directory-prefix",1, NULL, 'P' },
144 { "proxy", 1, NULL, 'Y' }, 145 { "proxy", 1, NULL, 'Y' },
146 { "user-agent", 1, NULL, 'U' },
145 { 0, 0, 0, 0 } 147 { 0, 0, 0, 0 }
146}; 148};
147#endif 149#endif
@@ -172,6 +174,7 @@ int wget_main(int argc, char **argv)
172 int quiet_flag = FALSE; /* Be verry, verry quiet... */ 174 int quiet_flag = FALSE; /* Be verry, verry quiet... */
173 int use_proxy = 1; /* Use proxies if env vars are set */ 175 int use_proxy = 1; /* Use proxies if env vars are set */
174 char *proxy_flag = "on"; /* Use proxies if env vars are set */ 176 char *proxy_flag = "on"; /* Use proxies if env vars are set */
177 char *user_agent = "Wget"; /* Content of the "User-Agent" header field */
175 178
176 /* 179 /*
177 * Crack command line. 180 * Crack command line.
@@ -180,9 +183,9 @@ int wget_main(int argc, char **argv)
180#if ENABLE_FEATURE_WGET_LONG_OPTIONS 183#if ENABLE_FEATURE_WGET_LONG_OPTIONS
181 bb_applet_long_options = wget_long_options; 184 bb_applet_long_options = wget_long_options;
182#endif 185#endif
183 opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", 186 opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:U:",
184 &fname_out, &headers_llist, 187 &fname_out, &headers_llist,
185 &dir_prefix, &proxy_flag); 188 &dir_prefix, &proxy_flag, &user_agent);
186 if (opt & WGET_OPT_CONTINUE) { 189 if (opt & WGET_OPT_CONTINUE) {
187 ++do_continue; 190 ++do_continue;
188 } 191 }
@@ -317,7 +320,8 @@ int wget_main(int argc, char **argv)
317 fprintf(sfp, "GET /%s HTTP/1.1\r\n", target.path); 320 fprintf(sfp, "GET /%s HTTP/1.1\r\n", target.path);
318 } 321 }
319 322
320 fprintf(sfp, "Host: %s\r\nUser-Agent: Wget\r\n", target.host); 323 fprintf(sfp, "Host: %s\r\nUser-Agent: %s\r\n", target.host,
324 user_agent);
321 325
322#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION 326#ifdef CONFIG_FEATURE_WGET_AUTHENTICATION
323 if (target.user) { 327 if (target.user) {