mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cgi/session.rb (CGI::Session#initialize): control adding
session_id hidden fields. fixed: [ruby-talk:123850] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0b2d95aafd
commit
3da93dd842
2 changed files with 10 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Dec 17 13:33:58 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/cgi/session.rb (CGI::Session#initialize): control adding
|
||||||
|
session_id hidden fields. fixed: [ruby-talk:123850]
|
||||||
|
|
||||||
Sun Dec 17 00:01:48 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Dec 17 00:01:48 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_proc_arity, rb_node_arity, rb_mod_method_arity,
|
* eval.c (rb_proc_arity, rb_node_arity, rb_mod_method_arity,
|
||||||
|
|
|
@ -253,15 +253,14 @@ class CGI
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unless session_id
|
unless session_id
|
||||||
if request.key?(session_key)
|
if session_id = request[session_key]
|
||||||
session_id = request[session_key]
|
|
||||||
session_id = session_id.read if session_id.respond_to?(:read)
|
session_id = session_id.read if session_id.respond_to?(:read)
|
||||||
end
|
end
|
||||||
unless session_id
|
unless session_id
|
||||||
session_id, = request.cookies[session_key]
|
session_id, = request.cookies[session_key]
|
||||||
end
|
end
|
||||||
unless session_id
|
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
|
raise ArgumentError, "session_key `%s' should be supplied"%session_key
|
||||||
end
|
end
|
||||||
session_id = create_new_id
|
session_id = create_new_id
|
||||||
|
@ -272,14 +271,14 @@ class CGI
|
||||||
begin
|
begin
|
||||||
@dbman = dbman::new(self, option)
|
@dbman = dbman::new(self, option)
|
||||||
rescue NoSession
|
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
|
raise ArgumentError, "invalid session_id `%s'"%session_id
|
||||||
end
|
end
|
||||||
session_id = @session_id = create_new_id
|
session_id = @session_id = create_new_id
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
request.instance_eval do
|
request.instance_eval do
|
||||||
@output_hidden = {session_key => session_id}
|
@output_hidden = {session_key => session_id} unless option['no_hidden']
|
||||||
@output_cookies = [
|
@output_cookies = [
|
||||||
Cookie::new("name" => session_key,
|
Cookie::new("name" => session_key,
|
||||||
"value" => session_id,
|
"value" => session_id,
|
||||||
|
@ -293,7 +292,7 @@ class CGI
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
end)
|
end)
|
||||||
]
|
] unless option['no_cookies']
|
||||||
end
|
end
|
||||||
@dbprot = [@dbman]
|
@dbprot = [@dbman]
|
||||||
ObjectSpace::define_finalizer(self, Session::callback(@dbprot))
|
ObjectSpace::define_finalizer(self, Session::callback(@dbprot))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue