Browse files

Make browser set cookies on the domain of the original request when r…

…esponse is 302 redirect with cookie values. This makes zombie.js work when redirecting to for OpenID 2.0 authentication. Delete content-type and content-length headers when redirecting. This prevents content types such as www-formdata from propagating into a redirected GET request and confusing the server.
  • Loading branch information...
jkingyens committed May 18, 2012
1 parent d46910a commit 433d91fc2c8f14c436e603a8256e0c4129163e5f
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/zombie/
@@ -264,6 +264,8 @@ class Resources extends Array
when 302, 303
# Follow redirect using GET (e.g. after form submission)
redirect = URL.resolve(url, response.headers['location'])
+ delete headers['content-type']
+ delete headers['content-length']
method = "GET" unless method == "GET" || method == "HEAD"
if redirect
@@ -274,7 +276,6 @@ class Resources extends Array
# Set cookies for the redirect-to resource
- cookies = browser.cookies(redirect.hostname, redirect.pathname)
for cookie in jar.cookies
cookies.update cookie.str
# This URL is the referer, make a request to the next URL

0 comments on commit 433d91f

Please sign in to comment.