[PATCH] support for User-Agent tuning for wget (mime attached)
Bernhard Fischer
rep.nop at aon.at
Thu Aug 31 12:53:22 UTC 2006
On Tue, Aug 29, 2006 at 11:16:57PM +0200, Csaba Henk wrote:
>Hi,
>
>I send the same "-U/--user-agent" patch here as earlier, but mime
>attached this time.
>
>I'm sorry for posting it as a separate thread -- I usually interact with
>the list via Gmane, so I could post this as a followup only if I had a
>newsreader which can do mime attachments. It's not the case now, and
>installing/configuring one would be more hassle than it's worth for.
>
>Csaba
>Index: networking/wget.c
>===================================================================
>--- networking/wget.c (revision 16010)
>+++ networking/wget.c (working copy)
>@@ -132,6 +132,9 @@
> #define WGET_OPT_HEADER 16
> #define WGET_OPT_PREFIX 32
> #define WGET_OPT_PROXY 64
>+#if ENABLE_FEATURE_WGET_USER_AGENT
>+#define WGET_OPT_USER_AGENT 128
>+#endif
>
> #if ENABLE_FEATURE_WGET_LONG_OPTIONS
> static const struct option wget_long_options[] = {
>@@ -142,6 +145,9 @@
> { "header", 1, NULL, 131 },
> { "directory-prefix",1, NULL, 'P' },
> { "proxy", 1, NULL, 'Y' },
>+#if ENABLE_FEATURE_WGET_USER_AGENT
>+ { "user-agent", 1, NULL, 'U' },
>+#endif
> { 0, 0, 0, 0 }
> };
> #endif
>@@ -172,6 +178,7 @@
> 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 +187,15 @@
> #if ENABLE_FEATURE_WGET_LONG_OPTIONS
> bb_applet_long_options = wget_long_options;
> #endif
>+#if ENABLE_FEATURE_WGET_USER_AGENT
>+ opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:U:",
>+ &fname_out, &headers_llist,
>+ &dir_prefix, &proxy_flag, &user_agent);
>+#else
Please use USE_FEATURE_WGET_USER_AGENT instead of adding the above #if
block.
OTOH, i'm not convinced that rob will be pleased if this goes into a
separate config option..
More information about the busybox
mailing list