tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Reitter <david.reit...@gmail.com>
Subject SSI - Regular expression parsing
Date Fri, 28 Jun 2013 23:40:53 GMT
Hi,

I'm trying to use some SSI in 7.0.39 using SSIFilter.  The file is parsed, in principle, but
whenever an IF expression with a certain regular expression is encountered, Tomcat seems to
stop processing the file and will not return any contents after that (for the request).

Example:

My request is:

http://...:8080/amt/file.html?year=234234


The relevant portion of the file is:


QS:<!--#echo var="QUERY_STRING" -->

<!--#if expr="${QUERY_STRING} = /year=(.*)/" -->
    <!--ssi-comment: year found -->
    <!--#set var="year" value="$1" -->
year:
<!--#echo var="year" -->

<!--#else -->
not
    <!--ssi-comment: year NOT found -->
    <!--#set var="year" value="some" -->
<!--#endif -->



The response to the request is the beginning of the file, and then

QS:year=2012

After the "#if", nothing is encountered.
Other IF statements work as expected - this seems to have to do with the regular expression.

I have tried a number of variants, including $QUERY_STRING instead of ${...}.
I find no error about this in the logs (I have set debug to 1 for the SSIFilter, but I'm not
sure if I need to change anything else in logging properties.

I tried simpler regular expressions.  The following

<!--#if expr="${QUERY_STRING} = /year=/" -->

Leads to the error below:

java.lang.ClassCastException: org.apache.catalina.ssi.ExpressionParseTree$EqualNode cannot
be cast to org.apache.catalina.ssi.ExpressionParseTree$StringNode
	org.apache.catalina.ssi.ExpressionParseTree$CompareNode.compareBranches(ExpressionParseTree.java:353)
	org.apache.catalina.ssi.ExpressionParseTree$EqualNode.evaluate(ExpressionParseTree.java:381)
	org.apache.catalina.ssi.ExpressionParseTree.evaluateTree(ExpressionParseTree.java:67)
	org.apache.catalina.ssi.SSIConditional.evaluateArguments(SSIConditional.java:124)
	org.apache.catalina.ssi.SSIConditional.process(SSIConditional.java:50)
	org.apache.catalina.ssi.SSIProcessor.process(SSIProcessor.java:160)
	org.apache.catalina.ssi.SSIFilter.doFilter(SSIFilter.java:144)


This occurs whenever the regular expression does not contain any parenthesis.  Is it even
recognized/parsed as a regexp?


Is this a bug, or is my syntax off?  I follow http://tomcat.apache.org/tomcat-6.0-doc/ssi-howto.html
Any help is appreciated.

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


Mime
View raw message