summaryrefslogtreecommitdiffstats
path: root/src/HTTPParser.py
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2019-12-13 11:47:31 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commit7548870a923db820380d352f65ff2e05de2ef65d (patch)
tree1cf97dfb60f51c1510f7b0591f561f4930b9c162 /src/HTTPParser.py
parent4ad2759e55f3038cd4680d213c8b59bb135d98b4 (diff)
Port program to Python 3
Python 2.7 will be deprecated in January of 2020. So, we need to have the program with a supported api.
Diffstat (limited to 'src/HTTPParser.py')
-rw-r--r--src/HTTPParser.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/HTTPParser.py b/src/HTTPParser.py
index bbced43..7c64805 100644
--- a/src/HTTPParser.py
+++ b/src/HTTPParser.py
@@ -1,5 +1,5 @@
-from mimetools import Message
-from StringIO import StringIO
+import email
+from io import StringIO
class HTTPParser:
def __init__(self):
@@ -14,7 +14,7 @@ class HTTPParser:
def parser(self,data):
self.requestLine, self.headersAlone = data.split('\n', 1)
- self.headers = Message(StringIO(self.headersAlone))
+ self.headers = email.message_from_file(StringIO(self.headersAlone))
if 'host' in self.headers.keys():
self.host = self.headers['host']