VY2@s_ddlmZddlZddlZddlZddlZddlZddlmZm Z ddl Z ddl m Z ddlmZddlmZyddlZejZWn4eefk rdZGdd d eZYnXy eZWn(ek r"Gd d d eZYnXdd lmZmZmZmZdd l m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ej-e.Z/ddddiZ0ej1dddZ2Gddde3Z4Gdddee3ZGdddeZ5Gddde5Z6ddZ7erUe5Z8e6Z5ne4Z5dS) )absolute_importN)errortimeout)six)HTTPConnection) HTTPExceptionc@seZdZdS) BaseSSLErrorN)__name__ __module__ __qualname__r r H/tmp/pip-build-04bmskau/requests/requests/packages/urllib3/connection.pyr s r c@seZdZdS)ConnectionErrorN)r r r r r r rrs r)NewConnectionErrorConnectTimeoutErrorSubjectAltNameWarningSystemTimeWarning)match_hostnameCertificateError)resolve_cert_reqsresolve_ssl_versionassert_fingerprintcreate_urllib3_contextssl_wrap_socket) connection)HTTPHeaderDicthttpPhttpsiic@seZdZdZdS)DummyConnectionz-Used to detect a failed ConnectionCls import.N)r r r __doc__r r r rr As r c@seZdZdZedZejejdfgZ dZ ddZ ddZ d d Z d d Zd d ddZd S)ra{ Based on httplib.HTTPConnection but provides an extra constructor backwards-compatibility layer between older and newer Pythons. Additional keyword parameters are used to configure attributes of the connection. Accepted parameters include: - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool` - ``source_address``: Set the source address for the current connection. .. note:: This is ignored for Python 2.6. It is only applied for 2.7 and 3.x - ``socket_options``: Set specific options on the underlying socket. If not specified, then defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. For example, if you wish to enable TCP Keep Alive in addition to the defaults, you might pass:: HTTPConnection.default_socket_options + [ (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), ] Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). rrFcOsytjr|jdd|jd|_tjdkrJ|jdd|jd|j|_t j |||dS)Nstrictsource_addresssocket_options)r$r%) rPY3popgetr#sys version_infodefault_socket_optionsr&_HTTPConnection__init__)selfargskwr r rr.js zHTTPConnection.__init__cCsi}|jr|j|d<|jr2|j|dr?r;datetimedatetoday RECENT_DATEwarningswarnformatrrdrrrfrrgrmrrbrcrrrsr getpeercertssl CERT_NONErnr)r_match_hostnamerlr`)r/r8hostname is_time_offcontextcertr r rrAsT              zVerifiedHTTPSConnection.connect) r r r r!rgrrrsrfrrtrAr r r rrks rkcCs\yt||WnDtk rW}z$tjd||||_WYdd}~XnXdS)Nz@Certificate did not match expected hostname: %s. Certificate: %s)rrlogr _peer_cert)rasserted_hostnamer9r r rrbs  r)9 __future__rryloggingror*r]rr6rr5r}packagesrZpackages.six.moves.http_clientrr-rrSSLErrorr ImportErrorAttributeError BaseExceptionr NameError Exception exceptionsrrrrZpackages.ssl_match_hostnamerrZ util.ssl_rrrrrutilr _collectionsr getLoggerr rr[rzr|objectr rarkrUnverifiedHTTPSConnectionr r r rsL          "(  &l