billbarker 2003/07/05 23:16:00 Modified: http11/src/java/org/apache/coyote/http11 Http11Processor.java Log: Re-activate dropping the connection on serious protocol errors. Also adding Remy's suggestion to check the exception, as well as checking the status code in the commit so that we can be nice enough to tell the client that we're not talking to them anymore if we discover the error soon enough. Revision Changes Path 1.70 +13 -3 jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java Index: Http11Processor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- Http11Processor.java 5 Jul 2003 01:39:42 -0000 1.69 +++ Http11Processor.java 6 Jul 2003 06:16:00 -0000 1.70 @@ -635,9 +635,16 @@ thrA.setCurrentStage(threadPool, "service"); rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); adapter.service(request, response); - /* Mimic httpd (currently disabled) - error = statusDropsConnection(response.getStatus()); - */ + // Handle when the response was committed before a serious + // error occurred. Throwing a ServletException should both + // set the status to 500 and set the errorException. + // If we fail here, then the response is likely already + // committed, so we can't try and set headers. + if(keepAlive && !error) { // Avoid checking twice. + error = response.getErrorException() != null || + statusDropsConnection(response.getStatus()); + } + } catch (InterruptedIOException e) { error = true; } catch (Throwable t) { @@ -1260,6 +1267,9 @@ keepAlive = false; } + // If we know that the request is bad this early, add the + // Connection: close header. + keepAlive = keepAlive && statusDropsConnection(statusCode); if (!keepAlive) { response.addHeader("Connection", "close"); } else if (!http11) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]