mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
wakou
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b40f3a89e3
commit
8f6673c2d4
3 changed files with 100 additions and 65 deletions
26
ChangeLog
26
ChangeLog
|
@ -1,3 +1,11 @@
|
|||
Mon Dec 25 05:11:04 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: version 2.1.2 (some bug fixes).
|
||||
|
||||
* lib/cgi.rb: Regexp::last_match[1] --> $1
|
||||
|
||||
* lib/net/telnet.rb: ditto.
|
||||
|
||||
Mon Dec 25 04:43:02 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||
|
||||
* lib/net/http.rb: does not send HEAD on closing socket.
|
||||
|
@ -84,7 +92,7 @@ Thu Dec 14 13:06:18 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
|||
* intern.h (rb_undef): prototyped not but rb_undef_method()
|
||||
which is also in ruby.h.
|
||||
|
||||
Thu Dec 14 09:20:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Thu Dec 14 09:20:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: support -T1 on ruby 1.6.2
|
||||
|
||||
|
@ -638,7 +646,7 @@ Thu Oct 12 18:56:28 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
|||
|
||||
* lib/net/http.rb: a code for "Switch Protocol" was wrongly 100.
|
||||
|
||||
Thu Oct 12 01:23:38 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Thu Oct 12 01:23:38 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: bug fix: CGI::html(): PRETTY option didn't work.
|
||||
|
||||
|
@ -927,7 +935,7 @@ Wed Sep 13 06:39:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
|
||||
* variable.c (rb_mod_class_variables): Module#class_variables added.
|
||||
|
||||
Wed Sep 13 06:09:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Wed Sep 13 06:09:26 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: bug fix: CGI::header(): output status header.
|
||||
|
||||
|
@ -949,7 +957,7 @@ Tue Sep 12 15:37:55 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
* eval.c (rb_yield_0): stripped array too much, should remove just
|
||||
for proc_call().
|
||||
|
||||
Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Tue Sep 12 07:05:24 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: version 2.0.0: require ruby1.5.4 or later.
|
||||
|
||||
|
@ -1858,7 +1866,7 @@ Tue Jun 20 10:54:19 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
|
|||
|
||||
* configure.in: add eval sitedir.
|
||||
|
||||
Tue Jun 20 06:14:43 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Tue Jun 20 06:14:43 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: change: version syntax. old: x.yz, now: x.y.z
|
||||
|
||||
|
@ -2017,7 +2025,7 @@ Wed Jun 14 09:29:42 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* string.c (rb_str_dup): dup should always propagate taintness.
|
||||
|
||||
Wed Jun 14 00:50:14 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Wed Jun 14 00:50:14 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: read_multipart(): if no content body then raise EOFError.
|
||||
|
||||
|
@ -2099,7 +2107,7 @@ Mon Jun 5 00:13:35 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
|
|||
|
||||
* eval.c (rb_thread_schedule): =/== typo.
|
||||
|
||||
Sun Jun 4 03:17:36 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Sun Jun 4 03:17:36 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: improve: CGI::pretty()
|
||||
|
||||
|
@ -2144,7 +2152,7 @@ Wed May 31 12:37:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* eval.c (rb_exec_end_proc): print error message from END procs.
|
||||
|
||||
Wed May 31 04:06:41 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Wed May 31 04:06:41 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: change: CGI#out() if "HEAD" == REQUEST_METHOD then
|
||||
output only HTTP header.
|
||||
|
@ -2231,7 +2239,7 @@ Wed May 24 16:32:45 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
|||
|
||||
* re.c (rb_reg_desc): re may be zero, check before dereferencing.
|
||||
|
||||
Wed May 24 16:03:06 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
Wed May 24 16:03:06 2000 Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
* lib/cgi.rb: bug fix: CGI::escape(), CGI::Cookie::new()
|
||||
|
||||
|
|
93
lib/cgi.rb
93
lib/cgi.rb
|
@ -4,7 +4,7 @@
|
|||
|
||||
cgi.rb - cgi support library
|
||||
|
||||
Version 2.1.1
|
||||
Version 2.1.2
|
||||
|
||||
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
||||
|
||||
|
@ -185,10 +185,10 @@ class CGI
|
|||
CR = "\015"
|
||||
LF = "\012"
|
||||
EOL = CR + LF
|
||||
VERSION = "2.1.1"
|
||||
RELEASE_DATE = "2000-12-14"
|
||||
VERSION_CODE = 211
|
||||
RELEASE_CODE = 20001214
|
||||
VERSION = "2.1.2"
|
||||
RELEASE_DATE = "2000-12-25"
|
||||
VERSION_CODE = 212
|
||||
RELEASE_CODE = 20001225
|
||||
|
||||
NEEDS_BINMODE = true if /WIN/ni === RUBY_PLATFORM
|
||||
PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'}
|
||||
|
@ -241,7 +241,7 @@ class CGI
|
|||
=end
|
||||
def CGI::escape(string)
|
||||
string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
|
||||
'%' + Regexp::last_match[1].unpack('H2' * Regexp::last_match[1].size).join('%').upcase
|
||||
'%' + $1.unpack('H2' * $1.size).join('%').upcase
|
||||
end.tr(' ', '+')
|
||||
end
|
||||
|
||||
|
@ -252,7 +252,7 @@ class CGI
|
|||
=end
|
||||
def CGI::unescape(string)
|
||||
string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do
|
||||
[Regexp::last_match[1].delete('%')].pack('H*')
|
||||
[$1.delete('%')].pack('H*')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -272,34 +272,34 @@ class CGI
|
|||
=end
|
||||
def CGI::unescapeHTML(string)
|
||||
string.gsub(/&(.*?);/n) do
|
||||
match = Regexp::last_match[1].dup
|
||||
match = $1.dup
|
||||
case match
|
||||
when /\Aamp\z/ni then '&'
|
||||
when /\Aquot\z/ni then '"'
|
||||
when /\Agt\z/ni then '>'
|
||||
when /\Alt\z/ni then '<'
|
||||
when /\A#(\d+)\z/n then
|
||||
if Integer(Regexp::last_match[1]) < 256
|
||||
Integer(Regexp::last_match[1]).chr
|
||||
when /\A#0*(\d+)\z/n then
|
||||
if Integer($1) < 256
|
||||
Integer($1).chr
|
||||
else
|
||||
if Integer(Regexp::last_match[1]) < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)
|
||||
[Integer(Regexp::last_match[1])].pack("U")
|
||||
if Integer($1) < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)
|
||||
[Integer($1)].pack("U")
|
||||
else
|
||||
"&##{Regexp::last_match[1]};"
|
||||
"&##{$1};"
|
||||
end
|
||||
end
|
||||
when /\A#x([0-9a-f]+)\z/ni then
|
||||
if Regexp::last_match[1].hex < 256
|
||||
Regexp::last_match[1].hex.chr
|
||||
if $1.hex < 256
|
||||
$1.hex.chr
|
||||
else
|
||||
if Regexp::last_match[1].hex < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)
|
||||
[Regexp::last_match[1].hex].pack("U")
|
||||
if $1.hex < 65536 and ($KCODE[0] == ?u or $KCODE[0] == ?U)
|
||||
[$1.hex].pack("U")
|
||||
else
|
||||
"&#x#{Regexp::last_match[1]};"
|
||||
"&#x#{$1};"
|
||||
end
|
||||
end
|
||||
else
|
||||
"&#{Regexp::last_match[1]};"
|
||||
"&#{match};"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -313,10 +313,11 @@ class CGI
|
|||
print CGI::escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
|
||||
# "<BR><A HREF="url"></A>"
|
||||
=end
|
||||
def CGI::escapeElement(string, *element)
|
||||
unless element.empty?
|
||||
string.gsub(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni) do
|
||||
CGI::escapeHTML(Regexp::last_match[0])
|
||||
def CGI::escapeElement(string, *elements)
|
||||
elements = elements[0] if elements[0].kind_of?(Array)
|
||||
unless elements.empty?
|
||||
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/ni) do
|
||||
CGI::escapeHTML($&)
|
||||
end
|
||||
else
|
||||
string
|
||||
|
@ -334,9 +335,14 @@ class CGI
|
|||
CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
|
||||
# "<BR><A HREF="url"></A>"
|
||||
=end
|
||||
def CGI::unescapeElement(string, *element)
|
||||
string.gsub(/<\/?(?:#{element.join("|")})(?!\w)(?:.|\n)*?>/ni) do
|
||||
CGI::unescapeHTML(Regexp::last_match[0])
|
||||
def CGI::unescapeElement(string, *elements)
|
||||
elements = elements[0] if elements[0].kind_of?(Array)
|
||||
unless elements.empty?
|
||||
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/ni) do
|
||||
CGI::unescapeHTML($&)
|
||||
end
|
||||
else
|
||||
string
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -491,7 +497,7 @@ status:
|
|||
|
||||
if defined?(MOD_RUBY)
|
||||
buf.scan(/([^:]+): (.+)#{EOL}/n){
|
||||
Apache::request[Regexp::last_match[1]] = Regexp::last_match[2]
|
||||
Apache::request[$1] = $2
|
||||
}
|
||||
Apache::request.send_http_header
|
||||
''
|
||||
|
@ -761,6 +767,10 @@ convert string charset, and set language to "ja".
|
|||
@params.update(hash)
|
||||
end
|
||||
|
||||
def param(name)
|
||||
@params[name].join("\0")
|
||||
end
|
||||
|
||||
def read_multipart(boundary, content_length)
|
||||
params = Hash.new([])
|
||||
boundary = "--" + boundary
|
||||
|
@ -787,7 +797,7 @@ convert string charset, and set language to "ja".
|
|||
|
||||
if (not head) and (/#{EOL}#{EOL}/n === buf)
|
||||
buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do
|
||||
head = Regexp::last_match[1].dup
|
||||
head = $1.dup
|
||||
""
|
||||
end
|
||||
next
|
||||
|
@ -809,8 +819,8 @@ convert string charset, and set language to "ja".
|
|||
end
|
||||
|
||||
buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|--)/n) do
|
||||
body.print Regexp::last_match[1]
|
||||
if "--" == Regexp::last_match[2]
|
||||
body.print $1
|
||||
if "--" == $2
|
||||
content_length = -1
|
||||
end
|
||||
""
|
||||
|
@ -843,12 +853,12 @@ convert string charset, and set language to "ja".
|
|||
/Content-Type: (.*)/ni === head
|
||||
eval <<-END
|
||||
def body.content_type
|
||||
#{(Regexp::last_match[1] or "").dump.untaint}.taint
|
||||
#{($1 or "").dump.untaint}.taint
|
||||
end
|
||||
END
|
||||
|
||||
/Content-Disposition:.* name="?([^\";]*)"?/ni === head
|
||||
name = Regexp::last_match[1].dup
|
||||
name = $1.dup
|
||||
|
||||
if params.has_key?(name)
|
||||
params[name].push(body)
|
||||
|
@ -891,7 +901,7 @@ convert string charset, and set language to "ja".
|
|||
if ("POST" == env_table['REQUEST_METHOD']) and
|
||||
(%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n ===
|
||||
env_table['CONTENT_TYPE'])
|
||||
boundary = Regexp::last_match[1].dup
|
||||
boundary = $1.dup
|
||||
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
|
||||
else
|
||||
@params = CGI::parse(
|
||||
|
@ -951,7 +961,7 @@ convert string charset, and set language to "ja".
|
|||
lines = string.gsub(/(?!\A)<(?:.|\n)*?>/n, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/n, "\\0\n")
|
||||
end_pos = 0
|
||||
while end_pos = lines.index(/^<\/(\w+)/n, end_pos)
|
||||
element = Regexp::last_match[1].dup
|
||||
element = $1.dup
|
||||
start_pos = lines.rindex(/^\s*<#{element}/ni, end_pos)
|
||||
lines[start_pos ... end_pos] = "__" + lines[start_pos ... end_pos].gsub(/\n(?!\z)/n, "\n" + shift) + "__"
|
||||
end
|
||||
|
@ -1925,6 +1935,19 @@ end
|
|||
|
||||
== HISTORY
|
||||
|
||||
* Mon Dec 25 05:02:27 JST 2000 - wakou
|
||||
* version 2.1.2
|
||||
* bug fix: CGI::escapeElement(): didn't accept empty element.
|
||||
* bug fix: CGI::unescapeElement(): ditto.
|
||||
* bug fix: CGI::unescapeHTML(): support for "©, ♥, ..."
|
||||
thanks to YANAGAWA Kazuhisa <kjana@os.xaxon.ne.jp>
|
||||
* bug fix: CGI::unescapeHTML(): support for "	"
|
||||
thanks to OHSHIMA Ryunosuke <ryu@jaist.ac.jp>
|
||||
* Regexp::last_match[0] --> $&
|
||||
* Regexp::last_match[1] --> $1
|
||||
* Regexp::last_match[2] --> $2
|
||||
* add: CGI#param(): test implement. undocumented.
|
||||
|
||||
* Mon Dec 11 00:16:51 JST 2000 - wakou
|
||||
* version 2.1.1
|
||||
* support -T1 on ruby 1.6.2
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
net/telnet.rb - simple telnet client library
|
||||
|
||||
Version 1.6.1
|
||||
Version 1.6.2
|
||||
|
||||
Wakou Aoyama <wakou@fsinet.or.jp>
|
||||
|
||||
|
@ -239,10 +239,10 @@ module Net
|
|||
CR = "\015"
|
||||
LF = "\012"
|
||||
EOL = CR + LF
|
||||
VERSION = "1.6.1"
|
||||
RELEASE_DATE = "2000-12-14"
|
||||
VERSION_CODE = 161
|
||||
RELEASE_CODE = 20001214
|
||||
VERSION = "1.6.2"
|
||||
RELEASE_DATE = "2000-12-25"
|
||||
VERSION_CODE = 162
|
||||
RELEASE_CODE = 20001225
|
||||
|
||||
def initialize(options)
|
||||
@options = options
|
||||
|
@ -398,42 +398,42 @@ module Net
|
|||
[#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}]|
|
||||
#{SB}[^#{IAC}]*#{IAC}#{SE}
|
||||
)/xno) do
|
||||
if IAC == Regexp::last_match[1] # handle escaped IAC characters
|
||||
if IAC == $1 # handle escaped IAC characters
|
||||
IAC
|
||||
elsif AYT == Regexp::last_match[1] # respond to "IAC AYT" (are you there)
|
||||
elsif AYT == $1 # respond to "IAC AYT" (are you there)
|
||||
self.write("nobody here but us pigeons" + EOL)
|
||||
''
|
||||
elsif DO[0] == Regexp::last_match[1][0] # respond to "IAC DO x"
|
||||
if OPT_BINARY[0] == Regexp::last_match[1][1]
|
||||
elsif DO[0] == $1[0] # respond to "IAC DO x"
|
||||
if OPT_BINARY[0] == $1[1]
|
||||
@telnet_option["BINARY"] = true
|
||||
self.write(IAC + WILL + OPT_BINARY)
|
||||
else
|
||||
self.write(IAC + WONT + Regexp::last_match[1][1..1])
|
||||
self.write(IAC + WONT + $1[1..1])
|
||||
end
|
||||
''
|
||||
elsif DONT[0] == Regexp::last_match[1][0] # respond to "IAC DON'T x" with "IAC WON'T x"
|
||||
self.write(IAC + WONT + Regexp::last_match[1][1..1])
|
||||
elsif DONT[0] == $1[0] # respond to "IAC DON'T x" with "IAC WON'T x"
|
||||
self.write(IAC + WONT + $1[1..1])
|
||||
''
|
||||
elsif WILL[0] == Regexp::last_match[1][0] # respond to "IAC WILL x"
|
||||
if OPT_BINARY[0] == Regexp::last_match[1][1]
|
||||
elsif WILL[0] == $1[0] # respond to "IAC WILL x"
|
||||
if OPT_BINARY[0] == $1[1]
|
||||
self.write(IAC + DO + OPT_BINARY)
|
||||
elsif OPT_ECHO[0] == Regexp::last_match[1][1]
|
||||
elsif OPT_ECHO[0] == $1[1]
|
||||
self.write(IAC + DO + OPT_ECHO)
|
||||
elsif OPT_SGA[0] == Regexp::last_match[1][1]
|
||||
elsif OPT_SGA[0] == $1[1]
|
||||
@telnet_option["SGA"] = true
|
||||
self.write(IAC + DO + OPT_SGA)
|
||||
else
|
||||
self.write(IAC + DONT + Regexp::last_match[1][1..1])
|
||||
self.write(IAC + DONT + $1[1..1])
|
||||
end
|
||||
''
|
||||
elsif WONT[0] == Regexp::last_match[1][0] # respond to "IAC WON'T x"
|
||||
if OPT_ECHO[0] == Regexp::last_match[1][1]
|
||||
elsif WONT[0] == $1[0] # respond to "IAC WON'T x"
|
||||
if OPT_ECHO[0] == $1[1]
|
||||
self.write(IAC + DONT + OPT_ECHO)
|
||||
elsif OPT_SGA[0] == Regexp::last_match[1][1]
|
||||
elsif OPT_SGA[0] == $1[1]
|
||||
@telnet_option["SGA"] = false
|
||||
self.write(IAC + DONT + OPT_SGA)
|
||||
else
|
||||
self.write(IAC + DONT + Regexp::last_match[1][1..1])
|
||||
self.write(IAC + DONT + $1[1..1])
|
||||
end
|
||||
''
|
||||
else
|
||||
|
@ -599,6 +599,10 @@ end
|
|||
|
||||
== HISTORY
|
||||
|
||||
* Mon Dec 25 01:37:43 JST 2000 - wakou
|
||||
* version 1.6.2
|
||||
* Regexp::last_match[1] --> $1
|
||||
|
||||
* Mon Dec 11 00:16:51 JST 2000 - wakou
|
||||
* version 1.6.1
|
||||
* $1 --> Regexp::last_match[1]
|
||||
|
|
Loading…
Reference in a new issue