From: Kaspar Schiess Date: 2004-11-11T19:28:51+09:00 Subject: Re: How to POST HEADERS along with COOKIES Daun Jaun wrote in news:dbd0bb6c041110225520095195@mail.gmail.com: > ckyArr = ... # suppose i have an array of CGI::Cookie objects > hdr['cookie']= unKnownFunc( ckyArr ) > h=Net::HTTP.new( ... ) Quoting from: http://wp.netscape.com/newsref/std/cookie_spec.html Syntax of the Cookie HTTP Request Header When requesting a URL from an HTTP server, the browser will match the URL against all cookies and if any of them match, a line containing the name/value pairs of all matching cookies will be included in the HTTP request. Here is the format of that line: Cookie: NAME1=OPAQUE_STRING1; NAME2=OPAQUE_STRING2 ... Considering the output of CGI::Cookie to be almost, but not quite what you are looking for, I would suggest keeping your cookies in a hash of string => string instead. Given such a hash: a = { 'foo' => "This is a test ;", 'bar' => 'Cookie value' } you could then format everything to the left of 'Cookie: ' by doing a.collect { |k, v| "#{k}=#{ CGI.escape(v) };" }.join(' ')$ resulting in "foo=This+is+a+test+%3B; bar=Cookie+value;" The encoding of the cookie value is not covered by the above link; it is only to be considered as a rough introduction. There is a rfc (whose number I don't have in my head) that describes what CGI.escape does. I hope that gets you on track. kaspar hand manufactured code - www.tua.ch/ruby