You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Bob Kline <bk...@rksystems.com> on 2007/02/25 07:11:05 UTC

[users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Before filing a bug report, I want to check with the list to see if I'm
missing something or if this is a known bug and I just haven't found it
in the database.

I'm upgrading my server and Apache will be jumping from 2.0.46 to 2.2.3.
 I noticed when testing things on the new box that Apache's behavior
when an error occurs has changed.  On the older server, when an error
occurs, the ErrorDocument 500 directive is consulted, and the page
specified by that directive is sent back to the client with proper HTTP
headers.  For example:

$ telnet www.rksystems.com 80
Trying 66.92.147.60...
Connected to www.rksystems.com.
Escape character is '^]'.
GET /cgi-bin/barf.py HTTP/1.1
Host: www.rksystems.com:80

HTTP/1.1 500 Internal Server Error
Date: Sun, 25 Feb 2007 03:30:02 GMT
Server: Apache/2.0.46 (Red Hat)
Content-Length: 668
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error ...</p>
...
</body></html>
Connection closed by foreign host.

With the new version of Apache, however, the content length is reported
as 0 (which makes the browser think the document is empty) and the
content type is given as text/x-python, causing the browser to open a
Save dialog box instead of displaying the error 500 document:

$ telnet debian.rksystems.com 80
Trying 66.92.147.178...
Connected to debian.rksystems.com.
Escape character is '^]'.
GET /cgi-bin/barf.py HTTP/1.1
Host: debian.rksystems.com:80

HTTP/1.1 500 Internal Server Error
Date: Sun, 25 Feb 2007 03:16:46 GMT
Server: Apache/2.2.3 (Debian)
Content-Length: 0
Connection: close
Content-Type: text/x-python

<html>
 <head>
  <title>Script Failure</title>
 </head>

 <body>
  Boo-boo!
 </body>
</html>
Connection closed by foreign host.

Is this a known bug?  Is there some configuration directive I haven't
found for convincing Apache to send back the right values (as it used to)?

Many thanks!

-- 
Bob Kline
http://www.rksystems.com
mailto:bkline@rksystems.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Bob Kline <bk...@rksystems.com>.
Nick Kew wrote:

> Insufficient information.  What's the actual error here?
> Can't run the script (if so why?)  Runs but crashes?
> Runs OK but generates an HTTP error within the script?
> Or???
> 

The script throws an exception before sending any output to the standard
output file.  Here's what's in the error log (with the prefixes stripped
so it fits on the lines):

Traceback (most recent call last):
  File "/usr/lib/cgi-bin/barf.py", line 2, in ?
    raise Exception("barfing on purpose")
Exception: barfing on purpose
Premature end of script headers: barf.py

The script itself consists of 2 lines:

#!/usr/bin/python
raise Exception("barfing on purpose")

Apache does recognize that an error has occurred for which it should
send back the document specified in the ErrorDocument directive, it's
just failing to send back the right header values for that document.
Again, the older version of Apache does it correctly (for exactly the
same repro script).

Please let me know if any other information is needed.

-- 
Bob Kline
http://www.rksystems.com
mailto:bkline@rksystems.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 25 Feb 2007 01:11:05 -0500
Bob Kline <bk...@rksystems.com> wrote:


> HTTP/1.1 500 Internal Server Error
> Date: Sun, 25 Feb 2007 03:16:46 GMT
> Server: Apache/2.2.3 (Debian)
> Content-Length: 0
> Connection: close
> Content-Type: text/x-python

Insufficient information.  What's the actual error here?
Can't run the script (if so why?)  Runs but crashes?
Runs OK but generates an HTTP error within the script?
Or???

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Bob Kline <bk...@rksystems.com>.
Joshua Slive wrote:
> In the case of this particular bug, if you look at the developer's
> list, you'll see lots of action happening, including a fix on trunk
> and a proposal to backport to 2.2.

Excellent news, thanks!  And thanks for the tip on where to *really* 
find information on the Apache bug activity.

-- 
Bob Kline
http://www.rksystems.com
mailto:bkline@rksystems.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Joshua Slive <jo...@slive.ca>.
On 5/27/07, Bob Kline <bk...@rksystems.com> wrote:
> Bob Kline wrote:
> > On 2/25/2007 11:14 AM, [some other] Bob wrote:
> >> Take a look at PR 39710
> >> (http://issues.apache.org/bugzilla/show_bug.cgi?id=39710), this seems
> >> to be quite similar to me.
> >>
> >
> > Yes, thanks, this does look the same problem.....
>
> I've been trying to channel the follow-on communication about this bug
> through the bug-tracking system, but I'm not having much luck, so at the
> risk of making a pest of myself, I'm asking here if there's a better way
> for users to communicate with the developers than through Bugzilla.
> We're coming up this week on the anniversary of the filing of this bug,
> which has a severity of Regression, and still it's marked new.  A patch
> has been posted, and it's been reported as having successfully corrected
> the incorrect behavior.  I've offered to assist in whatever way would be
> useful (more testing?) but I'm pretty much posting to a black hole.  I
> understand that the developer might look on the offer of assistance from
> someone with far less experience with this body of code than they have
> as useless (or worse), but I've been polite, and would have expected at
> least some acknowledgment of the offer, even if to decline it.
>
> Thanks in advance for any suggestions anyone has.

The canonical advice is here:
http://httpd.apache.org/dev/patches.html#ignored

In the case of this particular bug, if you look at the developer's
list, you'll see lots of action happening, including a fix on trunk
and a proposal to backport to 2.2.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Bob Kline <bk...@rksystems.com>.
Bob Kline wrote:
> On 2/25/2007 11:14 AM, [some other] Bob wrote:
>> Take a look at PR 39710 
>> (http://issues.apache.org/bugzilla/show_bug.cgi?id=39710), this seems 
>> to be quite similar to me.
>>
>
> Yes, thanks, this does look the same problem.....

I've been trying to channel the follow-on communication about this bug 
through the bug-tracking system, but I'm not having much luck, so at the 
risk of making a pest of myself, I'm asking here if there's a better way 
for users to communicate with the developers than through Bugzilla.  
We're coming up this week on the anniversary of the filing of this bug, 
which has a severity of Regression, and still it's marked new.  A patch 
has been posted, and it's been reported as having successfully corrected 
the incorrect behavior.  I've offered to assist in whatever way would be 
useful (more testing?) but I'm pretty much posting to a black hole.  I 
understand that the developer might look on the offer of assistance from 
someone with far less experience with this body of code than they have 
as useless (or worse), but I've been polite, and would have expected at 
least some acknowledgment of the offer, even if to decline it.

Thanks in advance for any suggestions anyone has.

-- 
Bob Kline
http://www.rksystems.com
mailto:bkline@rksystems.com


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Bob Kline <bk...@rksystems.com>.
On 2/25/2007 11:14 AM, Bob wrote:
> Take a look at PR 39710 
> (http://issues.apache.org/bugzilla/show_bug.cgi?id=39710), this seems 
> to be quite similar to me.
>

Yes, thanks, this does look the same problem.  It would appear from the 
comments in the PR that mod_cgid didn't get hit with this bug.  What 
would be the possible downsides (if any) to swapping out mod_cgi for 
mod_cgid?

-- 
Bob Kline
http://www.rksystems.com
mailto:bkline@rksystems.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache sending back incorrect Content-length and Content-type values for ErrorDocument

Posted by Bob <bo...@googlemail.com>.
Bob Kline wrote:
> Before filing a bug report, I want to check with the list to see if I'm
> missing something or if this is a known bug and I just haven't found it
> in the database.

Take a look at PR 39710 
(http://issues.apache.org/bugzilla/show_bug.cgi?id=39710), this seems to 
be quite similar to me.

-- 
Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org