# Got my redirect to work... something.cgi

**URL:** <https://www.ruby-forum.com/t/got-my-redirect-to-work-something-cgi/142752>\
**Category:** Ruby\
**Created:** [July 11, 2008, 2:52am UTC](https://www.ruby-forum.com/t/got-my-redirect-to-work-something-cgi/142752 "2008-07-11T02:52:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [July 11, 2008, 2:52am UTC](https://www.ruby-forum.com/t/got-my-redirect-to-work-something-cgi/142752/1 "2008-07-11T02:52:49Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [July 11, 2008, 4:12am UTC](https://www.ruby-forum.com/t/got-my-redirect-to-work-something-cgi/142752/2 "2008-07-11T04:12:59Z")

</div>

Xeno C. wrote:

> ```
> STDERR.puts "trace cookie: #{cookie.to_s}"
> 
> ```
> 
> 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…

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [July 11, 2008, 3:57pm UTC](https://www.ruby-forum.com/t/got-my-redirect-to-work-something-cgi/142752/3 "2008-07-11T15:57:30Z")

</div>

On Friday 11 July 2008 01:48:12 Xeno C. 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-talk/307763](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/307763)
