Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py3k - error in xmlrpc API if non-ascii-bytes are transmitted #664

Closed
palmkevin opened this issue Oct 6, 2015 · 2 comments · Fixed by #1029
Closed

Py3k - error in xmlrpc API if non-ascii-bytes are transmitted #664

palmkevin opened this issue Oct 6, 2015 · 2 comments · Fixed by #1029

Comments

@palmkevin
Copy link

The XMLRPC interface seems not being able to transmit non-ascii bytes.
If I have for example a process_name like this "test_öäü", then everything is working (the process is started by the supervisor) but the XMLRPC-method getAllProcessInfo is not usable any more because an exception is raise:xml.parsers.expat.ExpatError: unclosed token: line 67, column 0

It seems, that XMLRPC-XML-response has been cut at the end.
When making an xmlrpc-call in verbose-mode, then I can see this:

send: b"POST /RPC2 HTTP/1.1\r\nHost: lsdev01:9101\r\nAuthorization: Basic c3VwZXJ2aXNvcnVzZXI6JDNjdXIzJHVwM3J2aSRvcg==\r\nAccept-Encoding: gzip\r\nContent-Type: text/xml\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Length: 175\r\n\r\n<?xml version='1.0'?>\n<methodCall>\n<methodName>supervisor.getAllProcessInfo</methodName>\n<params>\n<param>\n<value><boolean>1</boolean></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Date header: Content-Length header: Content-Type header: Server body: b"<?xml version='1.0'?>\n<methodResponse>\n<params>\n<param>\n<value><array><data>\n<value><struct>\n<member>\n<name>description</name>\n<value><string></string></value>\n</member>\n<member>\n<name>pid</name>\n<value><int>20134</int></value>\n</member>\n<member>\n<name>stderr_logfile</name>\n<value><string></string></value>\n</member>\n<member>\n<name>stop</name>\n<value><int>0</int></value>\n</member>\n<member>\n<name>logfile</name>\n<value><string>/opt/ls/lx/log/test.out</string></value>\n</member>\n<member>\n<name>exitstatus</name>\n<value><int>0</int></value>\n</member>\n<member>\n<name>spawnerr</name>\n<value><string></string></value>\n</member>\n<member>\n<name>now</name>\n<value><int>1444120850</int></value>\n</member>\n<member>\n<name>group</name>\n<value><string>test</string></value>\n</member>\n<member>\n<name>name</name>\n<value><string>test_\xc3\xb6\xc3\xa4\xc3\xbc</string></value>\n</member>\n<member>\n<name>statename</name>\n<value><string>STARTING</string></value>\n</member>\n<member>\n<name>start</name>\n<value><int>1444120850</int></value>\n</member>\n<member>\n<nam"
body: b'e>state</name>\n<value><int>10</int></value>\n</member>\n<member>\n<name>stdout_logfile</name>\n<value><string>/opt/ls/lx/log/test.out</string></value>\n</member>\n</struct></value>\n</data></array></value>\n</param>\n</params>\n</methodRespons'

Here we can see clearly that the last three bytes are omitted. ('e>\n')

I don't know if the same problem van be observed for python 2...

@ztane
Copy link

ztane commented Jun 5, 2016

no, the body continues on the second line...?

@mnaberez mnaberez added the xmlrpc label Oct 9, 2016
@evanunderscore
Copy link

The body continues on the second line, but ends with <methodRespons and is missing the remaining e>\n, which is 3 bytes.

>>> len("test_öäü")
8
>>> len("test_öäü".encode())
11

Something must be allocating the message using the length of the string where it should be using the length of the encoded bytestring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants