From f9b63e973e519f1fd4558ea60ad988815e676574 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 18 Aug 2021 16:12:39 +0200 Subject: [PATCH] Remove asyncio event loop workaround for tornado (#4762) * remove asyncio event loop workaround for tornado * Update CHANGELOG.md --- CHANGELOG.md | 2 ++ mitmproxy/__init__.py | 9 --------- test/mitmproxy/tools/web/test_app.py | 8 -------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f9ff6dd..acf76819b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## Unreleased: mitmproxy next * fix some responses not being decoded properly if the encoding was uppercase #4735 (@Mattwmaster58) +* Windows: Switch to Python's default asyncio event loop, which increases the number of sockets + that can be processed simultaneously. ## 4 August 2021: mitmproxy 7.0.2 diff --git a/mitmproxy/__init__.py b/mitmproxy/__init__.py index 9deef9605..e69de29bb 100644 --- a/mitmproxy/__init__.py +++ b/mitmproxy/__init__.py @@ -1,9 +0,0 @@ -import asyncio -import sys - -if sys.platform == 'win32': - # workaround for - # https://github.com/tornadoweb/tornado/issues/2751 - # https://www.tornadoweb.org/en/stable/index.html#installation - # (copied multiple times in the codebase, please remove all occurrences) - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py index 79456e600..4272b202b 100644 --- a/test/mitmproxy/tools/web/test_app.py +++ b/test/mitmproxy/tools/web/test_app.py @@ -2,18 +2,10 @@ import asyncio import json as _json import logging import os -import sys from unittest import mock import pytest -if sys.platform == 'win32': - # workaround for - # https://github.com/tornadoweb/tornado/issues/2751 - # https://www.tornadoweb.org/en/stable/index.html#installation - # (copied multiple times in the codebase, please remove all occurrences) - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) - import tornado.testing # noqa from tornado import httpclient # noqa from tornado import websocket # noqa