Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1352

"Premature end of Content-Length delimited message body ..." when reading entity.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 4.3 Beta1
    • None
    • None
    • None

    Description

      Simplified sample code which still causes the error:

      HttpClient httpclient = new DecompressingHttpClient();

      HttpGet httpget = new HttpGet("http://www.shaanig.com/");

      HttpResponse response = httpclient.execute(httpget);

      String responseString = EntityUtils.toString(response.getEntity());

      Error:
      Exception in thread "main" org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 113531; received: 15329
      at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:179)
      at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:199)
      at org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:103)
      at org.apache.http.conn.BasicManagedEntity.streamClosed(BasicManagedEntity.java:157)
      at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:227)
      at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
      at java.util.zip.InflaterInputStream.close(InflaterInputStream.java:210)
      at java.util.zip.GZIPInputStream.close(GZIPInputStream.java:111)
      at org.apache.http.util.EntityUtils.toString(EntityUtils.java:249)
      at org.apache.http.util.EntityUtils.toString(EntityUtils.java:288)

      This only happens with http://www.shaanig.com/ , I'm not the owner the host, but I would like to execute GET requests to it. Seems like it can't close the stream.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              freddy1 Arūnas Bendoraitis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: