aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/language/http2.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-16 11:33:10 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2015-06-16 11:33:10 +0200
commitec68aa303e89398ba34bbe01f3fbd1ac1fc441f3 (patch)
tree9d6d762bdd34867aa1b1e308d68e55fdced98658 /libpathod/language/http2.py
parenta0d8afd0fcc3c678da0dc956c5a80d4e07d5ac3e (diff)
downloadmitmproxy-ec68aa303e89398ba34bbe01f3fbd1ac1fc441f3.tar.gz
mitmproxy-ec68aa303e89398ba34bbe01f3fbd1ac1fc441f3.tar.bz2
mitmproxy-ec68aa303e89398ba34bbe01f3fbd1ac1fc441f3.zip
http2: implement error response
Diffstat (limited to 'libpathod/language/http2.py')
-rw-r--r--libpathod/language/http2.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/libpathod/language/http2.py b/libpathod/language/http2.py
index 1d2517d3..c28b904e 100644
--- a/libpathod/language/http2.py
+++ b/libpathod/language/http2.py
@@ -179,7 +179,7 @@ class Response(message.Message):
body = self.body
if body:
- body = body.values(settings)
+ body = body.string()
self.rendered_values = settings.protocol.create_response(
self.code.string(),
@@ -192,17 +192,11 @@ class Response(message.Message):
return ":".join([i.spec() for i in self.tokens])
def make_error_response(reason, body=None):
- raise NotImplementedError
- # tokens = [
- # Code("800"),
- # Header(
- # base.TokValueLiteral("Content-Type"),
- # base.TokValueLiteral("text/plain")
- # ),
- # Reason(base.TokValueLiteral(reason)),
- # Body(base.TokValueLiteral("pathod error: " + (body or reason))),
- # ]
- # return Response(tokens)
+ tokens = [
+ Code("800"),
+ Body(base.TokValueLiteral("pathod error: " + (body or reason))),
+ ]
+ return Response(tokens)
# class Frame(message.Message):
# pass