On 7 May 2013 16:54, <ma...@apache.org> wrote: > Author: markt > Date: Tue May 7 15:54:36 2013 > New Revision: 1479953 > > URL: http://svn.apache.org/r1479953 > Log: > Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54703 > Be tolerant of applications that pass CR or LF in setHeader() values. > Fix some whitespace parsing issues idnetifed by the extended test cases in > readTokenOrQuotedString() > > Modified: > tomcat/tc7.0.x/trunk/ (props changed) > > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > > tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java > tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml > > Propchange: tomcat/tc7.0.x/trunk/ > ------------------------------------------------------------------------------ > Merged /tomcat/trunk:r1479248,1479951 > > Modified: > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > URL: > http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1479953&r1=1479952&r2=1479953&view=diff > ============================================================================== > --- > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > (original) > +++ > tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java > Tue May 7 15:54:36 2013 > @@ -262,17 +262,34 @@ public class HttpParser { > } > } > > - private static SkipConstantResult skipConstant(StringReader input, > - String constant) throws IOException { > - int len = constant.length(); > + // Skip any LWS and return the next char > + private static int skipLws(StringReader input, boolean withReset) > + throws IOException { > > + if (withReset) { > + input.mark(1); > + } > int c = input.read(); > > - // Skip lws > - while (c == 32 || c == 9) { > + while (c == 32 || c == 9 || c == 10 || c == 13) {
There are some other characters that could be considered as WS, e.g. FF and VT. Should those be allowed for? Also perhaps easier to read the comparisons as while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { That also agrees with how the test case is written. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org