diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 15:11:40 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-07-23 15:11:40 +1200 |
commit | 5283bb250788326ad1722b703148800a66a36adf (patch) | |
tree | 8f295eb98f69df0b96149347321448ff94c1ca16 /libpathod/rparse.py | |
parent | 1c45f5b05c7e066c28dfd4c9d1cde3b794f8983c (diff) | |
download | mitmproxy-5283bb250788326ad1722b703148800a66a36adf.tar.gz mitmproxy-5283bb250788326ad1722b703148800a66a36adf.tar.bz2 mitmproxy-5283bb250788326ad1722b703148800a66a36adf.zip |
Refactor rparse.InternalResponse -> rparse.PathodErrorResponse
Diffstat (limited to 'libpathod/rparse.py')
-rw-r--r-- | libpathod/rparse.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libpathod/rparse.py b/libpathod/rparse.py index 7836ea51..b09010b5 100644 --- a/libpathod/rparse.py +++ b/libpathod/rparse.py @@ -570,10 +570,7 @@ class Message: if check: ret = check(self, actions) if ret: - err = InternalResponse( - 800, - ret - ) + err = PathodErrorResponse(ret) err.serve(fp) return dict( disconnect = True, @@ -706,12 +703,12 @@ class CraftedResponse(Response): return d -class InternalResponse(Response): - def __init__(self, code, body): +class PathodErrorResponse(Response): + def __init__(self, msg, body=None): Response.__init__(self) - self.code = code - self.msg = LiteralGenerator(http_status.RESPONSES.get(code, "Unknown error")) - self.body = LiteralGenerator(body) + self.code = 800 + self.msg = LiteralGenerator(msg) + self.body = LiteralGenerator(body or msg) self.headers = [ ( LiteralGenerator("Content-Type"), |