GitHub user uty opened a pull request:

    https://github.com/apache/libcloud/pull/1069

    Fix "Failed to parse XML" error when XML contains wrong encoding declaration

    ## Fix "Failed to parse XML" error when XML contains wrong encoding 
declaration
    
    ### Description
    
    `lxml` fails to parse XML unicode string if latter contains encoding 
declaration. It raises `ValueError: Unicode strings with encoding declaration 
are not supported. Please use bytes input or XML fragments without 
declaration.` which was completely obstructed by reraise of 
`MalformedResponseError`.
    
    This was already partially fixed in 
`libcloud.common.base.XmlResponse.parse_body()`, however some subclasses had 
this method overwritten, or were not using it.
    
    ### Status
    
    - done, ready for review
    
    ### Checklist (tick everything that applies)
    
    - [x] [Code 
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
 (required, can be done after the PR checks)
    - [ ] Documentation
    - [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
    - [ ] 
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
 (required for bigger changes)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Scalr/libcloud for-upstream/lying_xml_encoding

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/1069.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1069
    
----
commit 4ff64a2755f35da41c509eff994b78b363de493f
Author: Hennadii Stas <[email protected]>
Date:   2017-06-07T13:26:32Z

    FAM-903 encode xml responses on ec2 and openstack before passing them to 
xml parser

commit 28d1eb0938c5005025056588dd304b34ae8b515a
Author: Hennadii Stas <[email protected]>
Date:   2017-06-09T12:37:36Z

    unint tests added

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to