Search in sources :

Example 1 with HandleParametersOption

use of org.zaproxy.zap.spider.SpiderParam.HandleParametersOption in project zaproxy by zaproxy.

the class URLCanonicalizerUnitTest method shouldCanonicalizeODataIDSimpleIn_IGNORE_COMPLETELY_mode.

@Test
public void shouldCanonicalizeODataIDSimpleIn_IGNORE_COMPLETELY_mode() throws URIException {
    HandleParametersOption spiderOpion = HandleParametersOption.IGNORE_COMPLETELY;
    URI uri = new URI("http", null, "host", 9001, "/app.svc/Book(1)");
    String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book()"));
    uri = new URI("http", null, "host", 9001, "/app.svc/Book(1)/Author");
    visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book()/Author"));
}
Also used : HandleParametersOption(org.zaproxy.zap.spider.SpiderParam.HandleParametersOption) URI(org.apache.commons.httpclient.URI) Test(org.junit.Test)

Example 2 with HandleParametersOption

use of org.zaproxy.zap.spider.SpiderParam.HandleParametersOption in project zaproxy by zaproxy.

the class URLCanonicalizerUnitTest method shouldCanonicalizeODataIDMultipleIn_USE_ALL_mode.

@Test
public void shouldCanonicalizeODataIDMultipleIn_USE_ALL_mode() throws URIException {
    HandleParametersOption spiderOpion = HandleParametersOption.USE_ALL;
    URI uri = new URI("http", null, "host", 9001, "/app.svc/Book(title='dummy',year=2012)");
    String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book(title='dummy',year=2012)"));
    uri = new URI("http", null, "host", 9001, "/app.svc/Book(title='dummy',year=2012)/Author");
    visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book(title='dummy',year=2012)/Author"));
}
Also used : HandleParametersOption(org.zaproxy.zap.spider.SpiderParam.HandleParametersOption) URI(org.apache.commons.httpclient.URI) Test(org.junit.Test)

Example 3 with HandleParametersOption

use of org.zaproxy.zap.spider.SpiderParam.HandleParametersOption in project zaproxy by zaproxy.

the class URLCanonicalizerUnitTest method shouldCanonicalizeODataIDMultipleIn_IGNORE_VALUE_mode.

@Test
public void shouldCanonicalizeODataIDMultipleIn_IGNORE_VALUE_mode() throws URIException {
    HandleParametersOption spiderOpion = HandleParametersOption.IGNORE_VALUE;
    URI uri = new URI("http", null, "host", 9001, "/app.svc/Book(title='dummy',year=2012)");
    String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book(title,year)"));
    uri = new URI("http", null, "host", 9001, "/app.svc/Book(title='dummy',year=2012)/Author");
    visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book(title,year)/Author"));
}
Also used : HandleParametersOption(org.zaproxy.zap.spider.SpiderParam.HandleParametersOption) URI(org.apache.commons.httpclient.URI) Test(org.junit.Test)

Example 4 with HandleParametersOption

use of org.zaproxy.zap.spider.SpiderParam.HandleParametersOption in project zaproxy by zaproxy.

the class URLCanonicalizerUnitTest method shouldCanonicalizeODataIDMultipleIn_IGNORE_COMPLETELY_mode.

@Test
public void shouldCanonicalizeODataIDMultipleIn_IGNORE_COMPLETELY_mode() throws URIException {
    HandleParametersOption spiderOpion = HandleParametersOption.IGNORE_COMPLETELY;
    URI uri = new URI("http", null, "host", 9001, "/app.svc/Book(title='dummy',year=2012)");
    String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book()"));
    uri = new URI("http", null, "host", 9001, "/app.svc/Book(title='dummy',year=2012)/Author");
    visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book()/Author"));
}
Also used : HandleParametersOption(org.zaproxy.zap.spider.SpiderParam.HandleParametersOption) URI(org.apache.commons.httpclient.URI) Test(org.junit.Test)

Example 5 with HandleParametersOption

use of org.zaproxy.zap.spider.SpiderParam.HandleParametersOption in project zaproxy by zaproxy.

the class URLCanonicalizerUnitTest method shouldCanonicalizeODataIDSimpleIn_USE_ALL_mode.

// Test the OData behavior
@Test
public void shouldCanonicalizeODataIDSimpleIn_USE_ALL_mode() throws URIException {
    HandleParametersOption spiderOpion = HandleParametersOption.USE_ALL;
    URI uri = new URI("http", null, "host", 9001, "/app.svc/Book(1)");
    String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book(1)"));
    uri = new URI("http", null, "host", 9001, "/app.svc/Book(1)/Author");
    visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation(uri, spiderOpion, true);
    assertThat(visitedURI, is("http://host:9001/app.svc/Book(1)/Author"));
}
Also used : HandleParametersOption(org.zaproxy.zap.spider.SpiderParam.HandleParametersOption) URI(org.apache.commons.httpclient.URI) Test(org.junit.Test)

Aggregations

URI (org.apache.commons.httpclient.URI)6 Test (org.junit.Test)6 HandleParametersOption (org.zaproxy.zap.spider.SpiderParam.HandleParametersOption)6