Search in sources :

Example 16 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithDifferentPortAsOutOfScope.

@Test
public void shouldFilterUriWithDifferentPortAsOutOfScope() throws Exception {
    // Given
    URI prefixUri = new URI("http://example.org/", true);
    HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
    URI uri = new URI("http://example.org:1234/", true);
    // When
    FetchStatus filterStatus = fetchFilter.checkFilter(uri);
    // Then
    assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 17 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithDifferentSmallerPathAsOutOfScope.

@Test
public void shouldFilterUriWithDifferentSmallerPathAsOutOfScope() throws Exception {
    // Given
    URI prefixUri = new URI("http://example.org/path", true);
    HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
    URI uri = new URI("http://example.org/p", true);
    // When
    FetchStatus filterStatus = fetchFilter.checkFilter(uri);
    // Then
    assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 18 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithDifferentHostAsOutOfScope.

@Test
public void shouldFilterUriWithDifferentHostAsOutOfScope() throws Exception {
    // Given
    URI prefixUri = new URI("http://example.org/", true);
    HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
    URI uri = new URI("http://domain.example.org/", true);
    // When
    FetchStatus filterStatus = fetchFilter.checkFilter(uri);
    // Then
    assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 19 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithNonHttpOrHttpsSchemeAsOutOfScope.

@Test
public void shouldFilterUriWithNonHttpOrHttpsSchemeAsOutOfScope() throws Exception {
    // Given
    URI prefixUri = new URI("http://example.org/", true);
    HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
    URI uri = new URI("ftp://example.org/", true);
    // When
    FetchStatus filterStatus = fetchFilter.checkFilter(uri);
    // Then
    assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 20 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithSamePathPrefixAsValid.

@Test
public void shouldFilterUriWithSamePathPrefixAsValid() throws Exception {
    // Given
    URI prefixUri = new URI("http://example.org/path", true);
    HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
    URI uri = new URI("http://example.org/path/subtree", true);
    // When
    FetchStatus filterStatus = fetchFilter.checkFilter(uri);
    // Then
    assertThat(filterStatus, is(equalTo(FetchStatus.VALID)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Aggregations

URI (org.apache.commons.httpclient.URI)33 FetchStatus (org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus)33 Test (org.junit.Test)31 FetchFilter (org.zaproxy.zap.spider.filters.FetchFilter)2 ArrayList (java.util.ArrayList)1 URIException (org.apache.commons.httpclient.URIException)1