mercurial/url.py
changeset 37100 9e6d3465f17e
parent 37084 f0b6fbea00cf
child 37735 126998dcfb08
equal deleted inserted replaced
37099:6ca5f825a0ca 37100:9e6d3465f17e
    10 from __future__ import absolute_import
    10 from __future__ import absolute_import
    11 
    11 
    12 import base64
    12 import base64
    13 import os
    13 import os
    14 import socket
    14 import socket
       
    15 import sys
    15 
    16 
    16 from .i18n import _
    17 from .i18n import _
    17 from . import (
    18 from . import (
    18     encoding,
    19     encoding,
    19     error,
    20     error,
   301 
   302 
   302 class logginghttpconnection(keepalive.HTTPConnection):
   303 class logginghttpconnection(keepalive.HTTPConnection):
   303     def __init__(self, createconn, *args, **kwargs):
   304     def __init__(self, createconn, *args, **kwargs):
   304         keepalive.HTTPConnection.__init__(self, *args, **kwargs)
   305         keepalive.HTTPConnection.__init__(self, *args, **kwargs)
   305         self._create_connection = createconn
   306         self._create_connection = createconn
       
   307 
       
   308     if sys.version_info < (2, 7, 7):
       
   309         # copied from 2.7.14, since old implementations directly call
       
   310         # socket.create_connection()
       
   311         def connect(self):
       
   312             self.sock = self._create_connection((self.host, self.port),
       
   313                                                 self.timeout,
       
   314                                                 self.source_address)
       
   315             if self._tunnel_host:
       
   316                 self._tunnel()
   306 
   317 
   307 class logginghttphandler(httphandler):
   318 class logginghttphandler(httphandler):
   308     """HTTP handler that logs socket I/O."""
   319     """HTTP handler that logs socket I/O."""
   309     def __init__(self, logfh, name, observeropts):
   320     def __init__(self, logfh, name, observeropts):
   310         super(logginghttphandler, self).__init__()
   321         super(logginghttphandler, self).__init__()