Search in sources :

Example 1 with HttpRequestHeader

use of org.parosproxy.paros.network.HttpRequestHeader in project zaproxy by zaproxy.

the class SpiderScan method readURI.

@Override
public void readURI(HttpMessage msg) {
    HttpRequestHeader requestHeader = msg.getRequestHeader();
    HttpResponseHeader responseHeader = msg.getResponseHeader();
    resourcesFound.add(new SpiderResource(msg.getHistoryRef().getHistoryId(), requestHeader.getMethod(), requestHeader.getURI().toString(), responseHeader.getStatusCode(), responseHeader.getReasonPhrase()));
    if (View.isInitialised()) {
        addMessageToMessagesTableModel(msg);
    }
}
Also used : HttpResponseHeader(org.parosproxy.paros.network.HttpResponseHeader) HttpRequestHeader(org.parosproxy.paros.network.HttpRequestHeader)

Example 2 with HttpRequestHeader

use of org.parosproxy.paros.network.HttpRequestHeader in project zaproxy by zaproxy.

the class FilterLogPostQuery method onHttpRequestSend.

@Override
public void onHttpRequestSend(HttpMessage httpMessage) {
    HttpRequestHeader reqHeader = httpMessage.getRequestHeader();
    if (reqHeader != null && reqHeader.isText() && !reqHeader.isImage()) {
        if (reqHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.POST)) {
            try {
                URI uri = reqHeader.getURI();
                // ZAP: Removed unused variable (int pos).
                String firstline;
                URI newURI = (URI) uri.clone();
                String query = httpMessage.getRequestBody().toString();
                if (query != null) {
                    newURI.setQuery(null);
                    firstline = newURI.toString();
                    // ZAP: Added type arguments.
                    Hashtable<String, String> param = parseParameter(query);
                    writeLogFile(firstline, param);
                } else {
                    firstline = uri.toString();
                    writeLogFile(firstline, null);
                }
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
    }
}
Also used : HttpRequestHeader(org.parosproxy.paros.network.HttpRequestHeader) URI(org.apache.commons.httpclient.URI)

Example 3 with HttpRequestHeader

use of org.parosproxy.paros.network.HttpRequestHeader in project zaproxy by zaproxy.

the class DefaultParseFilterUnitTest method createHttpMessageWithRequestUri.

private static HttpMessage createHttpMessageWithRequestUri(String requestUri) {
    try {
        HttpMessage message = new HttpMessage(new HttpRequestHeader("GET " + requestUri + " HTTP/1.1\r\nHost: example.com\r\n"));
        message.setResponseHeader("HTTP/1.1 200 OK\r\n");
        return message;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : HttpMessage(org.parosproxy.paros.network.HttpMessage) HttpRequestHeader(org.parosproxy.paros.network.HttpRequestHeader)

Example 4 with HttpRequestHeader

use of org.parosproxy.paros.network.HttpRequestHeader in project zaproxy by zaproxy.

the class AuthenticationMethodIndicatorsUnitTest method setUp.

@BeforeEach
void setUp() throws Exception {
    loginMessage = new HttpMessage();
    HttpRequestHeader header = new HttpRequestHeader();
    header.setURI(new URI("http://www.example.com", true));
    loginMessage.setRequestHeader(header);
    method = Mockito.mock(AuthenticationMethod.class, Mockito.CALLS_REAL_METHODS);
    method.setAuthCheckingStrategy(AuthCheckingStrategy.EACH_RESP);
}
Also used : HttpMessage(org.parosproxy.paros.network.HttpMessage) HttpRequestHeader(org.parosproxy.paros.network.HttpRequestHeader) URI(org.apache.commons.httpclient.URI) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with HttpRequestHeader

use of org.parosproxy.paros.network.HttpRequestHeader in project zaproxy by zaproxy.

the class AuthenticationMethodPollUrlUnitTest method setUp.

@BeforeEach
void setUp() throws Exception {
    loginMessage = new HttpMessage();
    HttpRequestHeader header = new HttpRequestHeader();
    header.setURI(new URI("http://www.example.com", true));
    loginMessage.setRequestHeader(header);
    method = Mockito.mock(AuthenticationMethod.class, Mockito.CALLS_REAL_METHODS);
    method.setAuthCheckingStrategy(AuthCheckingStrategy.EACH_RESP);
    this.startServer();
}
Also used : HttpMessage(org.parosproxy.paros.network.HttpMessage) HttpRequestHeader(org.parosproxy.paros.network.HttpRequestHeader) URI(org.apache.commons.httpclient.URI) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

HttpRequestHeader (org.parosproxy.paros.network.HttpRequestHeader)23 HttpMessage (org.parosproxy.paros.network.HttpMessage)13 URI (org.apache.commons.httpclient.URI)11 HttpRequestBody (org.zaproxy.zap.network.HttpRequestBody)4 IOException (java.io.IOException)3 URIException (org.apache.commons.httpclient.URIException)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 HttpMalformedHeaderException (org.parosproxy.paros.network.HttpMalformedHeaderException)3 HarPostData (edu.umass.cs.benchlab.har.HarPostData)2 HarPostDataParam (edu.umass.cs.benchlab.har.HarPostDataParam)2 HarQueryString (edu.umass.cs.benchlab.har.HarQueryString)2 Test (org.junit.jupiter.api.Test)2 HttpResponseHeader (org.parosproxy.paros.network.HttpResponseHeader)2 SSLContextManager (ch.csnc.extension.httpclient.SSLContextManager)1 HarCookie (edu.umass.cs.benchlab.har.HarCookie)1 HarCookies (edu.umass.cs.benchlab.har.HarCookies)1 HarHeader (edu.umass.cs.benchlab.har.HarHeader)1 HarPostDataParams (edu.umass.cs.benchlab.har.HarPostDataParams)1 HarQueryParam (edu.umass.cs.benchlab.har.HarQueryParam)1 HarRequest (edu.umass.cs.benchlab.har.HarRequest)1