summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/cgi-lib.rb14
-rw-r--r--string.c4
3 files changed, 12 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index e78ff3586ba..5614dc4d076 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Mar 20 16:40:34 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * 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 <matz@netlab.co.jp>
* experimental release 1.1b9_04.
diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb
index 02720b28353..00be8992f40 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 { <field> => <value> }
+# 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 "<html><head><title>"
diff --git a/string.c b/string.c
index ca4ad9cf615..3a278b898f2 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) {