avocado.utils.vmimage: add support for web page encoding
The HTMLParser class on Python 3 expects to receive text, and urlopen
returns bytes. To convert bytes into text, an encoding is needed.
Most providers utf-8 encoding on the responses, but Fedora's servers
use ISO-8859-1:
HTTP/1.1 200 OK
Date: Wed, 19 Sep 2018 00:46:43 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips
...
Content-Type: text/html;charset=ISO-8859-1
...
We could get away with utf-8, but let's be thorough here. This fixes
a "must be str, not bytes" error on Python 3.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
Showing
想要评论请 注册 或 登录