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
I don't fully understand what you are trying to achieve when you are saying that you have to wait until the handler returns. That is something you have to do anyway.
As for the chunk size, note that this might also be governed by a) the underlying stream provided by your Lisp implementation and b) the client.
Edi.
On Fri, Mar 26, 2010 at 12:53 PM, Vsevolod Dyomkin vseloved@gmail.com wrote:
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 _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
On Fri, 26 Mar 2010 13:53:04 +0200, Vsevolod Dyomkin vseloved@gmail.com wrote:
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.
Do you look for HUNCHENTOOT:SEND-HEADERS, per chance?
[Function] send-headers => stream
Sends the initial status line and all headers as determined by the REPLY object *REPLY*. Returns a binary stream to which the body of the reply can be written. Once this function has been called, further changes to *REPLY* don't have any effect. Also, automatic handling of errors (i.e. sending the corresponding status code to the browser, etc.) is turned off for this request and functions like REDIRECT or to ABORT-REQUEST-HANDLER won't have the desired effect once the headers are sent.
If your handlers return the full body as a string or as an array of octets, you should not call this function. If a handler calls SEND-HEADERS , its return value is ignored.