From 3d699ae9ffc32665e8f9117c4149e2ae03123bdf Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 20 Mar 1998 09:20:30 +0000 Subject: -a -> -a- ^^;; git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/cgi-lib.rb | 14 +++++--------- string.c | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index e78ff3586b..5614dc4d07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Mar 20 16:40:34 1998 Yukihiro Matsumoto + + * string.c (str_sub_iter_s): should check last pattern since it + may be matched to null. + Thu Mar 19 13:48:55 1998 Yukihiro Matsumoto * experimental release 1.1b9_04. diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb index 02720b2835..00be8992f4 100644 --- a/lib/cgi-lib.rb +++ b/lib/cgi-lib.rb @@ -7,14 +7,16 @@ # foo = CGI.new # foo['field'] <== value of 'field' # foo.keys <== array of fields -# foo.inputs <== hash of { => } +# and foo has Hash class methods # if running on Windows(IIS or PWS) then change cwd. if ENV['SERVER_SOFTWARE'] =~ /^Microsoft-/ then Dir.chdir ENV['PATH_TRANSLATED'].sub(/[^\\]+$/, '') end -class CGI +require "delegate" + +class CGI < SimpleDelegator attr("inputs") @@ -61,16 +63,10 @@ class CGI key, val = x.split(/=/,2).collect{|x|unescape(x)} @inputs[key] += ("\0" if @inputs[key]) + (val or "") end - end - def keys - @inputs.keys + super(@inputs) end - def [](key) - @inputs[key] - end - def CGI.message(msg, title = "") print "Content-type: text/html\n\n" print "" diff --git a/string.c b/string.c index ca4ad9cf61..3a278b898f 100644 --- a/string.c +++ b/string.c @@ -913,7 +913,7 @@ str_sub_s(str, pat, val, once) } if (once) break; - if (offset >= STRLEN(str)) break; + if (offset > STRLEN(str)) break; } if (n == 0) return Qnil; if (RSTRING(str)->len > offset) { @@ -996,7 +996,7 @@ str_sub_iter_s(str, pat, once) } if (once) break; - if (offset >= STRLEN(str)) break; + if (offset > STRLEN(str)) break; } if (n == 0) return Qnil; if (RSTRING(str)->len > offset) { -- cgit v1.2.3