Froze rails gems
[depot.git] / vendor / rails / actionpack / lib / action_controller / cgi_ext / stdinput.rb
1 require 'cgi'
2
3 module ActionController
4 module CgiExt
5 # Publicize the CGI's internal input stream so we can lazy-read
6 # request.body. Make it writable so we don't have to play $stdin games.
7 module Stdinput
8 def self.included(base)
9 base.class_eval do
10 remove_method :stdinput
11 attr_accessor :stdinput
12 end
13
14 base.alias_method_chain :initialize, :stdinput
15 end
16
17 def initialize_with_stdinput(type = nil, stdinput = $stdin)
18 @stdinput = stdinput
19 @stdinput.set_encoding(Encoding::BINARY) if @stdinput.respond_to?(:set_encoding)
20 initialize_without_stdinput(type || 'query')
21 end
22 end
23 end
24 end