Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Mar 2001 11:32:31 -0500 (EST)
From:      mike@pelley.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Message-ID:  <200103021632.f22GWVh00622@pelley.americas.nokia.com>

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

>Number:         25494
>Category:       bin
>Synopsis:       fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 02 08:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Mike Pelley
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Foundation
>Environment:

	

>Description:

	Environment variables used to support proxies should be consistent
across applications.  ftp and lynx support ftp_proxy - fetch should do the
same.  This also affects HTTP_PROXY/http_proxy.

>How-To-Repeat:

	man 3 fetch - compare to man ftp.

>Fix:

	Change fetch to support lowercase ftp_proxy/http_proxy as well,
and change man page to only mention the lowercase versions.  I also think
it's worth duplicating the environment variables from fetch(3) on
fetch(1), but I have not done that.  Following changes are against
STABLE:

Index: ftp.c
===================================================================
RCS file: /home/ncvs/src/lib/libfetch/ftp.c,v
retrieving revision 1.16.2.18
diff -u -r1.16.2.18 ftp.c
--- ftp.c	2001/02/22 16:23:52	1.16.2.18
+++ ftp.c	2001/03/01 23:23:05
@@ -875,10 +875,11 @@
     struct url *purl;
     char *p;
     
-    if (((p = getenv("FTP_PROXY")) || (p = getenv("HTTP_PROXY"))) &&
+    if (((p = getenv("FTP_PROXY")) || (p = getenv("ftp_proxy")) ||
+	(p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
 	*p && (purl = fetchParseURL(p)) != NULL) {
 	if (!*purl->scheme) {
-	    if (getenv("FTP_PROXY"))
+	    if (getenv("FTP_PROXY") || getenv("ftp_proxy"))
 		strcpy(purl->scheme, SCHEME_FTP);
 	    else
 		strcpy(purl->scheme, SCHEME_HTTP);
Index: http.c
===================================================================
RCS file: /home/ncvs/src/lib/libfetch/http.c,v
retrieving revision 1.13.2.12
diff -u -r1.13.2.12 http.c
--- http.c	2000/11/10 10:40:58	1.13.2.12
+++ http.c	2001/03/01 23:23:05
@@ -651,7 +651,8 @@
     struct url *purl;
     char *p;
     
-    if ((p = getenv("HTTP_PROXY")) && (purl = fetchParseURL(p))) {
+    if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
+	(purl = fetchParseURL(p))) {
 	if (!*purl->scheme)
 	    strcpy(purl->scheme, SCHEME_HTTP);
 	if (!purl->port)
Index: fetch.3
===================================================================
RCS file: /home/ncvs/src/lib/libfetch/fetch.3,v
retrieving revision 1.11.2.14
diff -u -r1.11.2.14 fetch.3
--- fetch.3	2001/02/22 16:24:24	1.11.2.14
+++ fetch.3	2001/03/01 23:23:05
@@ -430,7 +430,7 @@
 .It Ev FTP_PASSWORD
 Default FTP password if the remote server requests one and none was
 provided in the URL.
-.It Ev FTP_PROXY
+.It Ev ftp_proxy
 URL of the proxy to use for FTP requests.
 The document part is ignored.
 FTP and HTTP proxies are supported; if no scheme is specified, FTP is
@@ -447,7 +447,7 @@
 .Pp
 If this variable is set to an empty string, no proxy will be used for
 FTP requests, even if the
-.Ev HTTP_PROXY
+.Ev http_proxy
 variable is set.
 .It Ev HTTP_AUTH
 Specifies HTTP authorization parameters as a colon-separated list of
@@ -461,14 +461,14 @@
 .Pp
 This variable is only used if the server requires authorization and
 no user name or password was specified in the URL.
-.It Ev HTTP_PROXY
+.It Ev http_proxy
 URL of the proxy to use for HTTP requests.
 The document part is ignored.
 Only HTTP proxies are supported for HTTP requests.
 If no port number is specified, the default is 3128.
 .Pp
 Note that this proxy will also be used for FTP documents, unless the
-.Ev FTP_PROXY
+.Ev ftp_proxy
 variable is set.
 .It Ev HTTP_PROXY_AUTH
 Specifies authorization parameters for the HTTP proxy in the same
@@ -553,9 +553,9 @@
 and FTP proxy support.
 .Pp
 There's no way to select a proxy at run-time other than setting the
-.Ev HTTP_PROXY
+.Ev http_proxy
 or
-.Ev FTP_PROXY
+.Ev ftp_proxy
 environment variables as appropriate.
 .Pp
 .Nm libfetch
>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?200103021632.f22GWVh00622>