Forum: Ruby Help with print cgi.header(

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ernest Ellingson (Guest)
on 2006-02-05 00:29
(Received via mailing list)
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 *24*3600) # 60 days
cgi.header("type"=>mimeTypes[mimer],"Content-Disposition"=>"filename=#{filename}")
cgi.out("cookie"=>cookie){pdffile}
This topic is locked and can not be replied to.