Index: [Article Count Order] [Thread]

Date: Thu, 8 Jun 2006 16:23:11 +0200 (CEST)
From: "Immanuel Scholz" <immanuel.scholz@gmx.de>
Subject: [webricken:163] Asynchronous cgi or servlets?
To: webricken@notwork.org
Message-Id: <52040.80.246.32.40.1149776591.squirrel@www.eigenheimstrasse.de>
X-Mail-Count: 00163

Hello list,

I just subscribed to the list. I started looking at WEBrick a while ago,
in the need of a small, preinstalled and stand-alone servlet runner usable
with ruby and without much need of configuration.

My servlets (or CGI-scripts) take a long time to execute and return a huge
dataset. WEBrick caches the whole response in order to calculate the
Content-Length field. I'd like to be able to NOT specify the
Content-Length and instead starting deliver the data as soon as my servlet
code output them. I was able to do this with apache/mod_ruby, but this
involves too much installation and configuration effort.

Can I change that behaviour, so that WEBrick does not cache anything but
write out the stdout of the cgi scripts immediatly (or provide some stream
for the do_* functions to write to)?


To answer my own question: It does not look like WEBrick shipped with Ruby
1.8.4 support anything like this. Is any effort put into enabling the
asynchronous transfer with WEBrick?

From my understanding of the code, it needs more than a simple tweak to
enable this feature.

The most promising way seem to me to overwrite some functions in
HTTPResponse, especally send_response() and/or setup_header(). Then
including some factory mechanism (or subclass HTTPServer) to create the
subclassed HTTPResponse instead of the original one.

Any other (simplier) ideas?

Ciao, Imi