* * * * *

                           Bugs in Apache, Part II

Between restoring MySQL [1] databases and dumping MySQL databases I finally
tracked down an Apache bug from seven months ago [2] (as it relates to
mod_blog [3]). At the time, I was testing with Apache 2.0.54, but shortly
thereafter Apache 2.0.55 was released and thinking that it might have been
addressed, I waited.

Okay, perhaps I waited a bit too long, but hey.

The problem still existed under Apache 2.0.55, and upon reporting it to the
Apache Mailing List; a response came back—it might be similar to existing bug
[4] first reported on September 4^th, 2003!

> **From:** Joshua Slive <XXXXXXXXXXXXXXX>
> **To:** Apache Mailing List <XXXXXXXXXXXXXXXXXXXXXX>
> **Subject:** Re: [users@httpd] Odd interaction between mod_rewrite and
> mod_cgi
> **Date:** Wed, 15 Feb 2006 11:48:24 -0500
>
> Sounds like: http://issues.apache.org/bugzilla/show_bug.cgi?id=22898 [5]
>
> In general, there are not many people insterested in nph scripts anymore,
> so I'd guess that little testing or debugging is done on them. They aren't
> useful for very much.
>

Ouch.

Then this rather amusing exchange took place:

> **From:** Sean Conner <[email protected]>
> **To:** Apache Mailing List <XXXXXXXXXXXXXXXXXXXXXX>
> **Subject:** Re: [users@httpd] Odd interaction between mod_rewrite and
> mod_cgi
> **Date:** Wed, 15 Feb 2006 15:21:04 -0500 (EST)
>
> Be that as it may, but is there some other way for a CGI (Common Gateway
> Interface) script to return an HTTP (HyperText Transfer Protocol) status?
> That's primarily why I use the “nph-” feature (and no, rewriting the script
> in PHP is not an option).
>

> **From:** Joshua Slive <XXXXXXXXXXXXXXX>
> **To:** Apache Mailing List <XXXXXXXXXXXXXXXXXXXXXX>
> **Subject:** Re: [users@httpd] Odd interaction between mod_rewrite and
> mod_cgi
> **Date:** Wed, 15 Feb 2006 16:51:19 -0500
>
> Yes, there is a Status header, as in Status: 404
>

> **From:** Sean Conner <[email protected]>
> **To:** Apache Mailing List <XXXXXXXXXXXXXXXXXXXXXX>
> **Subject:** Re: [users@httpd] Odd interaction between mod_rewrite and
> mod_cgi
> **Date:** Wed, 15 Feb 2006 17:07:13 -0500 (EST)
>
> Oh wow … I'll have to try that. Is it also available in Apache 1.3? (just
> on the off chance that you might know … )
>

> **From:** Nick Kew <XXXXXXXXXXXXXXXXX>
> **To:** Apache Mailing List <XXXXXXXXXXXXXXXXXXXXXX>
> **Subject:** Re: [users@httpd] Odd interaction between mod_rewrite and
> mod_cgi
> **Date:** Wed, 15 Feb 2006 22:24:36 +0000
>
> Of course. It's in every version of Apache.
>
> More importantly, it's part of the CGI spec. That's something you should
> read.
>

Double ouch.

You see, in all the years I've had the code, I've never once read the CGI
spec (Common Gateway Interface) [6]. The code I have is based off code from
the old NCSA tutorial code (National Center for Supercomputing Applications)
[7]. And when I needed to set the headers myself, I went through the Apache
source code and found the “nph-” hack (probably back in the Apache 1.2 days).

And given that I still run Apache 1.3 …

Anyway.

I fixed mod_blog to send the Status: header and it works as expected under
both Apache 1.3 and Apache 2.0.

Life is good now.

Well, except for this stupid MySQL database migration.

[1] http://www.mysql.com/
[2] gopher://gopher.conman.org/0Phlog:2005/07/08.1
[3] https://boston.conman.org/about/
[4] http://issues.apache.org/bugzilla/show_bug.cgi?id=22898
[5] http://issues.apache.org/bugzilla/show_bug.cgi?id=22898
[6] http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
[7] ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/ncsa-default.tar.Z

Email author at [email protected]