Skip to content
Daniele Linguaglossa edited this page Jan 8, 2018 · 1 revision

Http

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.

Methods

Below the list of methods:

sendRequest

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

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

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>");
}

Related Topics

Clone this wiki locally