tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1489444 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/http11/AbstractHttp11Processor.java java/org/apache/coyote/http11/LocalStrings.properties webapps/docs/changelog.xml
Date Tue, 04 Jun 2013 13:42:50 GMT
Author: markt
Date: Tue Jun  4 13:42:50 2013
New Revision: 1489444

URL: http://svn.apache.org/r1489444
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54939
Log errors parsing HTTP request headers using a UserDataHelper

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/LocalStrings.properties
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1489437

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1489444&r1=1489443&r2=1489444&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue Jun
 4 13:42:50 2013
@@ -45,6 +45,7 @@ import org.apache.tomcat.util.buf.HexUti
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.MimeHeaders;
+import org.apache.tomcat.util.log.UserDataHelper;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
 import org.apache.tomcat.util.net.SocketStatus;
@@ -54,6 +55,7 @@ import org.apache.tomcat.util.res.String
 public abstract class AbstractHttp11Processor<S> extends AbstractProcessor<S>
{
 
     protected abstract Log getLog();
+    private final UserDataHelper userDataHelper;
 
     /**
      * The string manager for this package.
@@ -263,6 +265,7 @@ public abstract class AbstractHttp11Proc
 
     public AbstractHttp11Processor(AbstractEndpoint endpoint) {
         super(endpoint);
+        userDataHelper = new UserDataHelper(getLog());
     }
 
 
@@ -966,9 +969,21 @@ public abstract class AbstractHttp11Proc
                 break;
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
-                if (getLog().isDebugEnabled()) {
-                    getLog().debug(
-                            sm.getString("http11processor.header.parse"), t);
+                UserDataHelper.Mode logMode = userDataHelper.getNextMode();
+                if (logMode != null) {
+                    String message = sm.getString(
+                            "http11processor.header.parse");
+                    switch (logMode) {
+                        case INFO_THEN_DEBUG:
+                            message += sm.getString(
+                                    "http11processor.fallToDebug");
+                            //$FALL-THROUGH$
+                        case INFO:
+                            getLog().info(message);
+                            break;
+                        case DEBUG:
+                            getLog().debug(message);
+                    }
                 }
                 // 400 - Bad Request
                 response.setStatus(400);

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/LocalStrings.properties?rev=1489444&r1=1489443&r2=1489444&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/LocalStrings.properties (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/LocalStrings.properties Tue Jun  4
13:42:50 2013
@@ -22,6 +22,7 @@ http11protocol.proto.socketexception.inf
 http11protocol.start=Starting Coyote HTTP/1.1 on {0}
 
 http11processor.regexp.error=Error parsing regular expression {0}
+http11processor.fallToDebug=\n Note: further occurrences of HTTP header parsing errors will
be logged at DEBUG level.
 http11processor.filter.unknown=Unknown filter {0}
 http11processor.filter.error=Error intializing filter {0}
 http11processor.header.parse=Error parsing HTTP request header

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1489444&r1=1489443&r2=1489444&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Jun  4 13:42:50 2013
@@ -74,6 +74,10 @@
         Ensure that when auto deployment runs for a Host, it uses the latest
         values for copyXML, deployXML and unpackWARs. (markt)
       </fix>
+      <fix>
+        <bug>54939</bug>: Provide logging (using a UserDataHelper) when HTTP
+        header parsing fails (e.g. when maxHeaderCount is exceeded). (markt)
+      </fix>
       <add>
         <bug>54944</bug>: Enhancements to the unit tests for FORM
         authentication. Patch provided by Brian Burch. (markt)



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message