I think I found a bug in Apache 2.0.
I wanted to try a new look for the blog and while I have a test blog at home, I can't really reach the webserver since it's behind the firewall web traffic isn't forwarded, I thought it would be easier to get my blog running on my workstation at The Office. I already have Apache 2.0 installed on the machine, and getting the blog up and running only took a few minutes, even including the time to make a few test entries.
Now, one of the things about
mod_blog is that I make use of Apache's
to make the external URLs decent. Also, because I want to handle errors
correctly, I need to actually output the HTTP response header, so
mod_blog uses a
feature of Apache's
that allows the CGI to
output the response code. So, within the Apache configuration I have
RewriteEngine on RewriteBase / RewriteRule ^([0-9][0-9])(.*) nph-blog.cgi/$1$2 [L]
Basically, a URL of
internally to Apache, turned into
which does the actual parsing of the date to bring you the appropriate
nph- part of the name tells Apache not to generate
any headers for this script).
That works fine under Apache 1.3.
Under Apache 2.0, things are slightly different.
The same setup, and I get the page, but at the very bottom I get:
HTTP/1.1 200 OK Date: Sat, 09 Jul 2005 05:44:15 GMT Server: Apache/2.0.54 (Unix) DAV/2 PHP/4.3.11 Content-Length: 0 Connection: close Content-Type: text/plain
At first, I thought it might be a problem with mod_blog, since intially I
had the test blog as
http://www.example.net/~spc/blog/ and that
the problem could be an interaction between Apache's
mod_cgi using a CGI script that generates the headers. Moving the blog
http://www.example.net/ didn't improve things, so now it's
down to an interaction between
mod_cgi and a CGI script that generates the headers.
So, if I go to
http://www.example.net/2005/07/08.1, I get
the spurious output, but if I go to
http://www.example.net/nph-boston.cgi/2005/07/08.1 (go through
the CGI script directly)
the page renders correctly and without the extraneous stuff at the
I am running the latest version of Apache 2.0, and a rather quick query
of Google didn't come
up with any known issues with
mod_cgi using “Non-Header
Parsing” scripts and
mod_rewrite. Guess it's time to dig into
the code …