mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cgi/session.rb, lib/cgi/session/pstore.rb: suppress warnings.
fixed: [ruby-talk:204896] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b1c99d570b
commit
7639df765e
3 changed files with 15 additions and 25 deletions
|
@ -1,8 +1,11 @@
|
||||||
Sun Jul 30 22:29:01 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Jul 30 23:04:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_trap_eval): make the current thread runnable to deal with
|
* eval.c (rb_trap_eval): make the current thread runnable to deal with
|
||||||
exceptions which occurred within the trap. fixed: [ruby-dev:27729]
|
exceptions which occurred within the trap. fixed: [ruby-dev:27729]
|
||||||
|
|
||||||
|
* lib/cgi/session.rb, lib/cgi/session/pstore.rb: suppress warnings.
|
||||||
|
fixed: [ruby-talk:204896]
|
||||||
|
|
||||||
Sat Jul 29 06:12:06 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
Sat Jul 29 06:12:06 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* ext/tk/lib/multi-tk.rb: freeze ip_name for security reason.
|
* ext/tk/lib/multi-tk.rb: freeze ip_name for security reason.
|
||||||
|
|
|
@ -301,20 +301,14 @@ class CGI
|
||||||
|
|
||||||
# Retrieve the session data for key +key+.
|
# Retrieve the session data for key +key+.
|
||||||
def [](key)
|
def [](key)
|
||||||
unless @data
|
@data ||= @dbman.restore
|
||||||
@data = @dbman.restore
|
|
||||||
end
|
|
||||||
@data[key]
|
@data[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the session date for key +key+.
|
# Set the session date for key +key+.
|
||||||
def []=(key, val)
|
def []=(key, val)
|
||||||
unless @write_lock
|
@write_lock ||= true
|
||||||
@write_lock = true
|
@data ||= @dbman.restore
|
||||||
end
|
|
||||||
unless @data
|
|
||||||
@data = @dbman.restore
|
|
||||||
end
|
|
||||||
@data[key] = val
|
@data[key] = val
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -374,13 +368,15 @@ class CGI
|
||||||
# not exist, or opened if it does.
|
# not exist, or opened if it does.
|
||||||
def initialize(session, option={})
|
def initialize(session, option={})
|
||||||
dir = option['tmpdir'] || Dir::tmpdir
|
dir = option['tmpdir'] || Dir::tmpdir
|
||||||
prefix = option['prefix'] || ''
|
prefix = option['prefix'] || ''
|
||||||
suffix = option['suffix'] || ''
|
suffix = option['suffix'] || ''
|
||||||
id = session.session_id
|
id = session.session_id
|
||||||
require 'digest/md5'
|
require 'digest/md5'
|
||||||
md5 = Digest::MD5.hexdigest(id)[0,16]
|
md5 = Digest::MD5.hexdigest(id)[0,16]
|
||||||
@path = dir+"/"+prefix+md5+suffix
|
@path = dir+"/"+prefix+md5+suffix
|
||||||
unless File::exist? @path
|
if File::exist? @path
|
||||||
|
@hash = nil
|
||||||
|
else
|
||||||
unless session.new_session
|
unless session.new_session
|
||||||
raise CGI::Session::NoSession, "uninitialized session"
|
raise CGI::Session::NoSession, "uninitialized session"
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,17 +14,6 @@ require 'pstore'
|
||||||
|
|
||||||
class CGI
|
class CGI
|
||||||
class Session
|
class Session
|
||||||
def []=(key, val)
|
|
||||||
unless @write_lock
|
|
||||||
@write_lock = true
|
|
||||||
end
|
|
||||||
unless @data
|
|
||||||
@data = @dbman.restore
|
|
||||||
end
|
|
||||||
#@data[key] = String(val)
|
|
||||||
@data[key] = val
|
|
||||||
end
|
|
||||||
|
|
||||||
# PStore-based session storage class.
|
# PStore-based session storage class.
|
||||||
#
|
#
|
||||||
# This builds upon the top-level PStore class provided by the
|
# This builds upon the top-level PStore class provided by the
|
||||||
|
@ -53,7 +42,7 @@ class CGI
|
||||||
#
|
#
|
||||||
# This session's PStore file will be created if it does
|
# This session's PStore file will be created if it does
|
||||||
# not exist, or opened if it does.
|
# not exist, or opened if it does.
|
||||||
def initialize session, option={}
|
def initialize(session, option={})
|
||||||
dir = option['tmpdir'] || Dir::tmpdir
|
dir = option['tmpdir'] || Dir::tmpdir
|
||||||
prefix = option['prefix'] || ''
|
prefix = option['prefix'] || ''
|
||||||
id = session.session_id
|
id = session.session_id
|
||||||
|
@ -61,7 +50,9 @@ class CGI
|
||||||
md5 = Digest::MD5.hexdigest(id)[0,16]
|
md5 = Digest::MD5.hexdigest(id)[0,16]
|
||||||
path = dir+"/"+prefix+md5
|
path = dir+"/"+prefix+md5
|
||||||
path.untaint
|
path.untaint
|
||||||
unless File::exist?(path)
|
if File::exist?(path)
|
||||||
|
@hash = nil
|
||||||
|
else
|
||||||
unless session.new_session
|
unless session.new_session
|
||||||
raise CGI::Session::NoSession, "uninitialized session"
|
raise CGI::Session::NoSession, "uninitialized session"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue