[flow] thanks! +1 bug?

1 view
Skip to first unread message

carmen r

unread,
Aug 20, 2008, 2:49:29 AM8/20/08
to ebb...@googlegroups.com
flow is pretty cool. still gotta find that Ruby HTTP parser mentioned on the Mongrel & Rubinius lists in April. all of the links are already dead.


some responses dont have bodies. HEAD and various redirects come to mind.

so i did this

- body.each { |chunk| write(chunk) }
+ body.each { |chunk| write(chunk) } if body

in Response#call

also whats up with

[status, headers, [body]]

in the sample app

is the [] around body some weird Rack-ism?

thank you sir ry..

-c

ry dahl

unread,
Aug 20, 2008, 3:06:25 AM8/20/08
to ebb...@googlegroups.com
Hi Carmen,

On Wed, Aug 20, 2008 at 8:49 AM, carmen r <_@whats-your.name> wrote:
> flow is pretty cool. still gotta find that Ruby HTTP parser mentioned on
> the Mongrel & Rubinius lists in April. all of the links are already dead.

I haven't heard of that. I think Kirk Haines told me once that writing a naive
parser which just splits the header lines on ":" works well and as is
as fast as Zed's.

I like my new parser which allows one to simplify the
reading-from-socket logic. Nothing needs to be buffered, it keeps its
state no matter how big or small the chunk read is. All the reasoning
about persistent connections is done inside the parser.

> some responses dont have bodies. HEAD and various redirects come to mind.

HEAD is a request. According to rack they ought to all have bodies.

> so i did this
>
> - body.each { |chunk| write(chunk) }
> + body.each { |chunk| write(chunk) } if body
>
> in Response#call
>
> also whats up with
>
> [status, headers, [body]]
>
> in the sample app
>
> is the [] around body some weird Rack-ism?

yes, String is not a very good response body because the response
bodies must respond to :each, and in Ruby 1.9 they do not.


ry

Reply all
Reply to author
Forward
0 new messages