xigaro Posted November 8, 2012 Share Posted November 8, 2012 I use llRequestURL() in my script to get a URL for incoming HTTP requests. Is there a way my script can check the URL is still alive? I'd rather do it in script if possible, instead of pinging out to a server to do a remote test.From the docs it looks like the URL will be removed under certain conditions so I've made sure the URL is re-created when the events trigger. But I don't feel confident that the URL will stay alive under all other circumstances. A check every 60 minutes or so would put me at ease.What's the best way to check a llRequestURL() URL is still active and working?Thanks! Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted November 8, 2012 Share Posted November 8, 2012 As for checking, the only way is to try to connect to the script from outside (either outworld or another script). The cliennt doing the test doesn't have to be external. LSL doesn't provide a function to check if the URL is still valid. Link to comment Share on other sites More sharing options...
xigaro Posted November 8, 2012 Author Share Posted November 8, 2012 Thank you Darkie I don't know why I didn't think of that! I put this together and it looks like I can test from the same script: key request_id;string request_url;default{ state_entry() { // Open URL request_id = llRequestURL(); // Set hovertext llSetText("Touch me to kill the URL", <1,1,1>, 1.0); } http_request(key id, string method, string body) { if (method == URL_REQUEST_GRANTED) { // We were granted a URL, store it request_url = body; // Start timer to test URL llSetTimerEvent(10); } else if (method == "GET") { // Assume this is the script testing the URL llHTTPResponse(id, 200, "OK"); } } timer() { // Test the URL with an HTTP request llHTTPRequest(request_url, [], ""); } http_response(key request_id, integer status, list metadata, string body) { if (status == 200) { llOwnerSay("URL is still working correctly"); } else { llOwnerSay("URL failed with status code " + (string)status); } } touch_start(integer total_number) { // Kill the URL llReleaseURL(request_url); // Set hovertext llSetText("URL no longer available", <1,1,1>, 1.0); }} Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now