From e02b469de182c1d87ead38fa82630eaaee75c379 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 24 Jul 2003 05:18:47 +0000 Subject: * eval.c (thgroup_add): no warning for terminated threads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/cgi.rb | 18 ++++++++++++++---- lib/irb/locale.rb | 23 +++++++++++------------ 2 files changed, 25 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/cgi.rb b/lib/cgi.rb index 8f522ab7c1..1327b64d34 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -800,7 +800,7 @@ convert string charset, and set language to "ja". body = Tempfile.new("CGI") else begin - require "stringio" if not defined? StringIO + require "stringio" body = StringIO.new rescue LoadError require "tempfile" @@ -917,6 +917,7 @@ convert string charset, and set language to "ja". if ("POST" == env_table['REQUEST_METHOD']) and %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(env_table['CONTENT_TYPE']) boundary = $1.dup + @multipart = true @params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH'])) else @params = CGI::parse( @@ -947,7 +948,6 @@ convert string charset, and set language to "ja". super(str) end def [](idx) - p caller(1) warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']" self end @@ -964,8 +964,17 @@ convert string charset, and set language to "ja". def [](key) params = @params[key] value = params[0] - value ||= "" - Value.new(value,params) + if @multipart + if value + return value + elsif defined? StringIO + StringIO.new("") + else + Tempfile.new("CGI") + end + else + Value.new(value || "", params) + end end def keys(*args) @@ -1931,6 +1940,7 @@ The hash keys are case sensitive. Ask the samples. end extend QueryExtension + @multipart = false if "POST" != env_table['REQUEST_METHOD'] initialize_query() # set @params, @cookies else diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb index dad6b2f075..b2c90e38e2 100644 --- a/lib/irb/locale.rb +++ b/lib/irb/locale.rb @@ -21,27 +21,26 @@ module IRB LOCALE_DIR = "/lc/" def initialize(locale = nil) - @lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] - @lang = "C" unless @lang + @lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C" end attr_reader :lang - @@LC2KCONV = { - # "ja" => Kconv::JIS, - # "ja_JP" => Kconv::JIS, - "ja_JP.ujis" => Kconv::EUC, - "ja_JP.euc" => Kconv::EUC, - "ja_JP.eucJP" => Kconv::EUC, - "ja_JP.sjis" => Kconv::SJIS, - "ja_JP.SJIS" => Kconv::SJIS, - } + def lc2kconv(lang) + case lang + when "ja_JP.ujis", "ja_JP.euc", "ja_JP.eucJP" + Kconv::EUC + when "ja_JP.sjis", "ja_JP.SJIS" + Kconv::SJIS + end + end + private :lc2kconv def String(mes) mes = super(mes) case @lang when /^ja/ - mes = Kconv::kconv(mes, @@LC2KCONV[@lang]) + mes = Kconv::kconv(mes, lc2kconv(@lang)) else mes end -- cgit v1.2.3