Hi,

In message <22GUe.1298$au2.836 / newssvr17.news.prodigy.com>,
 `"Phlip" <phlipcpp / yahoo.com>' wrote:
> Rubies:
> 
> Ogle this Webrick GET handler:
> 
>   def do_GET(req, res)
>     res["content-type"] = "text/plain"
>     res.body = "Hello, world.\n"
>   end
> 
> That string "Hello, world.\n" is much shorter than typical web page 
> contents.
> 
> The longer the string assigned to response.body, the tackier this situation. 
> Ideally, the handler would prep the HTTP headers, then would pass a stream 
> into my application code. That would push bytes into the stream, and the 
> stream would push them out the raw TCP/IP ports synchronously.

res.body can take an IO object.

    def do_GET(req, res)
      res["content-type"] = "text/plain"
      res.chunked = true if res.keep_alive?
      res.body = IO.popen("dmesg")
    end

If the content-length header field is present, HTTPResponse
will read specified length data from the IO.

-- 
gotoyuzo