Search in sources :

Example 16 with FilterResult

use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.

the class DefaultParseFilterUnitTest method shouldNotFilterHttpMessageWithResponseUnderMaxParseSize.

@Test
void shouldNotFilterHttpMessageWithResponseUnderMaxParseSize() throws Exception {
    // Given
    int maxParseSizeBytes = 2;
    DefaultParseFilter filter = new DefaultParseFilter(createSpiderParam(maxParseSizeBytes), resourceBundle);
    HttpMessage httpMessage = createHttpMessageWithResponseBody("A");
    // When
    FilterResult filterResult = filter.filtered(httpMessage);
    // Then
    assertThat(filterResult.isFiltered(), is(equalTo(false)));
}
Also used : FilterResult(org.zaproxy.zap.spider.filters.ParseFilter.FilterResult) HttpMessage(org.parosproxy.paros.network.HttpMessage) Test(org.junit.jupiter.api.Test)

Example 17 with FilterResult

use of org.zaproxy.zap.spider.filters.ParseFilter.FilterResult in project zaproxy by zaproxy.

the class DefaultParseFilterUnitTest method shouldNotFilterHttpMessageWithRobotsTxtRequestEvenWithoutContentType.

@Test
void shouldNotFilterHttpMessageWithRobotsTxtRequestEvenWithoutContentType() throws Exception {
    // Given
    DefaultParseFilter filter = createDefaultParseFilter();
    HttpMessage httpMessage = createHttpMessageWithRequestUri("/robots.txt");
    httpMessage.getResponseHeader().setHeader(HttpHeader.CONTENT_TYPE, "");
    // When
    FilterResult filterResult = filter.filtered(httpMessage);
    // Then
    assertThat(filterResult.isFiltered(), is(equalTo(false)));
}
Also used : FilterResult(org.zaproxy.zap.spider.filters.ParseFilter.FilterResult) HttpMessage(org.parosproxy.paros.network.HttpMessage) Test(org.junit.jupiter.api.Test)

Aggregations

HttpMessage (org.parosproxy.paros.network.HttpMessage)17 FilterResult (org.zaproxy.zap.spider.filters.ParseFilter.FilterResult)17 Test (org.junit.jupiter.api.Test)16 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 SocketException (java.net.SocketException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 UnknownHostException (java.net.UnknownHostException)1 SSLException (javax.net.ssl.SSLException)1 URIException (org.apache.commons.httpclient.URIException)1 DatabaseException (org.parosproxy.paros.db.DatabaseException)1 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)1 ParseFilter (org.zaproxy.zap.spider.filters.ParseFilter)1