try using path for the cookie

This commit is contained in:
Sven Fuchs 2013-02-26 20:09:47 +01:00
parent d686b741bf
commit 5c18bd3406

View File

@ -9,16 +9,12 @@ class Travis::Web::App::AltVersions
alt = alt_from_params(env) || alt_from_cookie(env)
env['travis.alt'] = alt if alt
status, headers, body = app.call(env)
headers['Set-Cookie'] = cookie(alt) if env.key?('travis.alt')
headers['Set-Cookie'] = "alt=#{alt}; path=/; Secure" if alt
[status, headers, body]
end
private
def cookie(alt)
"alt=#{alt}; Domain=staging.travis-ci.org; Secure; Max-Age=#{alt == 'default' ? 0 : 86400}"
end
def alt_from_params(env)
alt_from_string env['QUERY_STRING']
end