Port fix bug 39689. Allow same quoting for SSI attribute values as httpd.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 22 Jul 2006 21:48:51 +0000 (21:48 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 22 Jul 2006 21:48:51 +0000 (21:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@424635 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ssi/SSIProcessor.java

index 9d7cd04..dfeb8e0 100644 (file)
@@ -232,12 +232,14 @@ public class SSIProcessor {
         boolean inside = false;
         String[] vals = new String[count];
         StringBuffer sb = new StringBuffer();
+        char endQuote = 0;
         for (int bIdx = start; bIdx < cmd.length(); bIdx++) {
             if (!inside) {
-                while (bIdx < cmd.length() && cmd.charAt(bIdx) != '"')
+                while (bIdx < cmd.length() && !isQuote(cmd.charAt(bIdx)))
                     bIdx++;
                 if (bIdx >= cmd.length()) break;
                 inside = !inside;
+                endQuote = cmd.charAt(bIdx);
             } else {
                 boolean escaped = false;
                 for (; bIdx < cmd.length(); bIdx++) {
@@ -248,7 +250,7 @@ public class SSIProcessor {
                         continue;
                     }
                     // If we reach the other " then stop
-                    if (c == '"' && !escaped) break;
+                    if (c == endQuote && !escaped) break;
                     // Since parsing of attributes and var
                     // substitution is done in separate places,
                     // we need to leave escape in the string
@@ -310,4 +312,8 @@ public class SSIProcessor {
     protected boolean isSpace(char c) {
         return c == ' ' || c == '\n' || c == '\t' || c == '\r';
     }
+    
+    protected boolean isQuote(char c) {
+        return c == '\'' || c == '\"' || c == '`';
+    }
 }
\ No newline at end of file