Bug 23067

Summary: fetch in FreeBSD 4.2 does not work with FTP proxy
Product: Base System Reporter: tarjei.jensen <tarjei.jensen>
Component: i386Assignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description tarjei.jensen 2000-11-24 13:00:00 UTC
When I used 4.1 I could set FTP_PASSIVE_MODE=NO and FTP_PROXY=our_proxy and I could get the make program in ports to fetch files for me.

With 4.2 and the same setup, the fetch stuff seems to try to use the ftp proxy as a http proxy. When I use fetch -v it says that it connects to port 80 on the ftp proxy. It is supposed to use port 21 and log in as user@remote_host.

I only set FTP_PASSIVE_MODE=OFF and FTP_PROXY=our_proxy. I set no other variable which fetch uses.

Fix: 

Write my own fetch program!
How-To-Repeat: It is there all the time.
Comment 1 Peter Pentchev 2000-11-24 13:05:59 UTC
On Fri, Nov 24, 2000 at 04:55:36AM -0800, tarjei.jensen@kvaerner.com wrote:
> 
> >Number:         23067
> >Category:       i386
> >Synopsis:       fetch in FreeBSD 4.2 does not work with FTP proxy
[snip]
> >Environment:
> FreeBSD testmaskin.kogfd.kvaerner.com 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000     jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC  i386
> 
> >Description:
> When I used 4.1 I could set FTP_PASSIVE_MODE=NO and FTP_PROXY=our_proxy and I could get the make program in ports to fetch files for me.
> 
> With 4.2 and the same setup, the fetch stuff seems to try to use the ftp proxy as a http proxy. When I use fetch -v it says that it connects to port 80 on the ftp proxy. It is supposed to use port 21 and log in as user@remote_host.
> 
> I only set FTP_PASSIVE_MODE=OFF and FTP_PROXY=our_proxy. I set no other variable which fetch uses.
> >How-To-Repeat:
> It is there all the time.
> >Fix:
> Write my own fetch program!

Which port exactly are you trying to fetch?  Can you paste the full output
of 'make fetch' in that port's directory?

G'luck,
Peter

-- 
This sentence no verb.
Comment 2 Peter Pentchev 2000-11-24 15:59:21 UTC
I should think this PR may safely be closed now, what with the following
exchange with the originator that took place in private mail.

G'luck,
Peter

-- 
No language can express every thought unambiguously, least of all this one.

On Fri, Nov 24, 2000 at 03:51:42PM -0000, Tarjei.Jensen@kvaerner.com wrote:
> That did it!
> 
> FTP_PROXY=ftp://our_proxy worked.
> 
> Using FTP_PROXY=our_proxy:21 did not work.
> 
> Thanks!
> 
> I suppose you will have to fix the documentation to reflect the changes in
> the fetch library.
> 
> That was rapid solving of a problem.
> 
> Greetings,
> 
> > -----Original Message-----
> > From: Peter Pentchev [mailto:roam@orbitel.bg]
> > Sent: 24. november 2000 16:00
> > To: Jensen, Tarjei KOGAS
> > Subject: Re: i386/23067: fetch in FreeBSD 4.2 does not work with FTP
> > proxy
> > 
> > 
> > On Fri, Nov 24, 2000 at 04:49:15PM +0200, Peter Pentchev wrote:
> > > Alright, can you try the same with FTP_PROXY=your_proxy:21?
> > > It seems that fetch defaults to using port 80 if no port is 
> > specified.
> > 
> > To be a bit more precise - since revision 1.51 of 
> > src/lib/libfetch/ftp.c,
> > which was MFC'd just before 4.2-RELEASE, libfetch now takes HTTP to be
> > the default scheme if no scheme is specified.  You *can* specify a FTP
> > scheme in your FTP_PROXY variable by using the ftp:// prefix; 
> > now I'm not
> > so sure if using hostname:21 would work and not be treated as an HTTP
> > connection to port 21.
> > 
> > So.. another suggestion - try FTP_PROXY=ftp://your_proxy and see if
> > that helps.
Comment 3 Peter Pentchev freebsd_committer freebsd_triage 2000-11-24 16:00:12 UTC
State Changed
From-To: open->closed

Originator was satisfied with specifying FTP_PROXY=ftp://hostname.
Comment 4 des 2000-11-26 16:01:41 UTC
tarjei.jensen@kvaerner.com writes:
> With 4.2 and the same setup, the fetch stuff seems to try to use the
> ftp proxy as a http proxy. When I use fetch -v it says that it
> connects to port 80 on the ftp proxy. It is supposed to use port 21
> and log in as user@remote_host.

RTFM.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org
Comment 5 Peter Pentchev 2000-11-26 17:18:13 UTC
On Sun, Nov 26, 2000 at 08:10:03AM -0800, Dag-Erling Smorgrav wrote:
> The following reply was made to PR i386/23067; it has been noted by GNATS.
> 
> From: Dag-Erling Smorgrav <des@ofug.org>
> To: tarjei.jensen@kvaerner.com
> Cc: freebsd-gnats-submit@FreeBSD.ORG
> Subject: Re: i386/23067: fetch in FreeBSD 4.2 does not work with FTP proxy
> Date: 26 Nov 2000 17:01:41 +0100
> 
>  tarjei.jensen@kvaerner.com writes:
>  > With 4.2 and the same setup, the fetch stuff seems to try to use the
>  > ftp proxy as a http proxy. When I use fetch -v it says that it
>  > connects to port 80 on the ftp proxy. It is supposed to use port 21
>  > and log in as user@remote_host.
>  
>  RTFM.

There was no call for that now, was there - this PR is already closed
to the originator's satisfaction - explicitly specifying the URL schema
as ftp:// does the trick.  However, your remark begs the question - *which*
manual?  Neither the fetch(1), nor the fetch(3) manpage on -stable suggests
that HTTP is used as the default schema - I was able to find out this was
a schema problem only by grepping for FTP_PROXY in src/lib/libfetch and
scanning the annotated CVS file around the found lines :(

And just to show that I'm writing this in good faith, not to slight or
anything, attached is a proposed patch to fetch.1 to document this HTTP
default.  The patch is against -stable, but it also applies cleanly to
-current with 1-line fuzz.  And btw - since I am not at all comfortable
with mdoc - is .Em the right tag to use for the ftp:// prefix on the last
line?  I tried using .Pf, but it would not allow me to glue a dot
at the end :(

On second thoughts.. wouldn't this be better documented in fetch(3)..
But still, I'd think it deserves mentioning in fetch(1).

G'luck,
Peter

-- 
If the meanings of 'true' and 'false' were switched, then this sentence wouldn't be false.

Index: fetch.1
===================================================================
RCS file: /home/ncvs/src/usr.bin/fetch/fetch.1,v
retrieving revision 1.33.2.4
diff -u -r1.33.2.4 fetch.1
--- fetch.1	2000/07/21 11:20:05	1.33.2.4
+++ fetch.1	2000/11/26 17:12:38
@@ -238,3 +238,13 @@
 and
 .Fl f
 options and specify URLs on the command line.
+.Pp
+All URL's processed by
+.Nm
+(including those specified on the command line, or those given in the
+.Ev FTP_PROXY
+and
+.Ev HTTP_PROXY
+environment variables) are considered by default to be HTTP URL's,
+unless explicitly given an FTP schema by prefixing them with
+.Em ftp:// .