Sending a cookie in the request using Net::HTTP

I can't find this answered in the RDoc, so I'll ask here: How do I send the cookie string in an HTTP request using Net::HTTP? I tried doing something like:

Net::HTTP.start( 'server.host.here' ) { |http|
  response = http.get(
    '/local/file.rb',
    'Cookie: cookie_name=cookie_val'
  )
}

hoping that the "initheader" in HTTP#get is where I should drop the cookie value, but that just gave me a traceback.

Francis Hwang
http://fhwang.net/

I can't find this answered in the RDoc, so I'll ask here: How do I send
the cookie string in an HTTP request using Net::HTTP? I tried doing
something like:

Net::HTTP.start( 'server.host.here' ) { |http|
  response = http.get(
    '/local/file.rb',

Try passing any extra headers in a hash here, like this:

    {"Cookie" => 'cookie_name=cookie_val; another_cookie=brownie'}

···

On Sun, Dec 05, 2004 at 02:07:17AM +0900, Francis Hwang wrote:

    'Cookie: cookie_name=cookie_val'
  )
}

--
Jos Backus _/ _/_/_/ Sunnyvale, CA
                                _/ _/ _/
                               _/ _/_/_/
                          _/ _/ _/ _/
jos at catnook.com _/_/ _/_/_/ require 'std/disclaimer'

Works like a charm. Thanks!

···

On Dec 4, 2004, at 5:15 PM, Jos Backus wrote:

On Sun, Dec 05, 2004 at 02:07:17AM +0900, Francis Hwang wrote:

I can't find this answered in the RDoc, so I'll ask here: How do I send
the cookie string in an HTTP request using Net::HTTP? I tried doing
something like:

Net::HTTP.start( 'server.host.here' ) { |http|
  response = http.get(
    '/local/file.rb',

Try passing any extra headers in a hash here, like this:

    {"Cookie" => 'cookie_name=cookie_val; another_cookie=brownie'}

    'Cookie: cookie_name=cookie_val'
  )
}

--
Jos Backus _/ _/_/_/ Sunnyvale, CA
                                _/ _/ _/
                               _/ _/_/_/
                          _/ _/ _/ _/
jos at catnook.com _/_/ _/_/_/ require 'std/disclaimer'

Francis Hwang