Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
wiperf / usr / local / lib / python3.7 / dist-packages / urllib3 / __pycache__ / connection.cpython-37.pyc
Size: Mime:
B

EQí	§ùã	@s²ddlmZddlZddlZddlZddlZddlZddlmZm	Z
ddlZddlm
Z
ddlmZddlmZyddlZejZWn,eefk
r®dZGdd	„d	eƒZYnXyeZWn$ek
rÜGd
d„deƒZYnXddlmZmZmZmZdd
l m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,e -e.¡Z/dddœZ0e 1ddd¡Z2e 3d¡Z4Gdd„de5ƒZ6Gdd„dee5ƒZGdd„deƒZ7dd„Z8esªe6Z7e7Z9dS)é)Úabsolute_importN)ÚerrorÚtimeouté)Úsix)ÚHTTPConnection)Ú
HTTPExceptionc@seZdZdS)ÚBaseSSLErrorN)Ú__name__Ú
__module__Ú__qualname__©r
r
ú7/tmp/pip-install-z4i6eiy2/urllib3/urllib3/connection.pyr	sr	c@seZdZdS)ÚConnectionErrorN)r
rrr
r
r
rrsr)ÚNewConnectionErrorÚConnectTimeoutErrorÚSubjectAltNameWarningÚSystemTimeWarning)Úmatch_hostnameÚCertificateError)Úresolve_cert_reqsÚresolve_ssl_versionÚassert_fingerprintÚcreate_urllib3_contextÚssl_wrap_socket)Ú
connection)ÚHTTPHeaderDictéPi»)ÚhttpÚhttpsiãz[^-!#$%&'*+.^_`|~0-9a-zA-Z]c@seZdZdZdS)ÚDummyConnectionz-Used to detect a failed ConnectionCls import.N)r
rrÚ__doc__r
r
r
rr Asr c@sxeZdZdZedZejejdfgZ	dZ
dd„Zedd„ƒZ
e
jd	d„ƒZ
d
d„Zdd
„Zdd„Zdd„Zddd„ZdS)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.
      - ``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., ``[]``).
    rrFcOsDtjs| dd¡| d¡|_| d|j¡|_tj|f|ž|ŽdS)NÚstrictÚsource_addressÚsocket_options)	rÚPY2ÚpopÚgetr#Údefault_socket_optionsr$Ú_HTTPConnectionÚ__init__)ÚselfÚargsÚkwr
r
rr*hs
zHTTPConnection.__init__cCs|j d¡S)aŸ
        Getter method to remove any trailing dots that indicate the hostname is an FQDN.

        In general, SSL certificates don't include the trailing dot indicating a
        fully-qualified domain name, and thus, they don't validate properly when
        checked against a domain name that includes the dot. In addition, some
        servers may not expect to receive the trailing dot when provided.

        However, the hostname with trailing dot is critical to DNS resolution; doing a
        lookup with the trailing dot will properly only resolve the appropriate FQDN,
        whereas a lookup without a trailing dot will search the system's search domain
        list. Thus, it's important to keep the original host around for use only in
        those cases where it's appropriate (i.e., when doing DNS lookup to establish the
        actual TCP connection across which we're going to send HTTP requests).
        Ú.)Ú	_dns_hostÚrstrip)r+r
r
rÚhostuszHTTPConnection.hostcCs
||_dS)z×
        Setter for the `host` property.

        We assume that only urllib3 uses the _dns_host attribute; httplib itself
        only uses `host`, and it seems reasonable that other libraries follow suit.
        N)r/)r+Úvaluer
r
rr1ˆsc
Cs i}|jr|j|d<|jr$|j|d<ytj|j|jf|jf|Ž}WnXtk
rlt|d|j	|jfƒ‚Yn0t
k
rš}zt|d|ƒ‚Wdd}~XYnX|S)zp Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        r#r$z0Connection to %s timed out. (connect timeout=%s)z(Failed to establish a new connection: %sN)r#r$rÚcreate_connectionr/ÚportrÚ
SocketTimeoutrr1ÚSocketErrorr)r+Úextra_kwÚconnÚer
r
rÚ	_new_conn’s"

zHTTPConnection._new_conncCs$||_t|ddƒr | ¡d|_dS)NÚ_tunnel_hostr)ÚsockÚgetattrÚ_tunnelÚ	auto_open)r+r8r
r
rÚ
_prepare_conn±szHTTPConnection._prepare_conncCs| ¡}| |¡dS)N)r:r@)r+r8r
r
rÚconnectºszHTTPConnection.connectcOs8t |¡}|r"td|| ¡fƒ‚tj|||f|ž|ŽS)zSend a request to the serverzAMethod cannot contain non-token characters %r (found at least %r))Ú_CONTAINS_CONTROL_CHAR_REÚsearchÚ
ValueErrorÚgroupr)Ú
putrequest)r+ÚmethodÚurlr,ÚkwargsÚmatchr
r
rrF¾s
zHTTPConnection.putrequestNc
Cst|dk	r|niƒ}d|k}d|k}|j||||dx | ¡D]\}}| ||¡q@Wd|krl| dd¡| ¡|dk	rtjtf}	t||	ƒrš|f}xh|D]`}
|
sªq t|
tƒs¾|
 	d¡}
t
t|
ƒƒd	d…}t| 	¡ƒ}|d
7}||
7}|d
7}| 
|¡q W| 
d¡dS)zƒ
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        Nzaccept-encodingr1)Úskip_accept_encodingÚ	skip_hostztransfer-encodingzTransfer-EncodingÚchunkedÚutf8és
s0

)rrFÚitemsÚ	putheaderÚ
endheadersrÚstring_typesÚbytesÚ
isinstanceÚencodeÚhexÚlenÚ	bytearrayÚsend)
r+rGrHÚbodyÚheadersrKrLÚheaderr2Ústringish_typesÚchunkÚlen_strZto_sendr
r
rÚrequest_chunkedÉs4




zHTTPConnection.request_chunked)NN)r
rrr!Úport_by_schemeÚdefault_portÚsocketÚIPPROTO_TCPÚTCP_NODELAYr(Úis_verifiedr*Úpropertyr1Úsetterr:r@rArFrar
r
r
rrGs

	rc	@sZeZdZedZdZdZdZdZdZ	dZ
dddddejddfdd„Z
d	dd„Zdd„ZdS)
ÚHTTPSConnectionrNc
KsDtj|||f||dœ|
—Ž||_||_||_||_|	|_d|_dS)N)r"rr)rr*Úkey_fileÚ	cert_fileÚkey_passwordÚssl_contextÚserver_hostnameÚ	_protocol)r+r1r4rkrlrmr"rrnror-r
r
rr*øszHTTPSConnection.__init__c

Csv|dkr$|jdk	r|jj}ntdƒ}||_||_||_||_||_||_|oVt	j
 |¡|_|oht	j
 |¡|_
|	|_dS)zX
        This method should only be called once, before the connection is used.
        N)rnÚverify_moderrkrlÚ	cert_reqsrmÚassert_hostnamerÚosÚpathÚ
expanduserÚca_certsÚca_cert_dirÚca_cert_data)
r+rkrlrrrmrwrsrrxryr
r
rÚset_certs

zHTTPSConnection.set_certcCsœ| ¡}|j}t|ddƒr4||_| ¡d|_|j}|}|jdk	rH|j}tj	 
¡tk}|rlt 
d t¡t¡d}|jdkr˜d}tt|jƒt|jƒd|_|j}t|jƒ|_|jsÒ|jsÒ|jsÒ|rÒt|dƒrÒ| ¡t||j|j|j|j|j|j||d	|_|j rt |jj!dd	|j ƒnd|jt"j#kr~t|d
dƒs~|j$dk	r~|j !¡}| %dd¡slt 
d
 |¡t&¡t'||j$pz|ƒ|jt"j(kp”|j dk	|_)dS)Nr;rzWSystem time is way off (before {0}). This will probably lead to SSL verification errorsFT)Ússl_versionrrÚload_default_certs)	r<ÚkeyfileÚcertfilermrwrxryrorn)Úbinary_formÚcheck_hostnameÚsubjectAltNamer
zëCertificate for {0} has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.))*r:r1r=r<r>r?r;roÚdatetimeÚdateÚtodayÚRECENT_DATEÚwarningsÚwarnÚformatrrnrrr{rrrrqrwrxryÚhasattrr|rrkrlrmrÚgetpeercertÚsslÚ	CERT_NONErsr'rÚ_match_hostnameÚ
CERT_REQUIREDrg)r+r8ÚhostnameroÚis_time_offZdefault_ssl_contextÚcontextÚcertr
r
rrA3sn




zHTTPSConnection.connect)	NNNNNNNNN)r
rrrbrcrrrwrxryr{rrdÚ_GLOBAL_DEFAULT_TIMEOUTr*rzrAr
r
r
rrjîs2
rjc
CsLyt||ƒWn8tk
rF}zt d||¡||_‚Wdd}~XYnXdS)Nz@Certificate did not match expected hostname: %s. Certificate: %s)rrÚlogÚwarningÚ
_peer_cert)r’Úasserted_hostnamer9r
r
rr•sr):Ú
__future__rÚrer‚Úloggingrtrdrr6rr5r†ÚpackagesrZpackages.six.moves.http_clientrr)rr‹ÚSSLErrorr	ÚImportErrorÚAttributeErrorÚ
BaseExceptionrÚ	NameErrorÚ	ExceptionÚ
exceptionsrrrrZpackages.ssl_match_hostnamerrZ	util.ssl_rrrrrÚutilrÚ_collectionsrÚ	getLoggerr
r”rbrƒr…ÚcompilerBÚobjectr rjrÚVerifiedHTTPSConnectionr
r
r
rÚ<module>sL
	


((