aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpathod/pathoc.py4
-rwxr-xr-xpathoc9
-rw-r--r--test/test_pathoc.py3
3 files changed, 12 insertions, 4 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py
index 90f3b98b..7551c589 100644
--- a/libpathod/pathoc.py
+++ b/libpathod/pathoc.py
@@ -38,7 +38,7 @@ class Pathoc(tcp.TCPClient):
print >> fp, "%s (unprintables escaped):"%header
print >> fp, netlib.utils.cleanBin(data)
- def print_request(self, spec, showreq, showresp, explain, hexdump, ignorecodes, fp=sys.stdout):
+ def print_request(self, spec, showreq, showresp, explain, hexdump, ignorecodes, ignoretimeout, fp=sys.stdout):
"""
Performs a series of requests, and prints results to the specified
file descriptor.
@@ -74,6 +74,8 @@ class Pathoc(tcp.TCPClient):
except http.HttpError, v:
print >> fp, "<< HTTP Error:", v.msg
except tcp.NetLibTimeout:
+ if ignoretimeout:
+ return
print >> fp, "<<", "Timeout"
except tcp.NetLibDisconnect: # pragma: nocover
print >> fp, "<<", "Disconnect"
diff --git a/pathoc b/pathoc
index a2749a59..5932d4a4 100755
--- a/pathoc
+++ b/pathoc
@@ -35,7 +35,7 @@ if __name__ == "__main__":
)
group = parser.add_argument_group('Controlling Output')
group.add_argument(
- "-c", dest="ignorecodes", type=str, default="",
+ "-C", dest="ignorecodes", type=str, default="",
help="Comma-separated list of response codes to ignore"
)
group.add_argument(
@@ -55,6 +55,10 @@ if __name__ == "__main__":
help="Print full response"
)
group.add_argument(
+ "-T", dest="ignoretimeout", action="store_true", default=False,
+ help="Ignore timeouts"
+ )
+ group.add_argument(
"-x", dest="hexdump", action="store_true", default=False,
help="Output in hexdump format"
)
@@ -94,7 +98,8 @@ if __name__ == "__main__":
showresp=args.showresp,
explain=args.explain,
hexdump=args.hexdump,
- ignorecodes=codes
+ ignorecodes=codes,
+ ignoretimeout=args.ignoretimeout
)
sys.stdout.flush()
if ret and args.oneshot:
diff --git a/test/test_pathoc.py b/test/test_pathoc.py
index e9690dd5..1c64f076 100644
--- a/test/test_pathoc.py
+++ b/test/test_pathoc.py
@@ -24,7 +24,7 @@ class TestDaemon:
_, _, _, _, content = c.request("get:/api/info")
assert tuple(json.loads(content)["version"]) == version.IVERSION
- def tval(self, requests, showreq=False, showresp=False, explain=False, hexdump=False, timeout=None, ignorecodes=None):
+ def tval(self, requests, showreq=False, showresp=False, explain=False, hexdump=False, timeout=None, ignorecodes=None, ignoretimeout=None):
c = pathoc.Pathoc("127.0.0.1", self.d.port)
c.connect()
if timeout:
@@ -38,6 +38,7 @@ class TestDaemon:
explain = explain,
hexdump = hexdump,
ignorecodes = ignorecodes,
+ ignoretimeout = ignoretimeout,
fp = s
)
return s.getvalue()