minor fixes

This commit is contained in:
Maximilian Hils 2016-07-01 17:49:18 -07:00
parent fa72462798
commit 2c09e0416b
4 changed files with 8 additions and 8 deletions

View File

@ -255,7 +255,7 @@ class Frame(object):
def __repr__(self): def __repr__(self):
ret = repr(self.header) ret = repr(self.header)
if self.payload: 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 return ret
def human_readable(self): def human_readable(self):

View File

@ -273,7 +273,7 @@ class Request(_HTTP2Message):
req = http.Request( req = http.Request(
b'', b'',
self.method.string(), self.method.string(),
b'', b'http',
b'', b'',
b'', b'',
path, path,

View File

@ -62,7 +62,7 @@ class LogCtx(object):
for line in strutils.hexdump(data): for line in strutils.hexdump(data):
self("\t%s %s %s" % line) self("\t%s %s %s" % line)
else: else:
for i in strutils.clean_bin(data).split(b"\n"): for i in strutils.clean_bin(data).split("\n"):
self("\t%s" % i) self("\t%s" % i)
def __call__(self, line): def __call__(self, line):

View File

@ -16,11 +16,11 @@ def test_native():
def test_clean_bin(): def test_clean_bin():
assert strutils.clean_bin(b"one") == b"one" assert strutils.clean_bin(b"one") == u"one"
assert strutils.clean_bin(b"\00ne") == b".ne" assert strutils.clean_bin(b"\00ne") == u".ne"
assert strutils.clean_bin(b"\nne") == b"\nne" assert strutils.clean_bin(b"\nne") == u"\nne"
assert strutils.clean_bin(b"\nne", False) == b".ne" assert strutils.clean_bin(b"\nne", False) == u".ne"
assert strutils.clean_bin(u"\u2605".encode("utf8")) == b"..." assert strutils.clean_bin(u"\u2605".encode("utf8")) == u"..."
assert strutils.clean_bin(u"one") == u"one" assert strutils.clean_bin(u"one") == u"one"
assert strutils.clean_bin(u"\00ne") == u".ne" assert strutils.clean_bin(u"\00ne") == u".ne"