HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.30
Disabled: passthru,chgrp
Upload Files
File: //proc/2863166/root/usr/lib/python3.9/site-packages/S3/__pycache__/Custom_httplib27.cpython-39.pyc
a

�9pe��@sddlmZmZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZzddlmZWney~ddlmZYn0ddlmZgd�Zdd	�Zd
d�Zdd
�Zddd�ZdZddd�ZGdd�de�Zdd�Zeej_eej_ eej_!eej_"eej_#eej_$dS)�)�absolute_import�print_functionN)
�_CS_REQ_SENT�_CS_REQ_STARTED�CONTINUE�UnknownProtocol�CannotSendHeader�
NO_CONTENT�NOT_MODIFIED�EXPECTATION_FAILED�HTTPMessage�
HTTPException)�StringIO�)�encode_to_s3)ZPATCHZPOSTZPUTcCs�|jdurdS|��\}}}||_|��|_|dkr<d|_n*|�d�rNd|_n|dkr^d|_nt|��|jdkr�d|_d|_	d	|_
tt��|_dSt|j
d�|_|jdkr�|jjD]}td
|dd�q�d|j_
|j�d
�}|r�|��dkr�d	|_	d|_nd|_	|��|_
|j�d�}|�r`|j	�s`zt|�|_Wnt�yJd|_Yn0|jdk�rfd|_nd|_|tk�s�|tk�s�d|k�r�dk�s�n|jdk�r�d|_|j
�s�|j	�s�|jdu�r�d	|_
dS)z� Re-implemented httplib begin function
    to not loop over "100 CONTINUE" status replies
    but to report it to higher level so it can be processed.
    NzHTTP/1.0�
zHTTP/1.�zHTTP/0.9�	rrzheader:� )�endztransfer-encoding�chunked�content-length�d��ZHEAD)�msgZ_read_status�status�strip�reason�version�
startswithr�lengthrZ
will_closerr�fp�
debuglevel�headers�printZ	getheader�lowerZ
chunk_leftZ_check_close�int�
ValueErrorr	r
�_method)�selfrrr�hdrZtr_encr �r+�7/usr/lib/python3.9/site-packages/S3/Custom_httplib27.py�httpresponse_patched_beginsh





�
�
���r-cCs�d}|dur|��tvrd}nr|dur�ztt|��}WnXttfy�ztt�|���j	�}Wn(tt
fy�|jdkr�td�Yn0Yn0|dur�|�
d|�dS)N�0rz
Cannot stat!!zContent-Length)�upper�_METHODS_EXPECTING_BODY�str�len�	TypeError�AttributeError�os�fstat�fileno�st_size�OSErrorr"r$�	putheader)r)�body�methodZthelenr+r+r,�)httpconnection_patched_set_content_lengthgsr=cCs(t�dd�|D��}i}d|vr(d|d<d|vr8d|d<d}|��D]$\}}	d	|��krDd
|	��vrDd}qDt|�}|j||fi|��d|vr�|�||�|��D]\}}	|�t|�t|	��q�|s�|�|�nT|s�t	d
��|��|�
�}
|
��t|_
|
jtk�rt��n|
jtk�r$|�|�dS)NcSsg|]}|���qSr+)r%)�.0�kr+r+r,�
<listcomp>��z7httpconnection_patched_send_request.<locals>.<listcomp>�hostrZ	skip_hostzaccept-encodingZskip_accept_encodingF�expectz100-continueTrz.A body is required when expecting 100-continue)�dict�fromkeysZ	iteritemsr%rZ
putrequest�_set_content_lengthr:�
endheadersr
Zgetresponse�readr�_HTTPConnection__staterr�ExpectationFailedr�send)r)r<�urlr;r#Zheader_namesZskipsZexpect_continuer*�valueZrespr+r+r,�#httpconnection_patched_send_requests8rNcCs&|jtkrt|_nt��|�|�dS)aoIndicate that the last header line has been sent to the server.

    This method sends the request to the server.  The optional
    message_body argument can be used to pass a message body
    associated with the request.  The message body will be sent in
    the same packet as the message headers if it is string, otherwise it is
    sent as a separate packet.
    N)rIrrr�_send_output�r)�message_bodyr+r+r,�!httpconnection_patched_endheaders�s	
rRi@cCsn|j�d�d�|j�}|jdd�=t|�}t|t�rNt|�tkrN||7}d}|�|�|durj|�|�dS)z�Send the currently buffered request and clear the buffer.

    Appends an extra \r\n to the buffer.
    A message_body may be specified, to be appended to the request.
    )rArAs
N)	�_buffer�extend�joinr�
isinstancer1r2�mssrK)r)rQrr+r+r,�"httpconnection_patched_send_output�s
rXc@seZdZdS)rJN)�__name__�
__module__�__qualname__r+r+r+r,rJ�srJcCs|�|�dS)N)rKrPr+r+r,�(httpconnection_patched_wrapper_send_body�sr\)N)N)%Z
__future__rrr5Zhttplibrrrrrr	r
rrr
Z	cStringIOr�ImportErrorZ	BaseUtilsrr0r-r=rNrRrWrXrJr\ZHTTPResponseZbeginZHTTPConnectionrGrOrFZ
_send_requestZwrapper_send_bodyr+r+r+r,�<module>s.0N(