From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#13857: Unhandled case in module/web/response.scm Date: Sat, 09 Mar 2013 11:15:53 +0100 Message-ID: <87hakk3mli.fsf@pobox.com> References: <878v669sh8.fsf@notengoamigos.org> <87a9qhznkf.fsf@notengoamigos.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362824200 2191 80.91.229.3 (9 Mar 2013 10:16:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Mar 2013 10:16:40 +0000 (UTC) Cc: Jason Earl , 13857@debbugs.gnu.org To: Daniel Hartwig Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Mar 09 11:17:01 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UEGpj-0000zP-F2 for guile-bugs@m.gmane.org; Sat, 09 Mar 2013 11:16:55 +0100 Original-Received: from localhost ([::1]:34590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEGpN-0007bc-Dj for guile-bugs@m.gmane.org; Sat, 09 Mar 2013 05:16:33 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEGpF-0007bH-KS for bug-guile@gnu.org; Sat, 09 Mar 2013 05:16:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEGpA-0003jW-DW for bug-guile@gnu.org; Sat, 09 Mar 2013 05:16:25 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEGpA-0003jS-90 for bug-guile@gnu.org; Sat, 09 Mar 2013 05:16:20 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UEGpq-0004LX-At for bug-guile@gnu.org; Sat, 09 Mar 2013 05:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 09 Mar 2013 10:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13857 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 13857-submit@debbugs.gnu.org id=B13857.136282420116672 (code B ref 13857); Sat, 09 Mar 2013 10:17:02 +0000 Original-Received: (at 13857) by debbugs.gnu.org; 9 Mar 2013 10:16:41 +0000 Original-Received: from localhost ([127.0.0.1]:40899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEGpV-0004Kq-9o for submit@debbugs.gnu.org; Sat, 09 Mar 2013 05:16:41 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:46784 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UEGpT-0004Kj-8O for 13857@debbugs.gnu.org; Sat, 09 Mar 2013 05:16:40 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id A6FD1CF2C; Sat, 9 Mar 2013 05:15:56 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=KXIyEFt+PGBe AliVxEFoN4JXgG8=; b=Vcs8vM3B3wVkEQ01EfuShoqNmsFReFrHJ/PZtv5SPi/6 TYjPCOIfZx9wQKudPP1o2YNYRTxeOdsiU6m3oSX7tkTvSPf7plKqihdL4tH2r+Ae AzHPeETYk8oIYb27HQtbrpshJoAhrmFXXd48wW6YrnXWbdjYGC3s+ees0mB6ShQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=jqJdQ1 iA9F73xaWzksmXu4/X5h+gc3pPhiuPyY96EuBt1nCLo5EpFXv7/MFIln47OtE7FS YiiBhHnHv9vd84Q8V1+ww4sdky/3KxBiYem+DiZcMX6xNpe4PQ5vEO0J5R+Ks3GU A8GIZsOG94fSuQwTE/cRgdOiIER5RVyPBkmdI= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 9505BCF2B; Sat, 9 Mar 2013 05:15:56 -0500 (EST) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id E04E9CF2A; Sat, 9 Mar 2013 05:15:55 -0500 (EST) In-Reply-To: (Daniel Hartwig's message of "Sat, 9 Mar 2013 09:27:58 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: 54A0B294-88A2-11E2-A1F2-59240E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6900 Archived-At: On Sat 09 Mar 2013 02:27, Daniel Hartwig writes: > It is anyway clear that =E2=80=98response-body-port=E2=80=99 is missing t= he case where > a content-length header is not present and the body is terminated by > the server closing the port. Some additional care needs to be taken, > e.g. =E2=80=98#:keep-alive?=E2=80=99 is incompatible with missing content= -length. > Depending on how =E2=80=98response-body-port=E2=80=99 is used, I will hav= e to consider > whether to signal an error or do something else in that case. > > Thanks for reporting this and hopefully it can be fixed for the next > point release. As I am currently somewhat involved with the web > modules and related RFCs it is something else I can work on. Something like this? --- a/module/web/response.scm +++ b/module/web/response.scm @@ -273,13 +273,26 @@ body is available. When KEEP-ALIVE? is #f, closing the returned port also closes R's response port." (define port - (if (member '(chunked) (response-transfer-encoding r)) - (make-chunked-input-port (response-port r) - #:keep-alive? keep-alive?) - (let ((len (response-content-length r))) - (and len - (make-delimited-input-port (response-port r) - len keep-alive?))))) + (cond + ((member '(chunked) (response-transfer-encoding r)) + (make-chunked-input-port (response-port r) + #:keep-alive? keep-alive?)) + ((response-content-length r) + =3D> (lambda (len) + (make-delimited-input-port (response-port r) + len keep-alive?))) + ((response-must-not-include-body? r) + #f) + ((or (memq 'close (response-connection r)) + (and (equal? (response-version r) '(1 . 0)) + (not (memq 'keep-alive (response-connection r))))) + port) + (else + ;; Here we have a message with no transfer encoding, no + ;; content-length, and a response that won't necessarily be closed + ;; by the server. Not much we can do; assume that the client + ;; knows how to handle it. + port))) =20 (when (and decode? port) (match (response-content-type r) Andy --=20 http://wingolog.org/