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. [Android framework protected API] Permission protection level definitio

On Mon, Mar 16, 2009 at 10:29 AM, Guillaume Leterrier <

Signature-based permissions require that the .apk being granted the
permission be signed with the same certificate as the one declaring it.  You
could make new types of permissions that allow other things, but we haven't
needed such things so haven't implemented them.

This is just a directory.  Each .apk has a line in its manifest declaring
which certificate it should be signed with, if it doesn't want to use the

I don't understand the question.  This protection level just means "same as
signature, but also allow anyone installed in /system to be granted the

You don't do this, because you will break existing applications.  This kind
of change will be considered a compatibility breakage, and such a device is
not considered to be an Android compatible device.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

2. Android Keystore V2 - Project Star

The executive level of this project is making Android the thing that
will finally thwart the userid/password explosion on the Internet but
there are several more short-term targets as well including OTP generation
and secure key storage.  The latter will be a two-stage process, first it is
about running a user keystore as a native service, while the end goal is
converting the service to use trusted HW based on the same principles
for unlimited secure storage and "execution" of user keys.

- Browser-extension scheme
- Symmetric and asymmetric key support
- Information Card add-on
- PIN and PUK options
- TPM "light" operation
- Secure multi-issuer key-management in shared key-stores 
- Mobile phones and consumers as primary target
- Anticipated deployment through open source implementations

1. Enroll.
2. Then try "Phone  Emulator"
3. In the Phone Emulator issue "Quick Run"

Related projects: WASP and WebAuth which are improved versions of
browser PKI clients extensively used in the EU:

Anders Rundgren


4. Your UK sales

5. Disk Activity and Disk Usage

6. a way to make signal processing

7. CheckBox test= (CheckBox) findViewById(; returns null