tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: DO NOT REPLY [Bug 45026] Custom HTTP-Error codes get remapped to 500er codes
Date Mon, 26 May 2008 12:05:33 GMT
Hi Mark,

bugzilla@apache.org wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=45026
> 
> --- Comment #4 from Mark Thomas <markt@apache.org>  2008-05-18 11:27:59 PST ---
> Rainer - this might be quicker for you to track down. The following patch
> ensures the correct status is returned but the body generated by Tomcat is
> disappearing somewhere (I suspect inside mod_jk).
> 
> Index: java/org/apache/jk/common/JkInputStream.java
> ===================================================================
> --- java/org/apache/jk/common/JkInputStream.java        (revision 657140)
> +++ java/org/apache/jk/common/JkInputStream.java        (working copy)
> @@ -278,6 +278,10 @@
>          } else {
>              message = message.replace('\n', ' ').replace('\r', ' ');
>          }
> +        if (message == null) {
> +            // mod_jk + httpd 2.x fails with a null status message - bug 45026
> +            message = Integer.toString(res.getStatus());
> +        }
>          tempMB.setString( message );
>          c2b.convert( tempMB );
>          outputMsg.appendBytes(tempMB);

I started a discussion with the httpd people, because there is code in 
httpd 2.x, that doesn't allow empty reason phrases, although RFC 2616 
allows them. In this case, httpd replaces the status line with a generic 
500 status line.

The workaround above works and looks fine (I did test it). Since there 
is no way to fix old httpds, I would suggest actually using the above 
workaround, even if httpd gets fixed. I committed a similar patch to 
mod_jk a few minutes ago.

One change between the above and the mod_jk fix: I added "Unknown 
Reason" as a reson phrase, instead of repeating the status code (message 
= "Unknown Reason"; instead of message = 
Integer.toString(res.getStatus());). That was motivated by the netscape 
web server, which documents to use "Unknwon reason" in case it doesn't 
know a better one. I only changed the second word to upper case.

Thanks for pointing out the root cause of the problem!

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message