# File lib/cookiejar/jar.rb, line 244 def get_cookie_header request_uri, opts = { } cookies = get_cookies request_uri, opts version = 0 ver = [[],[]] cookies.each do |cookie| ver[cookie.version] << cookie end if (ver[1].empty?) # can do a netscape-style cookie header, relish the opportunity cookies.map do |cookie| cookie.to_s end.join ";" else # build a RFC 2965-style cookie header. Split the cookies into # version 0 and 1 groups so that we can reuse the '$Version' header result = '' unless ver[0].empty? result << '$Version=0;' result << ver[0].map do |cookie| (cookie.to_s 1,false) end.join(';') # separate version 0 and 1 with a comma result << ',' end result << '$Version=1;' ver[1].map do |cookie| result << (cookie.to_s 1,false) end result end end