AlkantarClanX12

Your IP : 3.142.124.119


Current Path : /usr/lib64/python3.8/xmlrpc/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/xmlrpc/__pycache__/server.cpython-38.opt-2.pyc

U

e5d9��	@sddlmZmZmZmZmZddlmZddlm	Z	ddl
mZddlZddlZ
ddlZddlZddlZddlZddlZddlZzddlZWnek
r�dZYnXd*dd�Zd	d
�ZGdd�d�ZGd
d�de�ZGdd�deje�ZGdd�de�ZGdd�de�ZGdd�dej�ZGdd�d�Z Gdd�de�Z!Gdd�dee �Z"Gdd�dee �Z#e$dk�r
ddl%Z%Gd d!�d!�Z&ed"��~Z'e'�(e)�e'�(d#d$�d%�e'j*e&�dd&�e'�+�e,d'�e,d(�ze'�-�Wn(e.k
�r�e,d)�e�/d�YnXW5QRXdS)+�)�Fault�dumps�loads�gzip_encode�gzip_decode)�BaseHTTPRequestHandler)�partial)�	signatureNTcCsF|r|�d�}n|g}|D]&}|�d�r6td|��qt||�}q|S)N�.�_z(attempt to access private attribute "%s")�split�
startswith�AttributeError�getattr)�obj�attr�allow_dotted_namesZattrs�i�r�%/usr/lib64/python3.8/xmlrpc/server.py�resolve_dotted_attribute|s

�rcs�fdd�t��D�S)Ncs(g|] }|�d�stt�|��r|�qS)r)r
�callabler)�.0�member�rrr�
<listcomp>�s
�z'list_public_methods.<locals>.<listcomp>)�dirrrrr�list_public_methods�src@sleZdZddd�Zddd�Zddd�Zd	d
�Zdd�Zdd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�SimpleXMLRPCDispatcherFNcCs&i|_d|_||_|pd|_||_dS�N�utf-8)�funcs�instance�
allow_none�encoding�use_builtin_types��selfr#r$r%rrr�__init__�s

zSimpleXMLRPCDispatcher.__init__cCs||_||_dS�N)r"r)r'r"rrrr�register_instance�s!z(SimpleXMLRPCDispatcher.register_instancecCs2|dkrt|j|d�S|dkr$|j}||j|<|S)N)�name)r�register_function�__name__r!)r'Zfunctionr+rrrr,�s
z(SimpleXMLRPCDispatcher.register_functioncCs|j�|j|j|jd��dS)N)zsystem.listMethodszsystem.methodSignaturezsystem.methodHelp)r!�update�system_listMethods�system_methodSignature�system_methodHelp�r'rrr� register_introspection_functions�s
�z7SimpleXMLRPCDispatcher.register_introspection_functionscCs|j�d|ji�dS)Nzsystem.multicall)r!r.�system_multicallr2rrr�register_multicall_functions�sz3SimpleXMLRPCDispatcher.register_multicall_functionscCs�zPt||jd�\}}|dk	r(|||�}n|�||�}|f}t|d|j|jd�}Wn�tk
r�}zt||j|jd�}W5d}~XYnNt��\}}	}
z$ttdd||	f�|j|jd�}W5d}}	}
XYnX|�	|jd�S)N)r%�)Zmethodresponser#r$)r#r$�%s:%s�r$r#�xmlcharrefreplace)
rr%�	_dispatchrr#r$r�sys�exc_info�encode)r'�data�dispatch_method�path�params�method�response�fault�exc_type�	exc_value�exc_tbrrr�_marshaled_dispatch�s0�
��
z*SimpleXMLRPCDispatcher._marshaled_dispatchcCs^t|j���}|jdk	rVt|jd�r8|t|j���O}nt|jd�sV|tt|j��O}t|�S)N�_listMethodsr:)�setr!�keysr"�hasattrrIr�sorted)r'�methodsrrrr/s
z)SimpleXMLRPCDispatcher.system_listMethodscCsdS)Nzsignatures not supportedr)r'�method_namerrrr0/sz-SimpleXMLRPCDispatcher.system_methodSignaturecCs�d}||jkr|j|}nX|jdk	rrt|jd�r<|j�|�St|jd�srzt|j||j�}Wntk
rpYnX|dkr~dSt�|�SdS)N�_methodHelpr:�)	r!r"rLrPrrr�pydoc�getdoc)r'rOrBrrrr1<s$

�z(SimpleXMLRPCDispatcher.system_methodHelpc
Cs�g}|D]�}|d}|d}z|�|�||�g�Wqtk
rj}z|�|j|jd��W5d}~XYqt��\}}}	z|�dd||fd��W5d}}}	XYqXq|S)NZ
methodNamerA)�	faultCode�faultStringr6r7)�appendr:rrTrUr;r<)
r'Z	call_list�resultsZcallrOrArDrErFrGrrrr4[s,
��
��z'SimpleXMLRPCDispatcher.system_multicallcCs�z|j|}Wntk
r"YnX|dk	r4||�Std|��|jdk	r�t|jd�rd|j�||�Szt|j||j�}Wntk
r�YnX|dk	r�||�Std|��dS)Nzmethod "%s" is not supportedr:)	r!�KeyError�	Exceptionr"rLr:rrr)r'rBrA�funcrrrr:s*
�z SimpleXMLRPCDispatcher._dispatch)FNF)F)NN)NN)r-�
__module__�__qualname__r(r*r,r3r5rHr/r0r1r4r:rrrrr�s	�

$

)
$rc@sbeZdZdZdZdZdZe�dej	ej
B�Zdd�Zdd	�Z
d
d�Zdd
�Zdd�Zddd�ZdS)�SimpleXMLRPCRequestHandler)�/z/RPC2ix���Tz�
                            \s* ([^\s;]+) \s*            #content-coding
                            (;\s* q \s*=\s* ([0-9\.]+))? #q
                            cCs^i}|j�dd�}|�d�D]<}|j�|�}|r|�d�}|rFt|�nd}|||�d�<q|S)NzAccept-EncodingrQ�,�g�?r6)�headers�getr�	aepattern�match�group�float)r'�rZae�ere�vrrr�accept_encodings�s
z+SimpleXMLRPCRequestHandler.accept_encodingscCs|jr|j|jkSdSdS)NT)�	rpc_pathsr@r2rrr�is_rpc_path_valid�sz,SimpleXMLRPCRequestHandler.is_rpc_path_validc
Cs�|��s|��dSz�d}t|jd�}g}|rht||�}|j�|�}|sLqh|�|�|t|d�8}q,d�	|�}|�
|�}|dkr�WdS|j�|t
|dd�|j�}Wn�tk
�r6}zp|�d�t|jd��r|jj�r|�dt|��t��}	t|	�d	d
�d	�}	|�d|	�|�dd
�|��W5d}~XYn�X|�d�|�dd�|jdk	�r�t|�|jk�r�|���dd�}
|
�r�zt|�}|�dd�Wntk
�r�YnX|�dtt|���|��|j�|�dS)Ni�zcontent-lengthr_�r:i��_send_traceback_headerzX-exception�ASCII�backslashreplacezX-traceback�Content-length�0���Content-typeztext/xml�gziprzContent-Encoding) rm�
report_404�intrb�minZrfile�readrV�len�join�decode_request_content�serverrHrr@rY�
send_responserLro�send_header�str�	traceback�
format_excr=�end_headers�encode_thresholdrkrcr�NotImplementedError�wfile�write)r'Zmax_chunk_sizeZsize_remaining�LZ
chunk_size�chunkr>rCriZtrace�qrrr�do_POST�s`




�
�
z"SimpleXMLRPCRequestHandler.do_POSTcCs�|j�dd���}|dkr|S|dkrvz
t|�WStk
rT|�dd|�Yq�tk
rr|�dd�Yq�Xn|�dd|�|�dd	�|��dS)
Nzcontent-encodingZidentityrvi�zencoding %r not supported�zerror decoding gzip contentrrrs)	rbrc�lowerrr�r�
ValueErrorr�r�)r'r>r$rrrr}$s
z1SimpleXMLRPCRequestHandler.decode_request_contentcCsF|�d�d}|�dd�|�dtt|���|��|j�|�dS)Ni�sNo such pageruz
text/plainrr)rr�r�r{r�r�r��r'rCrrrrw5s
z%SimpleXMLRPCRequestHandler.report_404�-cCs|jjrt�|||�dSr))r~�logRequestsr�log_request)r'�code�sizerrrr�>sz&SimpleXMLRPCRequestHandler.log_requestN)r�r�)r-r[r\rlr�ZwbufsizeZdisable_nagle_algorithm�re�compile�VERBOSE�
IGNORECASErdrkrmr�r}rwr�rrrrr]�s	
�G	r]c@s*eZdZdZdZedddddfdd�ZdS)�SimpleXMLRPCServerTFNcCs,||_t�||||�tj�||||�dSr))r�rr(�socketserver�	TCPServer�r'ZaddrZrequestHandlerr�r#r$Zbind_and_activater%rrrr(WszSimpleXMLRPCServer.__init__)r-r[r\Zallow_reuse_addressror]r(rrrrr�Ds�r�c@s<eZdZedddddfdd�Zdd�Zdd	�Zdd
d�ZdS)
�MultiPathXMLRPCServerTFNc
Cs2t�||||||||�i|_||_|p*d|_dSr)r�r(�dispatchersr#r$r�rrrr(hs�zMultiPathXMLRPCServer.__init__cCs||j|<|Sr)�r�)r'r@�
dispatcherrrr�add_dispatcherrs
z$MultiPathXMLRPCServer.add_dispatchercCs
|j|Sr)r�)r'r@rrr�get_dispatchervsz$MultiPathXMLRPCServer.get_dispatchercCs|z|j|�|||�}Wn^t��dd�\}}z2ttdd||f�|j|jd�}|�|jd�}W5d}}XYnX|S)N�r6r7r8r9)	r�rHr;r<rrr$r#r=)r'r>r?r@rCrErFrrrrHys"
��z)MultiPathXMLRPCServer._marshaled_dispatch)NN)r-r[r\r]r(r�r�rHrrrrr�`s�

r�c@s0eZdZddd�Zdd�Zdd�Zdd	d
�ZdS)
�CGIXMLRPCRequestHandlerFNcCst�||||�dSr))rr(r&rrrr(�sz CGIXMLRPCRequestHandler.__init__cCsP|�|�}td�tdt|��t�tj��tjj�|�tjj��dS)NzContent-Type: text/xml�Content-Length: %d)rH�printr{r;�stdout�flush�bufferr�)r'�request_textrCrrr�
handle_xmlrpc�s

z%CGIXMLRPCRequestHandler.handle_xmlrpccCs�d}tj|\}}tjj|||d�}|�d�}td||f�tdtjj�tdt|��t�t	j
��t	j
j�
|�t	j
j��dS)Nr�)r��message�explainr z
Status: %d %szContent-Type: %sr�)rZ	responses�httpr~ZDEFAULT_ERROR_MESSAGEr=r�ZDEFAULT_ERROR_CONTENT_TYPEr{r;r�r�r�r�)r'r�r�r�rCrrr�
handle_get�s ��

z"CGIXMLRPCRequestHandler.handle_getc	Csz|dkr$tj�dd�dkr$|��nRzttj�dd��}Wnttfk
rVd}YnX|dkrltj�	|�}|�
|�dS)NZREQUEST_METHODZGETZCONTENT_LENGTHr_)�os�environrcr�rxr��	TypeErrorr;�stdinrzr�)r'r�Zlengthrrr�handle_request�s�

z&CGIXMLRPCRequestHandler.handle_request)FNF)N)r-r[r\r(r�r�r�rrrrr��s
r�c@s:eZdZdiiifdd�Zdiiidfdd�Zdd�ZdS)�
ServerHTMLDocNcCsZ|p|j}g}d}t�d�}|�||�}	|	s0�q:|	��\}
}|�||||
���|	��\}}
}}}}|
r�||��dd�}|�d||f�n�|r�dt|�}|�d|||�f�n~|r�dt|�}|�d|||�f�nV|||d�d	k�r|�|�	||||��n(|�r"|�d
|�n|�|�	||��|}q|�|||d���d�
|�S)NrzM\b((http|ftp)://\S+[\w/]|RFC[- ]?(\d+)|PEP[- ]?(\d+)|(self\.)?((?:\w|\.)+))\b�"z&quot;z<a href="%s">%s</a>z'http://www.rfc-editor.org/rfc/rfc%d.txtz(http://www.python.org/dev/peps/pep-%04d/r6�(zself.<strong>%s</strong>rQ)�escaper�r��search�spanrV�groups�replacerxZnamelinkr|)r'�textr�r!�classesrNrW�here�patternre�start�end�allZschemeZrfcZpepZselfdotr+Zurlrrr�markup�s6

zServerHTMLDoc.markupcCs�|r
|jpdd|}d}	d|�|�|�|�f}
t|�rHtt|��}nd}t|t�rp|dp`|}|dpld}n
t�|�}|
||	o�|�	d|	�}
|�
||j|||�}|o�d|}d	|
|fS)
NrQr�z$<a name="%s"><strong>%s</strong></a>z(...)rr6z'<font face="helvetica, arial">%s</font>z<dd><tt>%s</tt></dd>z<dl><dt>%s</dt>%s</dl>
)r-r�rr�r	�
isinstance�tuplerRrSZgreyr��	preformat)r'�objectr+�modr!r�rNZclZanchorZnote�titleZargspecZ	docstringZdecl�docrrr�
docroutine�s2�

��zServerHTMLDoc.docroutinec	Cs�i}|��D] \}}d|||<||||<q|�|�}d|}|�|dd�}|�||j|�}	|	ohd|	}	|d|	}g}
t|���}|D]\}}|
�|j|||d��q�||�ddd	d
�	|
��}|S)Nz#-z)<big><big><strong>%s</strong></big></big>z#ffffffz#7799eez<tt>%s</tt>z
<p>%s</p>
)r!ZMethodsz#eeaa77rQ)
�itemsr�Zheadingr�r�rMrVr�Z
bigsectionr|)r'�server_nameZpackage_documentationrNZfdict�key�value�head�resultr��contentsZmethod_itemsrrr�	docservers*
�zServerHTMLDoc.docserver)r-r[r\r�r�r�rrrrr��s)�
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�XMLRPCDocGeneratorcCsd|_d|_d|_dS)NzXML-RPC Server DocumentationzGThis server exports the following methods through the XML-RPC protocol.)r��server_documentation�server_titler2rrrr(:s�zXMLRPCDocGenerator.__init__cCs
||_dSr))r�)r'r�rrr�set_server_titleBsz#XMLRPCDocGenerator.set_server_titlecCs
||_dSr))r�)r'r�rrr�set_server_nameGsz"XMLRPCDocGenerator.set_server_namecCs
||_dSr))r�)r'r�rrr�set_server_documentationLsz+XMLRPCDocGenerator.set_server_documentationc	Cs�i}|��D]�}||jkr&|j|}n�|jdk	r�ddg}t|jd�rT|j�|�|d<t|jd�rp|j�|�|d<t|�}|dkr�|}q�t|jd�s�zt|j|�}Wq�tk
r�|}Yq�Xq�|}n|||<qt	�}|�
|j|j|�}|�
t�|j�|�S)N�_get_method_argstringrrPr6)NNr:)r/r!r"rLr�rPr�rrr�r�r�r�Zpage�htmlr�r�)r'rNrOrBZmethod_infoZ
documenterZ
documentationrrr�generate_html_documentationQs<

�
�z.XMLRPCDocGenerator.generate_html_documentationN)r-r[r\r(r�r�r�r�rrrrr�3s
r�c@seZdZdd�ZdS)�DocXMLRPCRequestHandlercCsf|��s|��dS|j���d�}|�d�|�dd�|�dtt|���|�	�|j
�|�dS)Nr rtruz	text/htmlrr)rmrwr~r�r=rr�r�r{r�r�r�r�rrr�do_GET�s
zDocXMLRPCRequestHandler.do_GETN)r-r[r\r�rrrrr��s
r�c@s"eZdZedddddfdd�ZdS)�DocXMLRPCServerTFNc
Cs&t�||||||||�t�|�dSr))r�r(r�r�rrrr(�s�zDocXMLRPCServer.__init__)r-r[r\r�r(rrrrr��s�r�c@seZdZdd�Zdd�ZdS)�DocCGIXMLRPCRequestHandlercCsT|���d�}td�tdt|��t�tj��tjj�|�tjj��dS)Nr zContent-Type: text/htmlr�)	r�r=r�r{r;r�r�r�r�r�rrrr��s
z%DocCGIXMLRPCRequestHandler.handle_getcCst�|�t�|�dSr))r�r(r�r2rrrr(�s
z#DocCGIXMLRPCRequestHandler.__init__N)r-r[r\r�r(rrrrr��sr��__main__c@s"eZdZdd�ZGdd�d�ZdS)�ExampleServicecCsdS)NZ42rr2rrr�getData�szExampleService.getDatac@seZdZedd��ZdS)zExampleService.currentTimecCs
tj��Sr))�datetimeZnowrrrr�getCurrentTime�sz)ExampleService.currentTime.getCurrentTimeN)r-r[r\�staticmethodr�rrrr�currentTime�sr�N)r-r[r\r�r�rrrrr��sr�)Z	localhosti@cCs||Sr)r)�x�yrrr�<lambda>�rnr��add)rz&Serving XML-RPC on localhost port 8000zKIt is advisable to run this example server within a secure, closed network.z&
Keyboard interrupt received, exiting.)T)0Z
xmlrpc.clientrrrrrZhttp.serverr�	functoolsr�inspectr	r�r�r�r;r�r�rRr�Zfcntl�ImportErrorrrrr]r�r�r�r�ZHTMLDocr�r�r�r�r�r-r�r�r~r,�powr*r5r�Z
serve_forever�KeyboardInterrupt�exitrrrr�<module>ksf

�,EbQ��