From owner-freebsd-bugs Sat May 26 14:50: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B20FC37B423 for ; Sat, 26 May 2001 14:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4QLo1981249; Sat, 26 May 2001 14:50:01 -0700 (PDT) (envelope-from gnats) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 3D01237B423 for ; Sat, 26 May 2001 14:44:21 -0700 (PDT) (envelope-from eoin@maths.tcd.ie) Received: from gosset.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 26 May 2001 22:44:20 +0100 (BST) Message-Id: <200105262244.aa87222@gosset.maths.tcd.ie> Date: Sat, 26 May 2001 22:44:19 +0100 (BST) From: eoin@maths.tcd.ie Reply-To: eoin@maths.tcd.ie To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/27669: Add a HTTP_USER_AGENT environment variable to libfetch Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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