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/django/utils/__pycache__/http.cpython-310.pyc
o

�h<�@s�ddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZmZmZmZddl	mZddl	mZddlmZddlmZed	ej�Zd
��ZdZdZd
ZdZ dZ!dZ"edeee e"f�Z#edeee!e"f�Z$edeee"e f�Z%dZ&dZ'gd�Z(dBdd�ZdCdd�Z)dd�Z*dd�Z+d d!�Z,d"d#�Z-d$d%�Z.d&d'�Z/d(d)�Z0d*d+�Z1d,d-�Z2dBd.d/�Z3dDd2d3�Z4d4d5�Z5dDd6d7�Z6dBd8d9�Z7d:d;�Z8d<d=�Z9d>d?�Z:d@dA�Z;dS)E�N)�Error��
formatdate)�ParseResult�SplitResult�_coerce_args�_splitnetloc�_splitparams�quote�scheme_chars�unquote)�	urlencode)�uses_params)�MultiValueDict)�_lazy_re_compilez�
    \A(      # start of string and capture group
    (?:W/)?  # optional weak indicator
    "        # opening quote
    [^"]*    # any sequence of non-quote characters
    "        # end quote
    )\Z      # end of string and capture group
z/jan feb mar apr may jun jul aug sep oct nov decz(?P<day>[0-9]{2})z(?P<day>[ 0-9][0-9])z(?P<mon>\w{3})z(?P<year>[0-9]{4})z(?P<year>[0-9]{2})z6(?P<hour>[0-9]{2}):(?P<min>[0-9]{2}):(?P<sec>[0-9]{2})z^\w{3}, %s %s %s %s GMT$z^\w{6,9}, %s-%s-%s %s GMT$z^\w{3} %s %s %s %s$z:/?#[]@z!$&'()*+,;=)�	�
�
Fc	Cs�t|t�r
|��}n	t|d�r|��}g}|D]R\}}|dur%td|��|r.t|ttf�r1|}n1zt|�}WntyB|}Yn wg}|D]}|durStd|��t|t�s\t|�}|�	|�qG|�	||f�qt
||�S)z
    A version of Python's urllib.parse.urlencode() function that can operate on
    MultiValueDict and non-string values.
    �itemsNzjCannot encode None for key '%s' in a query string. Did you mean to pass an empty string or omit the value?)�
isinstancer�lists�hasattrr�	TypeError�str�bytes�iter�append�original_urlencode)�query�doseq�query_params�key�value�	query_val�itr�item�r&�G/usr/local/CyberPanel/lib/python3.10/site-packages/django/utils/http.pyr
7s@


�����

r
cCst|dd�S)aj
    Format the time to match the RFC 5322 date format as specified by RFC 9110
    Section 5.6.7.

    `epoch_seconds` is a floating point number expressed in seconds since the
    epoch, in UTC - such as that outputted by time.time(). If set to None, it
    defaults to the current time.

    Output a string in the format 'Wdy, DD Mon YYYY HH:MM:SS GMT'.
    T)�usegmtr)�
epoch_secondsr&r&r'�	http_date`sr*c
Cs$tttfD]
}|�|�}|durnqtd|��zetjj}t|d�}|dkrItjj	|d�j
}||d}||ddkrE||d7}n||7}t�|d�
��d}t|d	�}t|d
�}	t|d�}
t|d�}tj||||	|
||d
�}t|���WSty�}
ztd|�|
�d}
~
ww)a
    Parse a date format as specified by HTTP RFC 9110 Section 5.6.7.

    The three formats allowed by the RFC are accepted, even if only the first
    one is still in widespread use.

    Return an integer expressed in seconds since the epoch, in UTC.
    Nz%%r is not in a valid HTTP date format�year�d)�tz�2�mon��day�hour�min�sec)�tzinfoz%r is not a valid date)�RFC1123_DATE�RFC850_DATE�ASCTIME_DATE�match�
ValueError�datetime�timezone�utc�int�nowr+�MONTHS�index�lower�	timestamp�	Exception)�date�regex�mr-r+�current_year�current_century�monthr1r2r3r4�result�excr&r&r'�parse_http_datens4
���rMcCs zt|�WStyYdSw)zK
    Same as parse_http_date, but return None if the input is invalid.
    N)rMrD)rEr&r&r'�parse_http_date_safe�s

�rNcCst|�dkr
td��t|d�S)zf
    Convert a base 36 string to an int. Raise ValueError if the input won't fit
    into an int.
    �
zBase36 input too large�$)�lenr:r>��sr&r&r'�
base36_to_int�s
rTcCsVd}|dkr
td��|dkr||Sd}|dkr)t|d�\}}|||}|dks|S)z&Convert an integer to a base36 string.�$0123456789abcdefghijklmnopqrstuvwxyzrz!Negative base36 conversion input.rP�)r:�divmod)�i�char_set�b36�nr&r&r'�
int_to_base36�s�r\cCst�|��d��d�S)ze
    Encode a bytestring to a base64 string for use in URLs. Strip any trailing
    equal signs.
    s
=�ascii)�base64�urlsafe_b64encode�rstrip�decoderRr&r&r'�urlsafe_base64_encode�srbc
CsR|��}zt�|�t|�t|�dd��WSttfy(}zt|��d}~ww)zn
    Decode a base64 encoded string. Add back any trailing equal signs that
    might have been stripped.
    ��=N)�encoder^�urlsafe_b64decode�ljustrQ�LookupError�
BinasciiErrorr:)rS�er&r&r'�urlsafe_base64_decode�s$��rkcCs4|��dkr	dgSdd�|�d�D�}dd�|D�S)z�
    Parse a string of ETags given in an If-None-Match or If-Match header as
    defined by RFC 9110. Return a list of quoted ETags, or ['*'] if all ETags
    should be matched.
    �*css�|]
}t�|���VqdS�N)�
ETAG_MATCHr9�strip)�.0�etagr&r&r'�	<genexpr>�s�zparse_etags.<locals>.<genexpr>�,cSsg|]}|r|d�qS)r0r&)rpr9r&r&r'�
<listcomp>�szparse_etags.<locals>.<listcomp>)ro�split)�etag_str�etag_matchesr&r&r'�parse_etags�srxcCst�|�r|Sd|S)z�
    If the provided string is already a quoted ETag, return it. Otherwise, wrap
    the string in quotes, making it a strong ETag.
    z"%s")rnr9)rvr&r&r'�
quote_etag�s
rycCs>|sdS|��}|ddkr|�|�p||dd�kp||kS)a4
    Return ``True`` if the host is either an exact match or a match
    to the wildcard pattern.

    Any pattern beginning with a period matches a domain and all of its
    subdomains. (e.g. ``.example.com`` matches ``example.com`` and
    ``foo.example.com``). Anything else is an exact string match.
    Fr�.r0N)rB�endswith)�host�patternr&r&r'�is_same_domain�s	��r~cCs\|dur|��}|sdS|durt�}nt|t�r|h}t|||d�o-t|�dd�||d�S)a�
    Return ``True`` if the url uses an allowed host and a safe scheme.

    Always return ``False`` on an empty url.

    If ``require_https`` is ``True``, only 'https' will be considered a valid
    scheme, as opposed to 'http' and 'https' with the default, ``False``.

    Note: "True" doesn't entail that a URL is "safe". It may still be e.g.
    quoted incorrectly. Ensure to also use django.utils.encoding.iri_to_uri()
    on the path component of untrusted URLs.
    NF)�
require_https�\�/)ro�setrr� _url_has_allowed_host_and_scheme�replace)�url�
allowed_hostsrr&r&r'�url_has_allowed_host_and_schemes

���r�rVTc
Csft||�\}}}t|||�}|\}}}}}|tvr$d|vr$t|�\}}nd}t||||||�}	||	�S)a#Parse a URL into 6 components:
    <scheme>://<netloc>/<path>;<params>?<query>#<fragment>
    Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
    Note that we don't break the components up in smaller bits
    (e.g. netloc is a single string) and we don't expand % escapes.�;rV)r�	_urlsplitrr	r)
r��scheme�allow_fragments�_coerce_result�splitresult�netlocr�fragment�paramsrKr&r&r'�	_urlparse sr�cCstD]}|�|d�}q|S)NrV)�_UNSAFE_URL_BYTES_TO_REMOVEr�)r��br&r&r'�_remove_unsafe_bytes_from_url2sr�c
Cst||�\}}}t|�}t|�}d}}}|�d�}|dkr?|d|�D]}|tvr-nq%|d|���||dd�}}|dd�dkrbt|d�\}}d|vrVd	|vs^d	|vrbd|vrbtd
��|rpd|vrp|�dd�\}}d|vr||�dd�\}}t|||||�}	||	�S)
aParse a URL into 5 components:
    <scheme>://<netloc>/<path>?<query>#<fragment>
    Return a 5-tuple: (scheme, netloc, path, query, fragment).
    Note that we don't break the components up in smaller bits
    (e.g. netloc is a single string) and we don't expand % escapes.rV�:rNr0��//�[�]zInvalid IPv6 URL�#�?)	rr��findrrBrr:rur)
r�r�r�r�r�rr�rX�c�vr&r&r'r�:s,
�"r�cCs�|�d�rdSzt|�}Wn
tyYdSw|js |jr dSt�|d�ddkr-dS|j}|js8|jr8d}|r=dgnddg}|jsJ|j|voP|pP||vS)Nz///Fr�C�http�https)�
startswithr�r:r�r��unicodedata�category)r�r�r�url_infor��
valid_schemesr&r&r'r�[s$
��r�cCs |�d�rd�|dd��}|S)z�
    If redirecting to an absolute path (two leading slashes), a slash must be
    escaped to prevent browsers from handling the path as schemaless and
    redirecting to another host.
    r�z/%2F{}r�N)r��format)r�r&r&r'�escape_leading_slashesys
r�ccs��|dd�dkrg|dd�}|�d�}|dkrD|�dd|�|�dd|�drD|�d|d�}|dkrD|�dd|�|�dd|�ds(|dkrLt|�}|d|�}|��V||d�}|dd�dks	dSdS)Nr0r�r�"�\"r�)r��countrQro)rS�end�fr&r&r'�_parseparam�s�
((�
�r�cCstd|�}|����}i}|D]o}|�d�}|dkrd}|d|�����}|�d�r;|dd�}|�d�d	kr;d
}||dd���}t|�d	krk|d|dkrYdkrknn|dd�}|�d
d��dd�}|r{|�	d�\}	}
}t
||	d�}|||<q||fS)zi
    Parse a Content-type like header.
    Return the main content-type and a dictionary of options.
    r��=rFNrl����'r�Tr0r��\\r�r�)�encoding)r��__next__rBr�ror{r�rQr�rur)�line�partsr!�pdict�prX�has_encoding�namer"r��langr&r&r'�parse_header_parameters�s,

,�r�cCst|r4|rdnd}z|�d�d�|�dd��dd��}Wnty,d	�t|��}Ynw|�d
|��S|r8dSdS)zq
    Construct a Content-Disposition HTTP header value from the given filename
    as specified by RFC 6266.
    �
attachment�inliner]z
filename="{}"r�r�r�r�zfilename*=utf-8''{}z; N)rer�r��UnicodeEncodeErrorr
)�
as_attachment�filename�disposition�	file_exprr&r&r'�content_disposition_header�s
��r�)Frm)rVT)<r^r;�rer��binasciirri�email.utilsr�urllib.parserrrrr	r
rrr
rr�django.utils.datastructuresr�django.utils.regex_helperr�Xrnrur@�__D�__D2�__M�__Y�__Y2�__Tr6r7r8�RFC3986_GENDELIMS�RFC3986_SUBDELIMSr�r*rMrNrTr\rbrkrxryr~r�r�r�r�r�r�r�r�r�r&r&r&r'�<module>s`(
�

))



 

!