[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

CGI/session adds session_id in hidden fields

Patrick Gundlach

12/16/2004 9:06:00 PM

Dear all,

I use ruby for cgi development and use the CGI::Session module. But
that module adds lines like

<INPUT TYPE=HIDDEN NAME="_session_id" VALUE="7245f27c4d765f92">

to my html files. I need to make the CGI::Session module to stop this.
How can I do so?

Background: I store the files that are generated from my ruby script
on the webserver as cache files. So the next visitor would get the
file with my session id.

Patrick
4 Answers

nobu.nokada

12/17/2004 1:08:00 AM

0

Hi,

At Fri, 17 Dec 2004 07:07:13 +0900,
Patrick Gundlach wrote in [ruby-talk:123850]:
> I use ruby for cgi development and use the CGI::Session module. But
> that module adds lines like
>
> <INPUT TYPE=HIDDEN NAME="_session_id" VALUE="7245f27c4d765f92">
>
> to my html files. I need to make the CGI::Session module to stop this.
> How can I do so?

Currently, CGI::Session always emit the HIDDEN field. This
patch is to stop it by adding an option 'by_hidden'=>false.


Index: lib/cgi/session.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/cgi/session.rb,v
retrieving revision 1.35
diff -U2 -p -d -r1.35 session.rb
--- lib/cgi/session.rb 15 Dec 2004 06:35:52 -0000 1.35
+++ lib/cgi/session.rb 17 Dec 2004 00:56:31 -0000
@@ -254,6 +254,5 @@ class CGI
end
unless session_id
- if request.key?(session_key)
- session_id = request[session_key]
+ if session_id = request[session_key]
session_id = session_id.read if session_id.respond_to?(:read)
end
@@ -262,5 +261,5 @@ class CGI
end
unless session_id
- if option.key?('new_session') and not option['new_session']
+ unless option.fetch('new_session', true)
raise ArgumentError, "session_key `%s' should be supplied"%session_key
end
@@ -273,5 +272,5 @@ class CGI
@dbman = dbman::new(self, option)
rescue NoSession
- if option.key?('new_session') and not option['new_session']
+ unless option.fetch('new_session', true)
raise ArgumentError, "invalid session_id `%s'"%session_id
end
@@ -280,5 +279,5 @@ class CGI
end
request.instance_eval do
- @output_hidden = {session_key => session_id}
+ @output_hidden = {session_key => session_id} if option.fetch('by_hidden', true)
@output_cookies = [
Cookie::new("name" => session_key,
@@ -294,5 +293,5 @@ class CGI
""
end)
- ]
+ ] if option.fetch('by_cookies', true)
end
@dbprot = [@dbman]


--
Nobu Nakada


Patrick Gundlach

12/18/2004 5:12:00 PM

0

Hi,

nobu.nokada@softhome.net writes:

> Currently, CGI::Session always emit the HIDDEN field. This
> patch is to stop it by adding an option 'by_hidden'=>false.


[...]

Thanks, I'll give it a try.

Patrick
--
.... Press any key. Then press the any other key.

mikegentry

4/8/2011 2:15:00 PM

0

On Apr 7, 9:30 pm, Irfon-Kim Ahmad <ir...@ambienautica.com> wrote:
> Although I know these are of little use without a transcript, the one
> thing that I can say is that the whole speech that the Duke gave (if you
> follow the transcript) about how you've helped them both and he's giving
> you the seed for it doesn't occur, so it's like the game failed to
> detect that I'd completed both quests.

I've figured it out.

The game tests for quest completion, but it only checks to see if you
have acquired both pearls. Since it's possible to complete the
Duchess' quest and then leave without getting the green pearl, the
game can go off the rails if you do things in a certain order.

There's two ways to avoid it:

1) finish the Duke's quest first; or

2) if you must do the Duchess' quest first, make sure you acquire the
green pearl BEFORE attempting the Duke's quest.

Sorry about that, folks. Obviously, this will (and should) affect your
votes, but I hope you'll use the workaround to see the ending.

Greg Boettcher

4/9/2011 1:43:00 AM

0

On Apr 8, 9:14 am, mikegentry <m...@edromia.com> wrote:
> I've figured it out.
>
> The game tests for quest completion, but it only checks to see if you
> have acquired both pearls. Since it's possible to complete the
> Duchess' quest and then leave without getting the green pearl, the
> game can go off the rails if you do things in a certain order.

Note to world (especially to other ST entrants):

The rules state that ST entrants should not publicly discuss any of
the ST games during the competition.

I gave Michael a warning, and I'm posting this as a reminder to other
entrants as well.

Greg