xmlrpclib hangs execution

Arno Stienen arnoreg at gmail.com
Wed May 30 17:32:05 EDT 2007


Tijs wrote:
>> Arno Stienen wrote:
>>> Perhaps I should be a bit more specific. When using this code to connect
>>> to a remote XML-RPC server (C++, xmlrpc++0.7 library):
>>>
>>>            import xmlrpclib
>>>            server = xmlrpclib.Server("http://10.10.101.62:29500")
>>>            print server.Connection_Request("roberto")
>>>
>>> the Python command line 'hangs' until I kill the server. Then, the
>>> correct output is suddenly displayed:
>>>
>>>            {'state': 0, 'id_session': '2Z3EUSLJFA13', 'port': 29501,
>>>            'str': 'Connection accepted. Session attached.'}
>>>
>>> Yet a slightly simpler call works flawlessly:
>>>
>>>            import xmlrpclib
>>>            server = xmlrpclib.Server("http://10.10.101.62:29500")
>>>            print server.Info_RT('Master')
>>>
>>>            {'state': 0, 'str': 'Info_RT'}
>>>
> 
> After having a quick look at your files, I conclude that the problem is in a
> combination of two problems:
> 
> 1. Your server is crap. It answers an HTTP/1.0 request by an HTTP/1.1
> response without specifying any Connection header and without closing the
> connection. Normally, a simple client that is not HTTP/1.1-aware expects
> the connection to close. HTTP/1.1 leaves the connection open by default.
> 
> 2. The Python implementation of xmlrpc is not very robust. It just waits for
> the connection to close. A well-written client (like your Java client)
> would detect the presence of a Content-Length header and use that. 

I'll now try this to fool the client into thinking the server 'should' 
keep the connection open:

http://www.velocityreviews.com/forums/t329401-re-xmlrpc-httplib-and-ssl-http-11-xmlrpc-client.html

Bye,
Arno.



More information about the Python-list mailing list