HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/site-packages/M2Crypto/__pycache__/httpslib.cpython-36.pyc
3

/ �\2(�@s�ddlmZddlZddlZddlZddlmZmZmZddl	m
Z
mZddlTddlm
Z
er�ddlmZmZmZmZmZmZGdd	�d	e�ZGd
d�de�ZdS)�)�absolute_importN)�SSL�py27plus�six)�urlsplit�
urlunsplit)�*)�
HTTPS_PORT)�Any�AnyStr�Callable�Dict�List�Optionalc@s>eZdZdZeZd
dd�Zdd�Zdd�Zd	d
�Z	dd�Z
dS)�HTTPSConnectionzA
    This class allows communication via SSL using M2Crypto.
    Nc
Ks�d|_||_||_t|j��td�}|r4td|��y&|d|_t|jtj	�sXt
|j��Wntk
rxtj	�|_YnXtj
||||�dS)at
        Represents one transaction with an HTTP server over the SSL
        connection.

        :param host: host name
        :param port: port number
        :param strict: if switched on, it raises BadStatusLine to be
                       raised if the status line can't be parsed as
                       a valid HTTP/1.0 or 1.1 status line.
        :param ssl: dict with all remaining named real parameters of the
                    function. Specifically, ``ssl_context`` is expected
                    to be included with SSL.Context; if it is not
                    default ``'sslv23'`` is substituted).
        N�key_file�	cert_file�ssl_contextzunknown keyword argument: %s)rrr)�session�host�port�set�keys�
ValueError�ssl_ctx�
isinstancerZContext�AssertionError�KeyError�HTTPConnection�__init__)�selfrr�strict�sslr�r#� /usr/lib64/python3.6/httpslib.pyrs

zHTTPSConnection.__init__cCs�d}x�tj|j|jdtj�D]�\}}}}}d}z�yRtj|j|d�}|j|j�|j	dk	rd|j
|j	�|j|j|jf�||_d}dStj
k
r�}z
|}WYdd}~XnXWd|dk	r�|j�XqW|dkr�td��|�dS)Nr)�familyz"Empty list returned by getaddrinfo)�socketZgetaddrinforrZSOCK_STREAMr�
ConnectionrZset_tlsext_host_namer�set_session�connect�sock�error�closer)r r+r%�_r*�er#r#r$r):s*
zHTTPSConnection.connectcCsdS)Nr#)r r#r#r$r,\szHTTPSConnection.closecCs
|jj�S)N)r*�get_session)r r#r#r$r/nszHTTPSConnection.get_sessioncCs
||_dS)N)r)r rr#r#r$r(rszHTTPSConnection.set_session)NN)�__name__�
__module__�__qualname__�__doc__r	Zdefault_portrr)r,r/r(r#r#r#r$rs
"rc@sfeZdZdZddd�ZdZdZddd	�Zddd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�ProxyHTTPSConnectiona�
    An HTTPS Connection that uses a proxy and the CONNECT request.

    When the connection is initiated, CONNECT is first sent to the proxy (along
    with authorization headers, if supplied). If successful, an SSL connection
    will be established over the socket through the proxy and to the target
    host.

    Finally, the actual request is sent over the SSL connection tunneling
    through the proxy.
    �Pi�)ZhttpZhttpszProxy-Authorizationz
User-AgentNcKs\tj||||f|�t|tj�r*|jd�n||_t|tj�rF|jd�n||_d|_d|_	dS)a�
        Create the ProxyHTTPSConnection object.

        :param host: host name of the proxy server
        :param port: port number of the proxy server
        :param strict: if switched on, it raises BadStatusLine to be
                       raised if the status line can't be parsed as
                       a valid HTTP/1.0 or 1.1 status line.
        :param username: username on the proxy server, when required
                         Username can be ``str``, but preferred type
                         is ``bytes``. M2Crypto does some conversion to
                         ``bytes`` when necessary, but it's better when
                         the user of the library does it on its own.
        :param password: password on the proxy server, when required
                         The same as with ``username``, ``str`` is accepted,
                         but ``bytes`` are preferred.
        :param ssl: dict with all remaining named real parameters of the
                    function. Specifically, ``ssl_context`` is expected
                    to be included with SSL.Context; if it is not
                    default ``'sslv23'`` is substituted).
        �utf8N)
rrrrZstring_types�encode�	_username�	_password�_proxy_auth�	_proxy_UA)r rrr!ZusernameZpasswordr"r#r#r$r�s
zProxyHTTPSConnection.__init__rcCs�t|�\}}}}}	|s"td|��y|jd�\}
}Wntk
rL|}YnXy|jd�\}}
t|
�}WnHtk
r�|}y|j|}Wn tk
r�td|��YnXYnX||_||_tdd|||	f�}t	j
|||||�dS)z�
        putrequest is called before connect, so can interpret url and get
        real host/port to be used to make CONNECT request to proxy
        zunknown URL type: %s�@�:zunknown protocol for: %s�N)rr�split�int�_portsr�
_real_host�
_real_portrr�
putrequest)r �methodZurlZ	skip_hostZskip_accept_encoding�protoZnetloc�pathZqueryZfragmentZusername_passwordZ	host_portrZport_sr�restr#r#r$rD�s*
zProxyHTTPSConnection.putrequestcCsD|j�|jj�kr||_|j�|jj�kr2||_ntj|||�dS)N)�lower�
_UA_HEADERr;�_AUTH_HEADERr:r�	putheader)r �header�valuer#r#r$rL�s
zProxyHTTPSConnection.putheadercOs&|js|j�|_tj|f|�|�dS)N)r:�_encode_authr�
endheaders)r �args�kwargsr#r#r$rP�s
zProxyHTTPSConnection.endheaderscCs\tj|�|jj|j��t|j�}|j�|j}|dkrP|j�t	j
d|��|j�dS)N��zProxy connection failed: %d)rr)r*Zsendall�_get_connect_msgZHTTPResponseZbeginZstatusr,r&r+�
_start_ssl)r Zresponse�coder#r#r$r)�s

zProxyHTTPSConnection.connectcCsjd|j|jf}|d|j|jf}|jr>|d|j|jf}|jrX|d|j|jf}|d}tj|�S)z6 Return an HTTP CONNECT request to send to the proxy. zCONNECT %s:%d HTTP/1.1
z
Host: %s:%d
z%s: %s
z
)rBrCr;rJr:rKr�
ensure_binary)r �msgr#r#r$rT�sz%ProxyHTTPSConnection._get_connect_msgcCs4tj|j|j�|_|jj�|jj�|jj�dS)z* Make this connection's socket SSL-aware. N)rr'rr*Z	setup_sslZset_connect_stateZconnect_ssl)r r#r#r$rU�s

zProxyHTTPSConnection._start_sslc
Cs`|jo
|jsdSd|j|jf}tj��$tjdt�tj|�jdd�}WdQRXt	j
d|�S)z> Encode the username and password for use in the auth header. Nz%s:%s�ignore�
r>zBasic %s)r8r9�warnings�catch_warnings�simplefilter�DeprecationWarning�base64Zencodestring�replacerrW)r ZuserpassZenc_userpassr#r#r$rOs
z!ProxyHTTPSConnection._encode_auth)NNNN)rr)r0r1r2r3rArKrJrrDrLrPr)rTrUrOr#r#r#r$r4ws

 
!

r4)Z
__future__rr[r_r&ZM2CryptorrrZM2Crypto.six.moves.urllib_parserrZM2Crypto.six.moves.http_clientr	Ztypingr
rrr
rrrrr4r#r#r#r$�<module>s b