From: Justin Erenkrantz Date: Mon, 15 Apr 2002 02:58:11 +0000 (+0000) Subject: Allow empty Host: header arguments. X-Git-Tag: 2.0.36~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e955e53d372368f8af153134e6cd0c350b97ddd5;p=thirdparty%2Fapache%2Fhttpd.git Allow empty Host: header arguments. Previously, request that sent: GET / HTTP/1.1 Host: would get a 400. RFC 2616 specifically allows for a "blank" host field. The read_request code properly handled this, but the fix_hostname in vhost.c would cause the 400. Now, simply return in fix_hostname when we see a blank hostname rather than erroring out. PR: 7441 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94655 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/vhost.c b/server/vhost.c index 07ea8c4f5e7..03e89481cfa 100644 --- a/server/vhost.c +++ b/server/vhost.c @@ -745,6 +745,11 @@ static void fix_hostname(request_rec *r) apr_port_t port; apr_status_t rv; + /* According to RFC 2616, Host header field CAN be blank. */ + if (!*r->hostname) { + return; + } + rv = apr_parse_addr_port(&host, &scope_id, &port, r->hostname, r->pool); if (rv != APR_SUCCESS || scope_id) { goto bad;