diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2019-04-06 00:42:59 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2019-04-06 01:53:27 +0200 |
commit | fef17a8d569a1fc18c54240f6e1b6135f70f2550 (patch) | |
tree | 0d5601f4722f4ea70f91efce2448fe4251437d9a /app-admin/rsyslog/files | |
parent | gui-apps/mako: initial add of gui-apps/mako (diff) | |
download | gentoo-fef17a8d569a1fc18c54240f6e1b6135f70f2550.tar.gz gentoo-fef17a8d569a1fc18c54240f6e1b6135f70f2550.tar.bz2 gentoo-fef17a8d569a1fc18c54240f6e1b6135f70f2550.zip |
app-admin/rsyslog: fix tests with Py3
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'app-admin/rsyslog/files')
-rw-r--r-- | app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch.patch | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch.patch b/app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch.patch new file mode 100644 index 000000000000..6600c61666e9 --- /dev/null +++ b/app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch.patch @@ -0,0 +1,83 @@ +From c82b747eaf96cc77efa530ca5844ba01b91bfc88 Mon Sep 17 00:00:00 2001 +From: Thomas Deutschmann <whissi@whissi.de> +Date: Sat, 6 Apr 2019 00:28:54 +0200 +Subject: [PATCH] tests: omhttp: add Python 3 compatibility + +Fixes: https://github.com/rsyslog/rsyslog/issues/3599 +--- + tests/omhttp_server.py | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/tests/omhttp_server.py b/tests/omhttp_server.py +index 6962138fa..d3fdb3a9a 100644 +--- a/tests/omhttp_server.py ++++ b/tests/omhttp_server.py +@@ -36,16 +36,16 @@ def validate_auth(self): + if 'Authorization' not in self.headers: + self.send_response(401) + self.end_headers() +- self.wfile.write('missing "Authorization" header') ++ self.wfile.write(b'missing "Authorization" header') + return False + + auth_header = self.headers['Authorization'] + _, b64userpwd = auth_header.split() +- userpwd = base64.b64decode(b64userpwd) ++ userpwd = base64.b64decode(b64userpwd).decode('utf-8') + if userpwd != metadata['userpwd']: + self.send_response(401) + self.end_headers() +- self.wfile.write('invalid auth: {0}'.format(userpwd)) ++ self.wfile.write(b'invalid auth: {0}'.format(userpwd)) + return False + + return True +@@ -60,16 +60,16 @@ def do_POST(self): + if metadata['fail_with_400_after'] != -1 and metadata['posts'] > metadata['fail_with_400_after']: + self.send_response(400) + self.end_headers() +- self.wfile.write('BAD REQUEST') ++ self.wfile.write(b'BAD REQUEST') + return + + if metadata['posts'] > 1 and metadata['fail_every'] != -1 and metadata['posts'] % metadata['fail_every'] == 0: + self.send_response(500) + self.end_headers() +- self.wfile.write('INTERNAL ERROR') ++ self.wfile.write(b'INTERNAL ERROR') + return + +- content_length = int(self.headers['Content-Length']) ++ content_length = int(self.headers['Content-Length'] or 0) + raw_data = self.rfile.read(content_length) + + if metadata['decompress']: +@@ -79,12 +79,12 @@ def do_POST(self): + + if self.path not in data: + data[self.path] = [] +- data[self.path].append(post_data) ++ data[self.path].append(post_data.decode('utf-8')) + +- res = json.dumps({'msg': 'ok'}) ++ res = json.dumps({'msg': 'ok'}).encode('utf8') + + self.send_response(200) +- self.send_header('Content-Type', 'application/json') ++ self.send_header('Content-Type', 'application/json; charset=utf-8') + self.send_header('Content-Length', len(res)) + self.end_headers() + +@@ -97,10 +97,10 @@ def do_GET(self): + else: + result = [] + +- res = json.dumps(result) ++ res = json.dumps(result).encode('utf8') + + self.send_response(200) +- self.send_header('Content-Type', 'application/json') ++ self.send_header('Content-Type', 'application/json; charset=utf-8') + self.send_header('Content-Length', len(res)) + self.end_headers() + |