[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Got my redirect to work... something.cgi

Xeno Campanoli

7/11/2008 12:48:00 AM

require "#{ScriptLib}/CGIUtils.rb"

if $CGIo.has_key?('user_name') and $CGIo['user_name'] != '' then
#
## Add call to CVS Access validation here eventually.
#

un = $CGIo['user_name']

cookie = CGI::Cookie.new('user_name', $CGIo['user_name'])
STDERR.puts "trace cookie: #{cookie.to_s}"

header = $CGIo.header({'Status' => '302 Moved', 'location' =>
'http://hyhost/index.rhtml'})
$CGIo.out( 'cookie' => cookie, 'header' => header ) { "Session
started..." }
else
$CGIo.out { "You have not been allowed access to this BARY resource." }
exit 0
end
---snip---
I still haven't figured out how you would do this with .rhtml, but it's
not really necessary. The really interesting and helpful thing would be
to make eruby put up the cookie if has or eventually gets a method or
set of methods to do so.

Thanks all though for the feedback.

xc

2 Answers

Xeno Campanoli

7/11/2008 2:08:00 AM

0

Xeno Campanoli wrote:
> require "#{ScriptLib}/CGIUtils.rb"
>
> if $CGIo.has_key?('user_name') and $CGIo['user_name'] != '' then
> #
> ## Add call to CVS Access validation here eventually.
> #
>
> un = $CGIo['user_name']
>
> cookie = CGI::Cookie.new('user_name', $CGIo['user_name'])
> STDERR.puts "trace cookie: #{cookie.to_s}"
>
> header = $CGIo.header({'Status' => '302 Moved', 'location' =>
> 'http://hyhost/index.rhtml'})
> $CGIo.out( 'cookie' => cookie, 'header' => header ) { "Session
> started..." }
> else
> $CGIo.out { "You have not been allowed access to this BARY resource." }
> exit 0
> end
> ---snip---
> I still haven't figured out how you would do this with .rhtml, but it's
> not really necessary. The really interesting and helpful thing would be
> to make eruby put up the cookie if has or eventually gets a method or
> set of methods to do so.
>
> Thanks all though for the feedback.
>
> xc
>
>
Oddly, the cookie I see in my browser isn't readable by default from the
redirected to point. Presumably I need a path or something...

Martin Boese

7/11/2008 1:53:00 PM

0

On Friday 11 July 2008 01:48:12 Xeno Campanoli wrote:

(...)

> The really interesting and helpful thing would be
> to make eruby put up the cookie if has or eventually gets a method or
> set of methods to do so.


I thought I answered that. A redirect option would be easy to add.

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...