Ruby - read cookie

This code isn’t working. whats missing?

#!/usr/bin/ruby -w
require “cgi”
$appcgi = CGI.new
puts $appcgi.header
$username = $appcgi.cookies[‘user’]
puts “\r$username”

any one?

On 17 March 2012 00:49, OK OK [email protected] wrote:

This code isn’t working. whats missing?

#!/usr/bin/ruby -w
require “cgi”
$appcgi = CGI.new
puts $appcgi.header
$username = $appcgi.cookies[‘user’]
puts “\r$username”

It might help if you tell us what you are trying to do and what
actually happens. It may be that the code /is/ working but that it is
not the right code for what you are trying to do.

Colin

Hi Colin,

I am trying to read cookies for the client. The cookie values are being
sent to the server, I can see that in http request capture.

I am using the above ruby code to read those cookie values. And that is
not working.

Thanks