diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-06-02 21:02:26 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-06-02 21:02:51 -0500 |
commit | 92050f6c6f586b2a73aeb61da4f41b9822bbcf6d (patch) | |
tree | ff7a871f1ffedbbc0a0c2c4837dc72e374bbf2a3 /actionpack/lib/action_controller | |
parent | 29641ff05ad1beb659582a3c4347c1395f940285 (diff) | |
download | rails-92050f6c6f586b2a73aeb61da4f41b9822bbcf6d.tar.gz rails-92050f6c6f586b2a73aeb61da4f41b9822bbcf6d.tar.bz2 rails-92050f6c6f586b2a73aeb61da4f41b9822bbcf6d.zip |
Ensure Rack processor reads CGI output_cookies for the session cookie.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/dispatcher.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/rack_process.rb | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/dispatcher.rb b/actionpack/lib/action_controller/dispatcher.rb index b40f1ba9be..7162fb8b1f 100644 --- a/actionpack/lib/action_controller/dispatcher.rb +++ b/actionpack/lib/action_controller/dispatcher.rb @@ -125,7 +125,7 @@ module ActionController def call(env) @request = RackRequest.new(env) - @response = RackResponse.new + @response = RackResponse.new(@request) dispatch end diff --git a/actionpack/lib/action_controller/rack_process.rb b/actionpack/lib/action_controller/rack_process.rb index 16625519b6..d5fb78c44d 100644 --- a/actionpack/lib/action_controller/rack_process.rb +++ b/actionpack/lib/action_controller/rack_process.rb @@ -4,6 +4,7 @@ require 'action_controller/session/cookie_store' module ActionController #:nodoc: class RackRequest < AbstractRequest #:nodoc: attr_accessor :env, :session_options + attr_reader :cgi class SessionFixationAttempt < StandardError #:nodoc: end @@ -199,7 +200,8 @@ end_msg class RackResponse < AbstractResponse #:nodoc: attr_accessor :status - def initialize + def initialize(request) + @request = request @writer = lambda { |x| @body << x } @block = nil super() @@ -270,9 +272,9 @@ end_msg else cookies << cookie.to_s end - @output_cookies.each { |c| cookies << c.to_s } if @output_cookies + @request.cgi.output_cookies.each { |c| cookies << c.to_s } if @request.cgi.output_cookies - headers['Set-Cookie'] = [headers['Set-Cookie'], cookies].compact.join("\n") + headers['Set-Cookie'] = [headers['Set-Cookie'], cookies].flatten.compact end options.each { |k,v| headers[k] = v } @@ -283,6 +285,8 @@ end_msg end class CGIWrapper < ::CGI + attr_reader :output_cookies + def initialize(request, *args) @request = request @args = *args |