HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/__pycache__/requests_file.cpython-310.pyc
o

��h��@s�ddlmZddlmZmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZzddlm
Z
WneyAddlmZ
YnwGdd�de�ZdS)	�)�BaseAdapter)�urlparse�unquote)�Response�codesN)�BytesIO)�StringIOcs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�FileAdapterTcstt|���||_dS�N)�superr	�__init__�_set_content_length)�self�set_content_length��	__class__��C/usr/local/CyberPanel/lib/python3.10/site-packages/requests_file.pyrs
zFileAdapter.__init__c
KsP|jdvrtd|j��t|j�}|jr|jdkrtd��t�}||_z�dd�|j�d�D�}|r@|ds@|�	d�|r@|dr5t
d	d
�|D��rSttj
t�tj
���|r�|d�d�sc|d�d�r�|�	d�}|�d�ru|d
d�d}|r�|ds�|�	d�|r�|dr{nd}|tjtjj|�}|r�tj�|�s�tjtjj|g|�R�}t�|d�|_|jj|j_WnMt�y}z@|jtjkr�tj|_n|jtj
kr�tj|_ntj|_t|�� t!�"d��}	t#|	�|_|j$r�t%|	�|j&d<|jj|j_WYd
}~|Sd
}~wwtj'|_|j|_t�(|j�)��}
t*�+|
j,��r&|j$�r&|
j-|j&d<|S)z�Wraps a file, described in request, in a Response object.

        :param request: The PreparedRequest` being "sent".
        :returns: a Response object containing the file
        )�GET�HEADzInvalid request method %s�	localhostz5file: URLs with hostname components are not permittedcSsg|]}t|��qSr)r��.0�prrr�
<listcomp>0sz$FileAdapter.send.<locals>.<listcomp>�/rcss�|]}tj|vVqdSr
)�os�seprrrr�	<genexpr>8s�z#FileAdapter.send.<locals>.<genexpr>�|�:N�����rbFzContent-Length).�method�
ValueErrorr�url�netlocr�request�path�split�pop�any�IOError�errno�ENOENTr�strerror�endswithr�join�
splitdrive�io�open�raw�close�release_conn�EACCESr�	forbidden�status_code�	not_found�bad_request�str�encode�locale�getpreferredencodingrr
�len�headers�ok�fstat�fileno�stat�S_ISREG�st_mode�st_size)rr(�kwargs�	url_parts�resp�
path_parts�
path_driver)�e�resp_str�	resp_statrrr�sendsh


���


��



��zFileAdapter.sendcCsdSr
r)rrrrr7xszFileAdapter.close)T)�__name__�
__module__�__qualname__rrSr7�
__classcell__rrrrr	scr	)�requests.adaptersr�requests.compatrr�requestsrrr.rrGr@r4r�ImportErrorrr	rrrr�<module>s�