diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index 1bc340cd0..0483a328b 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -65,8 +65,10 @@ class Pathoc(tcp.TCPClient): return except tcp.NetLibTimeout: print >> fp, "<<", "Timeout" - except tcp.NetLibDisconnect: + return + except tcp.NetLibDisconnect: # pragma: nocover print >> fp, "<<", "Disconnect" + return else: if respdump: print_full(fp, *resp) diff --git a/libpathod/pathod.py b/libpathod/pathod.py index e4889cac7..78ce3b950 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -9,9 +9,6 @@ class PathodError(Exception): pass class PathodHandler(tcp.BaseHandler): wbufsize = 0 sni = None - def debug(self, s): - logging.debug("%s:%s: %s"%(self.client_address[0], self.client_address[1], str(s))) - def info(self, s): logging.info("%s:%s: %s"%(self.client_address[0], self.client_address[1], str(s))) diff --git a/test/test_pathoc.py b/test/test_pathoc.py index 3cd076493..397a7f0eb 100644 --- a/test/test_pathoc.py +++ b/test/test_pathoc.py @@ -57,3 +57,4 @@ class TestDaemon: d = tutils.test_data.path("data/request") assert "foo" in self.tval(["+%s"%d]) assert "File" in self.tval(["+/nonexistent"]) + diff --git a/test/test_pathod.py b/test/test_pathod.py index d6e2e886c..8bc896d32 100644 --- a/test/test_pathod.py +++ b/test/test_pathod.py @@ -107,6 +107,12 @@ class CommonTests(tutils.DaemonTests): assert l["type"] == "error" assert "Invalid" in l["msg"] + def test_invalid_headers(self): + tutils.raises(http.HttpError, self.pathoc, "get:/:h'\t'='foo'") + l = self.d.log()[0] + assert l["type"] == "error" + assert "Invalid headers" in l["msg"] + def test_access_denied(self): rsp = self.get("=nonexistent") assert rsp.status_code == 800