[BUG 283172] fix build on windows

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@541 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jesse McConnell 2009-07-10 20:19:21 +00:00
parent 41e8f40b12
commit d5e524bca9
1 changed files with 29 additions and 23 deletions

View File

@ -102,27 +102,28 @@ public class DefaultServletTest extends TestCase
if ( !_runningOnWindows )
{
assertTrue("Creating dir 'f??r' (Might not work in Windows)", new File(resBase, "f??r").mkdir());
String resBasePath = resBase.getAbsolutePath();
defholder.setInitParameter( "resourceBase", resBasePath );
StringBuffer req1 = new StringBuffer();
/*
* Intentionally bad request URI. Sending a non-encoded URI with typically encoded characters '<', '>', and
* '"'.
*/
req1.append( "GET /context/;<script>window.alert(\"hi\");</script> HTTP/1.1\n" );
req1.append( "Host: localhost\n" );
req1.append( "\n" );
String response = connector.getResponses( req1.toString() );
assertResponseContains( "/one/", response );
assertResponseContains( "/two/", response );
assertResponseContains( "/three/", response );
assertResponseContains( "/f%3F%3Fr", response );
assertResponseNotContains( "<script>", response );
}
String resBasePath = resBase.getAbsolutePath();
defholder.setInitParameter("resourceBase",resBasePath);
StringBuffer req1 = new StringBuffer();
/* Intentionally bad request URI.
* Sending a non-encoded URI with typically encoded characters '<', '>', and '"'.
*/
req1.append("GET /context/;<script>window.alert(\"hi\");</script> HTTP/1.1\n");
req1.append("Host: localhost\n");
req1.append("\n");
String response = connector.getResponses(req1.toString());
assertResponseContains("/one/",response);
assertResponseContains("/two/",response);
assertResponseContains("/three/",response);
assertResponseContains("/f%3F%3Fr",response);
assertResponseNotContains("<script>",response);
}
public void testListingProperUrlEncoding() throws Exception
@ -236,10 +237,15 @@ public class DefaultServletTest extends TestCase
assertResponseContains("404",response);
connector.reopen();
response= connector.getResponses("GET /context/dir%3F/ HTTP/1.0\r\n\r\n");
assertResponseContains("Directory: /context/dir?/<",response);
if ( !_runningOnWindows )
{
response= connector.getResponses("GET /context/dir%3F/ HTTP/1.0\r\n\r\n");
assertResponseContains("Directory: /context/dir?/<",response);
connector.reopen();
connector.reopen();
}
response= connector.getResponses("GET /context/index.html HTTP/1.0\r\n\r\n");
assertResponseContains("Hello Index",response);