at first, thanks a lot for Rack. Its simplicity and efficiency are a delight.
This is not really a bug, just a small thing I came across :
I was testing an application I wrote with Rack 0.4.0. With 0.9.0 it
became stuck with a content-length of 0. I tried the new ContentLength
middleware but, still at 0, then I noticed that the header was set
before the ContentLength took a look at the env. So I went back and
the next stop was Rack::Response#finish.
http://github.com/chneukirchen/rack/tree/0.9/lib/rack/response.rb#L103-104
The 0.9.0 Rack::Response.finish sets the Content-Length (to
@length.to_s) if not present. Fine. Since I was using response.body =
"foo" or response.body = [ 'bar' ] and not response.write('foo') the
@length was staying at its initial value of 0
So, the workaround for me is to use Rack::Response#write but since the
response class exposes :body, I was thinking maybe this current
implementation might trap someone else.
While investigating all of that, I also noticed that
Rack::Response#finish is replying with [ status, atts, self ] and that
Rack::ContentLength doesn't seem to handle body that are instances of
Rack::Response (http://github.com/chneukirchen/rack/tree/0.9/lib/rack/content_length.rb#L12-20).
Well, maybe that's completely intentional...
OK, sorry for this mumbling, I wish you guys a happy new year,
--
John Mettraux - http://jmettraux.wordpress.com
Applied.
--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org