1

这些应用程序可以获得一个 Shoutcast 元数据。

在某些情况下会出现异常“服务器违反协议。Section=ResponseStatusLine”。

请求示例:

GET http://173.244.215.162:8300/;stream.nsv HTTP/1.1
GET: / HTTP/1.0
Icy-MetaData: 1
User-Agent: WinampMPEG/5.09
Host: 173.244.215.162:8300
Connection: Keep-Alive

回复:

ICY 200 OK
icy-notice1: <BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
icy-notice2: SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>
icy-name: 100Hitz - Top 40
icy-genre: Various
icy-url: http://www.100hitz.com
content-type: audio/mpeg
icy-pub: 1
icy-metaint: 32768
icy-br: 128

为了解决这个问题,我可以使用这些:

<system.net>
  <settings>
  <httpWebRequest useUnsafeHeaderParsing="true" />  
  </settings>
</system.net>

在我的 App.config 文件中,但在 Windows 8 商店应用程序中我不能

但是 MediaElement 与上面提到的 Url(request) 一起工作得很好。

有什么办法可以规避这些限制?(c++ lib或一些)。

谢谢。

**

升级版:

** 我找到了 C++(卡萨布兰卡)的 REST SDK。库允许毫无例外地获得响应,但仍然存在问题:

http_client client(L"http://173.244.215.162:8300/;stream.nsv");
http_request request(methods::GET);
request.headers().add(L"GET",L"/ HTTP/1.0");
request.headers().add(L"Icy-MetaData",L"1");

client.request(request).then([](http_response response)
{
...
}

响应标头出现在responce.body(); Is there any way to ignore HTTP RFC? 或者如何进行一些预处理以获得正确的响应标头。谢谢。

升级版:

通过手动标头解析解决此问题。仍在寻找更好的解决方案。

4

0 回答 0