From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH 1/2] web: Handle ending CRLF (\r\n) for chunked input and output ports. Date: Mon, 04 Jul 2022 11:54:27 +0200 Message-ID: <87o7y5fbjg.fsf@gnu.org> References: <20220630181554.25772-1-mail@cbaines.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7210"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) Cc: guile-devel@gnu.org To: Christopher Baines Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Jul 04 11:55:26 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o8Inc-0001i8-8i for guile-devel@m.gmane-mx.org; Mon, 04 Jul 2022 11:55:24 +0200 Original-Received: from localhost ([::1]:52912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Inb-0003Xv-4f for guile-devel@m.gmane-mx.org; Mon, 04 Jul 2022 05:55:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Imk-0002jq-6a for guile-devel@gnu.org; Mon, 04 Jul 2022 05:54:30 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Imj-0007qu-TB; Mon, 04 Jul 2022 05:54:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=/XAJYZE8sYdIh4OtV0b3IAaWrTVwsOhdP+rr+Wk+M1s=; b=FjnLflZtMwXqWjR41Uf2 geEdgfmcKcDm8ikyvCmgD1zh3h2qSNUzW4PWwIxjR6Y+p9QCCXLVUG7lBupPGmuxAHZdmFBmjwCOV DGTSE+5ZavRUMknfvrrRIRdDlILTaksNuq67LqBtH/dC5YNJmvhzCRLx1HJs4vsVrP/PBDLfGznI8 ghcaSiMKS+gBJtJEg7j9AQlPGNKaUheET8Tjz36bgWQXc7mKWGwgA0+g1Qr2Qwdi/4Jn1s0d2/1rW 0rqisrFjBVyNYNqRMQmK6nDX5XUxMIogGKLqHMoXg672UznxdpXfg4Puoe13whvAYG5JPqWFEMtSQ ZixQPy5k9Bs8bQ==; Original-Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=39216 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Imj-00019r-2R; Mon, 04 Jul 2022 05:54:29 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Sextidi 16 Messidor an 230 de la =?utf-8?Q?R=C3=A9vo?= =?utf-8?Q?lution=2C?= jour du Tabac X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu In-Reply-To: <20220630181554.25772-1-mail@cbaines.net> (Christopher Baines's message of "Thu, 30 Jun 2022 19:15:53 +0100") X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21249 Archived-At: Hi Chris, Christopher Baines skribis: > The chunked transfer encoding specifies the chunked body ends with > CRLF. This is in addition to the CRLF at the end of the last chunk, so > there should be CRLF twice at the end of the chunked body: > > https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1 > > * module/web/http.scm (make-chunked-input-port): Read two extra bytes at > the end of the chunked input. > (make-chunked-output-port): Write the missing \r\n when closing the > port. > * test-suite/tests/web-http.test (chunked encoding): Add missing \r\n to > test data. [...] > This port is of limited use if it cannot be used reliably. Rather than > behaving as if the input has finished when it ends unexpectedly, instead > raise an exception. > > * module/web/http.scm (make-chunked-input-port): Raise an exception on > premature termination. > (&chunked-input-ended-prematurely): New exception type. > (chunked-input-ended-prematurely-error?): New procedure. > * test-suite/tests/web-http.test (pass-if-named-exception): Rename to > pass-if-named-exception. > (pass-if-named-exception): New syntax. > ("Exception on premature chunk end"): New test for this behaviour. Applied, thanks! Are there servers out there where you would hit this bug? We were =E2=80=9Clucky=E2=80=9D not to notice before I guess. Ludo=E2=80=99.