Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc	@sQdZddlZddlZeje�ZyddlZejeZ	WnAe
k
r�ddlZddlZe
ede�Z	eZnXy
ejZWnek
r�d�ZnXer�jZejZejZejZnRdejfd��YZdZdZd	ZdZddeeedeed
�Zdefd��YZdS(
s�Abstraction to simplify socket use for Python < 2.6

This will attempt to use the ssl module and the new
socket.create_connection method, but fall back to the old
methods if those are unavailable.
i�NtHTTPSHandlercCs�|\}}d}d}x�tj||dtj�D]�}|\}}}}	}
y9tj|||�}tjd||�|j|
�WnEtjk
r�}tjd||�|r�|j�nd}q4nXPq4W|s�j|��n|S(Ns!getaddrinfo returns an empty listisconnect: (%s, %s)sconnect fail: %s %s(	tNonetsockettgetaddrinfotSOCK_STREAMtloggertinfotconnectterrortclose(taddressthosttporttmsgtsocktrestaftsocktypetprotot
_canonnametsa((sC/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pytcreate_connection6s(
t
FakeSocketcBseZdZddd�ZRS(s*Socket wrapper that supports SSL.
        iicCs�|dkr"td|j��nxYtr}y|jj|�SWq%tjk
ry}|jdtjkrpq%qz|�q%Xq%WdS(s1ssl-aware wrapper around socket.recv
            is3non-zero flags not allowed in calls to recv() on %sN(	t
ValueErrort	__class__tTruet_ssltreadRtsslerrortargstSSL_ERROR_WANT_READ(tselftbuflentflagstx((sC/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pytrecvXs	(t__name__t
__module__t__doc__R#(((sC/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pyRRsiiic	
CsC|tkr!|r!td��ntj|�}	t||	�}|S(NsUSSL certificate validation requires the ssl module(included in Python 2.6 and later.)(t	CERT_NONEt CertificateValidationUnsupportedRtsslR(
Rtkeyfiletcertfiletserver_sidet	cert_reqstssl_versiontca_certstdo_handshake_on_connecttsuppress_ragged_eofstsslob((sC/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pytwrap_socketnsR(cBseZdZRS(sCException raised when cert validation is requested but unavailable.(R$R%R&(((sC/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pyR(}s(R&tloggingRt	getLoggerR$RR)R3Rthave_ssltImportErrorthttplibturllib2tgetattrtFalseRtAttributeErrorR't
CERT_OPTIONALt
CERT_REQUIREDRt_PROTOCOL_SSLv23Rt	ExceptionR((((sC/sys/lib/python2.7/site-packages/mercurial/httpclient/socketutil.pyt<module>"s@





			

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.