[hunchentoot-devel] How to properly write directly to output stream?

Vsevolod Dyomkin vseloved at gmail.com
Fri Mar 26 11:53:04 UTC 2010


Hi,

I'm developing a new web-application, based on Hunchentoot 1.1, my previous
ones were based on pre-1.0 version.  Since there was a switch to
binary-streams, the following approach to HTML generation directly to the
input stream from CL-WHO, which I'd used previously had to be modified from

(let ((out (send-headers)))
   (with-html-output (*who-stream* out)
      ;; ...

to

(let ((out (flex:make-flexi-stream (send-headers)
                         :external-format
*hunchentoot-default-external-format*
                         :element-type 'character)))
   (with-html-output (*who-stream* out)
      ;; ...

Still it doesn't perform the same as before, because, as far as I
understand, of the new handling of chunking. It seems to me, that the chunk
size is set to 8K in Chunga and in my case that's very inconvenient: I'd
like to serve the page in many small portions, as the time of their
"arrival" is quite unpredictable.

That is why I've tried to turn off chunking or set lower chunk sizes (1K,
for example) via both the public API (acceptor-output-chunking-p) and by
manipulating the Hunchentoot internals, but failed to achieve anything.
Either only the headers are sent and the connection is closed, or I need to
wait until the handler returns.

I would be grateful, if someone, who better understands the internal
mechanisms of that, gave me an explanation and some advice.

Thanks in advance,
Vsevolod Dyomkin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20100326/8cc51372/attachment.html>


More information about the Tbnl-devel mailing list