First part of code for #286 request_new is not called yet by any function and will be used with the com-rewrite that passbe is doing.
git-svn-id: https://beef.googlecode.com/svn/trunk@756 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
@@ -86,6 +86,45 @@ beef.net = {
|
||||
this.raw_request(url, method, handler, params);
|
||||
},
|
||||
|
||||
/**
|
||||
*Performs http requests
|
||||
* @param: {String} scheme: HTTP or HTTPS
|
||||
* @param: {String} method: GET or POST
|
||||
* @param: {String} domain: bindshell.net, 192.168.3.4, etc
|
||||
* @param: {Int} port: 80, 5900, etc
|
||||
* @param: {String} path: /path/to/resource
|
||||
* @param: {String} anchor: this is the value that comes after the # in the URL
|
||||
* @param: {String} query: a=1&b=string&c=3.14
|
||||
* @param: {Int} timeout: timeout the request after N seconds
|
||||
* @param: {Bool} execute: execute the response as if it was a JavaScript file.
|
||||
* @param: {Funtion} callback: call the callback function at the completion of the method
|
||||
*
|
||||
* @return: {Object} response: this object contains the response details
|
||||
*/
|
||||
//TODO logic for same domain vs cross domain (cross domain get requires dataType: script)
|
||||
//TODO implement execute
|
||||
//TODO implement post
|
||||
//TODO build response object and return it
|
||||
request_new: function(scheme, method, domain, port, path, anchor, query, timeout, execute, callback) {
|
||||
if (method.toUpperCase() == "GET"){
|
||||
$j.ajax({type: method,
|
||||
dataType: "script",
|
||||
url: scheme+"://"+domain+":"+port+path,
|
||||
data: query+"#"+anchor,
|
||||
timeout: timeout,
|
||||
success: function(data, textStatus, jqXHR){
|
||||
console.log(data);
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown){
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
//POST
|
||||
console.log("POST");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Send browser details back to the framework. This function will gather the details
|
||||
* and send them back to the framework
|
||||
|
||||
Reference in New Issue
Block a user