Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7224: fix_in_place_editor_and_set_content_length.diff

File fix_in_place_editor_and_set_content_length.diff, 0.8 kB (added by jeremymcanally, 2 years ago)

SVN diff

  • actionpack/lib/action_controller/cgi_process.rb

    old new  
    224224      # Don't set the Content-Length for block-based bodies as that would mean reading it all into memory. Not nice 
    225225      # for, say, a 2GB streaming file. 
    226226      def set_content_length! 
    227         @headers["Content-Length"] = @body.size unless @body.respond_to?(:call) 
     227        if (@body.respond_to?(:size)) 
     228          @headers["Content-Length"] = @body.size  
     229        else 
     230          @headers["Content-Length"] = @body.to_s.size 
     231        end unless @body.respond_to?(:call) 
    228232      end 
    229233  end 
    230234end