Menu

#8 Problems with HTTP 1.0 Python client - version 1.7.4

open
nobody
None
5
2008-11-06
2008-11-06
No

Python 2.4 Client (version 1..0.1) using HTTP 1.0:

send: 'POST /RPC2 HTTP/1.0\r\nHost: dev-agis32:50955\r\nUser-Agent: xmlrpclib.py/1.0.1 (by http://www.pythonware.com\)\r\nContent-Type: text/xml\r\nContent-Length: 112\r\n\r\n'
send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>system.listMethods</methodName>\n<params>\n</params>\n</methodCall>\n"

ULXR server Reply (HTTP 1.1):

reply: 'HTTP/1.1 200 OK\r\n'
header: Proxy-Connection: Keep-Alive
header: Content-Type: text/xml
header: Content-Length: 647
header: X-Powered-By: ulxmlrpcpp/1.7.4
header: Server: 10.139.4.60
header: Date: Wed Nov 5 18:14:43 2008
body: '<?xml version="1.0" encoding="utf-8"?><methodResponse><params><param><value><array><data><value><string>OooiSubscriber_V1_echo</string></value><value><string>OooiSubscriber_V1_subscribe</string></value><value><string>OooiSubscriber_V1_unsubscribe</string></value><value><string>OooiSubscriber_V1_unsubscribeAll</string></value><value><string>system.getCapabilities</string></value><value><string>system.listMethods</string></value><value><string>system.methodHelp</string></value><value><string>system.methodSignature</string></value><value><string>ulxmlrpcpp.pretty_print</string></value></data></array></value></param></params></methodResponse>\n'

body: 'HTTP/1.1 200 OK\r\nProxy-Connection: Keep-Alive\r\nContent-Type: text/xml\r\nContent-Length: 306\r\nX-Powered-By: ulxmlrpcpp/1.7.4\r\nServer: 10.139.4.60\r\nDate: Wed Nov 5 18:14:53 2008\r\n\r\n<?xml version="1.0" encoding="utf-8"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><i4>500</i4></value></member><member><name>faultString</name><value><string>Timeout while attempting to read (using select).</string></value></member></struct></value></fault></methodResponse>\n'

Notice the exception returned by the ULXR server. This works fine if the ULXR server closes the connection after the response.

I found that in the HttpProtocol::machine_switchToBody() method (at the end of the method) there looks like there is a bug. I'm guessing that HTTP 1.0 does not have a closing property so this code will misbehave with HTTP 1.0 clients. I'm basing this on the code that is in HttpProtocol::determineClosing() which bases it's decision on the version of the HTTP protocol.

-- Mark

Discussion

  • Mark Barfield

    Mark Barfield - 2008-11-06

    Patch to HttpProtocol::machine_switchToBody() setting persistence of the connection

     
  • Victor Y. Sklyar

    I agree with this bug, but I solved this another way

    ====== ulxr_http_protocol.cpp.patch ====
    287c287
    < bool do_close = false;
    ---
    > bool do_close = true;

     
  • Ewald Arnold

    Ewald Arnold - 2009-03-21

    Hello,

    have you tried something like

    prot.setPersistent(false);

    As far as I remember the original spec required to close the connection after each request. So a persistent connection is not guaranteed to work.

    greets

     

Log in to post a comment.