Remove six.PY2 and platform checks and add warning

After a discussion with Joshua Lock, we agreed that for
Windows users it would be good to provide the option to use
SimpleHTTPRequestHandler, but still leave a warning about it,
knowing that this caused an error before.
See: 7dbb30ae10

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
This commit is contained in:
Martin Vrachev 2020-05-07 17:58:37 +03:00
parent b42ca297e5
commit c7f878b2dc

View file

@ -66,20 +66,19 @@ def log_request(self, code='-', size='-'):
# NOTE: On Windows/Python2 tests that use this simple_server.py in a
# subprocesses hang after a certain amount of requests (~68), if a PIPE is
# passed as Popen's stderr argument. As a simple workaround we silence the
# server on those Windows/Py2 to not fill the buffer.
if six.PY2 and platform.system() == 'Windows':
# passed as Popen's stderr argument. This problem doesn't emerge if
# we silence the HTTP messages.
# If you decide to receive the HTTP messages, then this bug
# could reappear.
use_quiet_http_request_handler = True
if len(sys.argv) > 2:
use_quiet_http_request_handler = sys.argv[2]
if use_quiet_http_request_handler:
handler = QuietHTTPRequestHandler
else:
use_quiet_http_request_handler = True
if len(sys.argv) > 2:
use_quiet_http_request_handler = sys.argv[2]
if use_quiet_http_request_handler:
handler = QuietHTTPRequestHandler
else:
handler = SimpleHTTPRequestHandler
handler = SimpleHTTPRequestHandler
httpd = six.moves.socketserver.TCPServer(('', PORT), handler)