Commit 1bbdb317 authored by Steve Kemp's avatar Steve Kemp
Browse files

Fix off-by-one in hostname detection.

Our module is called when an internal request results in a file-not-found
error.  At this point we kick in and try to update the virtual host to
point to the first sensible one we find.   Unfortunately we had an error
in the counting.

Given two hosts:


If a request came to the first site due to a rewrite from mod_rewrite, we'd
be invoked because of the internal-404.  We'd then fixup the hostname and
then mod_rewrite would fixup the path.

however we started counting the hostname fro the first letter, such that


would never be found.  So we'd always update the hostname to /srv/
and at that point mod_rewrite would correct the path and the request would
go to the wrong vhost.
parent 4ab411d3
......@@ -215,7 +215,7 @@ void update_vhost_request( char *path )
* Try increasingly stat()ing over parts of the hostname
* until we find a match.
for ( i = 1; i < host_len - 1; i++ )
for ( i = 0; i < host_len - 1; i++ )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment