%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/urllib3/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/urllib3/connection.pyo

�
9fc@@skddlmZddlZddlZddlZddlZddlZddlmZm	Z
ddlZddlm
Z
ddlmZddlmZyddlZejZWn3eefk
r�dZdefd	��YZnXy
eZWn'ek
r d
efd��YZnXddlmZmZmZm Z dd
l!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ej.e/�Z0idd6dd6Z1ej2ddd�Z3ej4d�Z5de6fd��YZ7dee6fd��YZdefd��YZ8de8fd ��YZ9d!�Z:erae8Z;e9Z8ne7Z8dS("i(tabsolute_importN(terrorttimeouti(tsix(tHTTPConnection(t
HTTPExceptiontBaseSSLErrorcB@seZRS((t__name__t
__module__(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyRstConnectionErrorcB@seZRS((RR(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR	s(tNewConnectionErrortConnectTimeoutErrortSubjectAltNameWarningtSystemTimeWarning(tmatch_hostnametCertificateError(tresolve_cert_reqstresolve_ssl_versiontassert_fingerprinttcreate_urllib3_contexttssl_wrap_socket(t
connection(tHTTPHeaderDictiPthttpi�thttpsi�i	i
s[^-!#$%&'*+.^_`|~0-9a-zA-Z]tDummyConnectioncB@seZdZRS(s-Used to detect a failed ConnectionCls import.(RRt__doc__(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyRDsRcB@s�eZdZedZejejdfgZe	Z
d�Zed��Z
e
jd��Z
d�Zd�Zd�Zd	�Zddd
�ZRS(s$
    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., ``[]``).
    RicO@s]tjr|jdd�n|jd�|_|jd|j�|_tj	|||�dS(Ntstricttsource_addresstsocket_options(
RtPY3tpoptNonetgetRtdefault_socket_optionsRt_HTTPConnectiont__init__(tselftargstkw((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR$js
	cC@s|jjd�S(s�
        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).
        t.(t	_dns_hosttrstrip(R%((s6/usr/lib/python2.7/site-packages/urllib3/connection.pythostwscC@s
||_dS(s�
        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%tvalue((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR+�scC@s�i}|jr|j|d<n|jr8|j|d<ny(tj|j|jf|j|�}WnWtk
r�}t|d|j	|jf��n&t
k
r�}t|d|��nX|S(sp Establish a socket connection and set nodelay settings on it.

        :return: New socket connection.
        RRs0Connection to %s timed out. (connect timeout=%s)s(Failed to establish a new connection: %s(RRRtcreate_connectionR)tportRt
SocketTimeoutRR+tSocketErrorR
(R%textra_kwtconnte((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyt	_new_conn�s 		"cC@s,||_|jr(|j�d|_ndS(Ni(tsockt_tunnel_hostt_tunnelt	auto_open(R%R2((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyt
_prepare_conn�s		
cC@s|j�}|j|�dS(N(R4R9(R%R2((s6/usr/lib/python2.7/site-packages/urllib3/connection.pytconnect�scO@sMtj|�}|r4td||j�f��ntj|||||�S(sSend a request to the serversAMethod cannot contain non-token characters %r (found at least %r)(t_CONTAINS_CONTROL_CHAR_REtsearcht
ValueErrortgroupR#t
putrequest(R%tmethodturlR&tkwargstmatch((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR?�scC@s�t|d
k	r|ni�}d|k}d|k}|j||d|d|�x*|j�D]\}}|j||�q_Wd|kr�|jdd�n|j�|d
k	rstjtf}	t	||	�r�|f}nx�|D]�}
|
s�q�nt	|
t�s|
j
d�}
ntt|
��d	}|j
|j
d
��|j
d�|j
|
�|j
d�q�Wn|j
d�d
S(s�
        Alternative to the common request method, which sends the
        body with chunked encoding and not as one block
        saccept-encodingR+tskip_accept_encodingt	skip_hoststransfer-encodingsTransfer-Encodingtchunkedtutf8isutf-8s
s0

N(RR R?titemst	putheadert
endheadersRtstring_typestbytest
isinstancetencodethextlentsend(R%R@RAtbodytheadersRDREtheaderR,tstringish_typestchunktlen_str((s6/usr/lib/python2.7/site-packages/urllib3/connection.pytrequest_chunked�s8



N(RRRtport_by_schemetdefault_porttsockettIPPROTO_TCPtTCP_NODELAYR"tFalsetis_verifiedR$tpropertyR+tsetterR4R9R:R?R RX(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyRIs
	

				tHTTPSConnectioncB@sBeZedZdZddddejddd�Zd�Z	RS(Rc	
	K@sStj|||d|d||	�||_||_||_||_d|_dS(NRRR(RR$tkey_filet	cert_filetssl_contexttserver_hostnamet	_protocol(
R%R+R.RcRdRRReRfR'((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR$�s
				cC@s�|j�}|j|�|jdkrOtdtd�dtd��|_ntd|d|jd|j	d|jd|j
�|_dS(Ntssl_versiont	cert_reqsR5tkeyfiletcertfileReRf(R4R9ReR RRRRRcRdRfR5(R%R2((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR:s
			N(
RRRYRZR RhR[t_GLOBAL_DEFAULT_TIMEOUTR$R:(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyRb�s
		tVerifiedHTTPSConnectioncB@sSeZdZdZdZdZdZdZdddddddd�Z	d�Z
RS(s[
    Based on httplib.HTTPSConnection but wraps the socket with
    SSL certification.
    cC@s�|dkrB|s|r!d}qB|jdk	rB|jj}qBn||_||_||_||_||_|o�tj	j
|�|_|o�tj	j
|�|_dS(sX
        This method should only be called once, before the connection is used.
        t
CERT_REQUIREDN(
R Retverify_modeRcRdRitassert_hostnameRtostpatht
expandusertca_certstca_cert_dir(R%RcRdRiRtRpRRu((s6/usr/lib/python2.7/site-packages/urllib3/connection.pytset_cert s						cC@s|j�}|j}|jrF||_|j�d|_|j}n|}|jdk	rg|j}ntj	j
�tk}|r�tj
djt�t�n|jdkr�tdt|j�dt|j��|_n|j}t|j�|_td|d|jd|jd|jd	|jd
|d|�|_|jrbt|jjdt�|j�n�|jtj kr�t!|d
t"�r�|j#t"k	r�|jj�}|j$dd�s�tj
dj|�t%�nt&||j#p�|�n|jtj'kp
|jdk	|_(dS(NisWSystem time is way off (before {0}). This will probably lead to SSL verification errorsRhRiR5RjRkRtRuRfRetbinary_formtcheck_hostnametsubjectAltNames�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/shazow/urllib3/issues/497 for details.)(()R4R+R6R5R7R8RfR tdatetimetdatettodaytRECENT_DATEtwarningstwarntformatR
ReRRRhRRiRoRRcRdRtRuRtgetpeercerttTruetsslt	CERT_NONEtgetattrR^RpR!Rt_match_hostnameRnR_(R%R2thostnameRftis_time_offtcontexttcert((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR:9sZ			
	
						

N(RRRR RiRtRuRhRRvR:(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyRmscC@sJyt||�Wn2tk
rE}tjd||�||_�nXdS(Ns@Certificate did not match expected hostname: %s. Certificate: %s(RRtlogRt
_peer_cert(R�tasserted_hostnameR3((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyR��s
	(<t
__future__RtreRztloggingRqR[RR0RR/R~tpackagesRtpackages.six.moves.http_clientRR#RR�tSSLErrorRtImportErrortAttributeErrorR t
BaseExceptionR	t	NameErrort	Exceptiont
exceptionsR
RRR
tpackages.ssl_match_hostnameRRt	util.ssl_RRRRRtutilRt_collectionsRt	getLoggerRR�RYR{R}tcompileR;tobjectRRbRmR�tUnverifiedHTTPSConnection(((s6/usr/lib/python2.7/site-packages/urllib3/connection.pyt<module>sP


"(	
�(m		

Zerion Mini Shell 1.0