P
Phlip
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.
(I'm also not talking about arbitary efficiency. Application code to push
data into a stream is much cleaner than code that assembles a huge
string...)
So is there some way to plug a real or virtual stream into the .body member?
Some of the documentation seems to imply there's a way...
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.
(I'm also not talking about arbitary efficiency. Application code to push
data into a stream is much cleaner than code that assembles a huge
string...)
So is there some way to plug a real or virtual stream into the .body member?
Some of the documentation seems to imply there's a way...