Search in sources :

Example 21 with TesterRequest

use of org.apache.tomcat.unittest.TesterRequest in project tomcat by apache.

the class TestResponse method testBug53062b.

@Test
public void testBug53062b() throws Exception {
    Request req = new TesterRequest();
    Response resp = new Response();
    resp.setRequest(req);
    String result = resp.toAbsolute(".");
    Assert.assertEquals("http://localhost:8080/level1/level2/", result);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) TesterRequest(org.apache.tomcat.unittest.TesterRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) TesterRequest(org.apache.tomcat.unittest.TesterRequest) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 22 with TesterRequest

use of org.apache.tomcat.unittest.TesterRequest in project tomcat by apache.

the class TestResponse method testBug53469b.

@Test
public void testBug53469b() throws Exception {
    Request req = new TesterRequest();
    Response resp = new Response();
    resp.setRequest(req);
    String result = resp.encodeURL("../../../../bar.html");
    Assert.assertEquals("../../../../bar.html", result);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) TesterRequest(org.apache.tomcat.unittest.TesterRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) TesterRequest(org.apache.tomcat.unittest.TesterRequest) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 23 with TesterRequest

use of org.apache.tomcat.unittest.TesterRequest in project tomcat by apache.

the class TestResponse method testBug53062j.

@Test
public void testBug53062j() throws Exception {
    Request req = new TesterRequest();
    Response resp = new Response();
    resp.setRequest(req);
    String result = resp.toAbsolute("./..?x=/../../");
    Assert.assertEquals("http://localhost:8080/level1/?x=/../../", result);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) TesterRequest(org.apache.tomcat.unittest.TesterRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) TesterRequest(org.apache.tomcat.unittest.TesterRequest) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 24 with TesterRequest

use of org.apache.tomcat.unittest.TesterRequest in project tomcat by apache.

the class TestResponse method testBug53062p.

@Test
public void testBug53062p() throws Exception {
    Request req = new TesterRequest();
    Response resp = new Response();
    resp.setRequest(req);
    String result = resp.toAbsolute("./..#/../..");
    Assert.assertEquals("http://localhost:8080/level1/#/../..", result);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) TesterRequest(org.apache.tomcat.unittest.TesterRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) TesterRequest(org.apache.tomcat.unittest.TesterRequest) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 25 with TesterRequest

use of org.apache.tomcat.unittest.TesterRequest in project tomcat by apache.

the class TestResponse method testBug53062g.

@Test
public void testBug53062g() throws Exception {
    Request req = new TesterRequest();
    Response resp = new Response();
    resp.setRequest(req);
    String result = resp.toAbsolute("bar.html?x=/../");
    Assert.assertEquals("http://localhost:8080/level1/level2/bar.html?x=/../", result);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) TesterRequest(org.apache.tomcat.unittest.TesterRequest) HttpServletRequest(javax.servlet.http.HttpServletRequest) TesterRequest(org.apache.tomcat.unittest.TesterRequest) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Aggregations

TesterRequest (org.apache.tomcat.unittest.TesterRequest)26 Test (org.junit.Test)24 TomcatBaseTest (org.apache.catalina.startup.TomcatBaseTest)22 HttpServletRequest (javax.servlet.http.HttpServletRequest)20 HttpServletResponse (javax.servlet.http.HttpServletResponse)20 Locale (java.util.Locale)2 TesterContext (org.apache.tomcat.unittest.TesterContext)2 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ServletSecurityElement (javax.servlet.ServletSecurityElement)1 ServletSecurity (javax.servlet.annotation.ServletSecurity)1 Context (org.apache.catalina.Context)1 Request (org.apache.catalina.connector.Request)1 Response (org.apache.catalina.connector.Response)1 LoggingBaseTest (org.apache.catalina.startup.LoggingBaseTest)1 TesterMapRealm (org.apache.catalina.startup.TesterMapRealm)1 TesterResponse (org.apache.tomcat.unittest.TesterResponse)1 TesterServletContext (org.apache.tomcat.unittest.TesterServletContext)1 SecurityCollection (org.apache.tomcat.util.descriptor.web.SecurityCollection)1