secondlife / jira-archive

2 stars 0 forks source link

[BUG-202990] Trying to recieve smart packet from stream frame Icy-MetaData:1 #3230

Open sl-service-account opened 6 years ago

sl-service-account commented 6 years ago

Steps to Reproduce

I received a HTTP 415 which i feel was incorrect: The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding

Actual Behavior

I expected the body to receive the first burst from the server as detailed in http://www.smackfu.com/stuff/programming/shoutcast.html

Steps to replicate


key HTTPRequest2;

throw_exception(string inputString)
{
    key owner = llGetOwner();
    llInstantMessage(owner, inputString);

    llResetScript();
}

default
{
    state_entry()
    {
      string url = "http://stream1.slowradio.com";
      HTTPRequest2 =llHTTPRequest(url,[HTTP_METHOD,"GET", HTTP_USER_AGENT,"LSL_Script (Mozilla Compatible)",   HTTP_MIMETYPE, "audio/mpeg"   ,HTTP_CUSTOM_HEADER,"icy-metaData","1",HTTP_BODY_MAXLENGTH,16384, HTTP_VERIFY_CERT,TRUE],"");
    }

    http_response(key k,integer status, list meta, string body)
    {
         if ((string)status == URL_REQUEST_DENIED)
            throw_exception("The following error occurred while attempting to get a free URL for this device:\n \n" + body);
         if(status != 200) {
            llOwnerSay("Error "+ (string)status);
            return ;
          }
         // llOwnerSay((string)k +"HTTP1 "+ (string)HTTPRequest1 +" HTTP2 "+ (string)HTTPRequest2);
         if(k == HTTPRequest2) {
            //feed = llGetSubString(body,llSubStringIndex(body, "<body>") + llStringLength("<body>"), llSubStringIndex(body,"</body>") - 1);
                llOwnerSay((string)llStringLength(body));

         }
    }
    touch_start(integer total_number)
    {
        llSay(0, "Touched.");
    }
}

Expected Behavior

I was expecting the HTTPRequest to open and for it to deliver the information I was asking for. It is possible some variance in the request could allow it to work however to date I have not found one. This must work as the current model uses the browser to place the decoded ID3 tag into chat and it cannot be detected by a listener . Decoding 7.html works for Shoutcast streams but there is nothing similar for radio stations other than this coding internal to MP3. which this method will not currently give access.

Other information

Can you please check this and provide a solution I have not been provided with a resolution but this page shows one has been accepted but not by me the reporter.

Links

Related

Original Jira Fields | Field | Value | | ------------- | ------------- | | Issue | BUG-202990 | | Summary | Trying to recieve smart packet from stream frame Icy-MetaData:1 | | Type | Bug | | Priority | Unset | | Status | Accepted | | Resolution | Accepted | | Reporter | VirtualKitten (virtualkitten) | | Created at | 2018-01-25T14:11:46Z | | Updated at | 2018-01-29T12:36:55Z | ``` { 'Business Unit': ['Platform'], 'Date of First Response': '2018-01-25T10:33:33.182-0600', "Is there anything you'd like to add?": 'Can you please check this and provide a solution', 'ReOpened Count': 0.0, 'Severity': 'Unset', 'System': 'SL Simulator', 'Target Viewer Version': 'viewer-development', 'What just happened?': 'I expected the body to receive the first burst from the server as detailed in http://www.smackfu.com/stuff/programming/shoutcast.html\r\n\r\nSteps to replicate\r\n\r\n\r\nkey HTTPRequest2;\r\n \r\nthrow_exception(string inputString)\r\n{\r\n key owner = llGetOwner();\r\n llInstantMessage(owner, inputString);\r\n \r\n \r\n llResetScript();\r\n}\r\n\r\ndefault\r\n{\r\n state_entry()\r\n {\r\n string url = "http://stream1.slowradio.com";\r\n HTTPRequest2 =llHTTPRequest(url,[HTTP_METHOD,"GET", HTTP_USER_AGENT,"LSL_Script (Mozilla Compatible)", HTTP_MIMETYPE, "audio/mpeg" ,HTTP_CUSTOM_HEADER,"icy-metaData","1",HTTP_BODY_MAXLENGTH,16384, HTTP_VERIFY_CERT,TRUE],"");\r\n }\r\n\r\n \r\n http_response(key k,integer status, list meta, string body)\r\n {\r\n if ((string)status == URL_REQUEST_DENIED)\r\n throw_exception("The following error occurred while attempting to get a free URL for this device:\\n \\n" + body);\r\n if(status != 200) {\r\n llOwnerSay("Error "+ (string)status);\r\n return ;\r\n }\r\n // llOwnerSay((string)k +"HTTP1 "+ (string)HTTPRequest1 +" HTTP2 "+ (string)HTTPRequest2);\r\n if(k == HTTPRequest2) {\r\n //feed = llGetSubString(body,llSubStringIndex(body, "") + llStringLength(""), llSubStringIndex(body,"") - 1);\r\n llOwnerSay((string)llStringLength(body));\r\n\r\n }\r\n }\r\n touch_start(integer total_number)\r\n {\r\n llSay(0, "Touched.");\r\n }\r\n}\r\n', 'What were you doing when it happened?': "I received a HTTP 415 which i feel was incorrect: The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format. The format problem might be due to the request's indicated Content-Type or Content-Encoding\r\n", 'What were you expecting to happen instead?': 'I was expecting the HTTPRequest to open and for it to deliver the information I was asking for. It is possible some variance in the request could allow it to work however to date I have not found one', 'Where': 'Not applicable', } ```
sl-service-account commented 6 years ago

Chaser Zaks commented at 2018-01-25T16:33:33Z

Unfortunately, LSL is not capable of handling/reading binary streams. Because of this, the audio/mpeg mimetype is not supported.

The best solution would be to have a outside server make a request to the HTTP mpeg stream, parse it, and return something friendly to LSL such as a json or csv block.

Additionally, I noticed you are doing

         if ((string)status == URL_REQUEST_DENIED)
            throw_exception("The following error occurred while attempting to get a free URL for this device:\n \n" + body);

in a http_response event. This check is intended for http_request events which occur if you call llRequestURL() or llRequestSecureURL(), or by doing a http request to one of the returned URLs from those two functions. http_response will never have a URL_REQUEST_DENIED status.

Additionally, while Shoutcast is a major streaming software, Icecast does have a similar page to 7.html, except it provides the respond in json which is much easier to read with LSL's built in json functions: https://github.com/xiph/Icecast-Server/blob/master/web/status-json.xsl

sl-service-account commented 6 years ago

VirtualKitten commented at 2018-01-25T17:15:12Z, updated at 2018-01-25T17:27:16Z

Thanks for your suggestion but i would like to keep it in world as have no website.

I have tried with several radio streams and this code gives same response.

The LSL system does not exclude this from MIME I tried it it gives no such error on DEBUG_CHANEL It just gives an error on the HTML codes if this is restricted it should show an error as other restricted MIME types do? If this is restricted it should follow the same route as it does not then it should function.

If you are suggesting that this is correct behavior for this item to be excluded then there is a bug as you have defined it.

Denise

sl-service-account commented 6 years ago

VirtualKitten commented at 2018-01-26T17:39:57Z

Chaser thank you for defining this bug too! As it is clear it does not return anything on DEBUG_CHANNEL . Could you be so kind to provide a copy of the 7.html from a site with ICECAST it exists? I am also aware that the radio stream http://stream.nexusradio.fm:80/nexusdance.mp3 does not provide a 7.html like other radio stations.

It is quite clear to me that reading a frame from the mp3 would not constitute a security breach for LSL so I am unsure why this has been partially blocked and provides the error 415 . My technical Group, which I am a member has worked to try and find a derivative header which would work . It is not to say there is not one . we just cannot find it in the current wiki pages. The fact that this partially works suggests it should and perhaps there is something someone else can add?

sl-service-account commented 6 years ago

VirtualKitten commented at 2018-01-26T17:51:35Z, updated at 2018-01-26T19:15:21Z

Mazidox Linden . Can you please inform me why you accepted this suggestion and it was not accepted by me the reporter as it is not relavent to this matter and determines it as a bug if Chaser is correct . Is this a case of Jira wiping matters from its jira system again and not responding to them properly? Is it not my place to accept the answer not a linden employee. Do you have a support email address in the USA please for Linden Labs?