Bug #5660

xmlrpc/client.rb issue

Added by Nathan Leavitt over 2 years ago. Updated about 2 years ago.

[ruby-core:41204]
Status:Closed
Priority:Normal
Assignee:-
Category:-
Target version:-
ruby -v:1.9.3 Backport:

Description

=begin
Some xmlrpc servers don't properly set the Content-Type headers. I know based on responses tracked here http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2727&group_id=426 that the .NET (C#) implementation doesn't set it properly. I am having the same issue with some implementations of Java. When this is missing I get the following error:

/usr/lib/ruby/1.8/xmlrpc/utils.rb:159:in parse_content_type'
/usr/lib/ruby/1.8/xmlrpc/client.rb:552:in
dorpc'
/usr/lib/ruby/1.8/xmlrpc/client.rb:420:in call2'
/usr/lib/ruby/1.8/xmlrpc/client.rb:410:in
call'
[GEM
ROOT]/gems/infusionsoft-1.0.6/lib/infusionsoft/connection.rb:15:in connection'
[GEM_ROOT]/gems/infusionsoft-1.0.6/lib/infusionsoft/request.rb:29:in
request'
[GEMROOT]/gems/infusionsoft-1.0.6/lib/infusionsoft/request.rb:5:in get'
[GEM_ROOT]/gems/infusionsoft-1.0.6/lib/infusionsoft/client/contact.rb:13:in
contact
add'
[GEMROOT]/gems/infusionsoft-1.0.6/lib/infusionsoft.rb:18:in send'
[GEM_ROOT]/gems/infusionsoft-1.0.6/lib/infusionsoft.rb:18:in
method
missing'
app/models/user.rb:168:in api_create'
app/controllers/users_controller.rb:66:in
create'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/base.rb:1333:in send'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:1333:in
performactionwithoutfilters'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/filters.rb:617:in call_filters'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/filters.rb:610:in
perform
actionwithoutbenchmark'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/benchmarking.rb:68:in perform_action_without_rescue'
[GEM_ROOT]/gems/activesupport-2.3.12/lib/active_support/core_ext/benchmark.rb:17:in
ms'
/usr/lib/ruby/1.8/benchmark.rb:308:in realtime'
[GEM_ROOT]/gems/activesupport-2.3.12/lib/active_support/core_ext/benchmark.rb:17:in
ms'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/benchmarking.rb:68:in perform_action_without_rescue'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/rescue.rb:160:in
performactionwithoutflash'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/flash.rb:151:in perform_action_without_newrelic_trace'
[GEM_ROOT]/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:255:in
perform
action'
[GEMROOT]/gems/newrelicrpm-3.0.1/lib/newrelic/agent/methodtracer.rb:193:in trace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:248:in
performaction'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/base.rb:532:in send'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:532:in
process
withoutfilters'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/filters.rb:606:in process'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:391:in
process'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/base.rb:386:in call'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/routing/route_set.rb:438:in
call'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/dispatcher.rb:87:in dispatch'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/dispatcher.rb:121:in
call'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/dispatcher.rb:130:in build_middleware_stack'
[GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/query_cache.rb:29:in
call'
[GEMROOT]/gems/activerecord-2.3.12/lib/activerecord/querycache.rb:29:in call'
[GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
cache'
[GEM
ROOT]/gems/activerecord-2.3.12/lib/activerecord/querycache.rb:9:in cache'
[GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/query_cache.rb:28:in
call'
[GEMROOT]/gems/activerecord-2.3.12/lib/activerecord/connectionadapters/abstract/connectionpool.rb:361:in call'
[GEM_ROOT]/gems/newrelic_rpm-3.0.1/lib/new_relic/rack/browser_monitoring.rb:18:in
call'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/stringcoercion.rb:25:in call'
[GEM_ROOT]/gems/rack-1.1.2/lib/rack/head.rb:9:in
call'
[GEM
ROOT]/gems/rack-1.1.2/lib/rack/methodoverride.rb:24:in call'
[GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/params_parser.rb:15:in
call'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/session/abstractstore.rb:177:in call'
app/classes/flash_session_cookie_middleware.rb:18:in
call'
[GEM
ROOT]/gems/actionpack-2.3.12/lib/actioncontroller/failsafe.rb:26:in call'
[GEM_ROOT]/gems/rack-1.1.2/lib/rack/lock.rb:11:in
call'
[GEM
ROOT]/gems/rack-1.1.2/lib/rack/lock.rb:11:in synchronize'
[GEM_ROOT]/gems/rack-1.1.2/lib/rack/lock.rb:11:in
call'
[GEMROOT]/gems/actionpack-2.3.12/lib/actioncontroller/dispatcher.rb:106:in call'
/usr/lib/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in
processrequest'
/usr/lib/passenger/lib/phusion
passenger/abstractrequesthandler.rb:207:in main_loop'
/usr/lib/passenger/lib/phusion_passenger/railz/application_spawner.rb:441:in
startrequesthandler'
/usr/lib/passenger/lib/phusionpassenger/railz/applicationspawner.rb:381:in handle_spawn_application'
/usr/lib/passenger/lib/phusion_passenger/utils.rb:252:in
safefork'
/usr/lib/passenger/lib/phusion
passenger/railz/applicationspawner.rb:377:in handle_spawn_application'
/usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:352:in
send'
/usr/lib/passenger/lib/phusion
passenger/abstractserver.rb:352:in main_loop'
/usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:196:in
start
synchronously'
/usr/lib/passenger/lib/phusionpassenger/abstractserver.rb:163:in start'
/usr/lib/passenger/lib/phusion_passenger/railz/application_spawner.rb:222:in
start'
/usr/lib/passenger/lib/phusionpassenger/spawnmanager.rb:262:in spawn_rails_application'
/usr/lib/passenger/lib/phusion_passenger/abstract_server_collection.rb:126:in
lookuporadd'
/usr/lib/passenger/lib/phusionpassenger/spawnmanager.rb:256:in spawn_rails_application'
/usr/lib/passenger/lib/phusion_passenger/abstract_server_collection.rb:80:in
synchronize'
/usr/lib/passenger/lib/phusionpassenger/abstractservercollection.rb:79:in synchronize'
/usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:255:in
spawn
railsapplication'
/usr/lib/passenger/lib/phusion
passenger/spawnmanager.rb:154:in spawn_application'
/usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:287:in
handle
spawnapplication'
/usr/lib/passenger/lib/phusion
passenger/abstractserver.rb:352:in __send__'
/usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:352:in
main
loop'
/usr/lib/passenger/lib/phusionpassenger/abstractserver.rb:196:in `start_synchronously'
/usr/lib/passenger/bin/passenger-spawn-server:63

I have submitted a patch assuming text/xml for the response Content-Type header when one isn't set.

NOTE: can also be reproduced on Ruby 1.8

ruby-xmlrpc-changes.patch Magnifier (658 Bytes) Nathan Leavitt, 11/23/2011 02:45 AM

Associated revisions

Revision 34935
Added by tenderlove about 2 years ago

  • lib/xmlrpc/client.rb: assume servers that do not send a Content-Type
    header are sending 'text/xml'. Thanks Nathan Leavitt!
    [Bug #5660]

  • test/xmlrpc/test_client.rb: supporting test

History

#1 Updated by Nathan Leavitt over 2 years ago

=begin
Here is the error that is thrown:

NoMethodError: private method `split' called for nil:NilClass
=end

#2 Updated by Aaron Patterson about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34935.
Nathan, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/xmlrpc/client.rb: assume servers that do not send a Content-Type
    header are sending 'text/xml'. Thanks Nathan Leavitt!
    [Bug #5660]

  • test/xmlrpc/test_client.rb: supporting test

Also available in: Atom PDF