Am 30.04.2018 um 12:57 schrieb ma...@apache.org:
Author: markt
Date: Mon Apr 30 10:57:27 2018
New Revision: 1830547

URL: http://svn.apache.org/viewvc?rev=1830547&view=rev
Log:
Correct a regression in the error page handling that prevented error pages from 
issuing redirects or taking other action that required the response status code 
to be changed.

Modified:
     tomcat/trunk/java/org/apache/coyote/Response.java
     tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
     tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/Response.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Response.java?rev=1830547&r1=1830546&r2=1830547&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Response.java Mon Apr 30 10:57:27 2018
@@ -227,10 +227,6 @@ public final class Response {
       * @param status The status value to set
       */
      public void setStatus(int status) {
-        if (this.status > 399) {
-            // Don't overwrite first recorded error status
-            return;
-        }
          this.status = status;
      }

This part of the patch makes TestHttp11InputBuffer fail for me, more precisely

Testcase: testNewLinesExcessive took 0.12 sec
        FAILED
HTTP/1.1 505
junit.framework.AssertionFailedError: HTTP/1.1 505
at org.apache.coyote.http11.TestHttp11InputBuffer.testNewLinesExcessive(TestHttp11InputBuffer.java:385)

The test expects status 400, but gets 505. The 505 is being set in the following stack:

at org.apache.coyote.Response.setStatus(Response.java:231)
at org.apache.coyote.http11.Http11Processor.prepareRequest(Http11Processor.java:588) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:388) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
...

In prepareRequest(), the String protocolMB contains the text "null".

I don't know whether we just need to fix the test expectation, or tested code.

Regards,

Rainer

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

Reply via email to