Skip to content
Permalink
Browse files

Revert "Fix DeprecationWarning on Python 3.8"

Fixes #1276.  Differences in behavior between the deprecated split
functions and urlparse() cause this to fail under some conditions.
For now, revert the changes.  A new patch will be needed to fix
the Python 3.8 warnings.  It is better to have it work with
warnings on 3.8 than to not work on many versions.

This reverts commit de5e719.
  • Loading branch information...
mnaberez committed Sep 16, 2019
1 parent 9e9a863 commit ff7f18169bcc8091055f61279d0a63997d594148
Showing with 8 additions and 7 deletions.
  1. +2 −4 supervisor/http.py
  2. +6 −3 supervisor/xmlrpc.py
@@ -12,11 +12,10 @@
except ImportError: # Windows
import getpass as pwd

from supervisor.compat import urllib
from supervisor.compat import sha1
from supervisor.compat import as_bytes
from supervisor.compat import as_string
from supervisor.compat import urlparse

from supervisor.medusa import asyncore_25 as asyncore
from supervisor.medusa import http_date
from supervisor.medusa import http_server
@@ -316,8 +315,7 @@ def get_server_url(self):

if 'HTTP_HOST' in environ:
host = environ['HTTP_HOST'].strip()
parsed = urlparse.urlparse(host)
hostname, port = parsed.hostname, str(parsed.port)
hostname, port = urllib.splitport(host)
else:
hostname = environ['SERVER_NAME'].strip()
port = environ['SERVER_PORT']
@@ -9,13 +9,13 @@

from supervisor.compat import xmlrpclib
from supervisor.compat import StringIO
from supervisor.compat import urllib
from supervisor.compat import as_bytes
from supervisor.compat import as_string
from supervisor.compat import encodestring
from supervisor.compat import decodestring
from supervisor.compat import httplib
from supervisor.compat import PY2
from supervisor.compat import urlparse

from supervisor.medusa.http_server import get_header
from supervisor.medusa.xmlrpc_handler import xmlrpc_handler
@@ -486,10 +486,13 @@ def __init__(self, username=None, password=None, serverurl=None):
self.verbose = False
self.serverurl = serverurl
if serverurl.startswith('http://'):
parsed = urlparse.urlparse(serverurl)
host, port = parsed.hostname, parsed.port
type, uri = urllib.splittype(serverurl)
host, path = urllib.splithost(uri)
host, port = urllib.splitport(host)
if port is None:
port = 80
else:
port = int(port)
def get_connection(host=host, port=port):
return httplib.HTTPConnection(host, port)
self._get_connection = get_connection

0 comments on commit ff7f181

Please sign in to comment.
You can’t perform that action at this time.