HttpGet problem with Chunked encoding

by m5p3nc3r » Thu, 05 Mar 2009 11:46:33 GMT

Sponsored Links
 Hi Guys

I am having issues retrieving the contents of a chunk encoded web
page. all pages that I try to retrieve throw:
  org.apache.http.MalformedChunkCodingException: Chunked stream ended

If I retrieve a page with no chunk encoding, the code works fine.

HttpClient httpClient=new DefaultHttpClient();
HttpGet httpGet=new HttpGet(url);
ResponseHandler<String> rh=new BasicResponseHandler();
String response=httpClient.execute(httpGet,rh);

This will work with (no chunk encoding)
but fail with (chunk encoding)

Now, I am assuming this is a problem with the apache httpclient
library, but wanted to know if anyone else has seen this problem and
if there is a way of working around it in the current release.

I am using android-sdk-linux_x86-1.1_r1




HttpGet problem with Chunked encoding

by m5p3nc3r » Sat, 07 Mar 2009 01:48:01 GMT

 Sorry for replying to my own post, but it seems that this is a problem
with the version of httpclient/httpcore that is installed with r1.1 of
the SDK.

If I download the latest verison: Core 4.0 and Client 4.0-Beta2,
everything works fine on my Linux desktop.  There is a line in the
release note of Core 4.0:

* [HTTPCORE-175] Chunk decoders no longer accept truncated chunks as
valid input.
  Contributed by Oleg Kalnichevski <olegk at>

That makes me think this has been fixed in that version.

So my question to the group are:
1, How do I tell what version of libraries are installed on the
2, Is it possible for me to upgrade libraries on the system?  If so,
3, If I have to wait for the libraries to be upgraded, is there a
release schedule I can track anywhere?




Sponsored Links

HttpGet problem with Chunked encoding

by Mark Murphy » Sat, 07 Mar 2009 02:10:00 GMT


Not easily.

The source code for Apache HttpClient is integrated into the overall
Android git repo system: ;a=summary

They just imported the source code, without any sort of RELEASE file.
The quick peek I took at some of the commit log entries does not
indicate which version they have.

On the other hand, since the source is there, you can probably track
major changes by looking for classes introduced in a release. So, if
HttpClient 4.0 added some class, and HttpClient-in-Android is missing
said class, then HttpClient-in-Android isn't on 4.0.

Anybody know a good way to discern which HttpClient is in git?

It is conceivable, though unlikely, that an in-APK edition of HttpClient
would supercede the system libraries.

If you are willing to build your own firmware, you can try replacing
HttpClient, but you might have to make changes to any other code that
uses the older version, if there are API differences, etc.

That I can't help you on...

Please file your problem, and the suggestion of the HttpClient 4.0
upgrade, in , if you haven't already.

Mark Murphy (a Commons Guy) 

Android Training on the Ranch! -- Mar 16-20, 2009 


Other Threads


I would like to play around with sockets to see if I can get them to
work, but I'm not having any luck.  Here's what I tried:

new Socket("", 80);

I've also tried

new Socket("localhost", 7);

but anything you can suggest that's simple is appreciated.  I'm no
socket expert so I'm not sure if these are considered simple

I read that I should add INTERNET permission to my manifest, so I did
this too:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    <application android:icon="@drawable/icon" android:label="@string/
        <activity android:name=".ServSock"
                <action android:name="android.intent.action.MAIN" />
android:name="android.intent.category.LAUNCHER" />
    <uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET"></uses-

I'm just trying to learn so there's no real goal, just looking for a
simple example that I can get working.  Any hints what I'm missing?


2. New Hero ROM..Drizzy's V3 Full No Name Hero ROM 32A

Wew..sangat menggoda...jiahahahahahaha...



3. Need to implement Android for my website powered in PHP

4. How do I implement the onClick method for a DialogPreference?

5. which package the function setSilent lived in ?

6. just renaming the file seems to help.

7. how to get launchCount and execution time for applications