There is a known issue in Shoutcast XML where when a certain Apple Useragent is used, it produces an XML error. This is passed to the Drupal Shoutcast module as well and when someone connects to the stream with that specific Apple device, it produces the following error on the site:
warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xA0 0x54 0x56 0x3B in modules/shoutcast/shoutcast.module on line 496.
While this is not an error with the Drupal Shoutcast module itself, has anyone came up with a patch that will either rewrite the useragent string to be valid XML, or at least ignore the string so that the error is not produced and therefore breaking the module during the time in which that person is connected?
The Apple useragent that is responsible is something like: AppleCoreMedia/1.0.0.9A406a (Apple in...
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | shoutcast.module.patch | 1.05 KB | yohnson |
| #1 | shoutcast.module.patch | 1.05 KB | yohnson |
Comments
Comment #1
yohnson commentedApple TV on the iOS5 has a user agent string that makes parsing the user agent string without some level of sanitation cause an error.
(Apple�TV; U; CPU OS 5_0_1 like Mac OS X; en_us)
Attached is a patch using the PHP function utf8_encode() around the user agent string.
Comment #2
yohnson commentedPrior patch attachment is missing a ) in the array definition edited. Revised patch attached
Comment #3
marty.true commentedI tried the second patch and it failed...
Comment #4
marty.true commentedI just manually changed the code in the shoutcast.module from your patch file and I think that worked okay. I'll post back if I find that it didn't work.
Thanks for the contrib! This has been a major pain!
Comment #5
marty.true commentedI applied the code in the patch and unfortunately I got this error this morning...warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /mysite/sites/all/modules/shoutcast/shoutcast.module on line 496.warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xA0 0x54 0x56 0x3B in /mysite/sites/all/modules/shoutcast/shoutcast.module on line 499.Disregard, I just downloaded the shoutcast.module file and found that for some reason, it had reverted back to original. I have inserted the patch code again and will monitor to see if it is working properly...
Comment #6
marty.true commentedAfter monitoring this for several weeks, I have still had instances where the Apple user agent still creates the issue...
Comment #7
marty.true commentedAny progress on fixing the broken XML that is generated from the "Bad Apple" user agent string that brings this module to its knees? Would love to have this fixed so that I don't keep having to keep kicking people off my stream in order to have the module displaying the information normally.
Comment #8
yohnson commentedPlease upload a sample of XML source from your shoutcast server. Use this URL to retrieve the XML needed to debug this issue, make sure there is an instance of the user string causing issues present in the XML
http://host:port/admin.cgi?mode=viewxml