tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1489437 - in /tomcat/trunk/java/org/apache/coyote/http11: AbstractHttp11Processor.java LocalStrings.properties
Date Tue, 04 Jun 2013 13:24:12 GMT
Author: markt
Date: Tue Jun  4 13:24:12 2013
New Revision: 1489437

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

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
    tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1489437&r1=1489436&r2=1489437&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue Jun  4 13:24:12
2013
@@ -48,6 +48,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;
@@ -57,6 +58,7 @@ import org.apache.tomcat.util.res.String
 public abstract class AbstractHttp11Processor<S> extends AbstractProcessor<S>
{
 
     protected abstract Log getLog();
+    private final UserDataHelper userDataHelper;
 
 
     /**
@@ -238,6 +240,7 @@ public abstract class AbstractHttp11Proc
 
     public AbstractHttp11Processor(AbstractEndpoint endpoint) {
         super(endpoint);
+        userDataHelper = new UserDataHelper(getLog());
     }
 
 
@@ -952,9 +955,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/trunk/java/org/apache/coyote/http11/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties?rev=1489437&r1=1489436&r2=1489437&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties Tue Jun  4 13:24:12
2013
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+http11processor.fallToDebug=\n Note: further occurrences of HTTP header parsing errors will
be logged at DEBUG level.
 http11processor.header.parse=Error parsing HTTP request header
 http11processor.neverused=This method should never be used
 http11processor.request.prepare=Error preparing request



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


Mime
View raw message