Add support for fetching files from name based virtual WWW servers.

Patch supplied by Michael Graff in PR pkg/7500.
This commit is contained in:
tron 1999-05-01 09:55:32 +00:00
parent 0a294a14a1
commit cf67e1925a

View file

@ -0,0 +1,40 @@
$NetBSD: patch-ag,v 1.1 1999/05/01 09:55:32 tron Exp $
--- 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: