You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2007/03/16 17:37:50 UTC
svn commit: r519054 -
/tomcat/container/branches/tc5.0.x/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java
Author: fhanik
Date: Fri Mar 16 09:37:49 2007
New Revision: 519054
URL: http://svn.apache.org/viewvc?view=rev&rev=519054
Log:
Add some options for handling URL chars, backport from TC 6.0.x
Modified:
tomcat/container/branches/tc5.0.x/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java
Modified: tomcat/container/branches/tc5.0.x/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/container/branches/tc5.0.x/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java?view=diff&rev=519054&r1=519053&r2=519054
==============================================================================
--- tomcat/container/branches/tc5.0.x/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java (original)
+++ tomcat/container/branches/tc5.0.x/catalina/src/share/org/apache/coyote/tomcat5/CoyoteAdapter.java Fri Mar 16 09:37:49 2007
@@ -53,6 +53,9 @@
implements Adapter
{
private static Log log = LogFactory.getLog(CoyoteAdapter.class);
+
+ protected static final boolean ALLOW_BACKSLASH =
+ Boolean.valueOf(System.getProperty("org.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH", "false")).booleanValue();
// -------------------------------------------------------------- Constants
@@ -232,7 +235,7 @@
req.getURLDecoder().convert(decodedURI, false);
} catch (IOException ioe) {
res.setStatus(400);
- res.setMessage("Invalid URI");
+ res.setMessage("Invalid URI: "+ioe.getMessage());
throw ioe;
}
// Normalization
@@ -473,8 +476,14 @@
// Replace '\' with '/'
// Check for null byte
for (pos = start; pos < end; pos++) {
- if (b[pos] == (byte) '\\')
- b[pos] = (byte) '/';
+ if (b[pos] == (byte) '\\') {
+ if (ALLOW_BACKSLASH) {
+ b[pos] = (byte) '/';
+ } else {
+ return false;
+ }
+ }
+
if (b[pos] == (byte) 0)
return false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org