Module: check_mk
Branch: master
Commit: 89939a84fcaf46bc582ad9a8271641b47823e421
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=89939a84fcaf46…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 28 15:56:00 2017 +0100
4418 FIX check_form_submit: Use Content-Type sent by server to decode the content
Change-Id: I5e95a006bea3f29bd6760e38cf3be2acf51eed8d
---
.werks/4418 | 11 +++++++++++
active_checks/check_form_submit | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/.werks/4418 b/.werks/4418
new file mode 100644
index 0000000..ad8dd34
--- /dev/null
+++ b/.werks/4418
@@ -0,0 +1,11 @@
+Title: check_form_submit: Use Content-Type sent by server to decode the content
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1488293718
+
+
diff --git a/active_checks/check_form_submit b/active_checks/check_form_submit
index ced4049..5ccf732 100755
--- a/active_checks/check_form_submit
+++ b/active_checks/check_form_submit
@@ -208,6 +208,10 @@ def open_url(url, method = 'GET', data = None):
code = fd.getcode()
content = fd.read()
+ encoding = fd.headers.getparam('charset')
+ if encoding:
+ content = content.decode(encoding)
+
debug('CODE: %s RESPONSE:' % code)
debug('\n'.join([ ' %02d %s' % (index + 1, line) for index, line
in enumerate(content.split('\n')) ]))
return code, real_url, content