tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common HandlerRequest.java
Date Fri, 17 Sep 2004 04:50:48 GMT
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message