From: "Ara.T.Howard" Date: 2005-11-04T12:13:05+09:00 Subject: [BUG/PATCH] http-access2 here's a patch for a bug that causes cookies using http-access2 not to be sent on subsequent requests: [ahoward@localhost ~]$ cat a.rb require "http-access2" cm = WebAgent::CookieManager::new "cookies" cm.load_cookies cookie = cm.cookies.first url = cookie.url matches = cookie.domain_match url.host, cookie.domain puts "domain_match('#{ url.host }', '#{ cookie.domain }') => #{ matches }" module WebAgent::CookieUtils def domain_match(host, domain) case domain when /\d+\.\d+\.\d+\.\d+/ return (host == domain) when '.' return true when /^\./ #return tail_match?(domain, host) return tail_match?(host, domain) else return (host == domain) end end end matches = cookie.domain_match url.host, cookie.domain puts "domain_match('#{ url.host }', '#{ cookie.domain }') => #{ matches }" [ahoward@localhost ~]$ cat cookies http://rubyforge.org//account/login.php session_ser LjEwMy45Ni40Ni0q%2A-fa0537de8cc31 1131676286 .rubyforge.org / 13 [ahoward@localhost ~]$ ruby a.rb domain_match('rubyforge.org', '.rubyforge.org') => false domain_match('rubyforge.org', '.rubyforge.org') => true without this fix cookies do not round trip as they are not found by Cookie#find. regards. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | anything that contradicts experience and logic should be abandoned. | -- h.h. the 14th dalai lama ===============================================================================