comparison mercurial/url.py @ 48936:680322e04f56

url: remove Python 2.7 support code Differential Revision: https://phab.mercurial-scm.org/D12342
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 21 Feb 2022 12:34:22 -0700
parents f254fc73d956
children 642e31cb55f0
comparison
equal deleted inserted replaced
48935:2cce2fa5bcf7 48936:680322e04f56
8 # GNU General Public License version 2 or any later version. 8 # GNU General Public License version 2 or any later version.
9 9
10 10
11 import base64 11 import base64
12 import socket 12 import socket
13 import sys
14 13
15 from .i18n import _ 14 from .i18n import _
16 from .pycompat import getattr 15 from .pycompat import getattr
17 from . import ( 16 from . import (
18 encoding, 17 encoding,
340 339
341 class logginghttpconnection(keepalive.HTTPConnection): 340 class logginghttpconnection(keepalive.HTTPConnection):
342 def __init__(self, createconn, *args, **kwargs): 341 def __init__(self, createconn, *args, **kwargs):
343 keepalive.HTTPConnection.__init__(self, *args, **kwargs) 342 keepalive.HTTPConnection.__init__(self, *args, **kwargs)
344 self._create_connection = createconn 343 self._create_connection = createconn
345
346 if sys.version_info < (2, 7, 7):
347 # copied from 2.7.14, since old implementations directly call
348 # socket.create_connection()
349 def connect(self):
350 self.sock = self._create_connection(
351 (self.host, self.port), self.timeout, self.source_address
352 )
353 if self._tunnel_host:
354 self._tunnel()
355 344
356 345
357 class logginghttphandler(httphandler): 346 class logginghttphandler(httphandler):
358 """HTTP handler that logs socket I/O.""" 347 """HTTP handler that logs socket I/O."""
359 348