[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Spiffy relies on content-length (was Re: [Chicken-users] Spiffy reli
From: |
Graham Fawcett |
Subject: |
Re: Spiffy relies on content-length (was Re: [Chicken-users] Spiffy relies on removed proc.) |
Date: |
Sun, 16 Mar 2008 16:48:29 -0400 |
On Sun, Mar 16, 2008 at 4:06 PM, Robin Lee Powell
<address@hidden> wrote:
> On Sun, Mar 16, 2008 at 03:20:11PM +0100, Peter Bex wrote:
> >
> > Thanks for the error report! I've fixed the bug and added a
> > testcase for it so it will not happen again. I've also pushed a
> > new release which should be available shortly (3.8).
>
> It seems to work now, but this leads to a more general Spiffy
> problem.
>
> Run spiffy with:
>
> (define-http-resource ("/test") "test html, sort of")
>
> and then access /test in any browser. You will find (I hope) that
> the browser hangs until timeout or until you kill Spiffy; I
> certainly do.
>
> Sending a Content-Length header, which define-http-resource doesn't,
> solves the problem.
Well, you've got three options that I can think of:
1) use a Content-Length header,
2) use a Connection: close header to prevent keep-alive,
3) use chunked encoding to send responses of arbitrary length, but
retaining keepalive.
The latter requires a "Transport-Encoding: chunked" header, and an
encoding of your response into chunked format. It's not hard, and a
(define-http-resource/chunked) could be written to handle the encoding
and header for you. See
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1 for the
details.
But still, there are at least three options, and none is "correct" as
a default. The lack of a correct default is probably why Spiffy punts
on the issue and leaves it up to you to do the right thing for your
app.
Graham