From 2c09e0416bcf94d9ebef7c11bb1883388e8e2c5d Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 1 Jul 2016 17:49:18 -0700 Subject: [PATCH] minor fixes --- netlib/websockets/frame.py | 2 +- pathod/language/http2.py | 2 +- pathod/log.py | 2 +- test/netlib/test_strutils.py | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/netlib/websockets/frame.py b/netlib/websockets/frame.py index 42196ffb9..671e1605e 100644 --- a/netlib/websockets/frame.py +++ b/netlib/websockets/frame.py @@ -255,7 +255,7 @@ class Frame(object): def __repr__(self): ret = repr(self.header) if self.payload: - ret = ret + "\nPayload:\n" + strutils.clean_bin(self.payload).decode("ascii") + ret = ret + "\nPayload:\n" + strutils.clean_bin(self.payload) return ret def human_readable(self): diff --git a/pathod/language/http2.py b/pathod/language/http2.py index 2693446e5..c0313baa3 100644 --- a/pathod/language/http2.py +++ b/pathod/language/http2.py @@ -273,7 +273,7 @@ class Request(_HTTP2Message): req = http.Request( b'', self.method.string(), - b'', + b'http', b'', b'', path, diff --git a/pathod/log.py b/pathod/log.py index 23e9a2ce5..1d3ec3565 100644 --- a/pathod/log.py +++ b/pathod/log.py @@ -62,7 +62,7 @@ class LogCtx(object): for line in strutils.hexdump(data): self("\t%s %s %s" % line) else: - for i in strutils.clean_bin(data).split(b"\n"): + for i in strutils.clean_bin(data).split("\n"): self("\t%s" % i) def __call__(self, line): diff --git a/test/netlib/test_strutils.py b/test/netlib/test_strutils.py index a50fc40a3..16e5d0b3e 100644 --- a/test/netlib/test_strutils.py +++ b/test/netlib/test_strutils.py @@ -16,11 +16,11 @@ def test_native(): def test_clean_bin(): - assert strutils.clean_bin(b"one") == b"one" - assert strutils.clean_bin(b"\00ne") == b".ne" - assert strutils.clean_bin(b"\nne") == b"\nne" - assert strutils.clean_bin(b"\nne", False) == b".ne" - assert strutils.clean_bin(u"\u2605".encode("utf8")) == b"..." + assert strutils.clean_bin(b"one") == u"one" + assert strutils.clean_bin(b"\00ne") == u".ne" + assert strutils.clean_bin(b"\nne") == u"\nne" + assert strutils.clean_bin(b"\nne", False) == u".ne" + assert strutils.clean_bin(u"\u2605".encode("utf8")) == u"..." assert strutils.clean_bin(u"one") == u"one" assert strutils.clean_bin(u"\00ne") == u".ne"