NetBSD Problem Report #8828
Received: (qmail 4804 invoked from network); 19 Nov 1999 22:08:21 -0000
Message-Id: <199911192204.OAA25717@nooksack.ldc.cs.wwu.edu>
Date: Fri, 19 Nov 1999 14:04:48 -0800 (PST)
From: mike@skew.org
Reply-To: mike@skew.org
To: gnats-bugs@gnats.netbsd.org
Subject: ftp(1) needs to send HTTP/1.1 Host: header
X-Send-Pr-Version: www-1.0
>Number: 8828
>Category: bin
>Synopsis: ftp(1) needs to send HTTP/1.1 Host: header
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lukem
>State: closed
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Nov 19 14:09:00 +0000 1999
>Closed-Date: Fri Nov 19 22:57:01 +0000 1999
>Last-Modified: Fri Nov 19 22:58:02 +0000 1999
>Originator: Mike Brown
>Release: actually, I'm using FreeBSD 3.2-RELEASE
>Organization:
>Environment:
FreeBSD chillout.skew.org 3.2-RELEASE FreeBSD 3.2-RELEASE #0: Sat Aug 7 10:25:47 MDT 1999 mike@chillout.skew.org:/usr/src/sys/compile/chillout i386
>Description:
ftp(1) does not send the HTTP/1.1 Host: header when retrieving from an http:// URL. This header was implemented on HTTP/1.0 servers for virtual hosting purposes and is commonly sent by clients as part of an HTTP/1.0 request. If you attempt to access an HTTP server when you only know its IP number, it will attempt to obtain the document from a default document root. Virtual hosting servers need to see the Host: header in order to know which root dir to use.
>How-To-Repeat:
*.apache.org sites all share the same IP number, but the document root for each site varies.
Therefore, this fails:
ftp http://xml.apache.org/dist/LICENSE.txt
>Fix:
*** fetch.c.old Tue Dec 16 01:58:15 1997
--- fetch.c Fri Nov 19 14:45:23 1999
***************
*** 236,243 ****
printf("Requesting %s\n", origline);
else
printf("Requesting %s (via %s)\n", origline, proxyenv);
! len = snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n",
! proxy ? "" : "/", path);
if (write(s, buf, len) < len) {
warn("Writing HTTP request");
goto cleanup_url_get;
--- 236,243 ----
printf("Requesting %s\n", origline);
else
printf("Requesting %s (via %s)\n", origline, proxyenv);
! len = snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\nHost: %s\r\n\r\n",
! proxy ? "" : "/", path, host);
if (write(s, buf, len) < len) {
warn("Writing HTTP request");
goto cleanup_url_get;
>Release-Note:
>Audit-Trail:
From: Mike Brown <mike@skew.org>
To: gnats-bugs@gnats.netbsd.org
Cc: Subject: bin/8828
Date: Fri, 19 Nov 1999 15:13:53 -0700 (MST)
My bad! The patch I submitted will not suffice as a fix,
because the Host: header should *not* be sent when the
host is only known by IP address.
I am unsure how to modify the patch to test for this
condition.
From: Mike Brown <mike@skew.org>
To: gnats-bugs@gnats.netbsd.org
Cc: Subject: bin/8828
Date: Fri, 19 Nov 1999 15:35:19 -0700 (MST)
Okay, ignore my last email. The patch I submitted will suffice.
Section 19.6.1.1 of RFC 2616 (HTTP/1.1) says:
Given the rate of growth of
the Web, and the number of servers already deployed, it is extremely
important that all implementations of HTTP (including updates to
existing HTTP/1.0 applications) correctly implement these
requirements:
- Both clients and servers MUST support the Host request-header.
So there you go.
From: Luke Mewburn <lukem@goanna.cs.rmit.edu.au>
To: mike@skew.org
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/8828: ftp(1) needs to send HTTP/1.1 Host: header
Date: Sat, 20 Nov 1999 09:56:33 +1100
mike@skew.org writes:
> >Release: actually, I'm using FreeBSD 3.2-RELEASE
so this is a bug in FreeBSD's ftp(1) client, not NetBSD's. (see below)
> >Environment:
> FreeBSD chillout.skew.org 3.2-RELEASE FreeBSD 3.2-RELEASE #0: Sat Aug 7 10:25:47 MDT 1999 mike@chillout.skew.org:/usr/src/sys/compile/chillout i386
> >Description:
> ftp(1) does not send the HTTP/1.1 Host: header when retrieving from
> an http:// URL. This header was implemented on HTTP/1.0 servers for
> virtual hosting purposes and is commonly sent by clients as part of
> an HTTP/1.0 request. If you attempt to access an HTTP server when you
> only know its IP number, it will attempt to obtain the document from a
> default document root. Virtual hosting servers need to see the Host:
> header in order to know which root dir to use.
ftp in NetBSD has supported the sending of the Host: header for
HTTP/1.1 connections since:
Wed Jun 3 15:50:34 1998 UTC
and this is definitely not a problem in the last release of NetBSD;
1.4.1, nor in 1.4 for that matter.
Before submitting bug reports to NetBSD, please ensure that the
problem actually exists in NetBSD... :-)
PS: I would recommend that FreeBSD imports and tracks
ftp://ftp.netbsd.org/pub/NetBSD/misc/lukemftp/lukemftp-1.1.tar.gz
because that is a `self contained' product with various fixes to stuff
like libedit and extra libc functions which FreeBSD may not have yet.
State-Changed-From-To: open->closed
State-Changed-By: lukem
State-Changed-When: Fri Nov 19 14:57:01 PST 1999
State-Changed-Why:
problem hasn't existed in netbsd for 18 months (since before netbsd 1.4)
suggest that updates its sources before reporting problems in the master
copy...
Responsible-Changed-From-To: bin-bug-people->lukem
Responsible-Changed-By: lukem
Responsible-Changed-When: Fri Nov 19 14:57:01 PST 1999
Responsible-Changed-Why:
i'm mr ftp.
From: Mike Brown <mike@skew.org>
To: lukem@goanna.cs.rmit.edu.au (Luke Mewburn)
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/8828: ftp(1) needs to send HTTP/1.1 Host: header
Date: Fri, 19 Nov 1999 16:40:40 -0700 (MST)
> mike@skew.org writes:
> > >Release: actually, I'm using FreeBSD 3.2-RELEASE
>
> so this is a bug in FreeBSD's ftp(1) client, not NetBSD's. (see below)
Ah, my reasoning, flawed as it was, was thus:
1. The ftp/fetch.c source says NetBSD all over it;
2. I looked at every mention of ftp in the NetBSD GNATS db
and saw that this had not been reported as a bug;
3. A patch submitted for a Content-Length header implied
that at the time that patch was submitted, no provision
had been made for the Host header (and I mistakenly
thought that it was a recent report, when in fact it was
over 2 years old).
I apologize for not checking
http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/basesrc/usr.bin/ftp/fetch.c
... as I would have seen that FreeBSD's FTP client is using a fetch.c
that is 80 patchlevels behind the current version.
> PS: I would recommend that FreeBSD imports and tracks
> ftp://ftp.netbsd.org/pub/NetBSD/misc/lukemftp/lukemftp-1.1.tar.gz
> because that is a `self contained' product with various fixes to stuff
> like libedit and extra libc functions which FreeBSD may not have yet.
Sounds good to me, but I'd guess that they'd be more likely to put it
in the ports collection. If I get a response from my post to their
GNATS db, I'll be sure to mention it. Thanks! (and I humbly apologize
again..)
-Mike
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.