lib/reel/response.rb
# Write the response out to the wire
Write the response out to the wire
Write the response out to the wire
def render(socket)
      socket << render_header
      case @body
      when String
        socket << @body
      when IO
        begin
          if !defined?(JRUBY_VERSION)
            IO.copy_stream(@body, socket)
          else
            while data = @body.read(4096)
              socket << data
            end
          end
        ensure
          @body.close
        end
      when Enumerable
        @body.each do |chunk|
          chunk_header = chunk.bytesize.to_s(16)
          socket << chunk_header + CRLF
          socket << chunk + CRLF
        end
        socket << "0#{CRLF * 2}"
      end
    end
def render ( socket ) socket << render_header case @body when String socket << @body when IO begin if ! defined? ( JRUBY_VERSION ) IO . copy_stream ( @body , socket ) else while data = @body . read ( 4096 ) socket << data end end ensure @body . close end when Enumerable @body . each do | chunk | chunk_header = chunk . bytesize . to_s ( 16 ) socket << chunk_header + CRLF socket << chunk + CRLF end socket << "0#{CRLF * 2}" end end
Write the response out to the wire
Write the response out to the wire
# JRuby 1.6.7 doesn't support IO.copy_stream :(
socket
<not_specific>