You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/02/20 20:21:21 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http HttpProcessor.java

remm        02/02/20 11:21:21

  Modified:    catalina/src/share/org/apache/catalina/connector/http
                        HttpProcessor.java
  Log:
  - Fix a case (found by accident when doing a bad cut & paste to a telnet) were an
    incorrect request could kill a processor (which wouldn't get recycled properly).
  - This may be used to cause 5735 or a DoS attack.
  
  Revision  Changes    Path
  1.42      +26 -11    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java
  
  Index: HttpProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- HttpProcessor.java	21 Dec 2001 21:15:44 -0000	1.41
  +++ HttpProcessor.java	20 Feb 2002 19:21:21 -0000	1.42
  @@ -1,6 +1,6 @@
  -/* * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v 1.41 2001/12/21 21:15:44 craigmcc Exp $
  - * $Revision: 1.41 $
  - * $Date: 2001/12/21 21:15:44 $
  +/* * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v 1.42 2002/02/20 19:21:21 remm Exp $
  + * $Revision: 1.42 $
  + * $Date: 2002/02/20 19:21:21 $
    *
    * ====================================================================
    *
  @@ -108,7 +108,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.41 $ $Date: 2001/12/21 21:15:44 $
  + * @version $Revision: 1.42 $ $Date: 2002/02/20 19:21:21 $
    */
   
   final class HttpProcessor
  @@ -1046,15 +1046,29 @@
               }
   
               // Finish up the handling of the request
  -            try {
  -                if (finishResponse) {
  +            if (finishResponse) {
  +                try {
                       response.finishResponse();
  +                } catch (IOException e) {
  +                    ok = false;
  +                } catch (Throwable e) {
  +                    log("process.invoke", e);
  +                    ok = false;
  +                }
  +                try {
                       request.finishRequest();
  +                } catch (IOException e) {
  +                    ok = false;
  +                } catch (Throwable e) {
  +                    log("process.invoke", e);
  +                    ok = false;
  +                }
  +                try {
                       if (output != null)
                           output.flush();
  +                } catch (IOException e) {
  +                    ok = false;
                   }
  -            } catch (IOException e) {
  -                ok = false;
               }
   
               // We have to check if the connection closure has been requested
  @@ -1078,21 +1092,22 @@
               socket.close();
           } catch (IOException e) {
               ;
  +        } catch (Throwable e) {
  +            log("process.invoke", e);
           }
           socket = null;
   
       }
   
   
  -    protected void shutdownInput(InputStream input)
  -        throws IOException {
  +    protected void shutdownInput(InputStream input) {
           try {
               int available = input.available();
               // skip any unread (bogus) bytes
               if (available > 0) {
                   input.skip(available);
               }
  -        } catch (Exception e) {
  +        } catch (Throwable e) {
               ;
           }
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>