lib/rufus/verbs/cookies.rb in rufus-verbs-0.8 vs lib/rufus/verbs/cookies.rb in rufus-verbs-0.9

- old
+ new

@@ -46,10 +46,15 @@ # # http://www.ietf.org/rfc/rfc2109.txt # module CookieMixin + # + # making the cookie jar available + # + attr_reader :cookies + protected # # Prepares the instance variable @cookies for storing # cooking for this endpoint. @@ -101,11 +106,11 @@ host = opts[:host] path = opts[:path] cpath = c.path || "/" - next unless cookie_acceptable?(opts, c) + next unless cookie_acceptable?(opts, response, c) domain = c.domain || host if c.max_age == 0 @cookies.remove_cookie domain, path, c @@ -117,11 +122,11 @@ # # Checks if the cookie is acceptable in the context of # the request that sent it. # - def cookie_acceptable? (opts, cookie) + def cookie_acceptable? (opts, response, cookie) # reject if : # # * The value for the Path attribute is not a prefix of the # request-URI. @@ -142,10 +147,12 @@ h, d = split_host(opts[:host]) return false if d != cdomain end - path = opts[:path] + #path = opts[:path] + path = response.request.path + cpath = cookie.path || "/" return false if path[0..cpath.length-1] != cpath true