billbarker    2004/09/16 21:50:48

  Modified:    jk/java/org/apache/jk/common HandlerRequest.java
  Log:
  Require that use of AJP/1.3 shutdown is explictly enabled to function.
  
  No Adapter in any version of Tomcat currently supports a clean shutdown from 
AJP/1.3, so it is better to turn it off (by default) for now.
  
  Fix for Bug #31204
  
  Revision  Changes    Path
  1.39      +25 -6     
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- HandlerRequest.java       15 Jun 2004 20:37:11 -0000      1.38
  +++ HandlerRequest.java       17 Sep 2004 04:50:47 -0000      1.39
  @@ -251,6 +251,14 @@
           return tomcatAuthentication;
       }
   
  +    public void setShutdownEnabled(boolean se) {
  +        shutdownEnabled = se;
  +    }
  +
  +    public boolean getShutdownEnabled() {
  +        return shutdownEnabled;
  +    }
  +
       public void setTomcatAuthentication(boolean newTomcatAuthentication) {
           tomcatAuthentication = newTomcatAuthentication;
       }
  @@ -324,6 +332,7 @@
       boolean decoded=true;
       boolean tomcatAuthentication=true;
       boolean registerRequests=true;
  +    boolean shutdownEnabled=false;
       
       public int invoke(Msg msg, MsgContext ep ) 
           throws IOException
  @@ -399,9 +408,14 @@
            if( !ch.isSameAddress(ep) ) {
                log.error("Shutdown request not from 'same address' ");
                return ERROR;
  -         }
  +            }
   
  +            if( !shutdownEnabled ) {
  +                log.warn("Ignoring shutdown request: shutdown not enabled");
  +                return ERROR;
  +            }
               // forward to the default handler - it'll do the shutdown
  +            checkRequest(ep);
               next.invoke( msg, ep );
   
               log.info("Exiting");
  @@ -429,10 +443,7 @@
   
       static int count = 0;
   
  -    private int decodeRequest( Msg msg, MsgContext ep, MessageBytes tmpMB )
  -        throws IOException
  -    {
  -        // FORWARD_REQUEST handler
  +    private Request checkRequest(MsgContext ep) {
           Request req=(Request)ep.getRequest();
           if( req==null ) {
               req=new Request();
  @@ -440,9 +451,17 @@
               req.setResponse(res);
               ep.setRequest( req );
               if( registerRequests ) {
  -             ep.getSource().registerRequest(req, ep, count++);
  +                ep.getSource().registerRequest(req, ep, count++);
               }
           }
  +        return req;
  +    }
  +
  +    private int decodeRequest( Msg msg, MsgContext ep, MessageBytes tmpMB )
  +        throws IOException
  +    {
  +        // FORWARD_REQUEST handler
  +        Request req = checkRequest(ep);
   
        RequestInfo rp = req.getRequestProcessor();
        rp.setStage(Constants.STAGE_PARSE);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to