unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: guile-devel@gnu.org
Subject: Chunked Encoding
Date: Thu, 29 Sep 2011 21:09:18 +0100	[thread overview]
Message-ID: <m3oby3m7pt.fsf@Kagami.home> (raw)


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"




             reply	other threads:[~2011-09-29 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29 20:09 Ian Price [this message]
2012-01-04 20:18 ` Chunked Encoding Andy Wingo
2012-05-06  4:52   ` Ian Price
2012-05-06 16:53     ` Ian Price
2012-05-08  0:33       ` Ian Price
2012-05-06 19:49     ` Thien-Thi Nguyen
2012-05-08  2:27       ` Ian Price
2012-05-08  6:26         ` Thien-Thi Nguyen
2012-05-08  3:26     ` Daniel Hartwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3oby3m7pt.fsf@Kagami.home \
    --to=ianprice90@googlemail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).