1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Sun Mar 18 08:58:18 2001 Wakou Aoyama <wakou@fsinet.or.jp>

* lib/net/cgi.rb: // === '' --> //.match('')

	* lib/net/cgi.rb: cgi#header(): improvement for mod_ruby.

	* lib/net/cgi.rb: cgi#rfc1123date(): improvement.
	  thanks to TADA Tadashi <sho@spc.gr.jp>.

	* lib/net/cgi.rb: cgi#rfc1123date(): document bug fix.
	  thanks to Kazuhiro NISHIYAMA <zn@mbf.nifty.com>.

	* lib/net/cgi.rb: cgi#header(): bug fix.
	  thanks to IWATSUKI Hiroyuki <don@na.rim.or.jp>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
wakou 2001-03-18 00:01:57 +00:00
parent b842d5f571
commit 20d29693ac
2 changed files with 35 additions and 20 deletions

View file

@ -1,3 +1,18 @@
Sun Mar 18 08:58:18 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/cgi.rb: // === '' --> //.match('')
* lib/net/cgi.rb: cgi#header(): improvement for mod_ruby.
* lib/net/cgi.rb: cgi#rfc1123date(): improvement.
thanks to TADA Tadashi <sho@spc.gr.jp>.
* lib/net/cgi.rb: cgi#rfc1123date(): document bug fix.
thanks to Kazuhiro NISHIYAMA <zn@mbf.nifty.com>.
* lib/net/cgi.rb: cgi#header(): bug fix.
thanks to IWATSUKI Hiroyuki <don@na.rim.or.jp>.
Thu Mar 15 01:28:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Mar 15 01:28:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016). * dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016).

View file

@ -4,7 +4,7 @@
cgi.rb - cgi support library cgi.rb - cgi support library
Version 2.1.3 Version 2.1.4
Copyright (C) 2000 Network Applied Communication Laboratory, Inc. Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
@ -186,12 +186,12 @@ class CGI
LF = "\012" LF = "\012"
EOL = CR + LF EOL = CR + LF
VERSION = '2.1.3' VERSION = '2.1.3'
RELEASE_DATE = '2001-02-26' RELEASE_DATE = '2001-03-18'
VERSION_CODE = 213 VERSION_CODE = 214
RELEASE_CODE = 20010226 RELEASE_CODE = 20010318
REVISION = '$Id$' REVISION = '$Id$'
NEEDS_BINMODE = true if /WIN/ni === RUBY_PLATFORM NEEDS_BINMODE = true if /WIN/ni.match(RUBY_PLATFORM)
PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'} PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'}
HTTP_STATUS = { HTTP_STATUS = {
@ -351,11 +351,11 @@ class CGI
=begin =begin
=== MAKE RFC1123 DATE STRING === MAKE RFC1123 DATE STRING
CGI::rfc1123_date(Time.now) CGI::rfc1123_date(Time.now)
# Sat, 1 Jan 2000 00:00:00 GMT # Sat, 01 Jan 2000 00:00:00 GMT
=end =end
def CGI::rfc1123_date(time) def CGI::rfc1123_date(time)
t = time.clone.gmtime t = time.clone.gmtime
return format("%s, %.2d %s %d %.2d:%.2d:%.2d GMT", return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year, RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
t.hour, t.min, t.sec) t.hour, t.min, t.sec)
end end
@ -424,7 +424,8 @@ status:
options["type"].concat( options.delete("charset") ) options["type"].concat( options.delete("charset") )
end end
if options.delete("nph") or (/IIS/n === env_table['SERVER_SOFTWARE']) options.delete("nph") if MOD_RUBY
if options.delete("nph") or /IIS/n.match(env_table['SERVER_SOFTWARE'])
buf.concat( (env_table["SERVER_PROTOCOL"] or "HTTP/1.0") + " " ) buf.concat( (env_table["SERVER_PROTOCOL"] or "HTTP/1.0") + " " )
buf.concat( (HTTP_STATUS[options["status"]] or buf.concat( (HTTP_STATUS[options["status"]] or
options["status"] or options["status"] or
@ -447,7 +448,7 @@ status:
end end
if options.has_key?("status") if options.has_key?("status")
status = HTTP_STATUS[options["status"]] or options["status"] status = (HTTP_STATUS[options["status"]] or options["status"])
buf.concat("Status: " + status + EOL) buf.concat("Status: " + status + EOL)
options.delete("status") options.delete("status")
end end
@ -809,9 +810,9 @@ convert string charset, and set language to "ja".
body = Tempfile.new("CGI") body = Tempfile.new("CGI")
body.binmode body.binmode
until head and (/#{boundary}(?:#{EOL}|--)/n === buf) until head and /#{boundary}(?:#{EOL}|--)/n.match(buf)
if (not head) and (/#{EOL}#{EOL}/n === buf) if (not head) and /#{EOL}#{EOL}/n.match(buf)
buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do buf = buf.sub(/\A((?:.|\n)*?#{EOL})#{EOL}/n) do
head = $1.dup head = $1.dup
"" ""
@ -850,14 +851,14 @@ convert string charset, and set language to "ja".
end end
END END
/Content-Disposition:.* filename="?([^\";]*)"?/ni === head /Content-Disposition:.* filename="?([^\";]*)"?/ni.match(head)
eval <<-END eval <<-END
def body.original_filename def body.original_filename
#{ #{
filename = ($1 or "").dup filename = ($1 or "").dup
if (/Mac/ni === env_table['HTTP_USER_AGENT']) and if /Mac/ni.match(env_table['HTTP_USER_AGENT']) and
(/Mozilla/ni === env_table['HTTP_USER_AGENT']) and /Mozilla/ni.match(env_table['HTTP_USER_AGENT']) and
(not /MSIE/ni === env_table['HTTP_USER_AGENT']) (not /MSIE/ni.match(env_table['HTTP_USER_AGENT']))
CGI::unescape(filename) CGI::unescape(filename)
else else
filename filename
@ -866,14 +867,14 @@ convert string charset, and set language to "ja".
end end
END END
/Content-Type: (.*)/ni === head /Content-Type: (.*)/ni.match(head)
eval <<-END eval <<-END
def body.content_type def body.content_type
#{($1 or "").dump.untaint}.taint #{($1 or "").dump.untaint}.taint
end end
END END
/Content-Disposition:.* name="?([^\";]*)"?/ni === head /Content-Disposition:.* name="?([^\";]*)"?/ni.match(head)
name = $1.dup name = $1.dup
if params.has_key?(name) if params.has_key?(name)
@ -905,7 +906,7 @@ convert string charset, and set language to "ja".
words = Shellwords.shellwords(string) words = Shellwords.shellwords(string)
if words.find{|x| /=/n === x } if words.find{|x| /=/n.match(x) }
words.join('&') words.join('&')
else else
words.join('+') words.join('+')
@ -915,8 +916,7 @@ convert string charset, and set language to "ja".
def initialize_query() def initialize_query()
if ("POST" == env_table['REQUEST_METHOD']) and if ("POST" == env_table['REQUEST_METHOD']) and
(%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n === (%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(env_table['CONTENT_TYPE'])
env_table['CONTENT_TYPE'])
boundary = $1.dup boundary = $1.dup
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH'])) @params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
else else