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

1. Launcher Permissions

Why are the READ_CONTACTS and CALL_PHONE permissions on the Launcher?
I see that AnyCut (not part of the Launcher) relies on the CALL_PHONE
to direct dial from an icon, but why is the READ_CONTACTS there?  Is
it also for 3rd part apps to put shortcuts to contacts on the screen?

2. How can I programically adjust an InsetDrawable 's padding


Is it possible for me to adjust InsetDrawable 's padding?  (inset
left, top, right, bottom)?
After it has been inflated?


3. Wiki for Android development

4. Assuming Developers are Pirates

5. second resources.getDrawable() fails

6. Any Listener for shake movement ?

7. timer_create problem