From 8eb8e7ed2e2dc330bda05f3627987dd5f41e5fdb Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 22 Jul 2006 21:48:51 +0000 Subject: [PATCH] Port fix bug 39689. Allow same quoting for SSI attribute values as httpd. 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/java/org/apache/catalina/ssi/SSIProcessor.java b/java/org/apache/catalina/ssi/SSIProcessor.java index 9d7cd040d..dfeb8e01f 100644 --- a/java/org/apache/catalina/ssi/SSIProcessor.java +++ b/java/org/apache/catalina/ssi/SSIProcessor.java @@ -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 -- 2.11.0