From 84e2f5268a4844d7999a9424c7f6a94fd4a68cb7 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 2 Nov 2006 00:21:28 +0000 Subject: * lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): Symbol should come earlier than String. * lib/soap/mapping/rubytypeFactory.rb (RubytypeFactory::obj2soap): ditto. * lib/set.rb (TC_Set::test_s_new): strings are no longer Enumerable * lib/soap/property.rb (Property::load): ditto. * lib/webrick/httputils.rb (WEBrick::HTTPUtils::parse_header): ditto. * lib/soap/mimemessage.rb (MIMEMessage::Headers::parse): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 17 +++++++++++++++++ lib/set.rb | 1 - lib/soap/mapping/rubytypeFactory.rb | 16 ++++++++-------- lib/soap/mimemessage.rb | 2 +- lib/soap/property.rb | 2 +- lib/webrick/httprequest.rb | 2 +- lib/webrick/httputils.rb | 2 +- lib/xmlrpc/create.rb | 6 +++--- lib/xsd/codegen/gensupport.rb | 8 ++++---- test/webrick/test_cgi.rb | 2 +- 10 files changed, 37 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51f0582829..f7bfb1cd86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Thu Nov 2 08:21:07 2006 Yukihiro Matsumoto + + * lib/xmlrpc/create.rb (XMLRPC::Create::conv2value): Symbol should + come earlier than String. + + * lib/soap/mapping/rubytypeFactory.rb (RubytypeFactory::obj2soap): + ditto. + + * lib/set.rb (TC_Set::test_s_new): strings are no longer + Enumerable + + * lib/soap/property.rb (Property::load): ditto. + + * lib/webrick/httputils.rb (WEBrick::HTTPUtils::parse_header): ditto. + + * lib/soap/mimemessage.rb (MIMEMessage::Headers::parse): ditto. + Thu Nov 2 09:08:04 2006 Yukihiro Matsumoto * array.c: revert lfree shift/unshift boost patch to avoid unknown diff --git a/lib/set.rb b/lib/set.rb index 98c566f9c0..ace02e08f2 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -640,7 +640,6 @@ class TC_Set < Test::Unit::TestCase Set.new([]) Set.new([1,2]) Set.new('a'..'c') - Set.new('XYZ') } assert_raises(NoMethodError) { Set.new(false) diff --git a/lib/soap/mapping/rubytypeFactory.rb b/lib/soap/mapping/rubytypeFactory.rb index 6c30f23a7b..4c629e10d6 100644 --- a/lib/soap/mapping/rubytypeFactory.rb +++ b/lib/soap/mapping/rubytypeFactory.rb @@ -38,6 +38,14 @@ class RubytypeFactory < Factory def obj2soap(soap_class, obj, info, map) param = nil case obj + when ::Symbol + unless @allow_original_mapping + return nil + end + param = SOAPStruct.new(TYPE_SYMBOL) + mark_marshalled_obj(obj, param) + param.add('id', SOAPString.new(obj.id2name)) + addiv2soapattr(param, obj, map) when ::String unless @allow_original_mapping return nil @@ -185,14 +193,6 @@ class RubytypeFactory < Factory mark_marshalled_obj(obj, param) param.add('name', SOAPString.new(obj.name)) addiv2soapattr(param, obj, map) - when ::Symbol - unless @allow_original_mapping - return nil - end - param = SOAPStruct.new(TYPE_SYMBOL) - mark_marshalled_obj(obj, param) - param.add('id', SOAPString.new(obj.id2name)) - addiv2soapattr(param, obj, map) when ::Struct unless @allow_original_mapping # treat it as an user defined class. [ruby-talk:104980] diff --git a/lib/soap/mimemessage.rb b/lib/soap/mimemessage.rb index acb4322e11..4e151e320a 100644 --- a/lib/soap/mimemessage.rb +++ b/lib/soap/mimemessage.rb @@ -49,7 +49,7 @@ class MIMEMessage def parse(str) header_cache = nil - str.each do |line| + str.lines.each do |line| case line when /^\A[^\: \t]+:\s*.+$/ parse_line(header_cache) if header_cache diff --git a/lib/soap/property.rb b/lib/soap/property.rb index 882dcc6e28..51f2e82628 100644 --- a/lib/soap/property.rb +++ b/lib/soap/property.rb @@ -70,7 +70,7 @@ class Property LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$") def load(stream) key_prefix = "" - stream.each_with_index do |line, lineno| + stream.lines.each_with_index do |line, lineno| line.sub!(/\r?\n\z/, '') case line when COMMENT_REGEXP diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 80188b8cfc..2dca0655d6 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -240,7 +240,7 @@ module WEBrick end end begin - @header = HTTPUtils::parse_header(@raw_header) + @header = HTTPUtils::parse_header(@raw_header.join) rescue => ex raise HTTPStatus::BadRequest, ex.message end diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb index c93146997f..38a42b98f8 100644 --- a/lib/webrick/httputils.rb +++ b/lib/webrick/httputils.rb @@ -127,7 +127,7 @@ module WEBrick def parse_header(raw) header = Hash.new([].freeze) field = nil - raw.each{|line| + raw.lines.each{|line| case line when /^([A-Za-z0-9!\#$%&'*+\-.^_`|~]+):\s*(.*?)\s*\z/om field, value = $1, $2 diff --git a/lib/xmlrpc/create.rb b/lib/xmlrpc/create.rb index 9150e2f56f..9a3df0d832 100644 --- a/lib/xmlrpc/create.rb +++ b/lib/xmlrpc/create.rb @@ -194,12 +194,12 @@ module XMLRPC when TrueClass, FalseClass @writer.tag("boolean", param ? "1" : "0") - when String - @writer.tag("string", param) - when Symbol @writer.tag("string", param.to_s) + when String + @writer.tag("string", param) + when NilClass if Config::ENABLE_NIL_CREATE @writer.ele("nil") diff --git a/lib/xsd/codegen/gensupport.rb b/lib/xsd/codegen/gensupport.rb index 1e85d3668f..8c2bb0d901 100644 --- a/lib/xsd/codegen/gensupport.rb +++ b/lib/xsd/codegen/gensupport.rb @@ -129,22 +129,22 @@ module GenSupport private def trim_eol(str) - str.collect { |line| + str.lines.collect { |line| line.sub(/\r?\n\z/, "") + "\n" }.join end def trim_indent(str) indent = nil - str = str.collect { |line| untab(line) }.join - str.each do |line| + str = str.lines.collect { |line| untab(line) }.join + str.each_line do |line| head = line.index(/\S/) if !head.nil? and (indent.nil? or head < indent) indent = head end end return str unless indent - str.collect { |line| + str.lines.collect { |line| line.sub(/^ {0,#{indent}}/, "") }.join end diff --git a/test/webrick/test_cgi.rb b/test/webrick/test_cgi.rb index c71f18c53b..7d883af3b5 100644 --- a/test/webrick/test_cgi.rb +++ b/test/webrick/test_cgi.rb @@ -54,7 +54,7 @@ class TestWEBrickCGI < Test::Unit::TestCase assert_equal("a=1, a=2, b=x", res.body)} req = Net::HTTP::Get.new("/") http.request(req){|res| - ary = res.body.to_a + ary = res.body.lines.to_a assert_match(%r{/$}, ary[0]) assert_match(%r{/webrick.cgi$}, ary[1]) } -- cgit v1.2.3