From mike@pelley.americas.nokia.com  Fri Mar  2 08:34:23 2001
Return-Path: <mike@pelley.americas.nokia.com>
Received: from SMTP.Network-Alchemy.COM (Hydrogen.Network-Alchemy.COM [199.46.17.130])
	by hub.freebsd.org (Postfix) with SMTP id 8886F37B71B
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  2 Mar 2001 08:34:22 -0800 (PST)
	(envelope-from mike@pelley.americas.nokia.com)
Received: from pelley.americas.nokia.com ([172.18.72.127]) by Hydrogen.Network-Alchemy.COM via INTERNET ;
          Fri, 2 Mar 2001 08:33:36 PST
Received: (from mike@localhost)
	by pelley.americas.nokia.com (8.11.2/8.11.1) id f22GWVh00622;
	Fri, 2 Mar 2001 11:32:31 -0500 (EST)
	(envelope-from mike)
Message-Id: <200103021632.f22GWVh00622@pelley.americas.nokia.com>
Date: Fri, 2 Mar 2001 11:32:31 -0500 (EST)
From: mike@pelley.com
Reply-To: mike@pelley.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
X-Send-Pr-Version: 3.2

>Number:         25494
>Category:       bin
>Synopsis:       fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 02 08:40:01 PST 2001
>Closed-Date:    Thu Mar 15 15:55:41 PST 2001
>Last-Modified:  Thu Mar 15 15:56:11 PST 2001
>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:

From: Dag-Erling Smorgrav <des@ofug.org>
To: mike@pelley.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: 05 Mar 2001 16:03:15 +0100

 mike@pelley.com writes:
 > 	Change fetch to support lowercase ftp_proxy/http_proxy as well,
 > and change man page to only mention the lowercase versions.
 
 Is this really the correct fix? Does lynx really apply the exact same
 semantics to ftp_proxy / http_proxy as libfetch does do FTP_PROXY /
 HTTP_PROXY?
 
 (me, I'm tempted to say the correct fix is "don't use lynx, use w3m")
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org

From: "Mike Pelley" <mike@pelley.com>
To: "Dag-Erling Smorgrav" <des@ofug.org>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: Tue, 6 Mar 2001 21:00:27 -0500

 > Is this really the correct fix? Does lynx really apply the exact same
 > semantics to ftp_proxy / http_proxy as libfetch does do FTP_PROXY /
 > HTTP_PROXY?
 
 ftp is in the base system and it also uses ftp_proxy/http_proxy.  The use of
 these environment variables is very similar between the two (and lynx) as
 far as I can tell - but perhaps I'm missing something?
 
 I think consistency is important - it seems incovenient to have two
 variables that do the same thing.
 
 > (me, I'm tempted to say the correct fix is "don't use lynx, use w3m")
 
 This doesn't quite seem relevant, but ftp should be enough to justify it
 regardless.
 
 Mike.
 

From: Dag-Erling Smorgrav <des@ofug.org>
To: "Mike Pelley" <mike@pelley.com>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: 07 Mar 2001 03:05:24 +0100

 "Mike Pelley" <mike@pelley.com> writes:
 > ftp is in the base system and it also uses ftp_proxy/http_proxy.
 
 Only when talking HTTP, and there is already consensus for removing
 the (horribly useless and broken) HTTP code from ftp(1). It just
 hasn't been done yet.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org

From: "Mike Pelley" <mike@pelley.com>
To: "Dag-Erling Smorgrav" <des@ofug.org>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: Tue, 6 Mar 2001 21:40:26 -0500

 > > ftp is in the base system and it also uses ftp_proxy/http_proxy.
 >
 > Only when talking HTTP, and there is already consensus for removing
 > the (horribly useless and broken) HTTP code from ftp(1). It just
 > hasn't been done yet.
 
 I'm not familiar with those discussions - it does seem to provide me with
 the functionality I need behind the proxies at work but obviously there are
 other problems (although horribly useless and broken is not true for
 everyone).
 
 However, an attempt at consistency should be made.  It appears that wget,
 lynx, links and ftp use http_proxy, and w3m and libfetch use HTTP_PROXY.
 Supporting both in libfetch seems like a reasonable patch.
 
 Mike.
 

From: Dag-Erling Smorgrav <des@ofug.org>
To: "Mike Pelley" <mike@pelley.com>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: 07 Mar 2001 04:10:00 +0100

 "Mike Pelley" <mike@pelley.com> writes:
 > I'm not familiar with those discussions - it does seem to provide me with
 > the functionality I need behind the proxies at work but obviously there are
 > other problems (although horribly useless and broken is not true for
 > everyone).
 
 Trust me, it's horribly useless and broken. It's barely more
 functional than an HTTP/0.9 client - the only part of HTTP/1.0 it
 actually implements correctly is parsing the Content-Length header. It
 can't talk to virtual hosts (except through a proxy), and it can't
 fetch the output of a CGI script (no chunk decoder), to name only two
 major shortcomings.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org

From: "Mike Pelley" <mike@pelley.com>
To: "Dag-Erling Smorgrav" <des@ofug.org>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: Tue, 6 Mar 2001 22:32:30 -0500

 > Trust me, it's horribly useless and broken. It's barely more
 > functional than an HTTP/0.9 client - the only part of HTTP/1.0 it
 > actually implements correctly is parsing the Content-Length header. It
 > can't talk to virtual hosts (except through a proxy), and it can't
 > fetch the output of a CGI script (no chunk decoder), to name only two
 > major shortcomings.
 
 That's not horribly useless and broken - that's limited.  Oddly enough, none
 of these problems have caused me any trouble retrieving via HTTP.
 
 This is off-topic however.  I think the patch should be applied to improve
 consistency, but to each his own.
 
 Mike.
 

From: Dag-Erling Smorgrav <des@ofug.org>
To: "Mike Pelley" <mike@pelley.com>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: 07 Mar 2001 04:52:40 +0100

 "Mike Pelley" <mike@pelley.com> writes:
 > That's not horribly useless and broken - that's limited.  Oddly enough, none
 > of these problems have caused me any trouble retrieving via HTTP.
 
 You've probably never used it without a proxy.
 
 > This is off-topic however.  I think the patch should be applied to improve
 > consistency, but to each his own.
 
 A similar change will be committed within the hour.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org

From: "Mike Pelley" <mike@pelley.com>
To: "Dag-Erling Smorgrav" <des@ofug.org>
Cc: <FreeBSD-gnats-submit@FreeBSD.ORG>
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: Tue, 6 Mar 2001 23:12:09 -0500

 > You've probably never used it without a proxy.
 
 I often use it without a proxy - it's on my laptop.
 
 > A similar change will be committed within the hour.
 
 Cool!
 
 Mike.
 

From: Tony Finch <dot@dotat.at>
To: Dag-Erling Smorgrav <des@ofug.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: Wed, 7 Mar 2001 04:19:54 +0000

 Dag-Erling Smorgrav <des@ofug.org> wrote:
 > 
 > Trust me, it's horribly useless and broken. It's barely more
 > functional than an HTTP/0.9 client - the only part of HTTP/1.0 it
 > actually implements correctly is parsing the Content-Length header. It
 > can't talk to virtual hosts (except through a proxy), and it can't
 > fetch the output of a CGI script (no chunk decoder), to name only two
 > major shortcomings.
 
 It'll never see HTTP/1.1 chunked content encoding because it's an
 HTTP/1.0 client.
 
 Tony.
 -- 
 f.a.n.finch      fanf@covalent.net      dot@dotat.at
 VIKING NORTH UTSIRE SOUTH UTSIRE: SOUTHEASTERLY 5 INCREASING 7 OR GALE 8. RAIN
 LATER. GOOD BECOMING MODERATE.

From: Dag-Erling Smorgrav <des@ofug.org>
To: Tony Finch <dot@dotat.at>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/25494: fetch uses environment variable FTP_PROXY, ftp/lynx use ftp_proxy
Date: 07 Mar 2001 05:47:48 +0100

 Tony Finch <dot@dotat.at> writes:
 > It'll never see HTTP/1.1 chunked content encoding because it's an
 > HTTP/1.0 client.
 
 If only it were so well... I'd love this to be true, I'd be able to
 rip the chunk decoder out of libfetch so it wouln't need the
 (non-portable) funopen() interface. Unfortunately, the words "MUST
 NOT" do not seem to mean anything to server authors.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Thu Mar 15 15:00:20 PST 2001 
Responsible-Changed-Why:  
libfetch is mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25494 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Thu Mar 15 15:55:41 PST 2001 
State-Changed-Why:  
Support for {ftp,http}_proxy has been added in -CURRENT and -STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25494 
>Unformatted:
