Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 1998 00:20:27 -0400 (EDT)
From:      dchapes@ddm.on.ca
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/6371: fetch(1) uses HTTP_PROXY for ftp requests when FTP_PROXY undefined
Message-ID:  <199804210420.AAA08216@squigy.ddm.on.ca>

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

>Number:         6371
>Category:       bin
>Synopsis:       fetch(1) uses HTTP_PROXY for ftp requests when FTP_PROXY undefined
>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:   Mon Apr 20 21:30:01 PDT 1998
>Last-Modified:
>Originator:     Dave Chapeskie
>Organization:
DDM Consulting
>Release:        FreeBSD 2.2.5-STABLE i386
>Environment:
FreeBSD-2.2.6

>Description:

I have a local Squid cache which I want fetch(1) to use for HTTP
requests but not for FTP requests (the cache has ftp access disabled).
If I just set the HTTP_PROXY variable fetch(1) uses the proxy for
both.  I couldn't find an easy way to tell fetch(1) not to use the proxy
without undefining HTTP_PROXY.

>How-To-Repeat:

% setenv HTTP_PROXY somewhere
% unsetenv FTP_PROXY
% fetch ftp://somehost/some/path

fetch(1) will use the HTTP_PROXY for the ftp request.


>Fix:

The following three line change causes fetch(1) to not use any proxy if
the FTP_PROXY env variable exists but is null.

It might be better to use a special value like "NONE" or change the
semantics of having HTTP_PROXY defined without FTP_PROXY defined but
this is a simpler change that doesn't impact people who don't set
FTP_PROXY yet want fetch(1) to use the HTTP_PROXY.

With this patch:
% setenv HTTP_PROXY somewhere
% setenv FTP_PROXY
% fetch ftp://somehost/some/path

fetch(1) will NOT use any proxy for the ftp request.


Index: ftp.c
===================================================================
RCS file: /cvs/FreeBSD/src/usr.bin/fetch/ftp.c,v
retrieving revision 1.3.2.5
diff -u -r1.3.2.5 ftp.c
--- ftp.c	1997/10/08 18:44:07	1.3.2.5
+++ ftp.c	1997/12/11 20:51:49
@@ -250,6 +250,9 @@
 	struct ftp_state *ftps;
 
 	hostname = getenv("FTP_PROXY");
+	if (hostname[0]=='\0')
+		return ftp_parse(fs,uri);
+
 	port = strchr(hostname, ':');
 	if (port == 0) {
 		portno = 21;
>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?199804210420.AAA08216>