Bug 184507 - [patch] [libfetch] allow hiding User-Agent with empty string
Summary: [patch] [libfetch] allow hiding User-Agent with empty string
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Some People
Assignee: Dag-Erling Smørgrav
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-05 00:00 UTC by Jan Beich
Modified: 2014-09-08 09:41 UTC (History)
3 users (show)

See Also:


Attachments
noua.diff (1.20 KB, patch)
2013-12-05 00:00 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2013-12-05 00:00:00 UTC
In some situations it may be desirable to completely hide User-Agent field
when fetching a file e.g., when using over Tor.

How-To-Repeat: $ sudo nc -kl 0 80 &

# before
$ HTTP_USER_AGENT= fetch http://0
GET / HTTP/1.1
Host: 0
Accept: */*
User-Agent: fetch libfetch/2.0
Connection: close
^C

# after
$ HTTP_USER_AGENT= fetch http://0
GET / HTTP/1.1
Host: 0
Accept: */*
Connection: close
^C

# other download tools

$ curl -A "" http://0
GET / HTTP/1.1
Host: 0
Accept: */*
^C

$ wget -U "" http://0 2>/dev/null
GET / HTTP/1.1
Accept: */*
Host: 0
Connection: Keep-Alive
^C
Comment 1 commit-hook freebsd_committer 2014-06-05 20:27:42 UTC
A commit references this bug:

Author: des
Date: Thu Jun  5 20:27:17 UTC 2014
New revision: 267127
URL: http://svnweb.freebsd.org/changeset/base/267127

Log:
  If HTTP_USER_AGENT is defined but empty, don't send User-Agent at all.

  PR:		184507
  Submitted by:	jbeich@tormail.org (with modifications)
  MFC after:	1 week

Changes:
  head/lib/libfetch/fetch.3
  head/lib/libfetch/http.c
Comment 2 Dag-Erling Smørgrav freebsd_committer 2014-09-08 09:41:41 UTC
Fixed on 2014-08-24 in r270460 (stable/10) and r270461 (stable/9)