From d3d724bb8809906ebae3abbd2c4a11c8a4aec268 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 20 Oct 2010 12:50:27 -0200 Subject: Remove this require since active_support/testing/default doesn't exist anymore --- actionpack/lib/action_dispatch/testing/performance_test.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/testing/performance_test.rb b/actionpack/lib/action_dispatch/testing/performance_test.rb index d6c98b4db7..e7aeb45fb3 100644 --- a/actionpack/lib/action_dispatch/testing/performance_test.rb +++ b/actionpack/lib/action_dispatch/testing/performance_test.rb @@ -1,5 +1,4 @@ require 'active_support/testing/performance' -require 'active_support/testing/default' begin module ActionDispatch -- cgit v1.2.3 From 2d5a12a50bcd83fcc99865de759b82e661b28698 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Fri, 22 Oct 2010 15:34:45 +0100 Subject: Don't write out secure cookies unless the request is secure --- actionpack/lib/action_dispatch/middleware/cookies.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 75c8cc3dd0..836416857c 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -98,17 +98,19 @@ module ActionDispatch def self.build(request) secret = request.env[TOKEN_KEY] host = request.host + secure = request.ssl? - new(secret, host).tap do |hash| + new(secret, host, secure).tap do |hash| hash.update(request.cookies) end end - def initialize(secret = nil, host = nil) + def initialize(secret = nil, host = nil, secure = false) @secret = secret @set_cookies = {} @delete_cookies = {} @host = host + @secure = secure super() end @@ -193,9 +195,15 @@ module ActionDispatch end def write(headers) - @set_cookies.each { |k, v| ::Rack::Utils.set_cookie_header!(headers, k, v) } + @set_cookies.each { |k, v| ::Rack::Utils.set_cookie_header!(headers, k, v) if write_cookie?(v) } @delete_cookies.each { |k, v| ::Rack::Utils.delete_cookie_header!(headers, k, v) } end + + private + + def write_cookie?(cookie) + @secure || !cookie[:secure] || Rails.env.development? + end end class PermanentCookieJar < CookieJar #:nodoc: -- cgit v1.2.3 From 69a1a0adb5d4e615f08e8b1d23d9a6b0e2dd6070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 26 Oct 2010 14:05:06 -0200 Subject: Remove rack-cache-purge. --- actionpack/lib/action_dispatch/http/rack_cache.rb | 9 --------- 1 file changed, 9 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/http/rack_cache.rb b/actionpack/lib/action_dispatch/http/rack_cache.rb index e5914abc81..b5c1435903 100644 --- a/actionpack/lib/action_dispatch/http/rack_cache.rb +++ b/actionpack/lib/action_dispatch/http/rack_cache.rb @@ -21,11 +21,6 @@ module ActionDispatch @store.write(key, value) end - def purge(key) - @store.delete(key) - nil - end - ::Rack::Cache::MetaStore::RAILS = self end @@ -58,10 +53,6 @@ module ActionDispatch [key, size] end - def purge(key) - @store.delete(key) - end - ::Rack::Cache::EntityStore::RAILS = self end end -- cgit v1.2.3 From 0dfdbdd4f447ada9b4d6653f34f609802ae597a5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 26 Oct 2010 11:31:05 -0700 Subject: Fix loop introduced by rack:dda892d --- actionpack/lib/action_dispatch/http/url.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index cfee95eb4b..4da82f958a 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -8,11 +8,6 @@ module ActionDispatch protocol + host_with_port + fullpath end - # Returns 'https' if this is an SSL request and 'http' otherwise. - def scheme - ssl? ? 'https' : 'http' - end - # Returns 'https://' if this is an SSL request and 'http://' otherwise. def protocol @protocol ||= ssl? ? 'https://' : 'http://' @@ -99,4 +94,4 @@ module ActionDispatch end end end -end \ No newline at end of file +end -- cgit v1.2.3 From 47ceb135c6b75988f2712bc44db397b992c1c731 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Wed, 27 Oct 2010 10:30:14 +0100 Subject: Ensure that Rails.env is defined first --- actionpack/lib/action_dispatch/middleware/cookies.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 836416857c..c4c2e1acd7 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -202,7 +202,7 @@ module ActionDispatch private def write_cookie?(cookie) - @secure || !cookie[:secure] || Rails.env.development? + @secure || !cookie[:secure] || defined?(Rails.env) && Rails.env.development? end end -- cgit v1.2.3