mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (str_gsub): internal buffer should not be listed by
ObjectSpace.each_object() by String#gsub. [ruby-dev:24931] * lib/cgi/session.rb (CGI::Session::FileStore::initialize): raise exception if data corresponding to session specified from the client does not exist. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a6610efee8
commit
77a23fba35
7 changed files with 41 additions and 8 deletions
11
ChangeLog
11
ChangeLog
|
@ -3,6 +3,11 @@ Sat Nov 20 01:45:04 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
|||
* test/xmlrpc/test_webrick_server.rb : move `requrie "webrick/https"'
|
||||
into #setup_http_server mohtod to avoid soap test errors.
|
||||
|
||||
Sat Nov 20 00:07:16 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (str_gsub): internal buffer should not be listed by
|
||||
ObjectSpace.each_object() by String#gsub. [ruby-dev:24931]
|
||||
|
||||
Fri Nov 19 22:44:43 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* lib/test/unit/collector/dir.rb: better support for -p/-x option.
|
||||
|
@ -63,6 +68,12 @@ Fri Nov 19 10:32:36 2004 Shugo Maeda <shugo@ruby-lang.org>
|
|||
* ext/readline/readline.c (readline_s_set_completion_append_character):
|
||||
accept nil. [ruby-core:03765]
|
||||
|
||||
Fri Nov 19 01:20:22 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* lib/cgi/session.rb (CGI::Session::FileStore::initialize): raise
|
||||
exception if data corresponding to session specified from the
|
||||
client does not exist.
|
||||
|
||||
Fri Nov 19 00:59:31 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (str_gsub): internal buffer should not be listed by
|
||||
|
|
|
@ -588,6 +588,9 @@ else
|
|||
AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>y) : (x)>>y))
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS(stdio_ext.h)
|
||||
AC_CHECK_FUNCS(__fpending)
|
||||
|
||||
AC_MSG_CHECKING(read count field in FILE structures)
|
||||
AC_CACHE_VAL(rb_cv_fcnt,
|
||||
[for fcnt in dnl
|
||||
|
|
3
io.c
3
io.c
|
@ -127,6 +127,9 @@ static VALUE lineno = INT2FIX(0);
|
|||
# define READ_DATA_PENDING_COUNT(fp) ((fp)->_egptr - (fp)->_gptr)
|
||||
# define READ_DATA_PENDING_PTR(fp) ((fp)->_gptr)
|
||||
# endif
|
||||
#elif defined(HAVE___FPENDING)
|
||||
# define READ_DATA_PENDING(fp) (__fpending(fp) > 0)
|
||||
# define READ_DATA_PENDING_COUNT(fp) (__fpending(fp))
|
||||
#elif defined(FILE_COUNT)
|
||||
# define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
|
||||
# define READ_DATA_PENDING_COUNT(fp) ((fp)->FILE_COUNT)
|
||||
|
|
|
@ -156,7 +156,7 @@ class CGI
|
|||
class Session
|
||||
|
||||
# The id of this session.
|
||||
attr_reader :session_id
|
||||
attr_reader :session_id, :new_session
|
||||
|
||||
def Session::callback(dbman) #:nodoc:
|
||||
Proc.new{
|
||||
|
@ -170,7 +170,7 @@ class CGI
|
|||
# a random number, and a constant string. This routine
|
||||
# is used internally for automatically generated
|
||||
# session ids.
|
||||
def Session::create_new_id
|
||||
def create_new_id
|
||||
require 'digest/md5'
|
||||
md5 = Digest::MD5::new
|
||||
now = Time::now
|
||||
|
@ -179,8 +179,10 @@ class CGI
|
|||
md5.update(String(rand(0)))
|
||||
md5.update(String($$))
|
||||
md5.update('foobar')
|
||||
@new_session = true
|
||||
md5.hexdigest[0,16]
|
||||
end
|
||||
private :create_new_id
|
||||
|
||||
# Create a new CGI::Session object for +request+.
|
||||
#
|
||||
|
@ -239,6 +241,7 @@ class CGI
|
|||
# end
|
||||
#
|
||||
def initialize(request, option={})
|
||||
@new_session = false
|
||||
session_key = option['session_key'] || '_session_id'
|
||||
id = option['session_id']
|
||||
unless id
|
||||
|
@ -367,6 +370,9 @@ class CGI
|
|||
md5 = Digest::MD5.hexdigest(id)[0,16]
|
||||
@path = dir+"/"+prefix+md5+suffix
|
||||
unless File::exist? @path
|
||||
unless session.new_session
|
||||
raise RuntimeError, "uninitialized session"
|
||||
end
|
||||
@hash = {}
|
||||
end
|
||||
end
|
||||
|
@ -433,7 +439,12 @@ class CGI
|
|||
# currently recognised.
|
||||
def initialize(session, option=nil)
|
||||
@session_id = session.session_id
|
||||
GLOBAL_HASH_TABLE[@session_id] ||= {}
|
||||
unless GLOBAL_HASH_TABLE.key?(@session_id)
|
||||
unless session.new_session
|
||||
raise RuntimeError, "uninitialized session"
|
||||
end
|
||||
GLOBAL_HASH_TABLE[@session_id] = {}
|
||||
end
|
||||
end
|
||||
|
||||
# Restore session state.
|
||||
|
|
|
@ -61,7 +61,10 @@ class CGI
|
|||
md5 = Digest::MD5.hexdigest(id)[0,16]
|
||||
path = dir+"/"+prefix+md5
|
||||
path.untaint
|
||||
unless File::exist? path
|
||||
unless File::exist?(path)
|
||||
unless session.new_session
|
||||
raise RuntimeError, "uninitialized session"
|
||||
end
|
||||
@hash = {}
|
||||
end
|
||||
@p = ::PStore.new(path)
|
||||
|
|
4
rubyio.h
4
rubyio.h
|
@ -16,6 +16,10 @@
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(HAVE_STDIO_EXT_H)
|
||||
#include <stdio_ext.h>
|
||||
#endif
|
||||
|
||||
typedef struct OpenFile {
|
||||
FILE *f; /* stdio ptr for read/write */
|
||||
FILE *f2; /* additional ptr for rw pipes */
|
||||
|
|
6
string.c
6
string.c
|
@ -2075,10 +2075,7 @@ str_gsub(argc, argv, str, bang)
|
|||
}
|
||||
|
||||
blen = RSTRING(str)->len + 30; /* len + margin */
|
||||
dest = rb_str_new5(str, 0, blen);
|
||||
if (bang) {
|
||||
RBASIC(dest)->klass = 0;
|
||||
}
|
||||
dest = str_new(0, 0, blen);
|
||||
buf = RSTRING(dest)->ptr;
|
||||
bp = buf;
|
||||
sp = cp = RSTRING(str)->ptr;
|
||||
|
@ -2158,6 +2155,7 @@ str_gsub(argc, argv, str, bang)
|
|||
RSTRING(dest)->len = 0;
|
||||
}
|
||||
else {
|
||||
RBASIC(dest)->klass = rb_obj_class(str);
|
||||
OBJ_INFECT(dest, str);
|
||||
str = dest;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue