Your IP : 3.144.227.73


Current Path : /opt/alt/python37/lib/python3.7/site-packages/raven/utils/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/raven/utils/__pycache__/http.cpython-37.pyc

B

��Y��@sjdZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZdej
dddfdd	�ZdS)
z�
raven.utils.http
~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
�)�absolute_importN)�defaults)�urllib2�httplib)�match_hostnameFc
	s�G��fdd�dtj��G�fdd�dtj�}|r:|g}n0ytjt��d�g}Wntk
rhg}YnXtj|�}tj	dkr�t
��}	t
�|�z|�
||�St
�|	�X|�
|||�S)Ncs(eZdZejZdd�Z��fdd�ZdS)z%urlopen.<locals>.ValidHTTPSConnectionc_stjj|f|�|�dS)N)r�HTTPConnection�__init__)�self�args�kwargs�r�A/opt/alt/python37/lib/python3.7/site-packages/raven/utils/http.pyrsz.urlopen.<locals>.ValidHTTPSConnection.__init__csdtj|j|jf|jd�}|jr,||_|��tj	|�tj
d�|_�dk	r`t|j��|j
p\|j�dS)N)�address�timeout)�ca_certsZ	cert_reqs)�socket�create_connection�host�portrZ_tunnel_host�sockZ_tunnel�sslZwrap_socketZ
CERT_REQUIREDrZgetpeercert�assert_hostname)r	r)rrrr
�connects


z-urlopen.<locals>.ValidHTTPSConnection.connectN)�__name__�
__module__�__qualname__rZ
HTTPS_PORTZdefault_portrrr)rrrr
�ValidHTTPSConnectionsrcseZdZ�fdd�ZdS)z"urlopen.<locals>.ValidHTTPSHandlercs|��|�S)N)Zdo_open)r	�req)rrr
�
https_open-sz-urlopen.<locals>.ValidHTTPSHandler.https_openN)rrrrr)rrr
�ValidHTTPSHandler,sr)�context)��)rrrZHTTPSHandlerrZ_create_unverified_context�AttributeErrorZbuild_opener�sys�version_infor�getdefaulttimeout�setdefaulttimeout�open)
�url�datarrZ
verify_sslrr�handlers�openerZdefault_timeoutr)rrrr
�urlopens"



r-)�__doc__�
__future__rrrr$Z
raven.confrZraven.utils.compatrrZraven.utils.ssl_match_hostnamerZTIMEOUTr-rrrr
�<module>s

?>