OsRequestURL

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Added note stating which version of OpenSim introduced this function)
Line 2: Line 2:
 
|threat_level=Moderate
 
|threat_level=Moderate
 
|delay=0
 
|delay=0
|function_syntax=void osRequestURL(list options)
+
|function_syntax= osRequestURL(list options)
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
 
//
 
//

Revision as of 17:29, 1 May 2019

osRequestURL(list options)
Requests one HTTP:// url (opensim version 0.9 or over)

Option supported : "allowXss" - Add 'Access-Control-Allow-Origin: *' to response header

Threat Level Moderate
Permissions No permissions specified
Extra Delay 0 seconds
Example(s)
//
//osRequestURL example
//
 
RequestReceived (key id, string query) {
    llHTTPResponse (id,200,query+" OK");
    query = llUnescapeURL(query);
    llSay (0, query);
}
 
default {
 
    state_entry() {
        osRequestURL ([ "allowXss" ]);
    }
 
    http_request(key id, string method, string body) {
 
        if (method == URL_REQUEST_GRANTED)
           llOwnerSay ("URL_REQUEST_GRANTED" +"\n" +body);
 
        if (method == URL_REQUEST_DENIED)
            llOwnerSay ("URL_REQUEST_DENIED");
 
        if (method == "GET")
            RequestReceived (id, llGetHTTPHeader(id,"x-query-string"));
 
        if (method == "POST")
            RequestReceived (id, body);
    }
 
}
Notes
This function was added in 0.9.0-post-fixes
Personal tools
General
About This Wiki