Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4.4 http api bugs?

I decided to start testing my app with Android 4.4 and noticed that the Android HTTP connection APIs are much stricter than before? I have never had this issue and I assume it is some type of bug.

I'm connecting to SHOUTcast broadcasts that contain the particular icy header response.

Has anyone seen this issue? How can I get around it?

URL used for this test:

http://50.117.121.162:80

Logcat of exception:

11-01 23:47:57.299: E/ConnectHelper(3081): java.net.ProtocolException: Unexpected status line: ICY 200 OK 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.RawHeaders.setStatusLine(RawHeaders.java:108) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.RawHeaders.fromBytes(RawHeaders.java:308) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:135) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:644) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.vblast.xiialive.media.streamers.ConnectHelper.connectWorker(ConnectHelper.java:176) 11-01 23:47:57.299: E/ConnectHelper(3081): at com.vblast.xiialive.media.streamers.ConnectHelper.run(ConnectHelper.java:143) 11-01 23:47:57.299: E/ConnectHelper(3081): at java.lang.Thread.run(Thread.java:841)

like image 677
Jona Avatar asked Nov 02 '13 03:11

Jona


1 Answers

On Android 4.4 things did change under the hood and the none standard SHOUTcast ICY header response is no longer supported. Just like the Apache HTTPClient library.

What I had to do can be found on this post:
How to parse a none standard HTTP response?

like image 159
Jona Avatar answered Sep 21 '22 14:09

Jona