[hunchentoot-devel] Re: Current development

Edi Weitz edi at agharta.de
Tue Jun 10 09:39:23 UTC 2008


On Tue, 10 Jun 2008 11:23:44 +0200, Lars Rune Nøstdal <larsnostdal at gmail.com> wrote:

> But something I'm missing from HT is the ability to control the
> stream or connection after this. SEND-HEADERS did not seem to work
> as I needed because if I "collect" the stream returned from that
> function for usage later, and let the request-thread it originated
> from die it seems the old HT has been closing that stream which of
> course causes problems when I later wanted to use the "collected"
> streams.

The stream you get from SEND-HEADERS is only good for handling the
current request, it is up to Hunchentoot what it does with this stream
later on and it depends on what has been negotiated between the client
and the server.  There are situations where the server must close the
stream and there are situations where the server must re-use it and
read the next request from it.  The server must also be able to switch
chunking on and off between requests if needed.

So, if you're trying to "keep" the stream between requests, that won't
work.

With respect to this, the old and the new Hunchentoot should behave
the same.  If they're not, that's probably an error.

> In the new HT this doesn't seem to happen (I think?), but the stream
> is of a binary type. I was wondering -- how do I send text to this
> stream?

Yes, this is new.  The rationale is that if you want maximum
convenience and protection from errors, you just send content to
Hunchentoot and let it take care of sending the right data to the
client.  If you request a stream, you're likely doing this for
performance reasons or because you want to do something special, so it
seems right to give you the "raw" binary stream.  If you want to send
text to this stream, wrap it with a flexi stream, see for example
stream-direct-utf-8 here:

  http://bknr.net/trac/browser/trunk/thirdparty/hunchentoot/test/test.lisp

> .. and I'm also wondering whether what I'm seeing is a random glitch
> by ways of timing or something, and that HT in fact will close the
> stream for me in this version also?

See above.  If you think there's a situation where Huchentoot should
close a stream but it doesn't, that's an error.  A test case would be
nice.

> I'm working on a "comet" server. Hence the somewhat unusual way of
> dealing with connections/streams.

I don't know what theat is, unfortunately,

Cheers,
Edi.



More information about the Tbnl-devel mailing list