o
    ßý°jç  ã                   @  sâ   d dl mZ d dlZd dlZd dlmZ ddlmZ ddlm	Z	 ddlm
Z
 ddlmZ dd	lmZ dd
lmZ e d¡Z									d,d-dd„ZejdejejB d�Ze d¡Zd.d#d$„Z		d/d0d)d*„Zdd+lmZ dS )1é    )ÚannotationsN)Údatetimeé   )Ú
_dt_as_utc)Úgenerate_etag)Ú
parse_date)Úparse_etags)Úparse_if_range_header)Úunquote_etagz&([Ww]/)?(?:"(.*?)"|(.*?))(?:\s*,\s*|$)TÚ
http_rangeú
str | NoneÚhttp_if_rangeÚhttp_if_modified_sinceÚhttp_if_none_matchÚhttp_if_matchÚetagÚdataúbytes | NoneÚlast_modifiedúdatetime | str | NoneÚignore_if_rangeÚboolÚreturnc	                 C  s  |du r|durt |ƒ}n|durtdƒ‚d}	t|tƒr t|ƒ}|dur,t|jdd�ƒ}d}
|s8| dur8t|ƒ}
|
durE|
jdurE|
j}nt|ƒ}|rS|rS||krSd}	|r†t	|ƒ\}}|
duro|
j
durot|
j
ƒ |¡}	|	 S t|ƒ}|rz| |¡}	t|ƒ}|r†| |¡ }	|	 S )a  Convenience method for conditional requests.
    :param http_range: Range HTTP header
    :param http_if_range: If-Range HTTP header
    :param http_if_modified_since: If-Modified-Since HTTP header
    :param http_if_none_match: If-None-Match HTTP header
    :param http_if_match: If-Match HTTP header
    :param etag: the etag for the response for comparison.
    :param data: or alternatively the data of the response to automatically
                 generate an etag using :func:`generate_etag`.
    :param last_modified: an optional date of the last modification.
    :param ignore_if_range: If `False`, `If-Range` header will be taken into
                            account.
    :return: `True` if the resource was modified, otherwise `False`.

    .. versionadded:: 2.2
    Nzboth data and etag givenFr   )ÚmicrosecondT)r   Ú	TypeErrorÚ
isinstanceÚstrr   r   Úreplacer	   Údater
   r   r   ÚcontainsÚcontains_weakÚ	is_strong)r   r   r   r   r   r   r   r   r   Ú
unmodifiedÚif_rangeÚmodified_sinceÚ_Úif_none_matchÚif_match© r(   ú‡/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/werkzeug/sansio/http.pyÚis_resource_modified   s:   

ò
r*   zr
    ([^=;]*)
    (?:\s*=\s*
      (
        "(?:[^\\"]|\\.)*"
      |
        .*?
      )
    )?
    \s*;\s*
    )Úflagss   \\([0-3][0-7]{2}|.)Úmút.Match[bytes]Úbytesc                 C  s,   |   d¡}t|ƒdkr|S t|dƒ dd¡S )Né   é   Úbig)ÚgroupÚlenÚintÚto_bytes)r,   Úvr(   r(   r)   Ú_cookie_unslash_replaceq   s   
r7   ÚcookieÚclsú#type[ds.MultiDict[str, str]] | Noneúds.MultiDict[str, str]c                 C  sº   |du rt  dtj¡}| s|ƒ S | › d�} g }t | ¡D ]<\}}| ¡ }| ¡ }|s+qt|ƒdkrQ|d |d   kr?dkrQn nt 	t
|dd…  ¡ ¡jd	d
�}| ||f¡ q||ƒS )a)  Parse a cookie from a string.

    The same key can be provided multiple times, the values are stored
    in-order. The default :class:`MultiDict` will have the first value
    first, and all values can be retrieved with
    :meth:`MultiDict.getlist`.

    :param cookie: The cookie header as a string.
    :param cls: A dict-like class to store the parsed cookies in.
        Defaults to :class:`MultiDict`.

    .. versionchanged:: 3.0
        Passing bytes, and the ``charset`` and ``errors`` parameters, were removed.

    .. versionadded:: 2.2
    Nztype[ds.MultiDict[str, str]]ú;r   r   éÿÿÿÿú"r/   r   )Úerrors)ÚtÚcastÚdsÚ	MultiDictÚ
_cookie_reÚfindallÚstripr3   Ú_cookie_unslash_reÚsubr7   ÚencodeÚdecodeÚappend)r8   r9   ÚoutÚckÚcvr(   r(   r)   Úparse_cookiez   s&   
,ÿþrO   )Údatastructures)	NNNNNNNNT)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r,   r-   r   r.   )NN)r8   r   r9   r:   r   r;   )Ú
__future__r   ÚreÚtypingr@   r   Ú	_internalr   Úhttpr   r   r   r	   r
   ÚcompileÚ_etag_rer*   ÚASCIIÚVERBOSErD   rG   r7   rO   Ú rP   rB   r(   r(   r(   r)   Ú<module>   s>    
÷O
ô


þ0