lib/rack/handler/ftw.rb in ftw-0.0.31 vs lib/rack/handler/ftw.rb in ftw-0.0.32

- old
+ new

@@ -2,10 +2,11 @@ require "ftw" require "ftw/protocol" require "ftw/crlf" require "socket" require "cabin" +require "http_parser" # FTW cannot fully respect the Rack 1.1 specification due to technical # limitations in the Rack design, specifically: # # * rack.input must be buffered, to support IO#rewind, for the duration of each @@ -202,12 +203,10 @@ end response.body = body begin connection.write(response.to_s + CRLF) - body.each do |chunk| - connection.write(chunk) - end + write_http_body(body, connection, response["Transfer-Encoding"] == "chunked") rescue => e @logger.error(e) connection.disconnect(e.inspect) end end # def handle_request