On Wednesday, February 22, 2012 at 12:23 AM, Fabio Kreusch wrote:
So, I have a Rack application which acts as a proxy. I haveimplemented a net/http api to deal with the communication, so the rackapp basically calls it like this:api.new(request_method, rack_request, options).response.response returns a valid rack response [status, headers, body].Body is an instance of the api, and it its implementation is like this(simplified version):def initialize...@proxy_connection = Net::HTTP.start(proxied_uri.host,proxied_uri.port)@proxy_connection.request(@proxy_request) do |response|@proxy_response = responseendenddef each(&block)@proxy_response.read_body(&block)enddef to_s@proxy_response.read_bodyendThe rack app can then call the proxied service with a full responsewith to_s, or as a streaming and receive the response in chunks witheach.The thing is, when I return the response in rack, I'm getting thefollowing stack trace: https://gist.github.com/1879724Apparently, the server or rack is calling 'each' more than once, butI'm not sure what might be causing it.The Rack app is running under rails 3.2.1.