HEX
Server: nginx/1.30.4
System: Linux d-twindigital-web-1.host-ed.eu 4.18.0-553.141.2.el8_10.x86_64 #1 SMP Wed Jul 8 10:28:18 EDT 2026 x86_64
User: u_twindigital_html (1009)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/S3/__pycache__/Custom_httplib27.cpython-36.opt-1.pyc
3

@tJ[��@sddlmZmZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZm
Z
mZyddlmZWn ek
r�ddlmZYnXddlmZddd	gZd
d�Zdd
�Zdd�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_s3ZPATCHZPOST�PUTcCs�|jdk	rdS|j�\}}}||_|j�|_|dkr<d|_n*|jd�rNd|_n|dkr^d|_nt|��|jdkr�d|_d|_	d	|_
tt��|_dSt|j
d�|_|jdkr�x|jjD]}td
|dd�q�Wd|j_
|jjd
�}|r�|j�dkr�d	|_	d|_nd|_	|j�|_
|jjd�}|�rh|j	�rhyt|�|_Wntk
�rRd|_YnX|jdk�rnd|_nd|_|tk�s�|tk�s�d|k�o�dkn�s�|jdk�r�d|_|j
�r�|j	�r�|jdk�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�chunkedzcontent-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+�&/usr/lib/python3.6/Custom_httplib27.py�httpresponse_patched_begins\







r-cCs�d}|dkr|j�tkrd}nv|dk	r�ytt|��}Wn\ttfk
r�yttj|j��j	�}Wn*tt
fk
r�|jdkr�td�YnXYnX|dk	r�|j
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_lengthgs
r=cCs,tjdd�|D��}i}d|kr(d|d<d|kr8d|d<d}x0|j�D]$\}}	d	|j�krFd
|	j�krFd}qFWt|�}|j||f|�d|kr�|j||�x(|j�D]\}}	|jt|�t|	��q�W|s�|j|�nT|s�t	d
��|j�|j
�}
|
j�t|_
|
jtk�rt��n|
jtk�r(|j|�dS)NcSsg|]}|j��qSr+)r%)�.0�kr+r+r,�
<listcomp>�sz7httpconnection_patched_send_request.<locals>.<listcomp>�hostrZ	skip_hostzaccept-encodingZskip_accept_encodingF�expectz100-continueTzcontent-lengthz.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<Zurlr;r#Zheader_namesZskipsZexpect_continuer*�valueZrespr+r+r,�#httpconnection_patched_send_requests8rLcCs&|jtkrt|_nt��|j|�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)rHrrr�_send_output)r)�message_bodyr+r+r,�!httpconnection_patched_endheaders�s	
rOi@cCsn|jjd�dj|j�}|jdd�=t|�}t|t�rNt|�tkrN||7}d}|j|�|dk	rj|j|�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.
    �s
N)rPrP)	�_buffer�extend�joinr�
isinstancer1r2�mssrJ)r)rNrr+r+r,�"httpconnection_patched_send_output�s
rVc@seZdZdS)rIN)�__name__�
__module__�__qualname__r+r+r+r,rI�srIcCs|j|�dS)N)rJ)r)rNr+r+r,�(httpconnection_patched_wrapper_send_body�srZ)N)N)%Z
__future__rrr5�httplibrrrrrr	r
rrr
�	cStringIOr�ImportErrorZUtilsrr0r-r=rLrOrUrVrIrZZHTTPResponseZbeginZHTTPConnectionrFrMrEZ
_send_requestZwrapper_send_bodyr+r+r+r,�<module>s.0
N(