-
Notifications
You must be signed in to change notification settings - Fork 61
Http
Daniele Linguaglossa edited this page Jan 8, 2018
·
1 revision
Http
is the utility class used to interact with request and responses, it allow for example to send custom request or craft a request from a string.
Below the list of methods:
sendRequest
is the method used to send a custom request , it may be used to provide a bridge between goWAPT and other applications; return an http.Response
object , below an example:
// Signature
// Http.sendRequest(http.Request * req)
function test(base_request) {
// Get pluto parameter
var p = Utils.getParameter(base_request, "pluto");
// Modify its value
Utils.setParameter(p, "new_value");
// Send the request with modified value and retrieve the response
var response = Http.sendRequest(base_request);
}
requestFromString
is the method used to craft a custom request from a string, below an example:
// Signature
// Http.requestFromString(string request)
function test(base_request) {
// Craft a request
var req = Http.requestFromString("GET / HTTP/1.1\r\nHost: www.google.it\r\nConnection: close\r\n\r\n");
// Send the request
var response = Http.sendRequest(req);
}
findOffsetInResponse
is the method used to find occurrence of a string inside an http.Response
object, below an example:
// Signature
// Http.findOffsetInResponse(http.Response * response, string value)
function test(base_request) {
var response = Http.sendRequest(base_request);
// Find the first occurrence of "<script>" and return its offset
var offset = Http.findOffsetInResponse(response, "<script>");
}