diff options
| author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 17:53:17 +1200 |
|---|---|---|
| committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 17:53:17 +1200 |
| commit | 763e1ff7862e8784170e7c23a015eceaa19e2f70 (patch) | |
| tree | 622697715d8e0ef0f1d150d7673170bbb322a6b1 /libpathod | |
| parent | 1d1098687cd397966cf810b52cbf9fe1bc8b1ec4 (diff) | |
| download | mitmproxy-763e1ff7862e8784170e7c23a015eceaa19e2f70.tar.gz mitmproxy-763e1ff7862e8784170e7c23a015eceaa19e2f70.tar.bz2 mitmproxy-763e1ff7862e8784170e7c23a015eceaa19e2f70.zip | |
pathod.py unit tests++
Diffstat (limited to 'libpathod')
| -rw-r--r-- | libpathod/pathod.py | 2 | ||||
| -rw-r--r-- | libpathod/rparse.py | 12 |
2 files changed, 4 insertions, 10 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py index f6b5e0f9..12719d13 100644 --- a/libpathod/pathod.py +++ b/libpathod/pathod.py @@ -129,7 +129,7 @@ class PathodHandler(tcp.BaseHandler): try: if not self.handle_request(): return - except tcp.NetLibDisconnect: + except tcp.NetLibDisconnect: # pragma: no cover self.info("Disconnect") self.server.add_log( dict( diff --git a/libpathod/rparse.py b/libpathod/rparse.py index bdce0dd7..e4b62822 100644 --- a/libpathod/rparse.py +++ b/libpathod/rparse.py @@ -22,8 +22,6 @@ class ParseException(Exception): return "%s at offset %s of %s"%(self.msg, self.col, repr(self.s)) -class ServerError(Exception): pass - def actions_log(lst): ret = [] @@ -250,15 +248,15 @@ class ValueFile: uf = settings.get("unconstrained_file_access") sd = settings.get("staticdir") if not sd: - raise ServerError("File access disabled.") + raise FileAccessDenied("File access disabled.") sd = os.path.normpath(os.path.abspath(sd)) s = os.path.expanduser(self.path) s = os.path.normpath(os.path.abspath(os.path.join(sd, s))) if not uf and not s.startswith(sd): - raise ServerError("File access outside of configured directory") + raise FileAccessDenied("File access outside of configured directory") if not os.path.isfile(s): - raise ServerError("File not readable") + raise FileAccessDenied("File not readable") return FileGenerator(s) def __str__(self): @@ -707,10 +705,6 @@ class PathodErrorResponse(Response): LiteralGenerator("Content-Type"), LiteralGenerator("text/plain") ), - ( - LiteralGenerator("Content-Length"), - LiteralGenerator(str(len(self.body))) - ) ] def serve(self, fp, check=None): |
