aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/wsgi.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-17 15:15:22 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-17 15:18:47 +1300
commit8360f70024330eeeb5c53d29e4a05194f872b511 (patch)
tree6bbdcfe54fcce1e41660ca07c9470f42debdec5b /netlib/wsgi.py
parent4918feb7252c76c95d85cd8b2b0334a22aaae274 (diff)
downloadmitmproxy-8360f70024330eeeb5c53d29e4a05194f872b511.tar.gz
mitmproxy-8360f70024330eeeb5c53d29e4a05194f872b511.tar.bz2
mitmproxy-8360f70024330eeeb5c53d29e4a05194f872b511.zip
First-order conversion to Python3-only
- Zap various occurrences of Python2 in docs and scripts - Remove six from netlib, and some other places where obvious project-wide search and replace works.
Diffstat (limited to 'netlib/wsgi.py')
-rw-r--r--netlib/wsgi.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/netlib/wsgi.py b/netlib/wsgi.py
index 0def75b5..17cbbf00 100644
--- a/netlib/wsgi.py
+++ b/netlib/wsgi.py
@@ -2,9 +2,8 @@ from __future__ import (absolute_import, print_function, division)
import time
import traceback
-import six
-from io import BytesIO
-from six.moves import urllib
+import urllib
+import io
from netlib import http, tcp, strutils
@@ -67,7 +66,7 @@ class WSGIAdaptor(object):
environ = {
'wsgi.version': (1, 0),
'wsgi.url_scheme': strutils.native(flow.request.scheme, "latin-1"),
- 'wsgi.input': BytesIO(flow.request.content or b""),
+ 'wsgi.input': io.BytesIO(flow.request.content or b""),
'wsgi.errors': errsoc,
'wsgi.multithread': True,
'wsgi.multiprocess': False,
@@ -139,7 +138,7 @@ class WSGIAdaptor(object):
def start_response(status, headers, exc_info=None):
if exc_info:
if state["headers_sent"]:
- six.reraise(*exc_info)
+ raise exc_info[1]
elif state["status"]:
raise AssertionError('Response already started')
state["status"] = status
@@ -148,7 +147,7 @@ class WSGIAdaptor(object):
self.error_page(soc, state["headers_sent"], traceback.format_tb(exc_info[2]))
state["headers_sent"] = True
- errs = six.BytesIO()
+ errs = io.BytesIO()
try:
dataiter = self.app(
self.make_environ(request, errs, **env), start_response