Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 May 2001 22:44:19 +0100 (BST)
From:      eoin@maths.tcd.ie
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/27669: Add a HTTP_USER_AGENT environment variable to libfetch
Message-ID:  <200105262244.aa87222@gosset.maths.tcd.ie>

next in thread | raw e-mail | index | archive | help

>Number:         27669
>Category:       bin
>Synopsis:       Add a HTTP_USER_AGENT environment variable to libfetch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 26 14:50:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Eoin Lawless
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Trinity College Dublin
>Environment:

4.2 Stable

>Description:

Some HTTP servers and some HTTP proxy servers restrict client access
to a list of known browsers. This patch allows the User Agent variable
to be set so that fetch, etc, can be used in these situations. One
example of such a website is http://www.webclimbing.com

>How-To-Repeat:

	

>Fix:


--- http.c.orig	Sat May 26 20:30:53 2001
+++ http.c	Sat May 26 22:39:32 2001
@@ -768,7 +768,10 @@
 	    _http_cmd(fd, "Host: %s", host);
 	else
 	    _http_cmd(fd, "Host: %s:%d", host, url->port);
-	_http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, __progname);
+	if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0')
+	    _http_cmd(fd, "User-Agent: %s ", p);
+	else 
+	    _http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, __progname);
 	if (url->offset)
 	    _http_cmd(fd, "Range: bytes=%lld-", url->offset);
 	_http_cmd(fd, "Connection: close");
--- fetch.3.orig	Sat May 26 20:30:53 2001
+++ fetch.3	Sat May 26 22:42:11 2001
@@ -477,6 +477,10 @@
 This variable is used if and only if connected to an HTTP proxy, and
 is ignored if a user and/or a password were specified in the proxy
 URL.
+.It Ev HTTP_USER_AGENT
+Specifies an alternative User-Agent when making a HTTP request. This
+can be useful when working with HTTP servers and HTTP proxy servers
+that only accept requests from known clients.
 .El
 .Sh SEE ALSO
 .Xr fetch 1 ,
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105262244.aa87222>