如何分析一个无标准的HTTP响应?标准、HTTP

2023-09-06 01:47:48 作者:我的爱很小声

我有一个真正的很难搞清楚如何解析一个没有标准的HTTP响应。

I'm having a real hard time figuring out how to parse a none standard HTTP response.

在没有标准响应包含 ICY 200 OK ,而不是 HTTP 200 OK 。下面是发送无标准的HTTP响应示例网址。 http://50.117.121.162:80

The none standard response contains ICY 200 OK instead of HTTP 200 OK. Here is a sample URL that sends the none standard HTTP response. http://50.117.121.162:80

由于Android 4.4 的HttpURLConnection 将不再与这些没有标准响应的工作。我已经使用 HttpClient的通过Apache的尝试,但由于它不工作在没有标准的HTTP响应。我曾经试过,然后按照向导添加一个自定义响应解析器,而Android似乎并没有必要所有的类来做到这一点。

Since Android 4.4 HttpURLConnection will no longer work with these none standard responses. I have tried using the HttpClient by Apache but it doesn't work because of the none standard HTTP response. I have then tried following the guide for adding a custom response parser, but Android doesn't seem have all the classes needed to do it.

我真的很努力找出一个解决方案。可能修改没有标准答案之前,它是由 HttpClient的或 HttpURLConnection的可以工作,但我不知道这甚至有可能...

I'm really struggling to figure out a solution. Possibly modify the none standard response before it is parsed by the HttpClient or the HttpURLConnection could work but I'm not sure if that is even possible...

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

推荐答案

大量的研究后,一个小的/精简版HTTP客户端库,我跑进了Apache的 HttpClient的为Android 。该库提供了HTTP连接的完整支持。然后,我只是修改了源$ C ​​$ C,特别是BasicLineParser更换ICY与HTTP / 1.0。

After a lot of research for a small/lite http client library, I ran into this port of the apache httpclient for android. The library provided a complete support for http connections. Then I simply modified the source code, particularly the BasicLineParser to replace ICY with HTTP/1.0.