422386 Comma-separated <param-value>s not trimmed in GzipFilter

This commit is contained in:
Jan Bartel 2013-11-25 10:24:17 +11:00
parent 44416abb1f
commit 17d281fa7c
2 changed files with 9 additions and 9 deletions

View File

@ -218,14 +218,14 @@ public class GzipFilter extends UserAgentFilter
{
StringTokenizer tok = new StringTokenizer(tmp,",",false);
while (tok.hasMoreTokens())
_mimeTypes.add(tok.nextToken());
_mimeTypes.add(tok.nextToken().trim());
}
}
else
{
StringTokenizer tok = new StringTokenizer(tmp,",",false);
while (tok.hasMoreTokens())
_mimeTypes.add(tok.nextToken());
_mimeTypes.add(tok.nextToken().trim());
}
tmp=filterConfig.getInitParameter("excludedAgents");
if (tmp!=null)
@ -233,7 +233,7 @@ public class GzipFilter extends UserAgentFilter
_excludedAgents=new HashSet<String>();
StringTokenizer tok = new StringTokenizer(tmp,",",false);
while (tok.hasMoreTokens())
_excludedAgents.add(tok.nextToken());
_excludedAgents.add(tok.nextToken().trim());
}
tmp=filterConfig.getInitParameter("excludeAgentPatterns");
@ -242,7 +242,7 @@ public class GzipFilter extends UserAgentFilter
_excludedAgentPatterns=new HashSet<Pattern>();
StringTokenizer tok = new StringTokenizer(tmp,",",false);
while (tok.hasMoreTokens())
_excludedAgentPatterns.add(Pattern.compile(tok.nextToken()));
_excludedAgentPatterns.add(Pattern.compile(tok.nextToken().trim()));
}
tmp=filterConfig.getInitParameter("excludePaths");
@ -251,7 +251,7 @@ public class GzipFilter extends UserAgentFilter
_excludedPaths=new HashSet<String>();
StringTokenizer tok = new StringTokenizer(tmp,",",false);
while (tok.hasMoreTokens())
_excludedPaths.add(tok.nextToken());
_excludedPaths.add(tok.nextToken().trim());
}
tmp=filterConfig.getInitParameter("excludePathPatterns");
@ -260,7 +260,7 @@ public class GzipFilter extends UserAgentFilter
_excludedPathPatterns=new HashSet<Pattern>();
StringTokenizer tok = new StringTokenizer(tmp,",",false);
while (tok.hasMoreTokens())
_excludedPathPatterns.add(Pattern.compile(tok.nextToken()));
_excludedPathPatterns.add(Pattern.compile(tok.nextToken().trim()));
}
tmp=filterConfig.getInitParameter("vary");

View File

@ -117,7 +117,7 @@ public class GzipFilterDefaultTest
FilterHolder holder = tester.setContentServlet(GetServlet.class);
holder.setInitParameter("mimeTypes","text/plain");
holder.setInitParameter("methods","POST,WIBBLE");
holder.setInitParameter("methods","POST, WIBBLE");
try
{
@ -441,7 +441,7 @@ public class GzipFilterDefaultTest
GzipTester tester = new GzipTester(testingdir,compressionType);
FilterHolder holder = tester.setContentServlet(DefaultServlet.class);
holder.setInitParameter("excludedAgents","foo");
holder.setInitParameter("excludedAgents","bar, foo");
tester.setUserAgent("foo");
int filesize = CompressedResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
@ -488,7 +488,7 @@ public class GzipFilterDefaultTest
GzipTester tester = new GzipTester(testingdir,compressionType);
FilterHolder holder = tester.setContentServlet(DefaultServlet.class);
holder.setInitParameter("excludePaths","/context/");
holder.setInitParameter("excludePaths","/bar/, /context/");
int filesize = CompressedResponseWrapper.DEFAULT_BUFFER_SIZE * 4;
tester.prepareServerFile("file.txt",filesize);