use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithNoHostAsOutOfScope.
@Test
public void shouldFilterUriWithNoHostAsOutOfScope() throws Exception {
// Given
URI prefixUri = new URI("http://example.org/", true);
HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
URI uri = new URI("http://", true);
// When
FetchStatus filterStatus = fetchFilter.checkFilter(uri);
// Then
assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class HttpPrefixFetchFilterUnitTest method shouldKeepNonDefaultPortFromPrefix.
@Test
public void shouldKeepNonDefaultPortFromPrefix() throws Exception {
// Given
URI prefixUri = new URI("https://example.org:8443/", true);
HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
// When
String normalisedPrefix = fetchFilter.getNormalisedPrefix();
// Then
assertThat(normalisedPrefix, is(equalTo("https://example.org:8443/")));
}
use of org.apache.commons.httpclient.URI in project zaproxy by zaproxy.
the class HttpPrefixFetchFilterUnitTest method shouldDiscardEverythingAfterPathComponentFromPrefix.
@Test
public void shouldDiscardEverythingAfterPathComponentFromPrefix() throws Exception {
// Given
URI prefixUri = new URI("https://example.org/path?query#fragment", true);
HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
// When
String normalisedPrefix = fetchFilter.getNormalisedPrefix();
// Then
assertThat(normalisedPrefix, is(equalTo("https://example.org/path")));
}
use of org.apache.commons.httpclient.URI 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)));
}
use of org.apache.commons.httpclient.URI 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)));
}
Aggregations