File: //usr/lib/python3.9/site-packages/rhn/__pycache__/rpclib.cpython-39.pyc
a
쑐c�^ � @ s` d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z z<ddl
Z
ddlmZm
Z
mZmZmZmZ ddlmZmZ W nF ey� ddlmZ
eZeZ
eZeZeZeZddlmZmZ Y n0 dZd d
� Zdd� Z d
d� Z!G dd� de"�Z#G dd� d�Z$G dd� de$�Z%G dd� de&�Z'G dd� de&�Z(dd� Z)G dd� d�Z*G dd� de*�Z+dd � Z,dS )!z2.8.62.8.6-8.el98.el9� N)�
transports)�sstr)�UserDictCase)�ListType� TupleType�
StringType�UnicodeType�DictType�DictionaryType)� splittype� splithost� c C s( zt �t j| � W dS Y dS 0 dS )z5 Returns true if n is IPv6 address, false otherwise. TFN)�socketZ inet_ptonZAF_INET6)�n� r �./usr/lib/python3.9/site-packages/rhn/rpclib.py�
check_ipv6. s
r c C s� | � dd�}d}d}d}d}t|�dkr^|d }|d � dd�}|d }t|�dkrf|d }n|d }|d dkr�t� dtd�\}}|�d��d �}n6t|�r�|}n(|� dd�}|d }t|�dkr�|d }||||fS )
z| Function used to split host information in an URL per RFC 2396
handle full hostname like user:passwd@host:port
�@� N� r �:�[z(?<=\]):�])�split�len�reZip_port�lstrip�rstripr ) Z
hoststring�l�host�port�user�passwdZhostport�userinfo�arrr r r �
split_host6 s,
r% c C s8 | d krt d��| �dd�}t|�dkr0|d } t| �S )NzHost string cannot be nullz://r r )�
ValueErrorr r r% )�proxyr$ r r r �get_proxy_info[ s r( c @ s e Zd ZdS )�MalformedURIErrorN��__name__�
__module__�__qualname__r r r r r) g s r) c @ s e Zd ZdZejZejZej Z
ejZd;dd�Z
d<dd�Zdd � Zd
d� Zdd
� Zdd� Zd=dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� ZeZd'd(� Zd>d)d*�Z d+d,� Z!d-d.� Z"d/d0� Z#d1d2� Z$d3d4� Z%d?d5d6�Z&d7d8� Z'd9d:� Z(dS )@�Servera7 uri [,options] -> a logical connection to an XML-RPC server
uri is the connection point on the server, given as
scheme://host/target.
The standard implementation always supports the "http" scheme. If
SSL socket support is available (Python 2.0), it also supports
"https".
If the target part and the slash preceding it are both omitted,
"/RPC2" is assumed.
The following options can be given as keyword arguments:
transport: a transport factory
encoding: the request encoding (default is UTF-8)
verbose: verbosity level
proxy: use an HTTP proxy
username: username for authenticated HTTP proxy
password: password for authenticated HTTP proxy
All 8-bit strings passed to the server proxy are assumed to use
the given encoding.
Nr c C s6 |d krZt |�\}}}
}|d ur.d||f }n|}|
d urZ|d u rZ|
}|d urZ|d u rZ|}t|�| _d | _d | _d | _|| _|| _|| _|
| _ t
t�� �dkr�t�� d | _
nt| _
| �� |d u r�d| _| �| j||||
�}nd| _d | _d| _|| _g | _d | _|| _|| _| �|� | �| � d | _t� | _d S )Nz%s:%sr r )r( r �_uri�_refreshCallback�_progressCallback�_bufferSize�_proxy� _username� _password�_timeoutr �__version__r �rpc_version�_reset_host_handler_and_type�_allow_redirect�default_transport�_type�_redirected�use_handler_path�
_transport�_trusted_cert_files�_lang� _encoding�_verbose�set_refresh_callback�set_progress_callback�send_handlerr �_headers)�self�uri� transport�encoding�verboser'