diff --git a/libexec/httpd/bozohttpd.8 b/libexec/httpd/bozohttpd.8 index 8753914da992..b11102a5bc6a 100644 --- a/libexec/httpd/bozohttpd.8 +++ b/libexec/httpd/bozohttpd.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: bozohttpd.8,v 1.45 2014/02/09 01:46:10 mrg Exp $ +.\" $NetBSD: bozohttpd.8,v 1.46 2014/02/09 12:32:32 mrg Exp $ .\" .\" $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $ .\" @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 2, 2014 +.Dd February 9, 2014 .Dt HTTPD 8 .Os .Sh NAME diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c index 88f310cbe9c2..ef0934cfa5da 100644 --- a/libexec/httpd/bozohttpd.c +++ b/libexec/httpd/bozohttpd.c @@ -1,4 +1,4 @@ -/* $NetBSD: bozohttpd.c,v 1.48 2014/02/09 01:46:10 mrg Exp $ */ +/* $NetBSD: bozohttpd.c,v 1.49 2014/02/09 12:32:32 mrg Exp $ */ /* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */ @@ -1058,12 +1058,20 @@ check_virtual(bozo_httpreq_t *request) goto use_slashdir; /* - * ok, we have a virtual host, use scandir(3) to find a case + * canonicalise hr_host - that is, remove any :80. + */ + len = strlen(request->hr_host); + if (len > 3 && strcmp(request->hr_host + len - 3, ":80") == 0) { + request->hr_host[len - 3] = '\0'; + len = strlen(request->hr_host); + } + + /* + * ok, we have a virtual host, use opendir(3) to find a case * insensitive match for the virtual host we are asked for. * note that if the virtual host is the same as the master, * we don't need to do anything special. */ - len = strlen(request->hr_host); debug((httpd, DEBUG_OBESE, "check_virtual: checking host `%s' under httpd->virtbase `%s' " "for file `%s'",