57705: Add debug logging for requests denied by the remote host and remote address valves and filters. Based on a patch by Graham Leggett. (markt)

대상 버전 : Tomcat 7.0.71 ~ 등

  • 9.0.x for 9.0.0.M9 onwards
  • 8.5.x for 8.5.4 onwards
  • 8.0.x for 8.0.37 onwards
  • 7.0.x for 7.0.71 onwards

대상 파일 :

  • RemoteAddrValve.java
  • RemoteHostValve.java

 

1. RemoteAddrValve.java, RemoteHostValve.java

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
    @Override
    protected Log getLog() {
        return log;
    }

 

2. RequestFilterValve.java

import org.apache.juli.logging.Log;
   protected void process(String property, Request request, Response response)
            throws IOException, ServletException {
 
        if (isAllowed(property)) {
            getNext().invoke(request, response);
            return;
        }
 
        if (getLog().isDebugEnabled()) {
            getLog().debug(sm.getString("requestFilterValve.deny",
                    request.getRequestURI(), property));
        }
 
        // Deny this request
        denyRequest(request, response);
    }
 
 
    protected abstract Log getLog();