Help with print cgi.header(


#1

I’m trying to set a cookie using Apache on RHFedora core3 and Ruby CGI
I’m sending a pdf file.

The mail format looks as if there are two lines for the cookie header,
but in reality there is only one.

Here are the headers I’m printing

cookexpires=(Time.now + (60 * 24 * 3600)).strftime("%a, %d-%m-%Y%H:%M:%S
GMT")
print cgi.header(“Content-Type” => mimeTypes[mimer])
print cgi.header(“Content-Dispostion” => filename)
print cgi.header(“Content-length” => s.length.to_s)
print cgi.header(“Set-Cookie” => “#{CGI.escape(“sample_issue=yes;”)};
expires=#{cookexpires}; domain=ftienergybusinesswatch”)
print “\r\n”
print(pdffile)
print “\r\n”

The pdf file gets sent OK in Firefox. The pdf file opens correctly but
no cookie shows up.

In IE I have to do it this way for the file to appear correctly and the
cookie does show up in IE.

cookie=CGI::Cookie.new(“sample_issue”, “yes”)
cookie.expires=Time.now + (60 243600) # 60 days
cgi.header(“type”=>mimeTypes[mimer],“Content-Disposition”=>“filename=#{filename}”)
cgi.out(“cookie”=>cookie){pdffile}