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 2615610082 for ; Thu, 6 Feb 2014 14:44:18 +0000 (UTC) Received: (qmail 82569 invoked by uid 500); 6 Feb 2014 14:44:16 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 82287 invoked by uid 500); 6 Feb 2014 14:44:12 -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 82231 invoked by uid 99); 6 Feb 2014 14:44:11 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Feb 2014 14:44:11 +0000 Date: Thu, 6 Feb 2014 14:44:11 +0000 (UTC) From: "Dmitry Potapov (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HTTPCORE-372) ChunkedInputStream and ChunkDecoder allows closing chunk absence MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCORE-372?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D13= 893390#comment-13893390 ]=20 Dmitry Potapov commented on HTTPCORE-372: ----------------------------------------- Oleg, I'm not sure I've got you correct. ChunkDecoder lines 180-181 become unreachable, that's why whole block on l= ines 179-182 was removed. New block at lines 90-100 follows the same logic = as in past for case when endOfStream =3D=3D false; for endOfStream =3D=3D t= rue case I fill cr and lf with zeroes to have exception thrown at line 102,= so, no new throws needed to indicate protocol violation. So, I see the only one change, which can be introduced here: remove lines 9= 4, 95, 124 and 125 which sets state to COMPLETED and completed flag to true= . If you have any other considerations concerning these changes, please, let = me know > ChunkedInputStream and ChunkDecoder allows closing chunk absence > ---------------------------------------------------------------- > > Key: HTTPCORE-372 > URL: https://issues.apache.org/jira/browse/HTTPCORE-372 > Project: HttpComponents HttpCore > Issue Type: Improvement > Components: HttpCore, HttpCore NIO > Reporter: Dmitry Potapov > Fix For: 4.4-alpha1 > > Attachments: expect-closing-chunk.patch > > > I've found that both these classes treats chunked streams without closing= chunk as complete streams without any errors. This contradicts RFC2616 =C2= =A73.6.1 > Consider the following scenario: > 1. HttpClient sends request to Server > 2. Server accepts request and send response headers with Transfer-Encodin= g: chunked > 3. Server sends first chunk completely and dies with segfault before send= ing the next chunk > 4. HttpClient receives response headers and creates ChunkedInputStream > 5. ChunkedInputStream reads this first chunk and encounters eof > Expected result: > IOException thrown indicating incomplete response > Actual result: > No exception is thrown, -1 is returned on the next read and nobody knows = that response is incomplete. -- This message was sent by Atlassian JIRA (v6.1.5#6160) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org