aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod
diff options
context:
space:
mode:
Diffstat (limited to 'libpathod')
-rw-r--r--libpathod/language/http2.py19
-rw-r--r--libpathod/pathoc.py7
-rw-r--r--libpathod/pathod.py7
3 files changed, 18 insertions, 15 deletions
diff --git a/libpathod/language/http2.py b/libpathod/language/http2.py
index c28b904e..dec2d5fe 100644
--- a/libpathod/language/http2.py
+++ b/libpathod/language/http2.py
@@ -35,8 +35,15 @@ class Path(base.Value):
class Header(base.KeyValue):
+ unique_name = None
preamble = "h"
+ def values(self, settings):
+ return (
+ self.key.get_generator(settings),
+ self.value.get_generator(settings),
+ )
+
class Body(base.Value):
preamble = "b"
@@ -45,9 +52,11 @@ class Body(base.Value):
class Times(base.Integer):
preamble = "x"
+
class Code(base.Integer):
pass
+
class Request(message.Message):
comps = (
Header,
@@ -57,7 +66,7 @@ class Request(message.Message):
logattrs = ["method", "path"]
def __init__(self, tokens):
- super(Response, self).__init__(tokens)
+ super(Request, self).__init__(tokens)
self.rendered_values = None
@property
@@ -106,9 +115,7 @@ class Request(message.Message):
if self.rendered_values:
return self.rendered_values
else:
- headers = self.headers
- if headers:
- headers = headers.values(settings)
+ headers = [header.values(settings) for header in self.headers]
body = self.body
if body:
@@ -173,9 +180,7 @@ class Response(message.Message):
if self.rendered_values:
return self.rendered_values
else:
- headers = self.headers
- if headers:
- headers = headers.values(settings)
+ headers = [header.values(settings) for header in self.headers]
body = self.body
if body:
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py
index 9c021360..c42cc82a 100644
--- a/libpathod/pathoc.py
+++ b/libpathod/pathoc.py
@@ -30,13 +30,8 @@ class SSLInfo:
self.certchain, self.cipher, self.alp = certchain, cipher, alp
def __str__(self):
- if self.alp:
- alp = self.alp
- else:
- alp = '<no protocol negotiated>'
-
parts = [
- "Application Layer Protocol: %s" % alp,
+ "Application Layer Protocol: %s" % self.alp,
"Cipher: %s, %s bit, %s" % self.cipher,
"SSL certificate chain:"
]
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index b6f04b92..212abbdc 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -234,6 +234,7 @@ class PathodHandler(tcp.BaseHandler):
method = headers[':method']
path = headers[':path']
headers = odict.ODict(headers)
+ httpversion = ""
else:
req = self.read_http_request(lg)
if 'next_handle' in req:
@@ -246,6 +247,7 @@ class PathodHandler(tcp.BaseHandler):
path = req['path']
headers = req['headers']
body = req['body']
+ httpversion = req['httpversion']
clientcert = None
if self.clientcert:
@@ -265,7 +267,7 @@ class PathodHandler(tcp.BaseHandler):
path=path,
method=method,
headers=headers.lst,
- # httpversion=httpversion,
+ httpversion=httpversion,
sni=self.sni,
remote_address=self.address(),
clientcert=clientcert,
@@ -375,7 +377,8 @@ class PathodHandler(tcp.BaseHandler):
method=method,
path=path,
headers=headers,
- body=body)
+ body=body,
+ httpversion=httpversion)
def make_http_error_response(self, reason, body=None):
"""