mirror of https://github.com/python/cpython.git
Little cleanup
This commit is contained in:
parent
fad65594ba
commit
b678ce5aa6
|
@ -36,13 +36,13 @@
|
||||||
import httplib # only for the default HTTP port
|
import httplib # only for the default HTTP port
|
||||||
from calendar import timegm
|
from calendar import timegm
|
||||||
|
|
||||||
debug = 0 # set to true to enable debugging via the logging module
|
debug = False # set to True to enable debugging via the logging module
|
||||||
logger = None
|
logger = None
|
||||||
|
|
||||||
def _debug(*args):
|
def _debug(*args):
|
||||||
global logger
|
|
||||||
if not debug:
|
if not debug:
|
||||||
return
|
return
|
||||||
|
global logger
|
||||||
if not logger:
|
if not logger:
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger("cookielib")
|
logger = logging.getLogger("cookielib")
|
||||||
|
|
|
@ -165,7 +165,7 @@ class GopherError(URLError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# copied from cookielib.py
|
# copied from cookielib.py
|
||||||
cut_port_re = re.compile(r":\d+$")
|
_cut_port_re = re.compile(r":\d+$")
|
||||||
def request_host(request):
|
def request_host(request):
|
||||||
"""Return request-host, as defined by RFC 2965.
|
"""Return request-host, as defined by RFC 2965.
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ def request_host(request):
|
||||||
host = request.get_header("Host", "")
|
host = request.get_header("Host", "")
|
||||||
|
|
||||||
# remove port, if present
|
# remove port, if present
|
||||||
host = cut_port_re.sub("", host, 1)
|
host = _cut_port_re.sub("", host, 1)
|
||||||
return host.lower()
|
return host.lower()
|
||||||
|
|
||||||
class Request:
|
class Request:
|
||||||
|
|
Loading…
Reference in New Issue