aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-03-12 16:07:04 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-03-12 16:07:26 -0700
commit77a09218f697676f8a05f06eeb5c89a26419d489 (patch)
treec2282c835b159ad3913a0f0e2bb67d3288a4fb70 /actionpack/lib/action_dispatch/http
parentf6da9924b0aa141d4322acd95559a5e954666c8a (diff)
downloadrails-77a09218f697676f8a05f06eeb5c89a26419d489.tar.gz
rails-77a09218f697676f8a05f06eeb5c89a26419d489.tar.bz2
rails-77a09218f697676f8a05f06eeb5c89a26419d489.zip
only write the jar if the response isn't committed
when streaming responses, we need to make sure the cookie jar is written to the headers before returning up the stack. This commit introduces a new method on the response object that writes the cookie jar to the headers as the response is committed. The middleware and test framework will not write the cookie headers if the response has already been committed. fixes #14352
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 2c6bcf7b7b..b5454f519f 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -140,6 +140,7 @@ module ActionDispatch # :nodoc:
def commit!
synchronize do
+ finalize_response
@committed = true
@cv.broadcast
end
@@ -273,6 +274,9 @@ module ActionDispatch # :nodoc:
private
+ def finalize_response
+ end
+
def merge_default_headers(original, default)
return original unless default.respond_to?(:merge)