diff options
-rw-r--r-- | actionpack/lib/action_controller/metal/live.rb | 20 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameters.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 6 |
4 files changed, 32 insertions, 10 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index 43a9e3aa9d..d8fe43b5af 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -33,13 +33,13 @@ module ActionController module Live class Buffer < ActionDispatch::Response::Buffer #:nodoc: def initialize(response) - super(response, Queue.new) + super(response, SizedQueue.new(10)) end def write(string) unless @response.committed? @response.headers["Cache-Control"] = "no-cache" - @response.headers.delete("Content-Length") + @response.headers.delete "Content-Length" end super @@ -47,13 +47,13 @@ module ActionController def each while str = @buf.pop - yield(str) + yield str end end def close super - @buf.push(nil) + @buf.push nil end end @@ -78,7 +78,7 @@ module ActionController end def initialize(status = 200, header = {}, body = []) - header = Header.new(self, header) + header = Header.new self, header super(status, header, body) end @@ -89,11 +89,11 @@ module ActionController private - def build_buffer(response, body) - buf = Live::Buffer.new(response) - body.each { |part| buf.write(part) } - buf - end + def build_buffer(response, body) + buf = Live::Buffer.new response + body.each { |part| buf.write part } + buf + end end def process(name) diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index bcfd0b0d00..9a7b5bc8c7 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -4,6 +4,11 @@ require 'active_support/core_ext/hash/indifferent_access' module ActionDispatch module Http module Parameters + def initialize(env) + super + @symbolized_path_params = nil + end + # Returns both GET and POST \parameters in a single hash. def parameters @env["action_dispatch.request.parameters"] ||= begin diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 1377e53ce8..d24c7c7f3f 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -38,6 +38,17 @@ module ActionDispatch METHOD end + def initialize(env) + super + @method = nil + @request_method = nil + @remote_ip = nil + @original_fullpath = nil + @fullpath = nil + @ip = nil + @uuid = nil + end + def key?(key) @env.key?(key) end diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 4266ec042e..8aa02ec482 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -87,6 +87,12 @@ module ActionDispatch end end + def initialize(env) + super + @protocol = nil + @port = nil + end + # Returns the complete URL used for this request. def url protocol + host_with_port + fullpath |