summaryrefslogtreecommitdiff
path: root/server/vhost.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/vhost.c')
-rw-r--r--server/vhost.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/server/vhost.c b/server/vhost.c
index 5b79fea5..b8e9ca75 100644
--- a/server/vhost.c
+++ b/server/vhost.c
@@ -706,25 +706,27 @@ static void fix_hostname(request_rec *r)
char *dst;
apr_port_t port;
apr_status_t rv;
+ const char *c;
/* According to RFC 2616, Host header field CAN be blank. */
if (!*r->hostname) {
return;
}
+ /* apr_parse_addr_port will interpret a bare integer as a port
+ * which is incorrect in this context. So treat it separately.
+ */
+ for (c = r->hostname; apr_isdigit(*c); ++c);
+ if (!*c) { /* pure integer */
+ return;
+ }
+
rv = apr_parse_addr_port(&host, &scope_id, &port, r->hostname, r->pool);
if (rv != APR_SUCCESS || scope_id) {
goto bad;
}
- if (!host && port) {
- /* silly looking host ("Host: 123") but that isn't our job
- * here to judge; apr_parse_addr_port() would think we had a port
- * but no address
- */
- host = apr_itoa(r->pool, (int)port);
- }
- else if (port) {
+ if (port) {
/* Don't throw the Host: header's port number away:
save it in parsed_uri -- ap_get_server_port() needs it! */
/* @@@ XXX there should be a better way to pass the port.