Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006550opensim[REGION] Script Functionspublic2013-02-24 00:332016-05-22 07:50
Reporterdjphil 
Assigned Tomelanie 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformPCOSWindowsOS VersionSeven
Product Version 
Target VersionFixed in Versionmaster (dev code) 
Summary0006550: Possible problem with llHTTPRequest
DescriptionI tried to play with llHTTPRequest but I have problems ...

First I uncommented these two lines in my ini file
ExternalHostNameForLSL = "127.0.0.1"
user_agent = "OpenSim LSL (Mozilla Compatible)"
Otherwise it does not work ...

Now this works a little better but I still have problems.

If I do this, this works correctly:
llHTTPRequest(STREAMURL + "/7.html",[],"");
llHTTPRequest(STREAMURL + "/7.html", [HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "");

If I do this, it does not work properly:
llHTTPRequest(STREAMURL + "/7.html HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n",[],"");
llHTTPRequest(STREAMURL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");

This really returns "Invalid resource"
(<HTML><HEAD><TITLE>SHOUTcast Server</TITLE></HEAD><BODY><H3>Invalid resource</H3></BODY></HTML>)

This is it a bug, I do not know ... ?

I attached two small scripts
The first is a simple to quickly test
The 2nd is a bit more complete and can retrieve information shoutcast server (/ 7.html)

Note that I've tried it in Second Life and also this works very well!
Additional InformationFirst Script:
-------------

string STREAMURL = "http://178.156.201.212:7777"; [^]

default
{
    touch_start(integer total_number)
    {
        llSay(0,"Un moment...");

        // This Work
        llHTTPRequest(STREAMURL + "/7.html",[],"");
        // llHTTPRequest(STREAMURL + "/7.html", [HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "");

        // This don't Work
        // llHTTPRequest(STREAMURL + "/7.html HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n",[],"");
        // llHTTPRequest(STREAMURL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");
    }
    
    http_response(key id, integer status, list metadata, string body)
    {
        llSay(0,"Voici la response:\n" + body);
    }
}

Second Script:
--------------

// 7.html gives the following in the body
// 0 -> current listeners
// 1 -> status
// 2 -> listener peak
// 3 -> max listeners
// 4 -> reported listeners
// 5 -> bitrate
// 6 -> song


string stream = "http://178.156.201.212:7777"; [^]
key kSentRequest;

default
{
    state_entry()
    {
        string URL = stream + "/7.html HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n";
        kSentRequest = llHTTPRequest(URL, [], "");
    }
    
    http_response (key kRecRequest, integer intStatus, list lstMeta, string strBody)
    {
        if (kRecRequest == kSentRequest)
        {
            // Strip the html out of the received information and just show what is inbetween the body tags
            list html = llParseString2List(strBody,["<body>", "</body>"],[]);
            string info = (llList2String(html,1));
            
            list status = llCSV2List(info);
            
            llSay(0," Current Listeners: " + llList2String(status,0));
            llSay(0,"Status: " + llList2String(status,1));
            llSay(0,"listener peak: " + llList2String(status,2));
            llSay(0,"max listeners: " + llList2String(status,3));
            llSay(0,"reported listeners: " + llList2String(status,4));
            llSay(0,"bitrate: " + llList2String(status,5));
            llSay(0,"Song: " + llList2String(status,6));
            kSentRequest = NULL_KEY;
        }
    }
}
TagsNo tags attached.
Git Revision or version numberOSgrid (0.7.6 (Dev) 2642129
Run Mode Grid (Multiple Regions per Sim)
Physics EngineODE
Environment.NET / Windows32
Mono VersionNone
ViewerAngstrom Voodoo FireStorm
Attached Files

- Relationships

-  Notes
(0023595)
melanie (administrator)
2013-02-24 03:05

Appending extra header information with \n is an exploit of a SL bug that OpenSim doesn't emulate. Since OpenSim allows you to set the user agent string in the .ini file, the dirty SL hack was not implemented.

This is by design.
(0025357)
djphil (reporter)
2014-03-03 18:17

Ok ...
(0030356)
danbanner (manager)
2016-05-22 05:20

I have discovered that this 'hack' would be very useful in certain situations where changing the user-agent for a specific purpose is much more practical than permanent change in the OpenSim.ini

for example a (non-api) translator that requires user_agent = "Mozilla/5.0 (X11; Linux i586; rv:31.0) Gecko/20100101 Firefox/31.0" which works well for the translator but might break other scripts using llHTTPRequest
(0030358)
melanie (administrator)
2016-05-22 05:41

Well, if this isn't a necrobump I don't know what is!

Avination has working streamboards. I am not sure if we implemented the SL hack or a canonical solution but I would suggest trying 0.9.0.

No more work will be done on 0.8
(0030359)
djphil (reporter)
2016-05-22 06:36

Need to reopen this mantis 0006550
(0030360)
melanie (administrator)
2016-05-22 07:24

Please test on 0.9 and give feedback
(0030361)
djphil (reporter)
2016-05-22 07:49

Everything works correctly for me in 0.9

Ty!
(0030362)
djphil (reporter)
2016-05-22 07:50

Tank you danbanner to point me this mantis again

- Issue History
Date Modified Username Field Change
2013-02-24 00:33 djphil New Issue
2013-02-24 00:35 djphil Additional Information Updated View Revisions
2013-02-24 03:05 melanie Note Added: 0023595
2013-02-24 03:06 melanie Status new => resolved
2013-02-24 03:06 melanie Resolution open => no change required
2013-02-24 03:06 melanie Assigned To => melanie
2014-03-03 18:17 djphil Note Added: 0025357
2014-03-03 18:17 djphil Status resolved => closed
2016-05-22 05:20 danbanner Note Added: 0030356
2016-05-22 05:41 melanie Note Added: 0030358
2016-05-22 06:36 djphil Note Added: 0030359
2016-05-22 07:23 melanie Status closed => feedback
2016-05-22 07:23 melanie Resolution no change required => reopened
2016-05-22 07:23 melanie Status feedback => new
2016-05-22 07:24 melanie Note Added: 0030360
2016-05-22 07:49 djphil Note Added: 0030361
2016-05-22 07:50 djphil Note Added: 0030362
2016-05-22 07:50 djphil Status new => resolved
2016-05-22 07:50 djphil Fixed in Version => master (dev code)
2016-05-22 07:50 djphil Resolution reopened => fixed
2016-05-22 07:50 djphil Status resolved => closed


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker