Hi,
If I uncomment line 14 nothing is displayed and each time the page is
refreshed ( 2 second interval) ruby creates a different file
/tmp/rubysess.*
But if I uncomment lines 17-23 it works, displaying the last access time
and only one session file is created.
Why is that? I don’t want to use cgi.out{} and stuff
If don’t want to use cgi.out, you’d need to at least send back some
http headers (at least Content-type) for anything to reach the user.
(also, I don’t know why you’re using cgi = CGI.new(“html4”) if you
don’t want the html helpers, but :\ )
If don’t want to use cgi.out, you’d need to at least send back some
http headers (at least Content-type) for anything to reach the user.
(also, I don’t know why you’re using cgi = CGI.new(“html4”) if you
don’t want the html helpers, but :\ )
The first thing you should output is:
print “Content-type: text/html\r\n\r\n”
or equivalently:
puts cgi.header
Or you can also use cgi.out, which will automatically take care of
the header information, like this:
require ‘cgi’
cgi = CGI.new
html =<<ENDOFHTML
Test
hello world
ENDOFHTML
cgi.out do
html
end
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.