aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/response.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-02-07 00:08:28 -0600
committerJoshua Peek <josh@joshpeek.com>2009-02-07 00:08:28 -0600
commit2277fbedbea930fb8ce38ab7eb133de6fcc4a2d6 (patch)
tree784f2dfcd066eaa17a89cc435ec4de44393799c8 /actionpack/lib/action_controller/response.rb
parent24f2e676f700b8a387c6f4c27acf172658cd7863 (diff)
downloadrails-2277fbedbea930fb8ce38ab7eb133de6fcc4a2d6.tar.gz
rails-2277fbedbea930fb8ce38ab7eb133de6fcc4a2d6.tar.bz2
rails-2277fbedbea930fb8ce38ab7eb133de6fcc4a2d6.zip
Temporarily bundle Rack 1.0 prerelease for testing
Diffstat (limited to 'actionpack/lib/action_controller/response.rb')
-rw-r--r--actionpack/lib/action_controller/response.rb29
1 files changed, 4 insertions, 25 deletions
diff --git a/actionpack/lib/action_controller/response.rb b/actionpack/lib/action_controller/response.rb
index 2daeeb9202..4533c12074 100644
--- a/actionpack/lib/action_controller/response.rb
+++ b/actionpack/lib/action_controller/response.rb
@@ -167,33 +167,12 @@ module ActionController # :nodoc:
str
end
- # Over Rack::Response#set_cookie to add HttpOnly option
def set_cookie(key, value)
- case value
- when Hash
- domain = "; domain=" + value[:domain] if value[:domain]
- path = "; path=" + value[:path] if value[:path]
- # According to RFC 2109, we need dashes here.
- # N.B.: cgi.rb uses spaces...
- expires = "; expires=" + value[:expires].clone.gmtime.
- strftime("%a, %d-%b-%Y %H:%M:%S GMT") if value[:expires]
- secure = "; secure" if value[:secure]
- httponly = "; HttpOnly" if value[:http_only]
- value = value[:value]
- end
- value = [value] unless Array === value
- cookie = ::Rack::Utils.escape(key) + "=" +
- value.map { |v| ::Rack::Utils.escape v }.join("&") +
- "#{domain}#{path}#{expires}#{secure}#{httponly}"
-
- case self["Set-Cookie"]
- when Array
- self["Set-Cookie"] << cookie
- when String
- self["Set-Cookie"] = [self["Set-Cookie"], cookie]
- when nil
- self["Set-Cookie"] = cookie
+ if value.has_key?(:http_only)
+ value[:httponly] ||= value.delete(:http_only)
end
+
+ super(key, value)
end
private