|
diff --git a/lib/soap/mapping/encodedregistry.rb b/lib/soap/mapping/encodedregistry.rb |
|
index c948e15c..7be73985 100644 |
|
--- a/lib/soap/mapping/encodedregistry.rb |
|
+++ b/lib/soap/mapping/encodedregistry.rb |
|
@@ -6,6 +6,11 @@ |
|
# redistribute it and/or modify it under the same terms of Ruby's license; |
|
# either the dual license version in 2003, or any later version. |
|
|
|
+# in 2.4, 2.5 Fixnum/Bignum aliased to 'Integer' |
|
+FixnumShim = 1.class |
|
+FIXNUM_PRESENT = FixnumShim.name == 'Fixnum' |
|
+BignumShim = (10**20).class |
|
+BIGNUM_PRESENT = BignumShim.name == 'Bignum' |
|
|
|
require 'soap/baseData' |
|
require 'soap/mapping/mapping' |
|
@@ -122,7 +127,7 @@ def find_mapped_obj_class(target_soap_class) |
|
|
|
StringFactory = StringFactory_.new |
|
BasetypeFactory = BasetypeFactory_.new |
|
- FixnumFactory = FixnumFactory_.new |
|
+ FixnumFactory = FixnumFactory_.new if FIXNUM_PRESENT |
|
DateTimeFactory = DateTimeFactory_.new |
|
ArrayFactory = ArrayFactory_.new |
|
Base64Factory = Base64Factory_.new |
|
@@ -146,7 +151,6 @@ def find_mapped_obj_class(target_soap_class) |
|
{:derived_class => true}], |
|
[::Float, ::SOAP::SOAPFloat, BasetypeFactory, |
|
{:derived_class => true}], |
|
- [::Fixnum, ::SOAP::SOAPInt, FixnumFactory], |
|
[::Integer, ::SOAP::SOAPInt, BasetypeFactory, |
|
{:derived_class => true}], |
|
[::Integer, ::SOAP::SOAPLong, BasetypeFactory, |
|
@@ -199,6 +203,8 @@ def find_mapped_obj_class(target_soap_class) |
|
{:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}], |
|
] |
|
|
|
+ SOAPBaseMap << [FixnumShim, ::SOAP::SOAPInt, FixnumFactory] if FIXNUM_PRESENT |
|
+ |
|
RubyOriginalMap = [ |
|
[::NilClass, ::SOAP::SOAPNil, BasetypeFactory], |
|
[::TrueClass, ::SOAP::SOAPBoolean, BasetypeFactory], |
|
@@ -212,7 +218,6 @@ def find_mapped_obj_class(target_soap_class) |
|
{:derived_class => true}], |
|
[::Float, ::SOAP::SOAPFloat, BasetypeFactory, |
|
{:derived_class => true}], |
|
- [::Fixnum, ::SOAP::SOAPInt, FixnumFactory], |
|
[::Integer, ::SOAP::SOAPInt, BasetypeFactory, |
|
{:derived_class => true}], |
|
[::Integer, ::SOAP::SOAPLong, BasetypeFactory, |
|
@@ -263,6 +268,8 @@ def find_mapped_obj_class(target_soap_class) |
|
{:type => XSD::QName.new(RubyCustomTypeNamespace, "SOAPException")}], |
|
] |
|
|
|
+ RubyOriginalMap << [FixnumShim, ::SOAP::SOAPInt, FixnumFactory] if FIXNUM_PRESENT |
|
+ |
|
attr_accessor :default_factory |
|
attr_accessor :excn_handler_obj2soap |
|
attr_accessor :excn_handler_soap2obj |
|
@@ -411,7 +418,10 @@ def addextend2obj(obj, attr) |
|
end |
|
|
|
def addextend2soap(node, obj) |
|
- return if [Symbol, Fixnum, Bignum, Float].any?{ |c| obj.is_a?(c) } |
|
+ return if [Symbol, Integer, Float].any?{ |c| obj.is_a?(c) } |
|
+ return if FIXNUM_PRESENT && obj.is_a?(FixnumShim) |
|
+ return if BIGNUM_PRESENT && obj.is_a?(BignumShim) |
|
+ return if obj.is_a?(String) && obj.frozen? |
|
list = (class << obj; self; end).ancestors - obj.class.ancestors |
|
list = list.reject{|c| c.class == Class } ## As of Ruby 2.1 Singleton Classes are now included in the ancestry. Need to filter those out here. |
|
|
|
diff --git a/lib/soap/mapping/rubytypeFactory.rb b/lib/soap/mapping/rubytypeFactory.rb |
|
index e6b04947..21e17eea 100644 |
|
--- a/lib/soap/mapping/rubytypeFactory.rb |
|
+++ b/lib/soap/mapping/rubytypeFactory.rb |
|
@@ -6,6 +6,10 @@ |
|
# redistribute it and/or modify it under the same terms of Ruby's license; |
|
# either the dual license version in 2003, or any later version. |
|
|
|
+old_verbose, $VERBOSE = $VERBOSE, nil # silence warnings |
|
+DATA_PRESENT = defined?(Data) |
|
+DataShim = Kernel.const_get('Data') if DATA_PRESENT |
|
+$VERBOSE = old_verbose |
|
|
|
module SOAP |
|
module Mapping |
|
@@ -38,6 +42,7 @@ def initialize(config = {}) |
|
|
|
def obj2soap(soap_class, obj, info, map) |
|
param = nil |
|
+ |
|
case obj |
|
when ::String |
|
unless @allow_original_mapping |
|
@@ -193,7 +198,7 @@ def obj2soap(soap_class, obj, info, map) |
|
param.add('member', ele_member) |
|
addiv2soapattr(param, obj, map) |
|
end |
|
- when ::IO, ::Binding, ::Data, ::Dir, ::File::Stat, |
|
+ when ::IO, ::Binding, DataShim, ::Dir, ::File::Stat, |
|
::MatchData, Method, ::Proc, ::Process::Status, ::Thread, |
|
::ThreadGroup, ::UnboundMethod |
|
return nil |
|
diff --git a/lib/soap/property.rb b/lib/soap/property.rb |
|
index 6cf74577..dc10d1de 100644 |
|
--- a/lib/soap/property.rb |
|
+++ b/lib/soap/property.rb |
|
@@ -33,7 +33,9 @@ module SOAP |
|
# aaa.hhh = iii |
|
# |
|
class Property |
|
- FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError |
|
+ unless defined?(FrozenError) # defined since 2.5 |
|
+ FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError |
|
+ end |
|
|
|
include Enumerable |
|
|
|
@@ -327,4 +329,4 @@ def loadstr(str) |
|
end |
|
|
|
|
|
-end |
|
\ No newline at end of file |
|
+end |
|
diff --git a/lib/soap/rpc/cgistub.rb b/lib/soap/rpc/cgistub.rb |
|
index 89dbda14..51938fdb 100644 |
|
--- a/lib/soap/rpc/cgistub.rb |
|
+++ b/lib/soap/rpc/cgistub.rb |
|
@@ -202,7 +202,7 @@ def set_fcgi_request(request) |
|
HTTPVersion = WEBrick::HTTPVersion.new('1.0') # dummy; ignored |
|
|
|
def run |
|
- res = WEBrick::HTTPResponse.new({:HTTPVersion => HTTPVersion}) |
|
+ res = WEBrick::HTTPResponse.new({:HTTPVersion => HTTPVersion, :Logger => logger}) |
|
begin |
|
@log.info { "received a request from '#{ @remote_host }'" } |
|
if @fcgi |
|
@@ -227,9 +227,12 @@ def run |
|
r.send_http_header |
|
buf = res.body |
|
else |
|
- buf = '' |
|
+ # since 2.5 it doesn't work with empty string in WEBRICK::HTTPResponse#send_header(socket) |
|
+ # https://github.com/ruby/ruby/commit/c44978b99f0454b8f00674f2f407893c8c47248e |
|
+ buf = StringIO.new |
|
res.send_response(buf) |
|
- buf.sub!(/^[^\r]+\r\n/, '') # Trim status line. |
|
+ |
|
+ buf = buf.string.sub(/^[^\r]+\r\n/, '') # Trim status line. |
|
end |
|
@log.debug { "SOAP CGI Response:\n#{ buf }" } |
|
if @fcgi |
|
diff --git a/lib/xsd/xmlparser/oxparser.rb b/lib/xsd/xmlparser/oxparser.rb |
|
index 79cc384b..52bf6068 100644 |
|
--- a/lib/xsd/xmlparser/oxparser.rb |
|
+++ b/lib/xsd/xmlparser/oxparser.rb |
|
@@ -28,7 +28,7 @@ def do_parse(string_or_readable) |
|
::Ox.sax_parse(handler, string, {:symbolize=> false, :convert_special=> true, :skip=> :skip_return} ) |
|
else |
|
# Use HTMLEntities Decoder. Leave the special-character conversion alone and let HTMLEntities decode it for us. |
|
- ::Ox.sax_parse(handler, string, {}) |
|
+ ::Ox.sax_parse(handler, string, {:skip=> :skip_none}) |
|
end |
|
end |