Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE9AF5B19 for ; Thu, 12 May 2011 17:18:29 +0000 (UTC) Received: (qmail 97157 invoked by uid 500); 12 May 2011 17:18:29 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 97117 invoked by uid 500); 12 May 2011 17:18:29 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 97104 invoked by uid 99); 12 May 2011 17:18:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 May 2011 17:18:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 May 2011 17:18:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 4D69087FE5 for ; Thu, 12 May 2011 17:17:47 +0000 (UTC) Date: Thu, 12 May 2011 17:17:47 +0000 (UTC) From: "Daniel Rabe (JIRA)" To: dev@hc.apache.org Message-ID: <1599745155.7335.1305220667312.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (HTTPCLIENT-1085) Connection is never reused if response is gzip with non-negative Content-Length MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Connection is never reused if response is gzip with non-negative Content-Length ------------------------------------------------------------------------------- Key: HTTPCLIENT-1085 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1085 Project: HttpComponents HttpClient Issue Type: Improvement Components: HttpClient Affects Versions: 4.1.1 Reporter: Daniel Rabe Priority: Minor While debugging a separate issue, I noticed that DefaultConnectionReuseStrategy is very sensitive to whether the server returns a positive content-length or content-length=-1 with chunked encoding. In particular, I saw two cases: (1) Server returns gzip response with Content-Length=-1, chunked encoding. The connection is reused. (2) Server returns gzip response with Content-Length= The connection is NOT reused. This is because of the following code in DefaultConnectionReuseStrategy: if (entity.getContentLength() < 0) { if (!entity.isChunked() || ver.lessEquals(HttpVersion.HTTP_1_0)) { // if the content length is not known and is not chunk // encoded, the connection cannot be reused return false; } } GzipDecompressingEntity implements its getContentLength as always returning -1. However, it is not chunked. Therefore, the connection is not reused. I'm not sure if you would consider this a bug or a request for enhancement, but it seems to me that if the server is returning an accurate content-length, the client should be able to consume that number of bytes, then reuse the connection. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org