如何分析一个无标准的HTTP响应? [英] How to parse a none standard HTTP response?

查看:177
本文介绍了如何分析一个无标准的HTTP响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个真正的很难搞清楚如何解析一个没有标准的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的或<解析A HREF =htt​​p://developer.android.com/reference/java/net/HttpURLConnection.html> 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.

这篇关于如何分析一个无标准的HTTP响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆