title: Ruby Mechanize ignore cookie in response
body: <p>I'm playing with Ruby <strong>Mechanize</strong> with a website. But it seems that it ignored one of the set-cookie header on the response. Please see my code and the result. The <code>u=__LOGOUT__</code> part is missing in the result of agent.cookies. Why? Thanks.</p>
  
  <pre><code>require 'mechanize'
  require 'logger'
  agent = Mechanize.new
  agent.user_agent_alias = 'Windows IE 9'
  agent.follow_meta_refresh = true
  agent.log = Logger.new(STDOUT)
  
  cookie = Mechanize::Cookie.new("__utmarea", "404-0-1")
  cookie.domain = '.youku.com'
  cookie.path = '/'
  agent.cookie_jar.add(URI.parse("http://www.youku.com/"), cookie)
  
  page = agent.get("http://www.youku.com/index_login/", :referer =&gt; "http://www.youku.com/")
  puts agent.cookies.to_s
  </code></pre>
  
  <p>This is the result when I execute the upper code.</p>
  
  <pre><code>F:\Dropbox\temp&gt;ruby youku.rb
  I, [2012-03-02T11:52:15.398550 #3188]  INFO -- : Net::HTTP::Get: /index_login/?referer=http%3A%2F%2Fwww.youku.com%2F
  D, [2012-03-02T11:52:15.399550 #3188] DEBUG -- : request-header: accept =&gt; */*
  D, [2012-03-02T11:52:15.400550 #3188] DEBUG -- : request-header: user-agent =&gt; Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
  D, [2012-03-02T11:52:15.401550 #3188] DEBUG -- : request-header: accept-encoding =&gt; gzip,deflate,identity
  D, [2012-03-02T11:52:15.402550 #3188] DEBUG -- : request-header: accept-charset =&gt; ISO-8859-1,utf-8;q=0.7,*;q=0.7
  D, [2012-03-02T11:52:15.403550 #3188] DEBUG -- : request-header: accept-language =&gt; en-us,en;q=0.5
  D, [2012-03-02T11:52:15.403550 #3188] DEBUG -- : request-header: cookie =&gt; __utmarea=404-0-1
  D, [2012-03-02T11:52:15.404550 #3188] DEBUG -- : request-header: host =&gt; www.youku.com
  I, [2012-03-02T11:52:15.699565 #3188]  INFO -- : status: Net::HTTPOK 1.1 200 OK
  D, [2012-03-02T11:52:15.700565 #3188] DEBUG -- : response-header: server =&gt; Apache
  D, [2012-03-02T11:52:15.701565 #3188] DEBUG -- : response-header: set-cookie =&gt; YOUKUSESSID=g9db0qlosehrvao5o825oh5455; path=/; domain=.youku.com, u=__LOGOUT__; expires=Thu, 01-Jan-1970 00:00:01 GMT;
  path=/; domain=.youku.com
  D, [2012-03-02T11:52:15.702565 #3188] DEBUG -- : response-header: expires =&gt; Thu, 19 Nov 1981 08:52:00 GMT
  D, [2012-03-02T11:52:15.702565 #3188] DEBUG -- : response-header: cache-control =&gt; no-store, no-cache, must-revalidate
  D, [2012-03-02T11:52:15.703566 #3188] DEBUG -- : response-header: pragma =&gt; no-cache
  D, [2012-03-02T11:52:15.704566 #3188] DEBUG -- : response-header: vary =&gt; Accept-Encoding
  D, [2012-03-02T11:52:15.704566 #3188] DEBUG -- : response-header: content-encoding =&gt; gzip
  D, [2012-03-02T11:52:15.705566 #3188] DEBUG -- : response-header: content-type =&gt; text/html; charset=UTF-8
  D, [2012-03-02T11:52:15.705566 #3188] DEBUG -- : response-header: content-length =&gt; 1724
  D, [2012-03-02T11:52:15.706566 #3188] DEBUG -- : response-header: date =&gt; Fri, 02 Mar 2012 03:52:19 GMT
  D, [2012-03-02T11:52:15.707566 #3188] DEBUG -- : response-header: age =&gt; 0
  D, [2012-03-02T11:52:15.707566 #3188] DEBUG -- : response-header: connection =&gt; keep-alive
  D, [2012-03-02T11:52:15.708566 #3188] DEBUG -- : response-header: x-cache =&gt; Miss from a05.www
  D, [2012-03-02T11:52:15.709566 #3188] DEBUG -- : Read 1724 bytes (1724 total)
  D, [2012-03-02T11:52:15.710566 #3188] DEBUG -- : gzip response
  D, [2012-03-02T11:52:15.713566 #3188] DEBUG -- : saved cookie: YOUKUSESSID=g9db0qlosehrvao5o825oh5455
  D, [2012-03-02T11:52:15.717566 #3188] DEBUG -- : saved cookie: u=__LOGOUT__
  [__utmarea=404-0-1, YOUKUSESSID=g9db0qlosehrvao5o825oh5455]
  
  F:\Dropbox\temp&gt;
  </code></pre>