Subject: pkg/7500: mpg123-0.59q can't play from name-based virtual hosts
To: None <gnats-bugs@gnats.netbsd.org>
From: Michael Graff <explorer@flame.org>
List: netbsd-bugs
Date: 04/29/1999 15:35:48
>Number: 7500
>Category: pkg
>Synopsis: mpg123-0.59q can't play from name-based virtual hosts
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: pkg-manager (NetBSD software packages system bug manager)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 29 15:35:01 1999
>Last-Modified:
>Originator: Michael Graff
>Organization:
flame.org: yes, we do know everything
>Release: current
>Environment:
System: NetBSD kechara.flame.org 1.4_BETA NetBSD 1.4_BETA (KECHARA) #0: Wed Apr 28 19:59:58 PDT 1999 explorer@kechara.flame.org:/raid0/OS/NetBSD/src-1-4/sys/arch/i386/compile/KECHARA i386
>Description:
mpg123 fails to send the HTTP Host: header, so name based virtual hosts
cannot be used to pull files from.
>How-To-Repeat:
mpg123 http://virtual.host.somewhere.com/file.mp3
404 is returned.
>Fix:
Here's my patch-ag:
--- work/mpg123-0.59q/httpget.c Mon Nov 23 08:17:46 1998
+++ httpget.c Thu Apr 29 15:08:05 1999
@@ -154,6 +154,7 @@
if (!(proxyurl = getenv("http_proxy")))
proxyurl = getenv("HTTP_PROXY");
if (proxyurl && proxyurl[0] && strcmp(proxyurl, "none")) {
+ host = NULL;
if (!(url2hostport(proxyurl, &host, &proxyip, &proxyport))) {
fprintf (stderr, "Unknown proxy host \"%s\".\n",
host ? host : "");
@@ -184,18 +185,22 @@
myip = proxyip;
}
else {
+ host = NULL;
if (!(sptr = url2hostport(purl, &host, &myip, &myport))) {
fprintf (stderr, "Unknown host \"%s\".\n",
host ? host : "");
exit (1);
}
- if (host)
- free (host);
strcat (request, sptr);
}
sprintf (request + strlen(request),
" HTTP/1.0\r\nUser-Agent: %s/%s\r\n",
prgName, prgVersion);
+ if (host) {
+ sprintf(request + strlen(request),
+ "Host: %s:%u\r\n", host, myport);
+ free (host);
+ }
strcat (request, ACCEPT_HEAD);
strcat (request, "\r\n");
server.sin_family = AF_INET;
>Audit-Trail:
>Unformatted: