From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.devel Subject: Chunked Encoding Date: Thu, 29 Sep 2011 21:09:18 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1317327112 28019 80.91.229.12 (29 Sep 2011 20:11:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 29 Sep 2011 20:11:52 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Sep 29 22:11:49 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R9MxK-0005xW-Kj for guile-devel@m.gmane.org; Thu, 29 Sep 2011 22:11:42 +0200 Original-Received: from localhost ([::1]:60656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9MxK-0003Xe-0T for guile-devel@m.gmane.org; Thu, 29 Sep 2011 16:11:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9MxH-0003Uz-4z for guile-devel@gnu.org; Thu, 29 Sep 2011 16:11:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9MxF-0002Lo-TC for guile-devel@gnu.org; Thu, 29 Sep 2011 16:11:39 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:46841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9MxF-0002Li-Ng for guile-devel@gnu.org; Thu, 29 Sep 2011 16:11:37 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R9MxB-0005pv-D6 for guile-devel@gnu.org; Thu, 29 Sep 2011 22:11:33 +0200 Original-Received: from host109-154-211-128.range109-154.btcentralplus.com ([109.154.211.128]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Sep 2011 22:11:33 +0200 Original-Received: from ianprice90 by host109-154-211-128.range109-154.btcentralplus.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Sep 2011 22:11:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: host109-154-211-128.range109-154.btcentralplus.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:eRsviiU5YYQoEn7hfyS7wOxcwYQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12814 Archived-At: Hi guilers, If you've used the (web ...) modules, you may have noticed that guile does not currently support chunked-encoding. This is expected in a HTTP/1.1 world, so I wrote an implementation to cover my immediate need, but I'm not particularly convinced of it, so I wanted to discuss this before sending a patch. What I did was introduce two new exported procedures for reading (all I needed at the moment), namely 'read-chunk' and 'read-chunked-response-body'. (read-chunk port) reads one chunk from a port. (read-chunked-response-body response) read the full body for the response and returns it as a bytevector. It was written to be similar to 'read-response-body'. For writing chunks then, the obvious thing is to write two procedures 'write-chunk' and 'write-chunked-response-body' which perform the inverse. However, it seems to me that 'write-chunked-response-body' is a practically useless procedure, because if you ever had a full body, you can just use 'write-response-body'. Another option I've been thinking over would be to go for a sort of chunking version of R6RS' 'transcoded-port' which would handle it transparently for users of the returned port. I'd also suggest extending 'http-get' from (web client) to handle chunked encoding (and trailers too, I guess) for the user. Comments kindly requested, Ian -- Ian Price "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"