Subject: Re: bin/15415: ftp(1) would fail to fetch using HTTP.
To: None <cgd@broadcom.com>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: netbsd-bugs
Date: 01/30/2002 08:34:22
In message <yov54rl5xf0y.fsf@broadcom.com>
on 29 Jan 2002 09:06:53 -0800,
cgd@broadcom.com wrote:
> At Tue, 29 Jan 2002 16:35:34 +0000 (UTC), "Takahiro Kambe" wrote:
> > - fprintf(fin, "Host: [%s]:%d\r\n", h, portnum);
> > + fprintf(fin, "Host: [%s]", h);
> > free(h);
> > } else
> > - fprintf(fin, "Host: %s:%d\r\n", host, portnum);
> > + fprintf(fin, "Host: %s", host);
> > + if (portnum != HTTP_PORT) {
> > + fprintf(fin, "%d", portnum);
> > + }
> > + fputs("\r\n", fin);
>
> you're missing the ':', it seems...
Thanks, you're absolutely right.
--- usr.bin/ftp/fetch.c.orig Wed Jan 30 01:14:03 2002
+++ usr.bin/ftp/fetch.c Wed Jan 30 08:32:50 2002
@@ -730,10 +730,14 @@
(p = strchr(h, '%')) != NULL) {
*p = '\0';
}
- fprintf(fin, "Host: [%s]:%d\r\n", h, portnum);
+ fprintf(fin, "Host: [%s]", h);
free(h);
} else
- fprintf(fin, "Host: %s:%d\r\n", host, portnum);
+ fprintf(fin, "Host: [%s]", host);
+ if (portnum != HTTP_PORT) {
+ fprintf(fin, ":%d", portnum);
+ }
+ fputs("\r\n", fin);
fprintf(fin, "Accept: */*\r\n");
fprintf(fin, "Connection: close\r\n");
if (restart_point) {