wget user agent?...

Csaba Henk csaba-ml at creo.hu
Mon Aug 21 14:46:57 UTC 2006


Hi, I'd like to adjust the User-Agent header when using BB wget (there are some strange servers, which refuse clients reporting themselves as wget -- see eg.
http://www.freebsd.org/cgi/cvsweb.cgi/projects/csup/csup.tar.gz?tarball=1).

Currently this is not possible. Using "--header 'User-Agent: foobar'"
will add another User-Agent header and keep the one with "Wget" in it
(hence the above server will still refuse me). I'd post some code which
could help here, if BB developers were willing to commit it. However, I
can imagine more than one approach:

1) add a -U/--user-agent option like original wget has it;
2) automaticly enforce uniqueness of header field names (by discarding
   all but one fields with the same name);
3) add an option to control enforcing uniqueness of field names.

(Orig. wget doesn't seem to do anything like 2 or 3.)

Cf. rfc2616 [HTTP 1/1]: 

  "4.2 Message Headers
  [...]
  Multiple message-header fields with the same field-name MAY be
  present in a message if and only if the entire field-value for that
  header field is defined as a comma-separated list [i.e., #(values)].
  It MUST be possible to combine the multiple header fields into one
  "field-name: field-value" pair, without changing the semantics of the
  message, by appending each subsequent field-value to the first, each
  separated by a comma. The order in which header fields with the same
  field-name are received is therefore significant to the interpretation
  of the combined field value, and thus a proxy MUST NOT change the
  order of these field values when a message is forwarded."

What would be the preferred approach?

Csaba




More information about the busybox mailing list