Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 53242 invoked from network); 26 May 2008 12:06:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 May 2008 12:06:08 -0000 Received: (qmail 12294 invoked by uid 500); 26 May 2008 12:06:09 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 11397 invoked by uid 500); 26 May 2008 12:06:07 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 11386 invoked by uid 99); 26 May 2008 12:06:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 May 2008 05:06:07 -0700 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [195.227.30.149] (HELO mailserver.kippdata.de) (195.227.30.149) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 May 2008 12:05:13 +0000 Received: from [195.227.30.148] (larix [195.227.30.148]) by mailserver.kippdata.de (8.13.5/8.13.5) with ESMTP id m4QC5X5u019596 for ; Mon, 26 May 2008 14:05:34 +0200 (CEST) Message-ID: <483AA78D.7040505@kippdata.de> Date: Mon, 26 May 2008 14:05:33 +0200 From: Rainer Jung User-Agent: Thunderbird 2.0.0.6 (X11/20070802) MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: DO NOT REPLY [Bug 45026] Custom HTTP-Error codes get remapped to 500er codes References: <20080518182800.7AE05234C115@brutus.apache.org> In-Reply-To: <20080518182800.7AE05234C115@brutus.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Mark, bugzilla@apache.org wrote: > https://issues.apache.org/bugzilla/show_bug.cgi?id=45026 > > --- Comment #4 from Mark Thomas 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