xmlrpc server returning not well formed xml in some cases
Bug #143133 reported by
Maciej Pietrzak
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Invalid
|
Low
|
Unassigned |
Bug Description
xmlrpc response contains exception information, which is included as is.
if exception has "strange" characters (not utf-8 characters) resulting xml is not well formed xml.
xmlrpc server implementation should always return valid xml. if there's an error on server side, an Fault object should be returned. suppose there is an error (offending exception), there's an another error - bad encoding in exceptions's description (this one is light), response should be a valid xml anyway.
proposed solution: test strings against .decode('utf-8') and include repr() it this throws exception unicode exception. this (i guess) should be faster than trying to parse xml after is is constructed.
thanks.
Changed in zope2: | |
status: | New → Incomplete |
To post a comment you must log in.
Uploaded: xmlrpc-fault.patch
Example patch.
In case that fault description is not valid utf-8 string it replaces all chars that are > 127 to question marks.
This can be done with re or doing "value = repr(value)" - I don't know which is faster. Patched code just iterates over the string chars.
Patch against current svn revision: 27314.
HTH.