aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpathod/pathoc.py30
-rw-r--r--test/test_pathoc.py4
2 files changed, 6 insertions, 28 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py
index 39d3c3d6..7f7cbb87 100644
--- a/libpathod/pathoc.py
+++ b/libpathod/pathoc.py
@@ -11,7 +11,7 @@ import threading
import OpenSSL.crypto
-from netlib import tcp, http, http2, certutils, websockets, socks
+from netlib import tcp, http, http2, http_semantics, certutils, websockets, socks
import language.http
import language.websockets
@@ -66,25 +66,6 @@ class SSLInfo(object):
return "\n".join(parts)
-class Response(object):
-
- def __init__(
- self,
- httpversion,
- status_code,
- msg,
- headers,
- content,
- sslinfo
- ):
- self.httpversion, self.status_code = httpversion, status_code
- self.msg = msg
- self.headers, self.content = headers, content
- self.sslinfo = sslinfo
-
- def __repr__(self):
- return "Response(%s - %s)" % (self.status_code, self.msg)
-
class WebsocketFrameReader(threading.Thread):
@@ -429,17 +410,14 @@ class Pathoc(tcp.TCPClient):
if self.use_http2:
status_code, headers, body = self.protocol.read_response()
- resp = Response("HTTP/2", status_code, "", headers, body, self.sslinfo)
+ resp = http_semantics.Response("HTTP/2", status_code, "", headers, body, self.sslinfo)
else:
- resp = list(
- http.read_response(
+ resp = http.read_response(
self.rfile,
req["method"],
None
)
- )
- resp.append(self.sslinfo)
- resp = Response(*resp)
+ resp.sslinfo = self.sslinfo
except http.HttpError as v:
lg("Invalid server response: %s" % v)
raise
diff --git a/test/test_pathoc.py b/test/test_pathoc.py
index fb8d348a..926fcab5 100644
--- a/test/test_pathoc.py
+++ b/test/test_pathoc.py
@@ -4,13 +4,13 @@ import re
import OpenSSL
from mock import Mock
-from netlib import tcp, http, http2, socks
+from netlib import tcp, http, http2, http_semantics, socks
from libpathod import pathoc, test, version, pathod, language
import tutils
def test_response():
- r = pathoc.Response("1.1", 200, "Message", {}, None, None)
+ r = http_semantics.Response("1.1", 200, "Message", {}, None, None)
assert repr(r)