Issue #5660 has been reported by Nathan Leavitt.

----------------------------------------
Bug #5660: xmlrpc/client.rb issue
http://redmine.ruby-lang.org/issues/5660

Author: Nathan Leavitt
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 1.9.3


=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 `do_rpc'
 /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'
 [GEM_ROOT]/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'
 [GEM_ROOT]/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'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:1333:in `send'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:1333:in `perform_action_without_filters'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/filters.rb:617:in `call_filters'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/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'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/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'
 [GEM_ROOT]/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/method_tracer.rb:193:in `trace_execution_scoped'
 [GEM_ROOT]/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:248:in `perform_action'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:532:in `send'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/base.rb:532:in `process_without_filters'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/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/action_controller/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/action_controller/dispatcher.rb:87:in `dispatch'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/dispatcher.rb:121:in `_call'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
 [GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/query_cache.rb:29:in `call'
 [GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/query_cache.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/active_record/query_cache.rb:9:in `cache'
 [GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/query_cache.rb:28:in `call'
 [GEM_ROOT]/gems/activerecord-2.3.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
 [GEM_ROOT]/gems/newrelic_rpm-3.0.1/lib/new_relic/rack/browser_monitoring.rb:18:in `call'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/string_coercion.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'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/session/abstract_store.rb:177:in `call'
 app/classes/flash_session_cookie_middleware.rb:18:in `call'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/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'
 [GEM_ROOT]/gems/actionpack-2.3.12/lib/action_controller/dispatcher.rb:106:in `call'
 /usr/lib/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
 /usr/lib/passenger/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
 /usr/lib/passenger/lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
 /usr/lib/passenger/lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
 /usr/lib/passenger/lib/phusion_passenger/utils.rb:252:in `safe_fork'
 /usr/lib/passenger/lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:163:in `start'
 /usr/lib/passenger/lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
 /usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
 /usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
 /usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
 /usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
 /usr/lib/passenger/lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:352:in `__send__'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
 /usr/lib/passenger/lib/phusion_passenger/abstract_server.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


-- 
http://redmine.ruby-lang.org