AlkantarClanX12

Your IP : 18.224.69.176


Current Path : /opt/alt/python312/lib64/python3.12/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/wsgiref/__pycache__/headers.cpython-312.opt-1.pyc

�

�Q�fn��P�dZddlZejd�Zdd�ZGd�d�Zy)z�Manage HTTP Response Headers

Much of this module is red-handedly pilfered from email.message in the stdlib,
so portions are Copyright (C) 2001,2002 Python Software Foundation, and were
written by Barry Warsaw.
�Nz[ \(\)<>@,;:\\"/\[\]\?=]c��|�Vt|�dkDrH|stj|�r*|jdd�jdd�}|�d|�d�S|�d|��S|S)z~Convenience function to format and return a key=value pair.

    This will quote the value if needed or if quote is true.
    r�\z\\�"z\"z="�=)�len�	tspecials�search�replace)�param�value�quotes   �6/opt/alt/python312/lib64/python3.12/wsgiref/headers.py�_formatparamr
s\��

��S��Z�!�^��I�$�$�U�+��M�M�$��/�7�7��U�C�E� %�u�-�-�#�U�+�+���c�z�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zdd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�Headersz,Manage a collection of HTTP response headersNc�V�|�|ng}t|�turtd��||_y)Nz+Headers must be a list of name/value tuples)�type�list�	TypeError�_headers�_convert_string_type)�self�headers�k�vs    r�__init__zHeaders.__init__s0��$�0�'�b����=��$��I�J�J���
�rc�n�t|�tur|Stdjt	|����)zConvert/check value type.z1Header names/values must be of type str (got {0}))r�str�AssertionError�format�repr)rrs  rrzHeaders._convert_string_type)s3����;�#���L��%�%+�V�D��K�%8�:�	:rc�,�t|j�S)z9Return the total number of headers, including duplicates.)rr�rs r�__len__zHeaders.__len__0s���4�=�=�!�!rc��||=|jj|j|�|j|�f�y)zSet the value of a header.N)r�appendr)r�name�vals   r�__setitem__zHeaders.__setitem__4s:����J��
�
���
�
&�
&�t�
,�d�.G�.G��.L�M�	Orc���|j|j��}|jD�cgc]}|dj�|k7s�|��c}|jddycc}w)zyDelete all occurrences of a header, if present.

        Does *not* raise an exception if the header is missing.
        rN�r�lowerr�rr(�kvs   r�__delitem__zHeaders.__delitem__:sO��
�(�(�����6��)-���P��2�"�Q�%�+�+�-�4�:O�B��P��
�
�a���Ps�A�
Ac�$�|j|�S)aHGet the first header value for 'name'

        Return None if the header is missing instead of raising an exception.

        Note that if the header appeared multiple times, the first exactly which
        occurrence gets returned is undefined.  Use getall() to get all
        the values matching a header field name.
        ��get�rr(s  r�__getitem__zHeaders.__getitem__Bs���x�x��~�rc�(�|j|�duS)z/Return true if the message contains the header.Nr2r4s  r�__contains__zHeaders.__contains__Ms���x�x��~�T�)�)rc��|j|j��}|jD�cgc]}|dj�|k(s�|d�� c}Scc}w)aqReturn a list of all the values for the named field.

        These will be sorted in the order they appeared in the original header
        list or were added to this instance, and may contain duplicates.  Any
        fields deleted and re-inserted are always appended to the header list.
        If no fields exist with the given name, returns an empty list.
        r�r,r.s   r�get_allzHeaders.get_allRsK���(�(�����6�� $�
�
�E�
�"��A������1D��1��
�E�E��Es�A�
Ac��|j|j��}|jD]\}}|j�|k(s�|cS|S)z:Get the first header value for 'name', or return 'default'r,)rr(�defaultrrs     rr3zHeaders.get^sC���(�(�����6���=�=�C�A�a��w�w�y�$����!��rc�L�|jD��cgc]\}}|��	c}}Scc}}w)a*Return a list of all the header field names.

        These will be sorted in the order they appeared in the original header
        list, or were added to this instance, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        �r�rrrs   r�keyszHeaders.keysg�$��#�m�m�,�m�d�a���m�,�,��,�� c�L�|jD��cgc]\}}|��	c}}Scc}}w)a!Return a list of all header values.

        These will be sorted in the order they appeared in the original header
        list, or were added to this instance, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        r>r?s   r�valueszHeaders.valuesqrArBc� �|jddS)aGet all the header fields and values.

        These will be sorted in the order they were in the original header
        list, or were added to this instance, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        Nr>r$s r�itemsz
Headers.items{s���}�}�Q��rc�N�|jj�d|j�d�S)N�(�))�	__class__�__name__rr$s r�__repr__zHeaders.__repr__�s���>�>�2�2�D�M�M�B�Brc�n�dj|jD�cgc]}d|z��	c}ddgz�Scc}w)zkstr() returns the formatted headers, complete with end line,
        suitable for direct HTTP transmission.z
z%s: %s�)�joinr)rr/s  r�__str__zHeaders.__str__�s6���{�{�D�M�M�B�M�b�H�r�M�M�B�B�r�7�J�K�K��Bs�2c�6�t|�jd�S)Nz
iso-8859-1)r�encoder$s r�	__bytes__zHeaders.__bytes__�s���4�y����-�-rc��|j|�}|�=|jj|j|�|j|�f�|S|S)z�Return first matching header value for 'name', or 'value'

        If there is no header named 'name', add a new header with name 'name'
        and value 'value'.)r3rr'r)rr(r�results    r�
setdefaultzHeaders.setdefault�sR��
���$����>��M�M� � �$�";�";�D�"A��)�)�%�0�"2�
3��L��Mrc	���g}|�"|j|�}|j|�|j�D]v\}}|j|�}|�"|j|jdd���;|j|�}|jt	|jdd�|���x|j
j|j|�dj
|�f�y)afExtended header setting.

        _name is the header field to add.  keyword arguments can be used to set
        additional parameters for the header field, with underscores converted
        to dashes.  Normally the parameter will be added as key="value" unless
        value is None, in which case only the key will be added.

        Example:

        h.add_header('content-disposition', 'attachment', filename='bud.gif')

        Note that unlike the corresponding 'email.message' method, this does
        *not* handle '(charset, language, value)' tuples: all values must be
        strings or None.
        N�_�-z; )rr'rFr
rrrO)r�_name�_value�_params�partsrrs       r�
add_headerzHeaders.add_header�s��� �����.�.�v�6�F��L�L�� ��M�M�O�D�A�q��)�)�!�,�A��y����Q�Y�Y�s�C�0�1��-�-�a�0�����\�!�)�)�C��*=�q�A�B�
$�	
�
�
���d�7�7��>��	�	�%�@P�Q�Rr)N)rK�
__module__�__qualname__�__doc__rrr%r*r0r5r7r:r3r@rDrFrLrPrSrVr^�rrrrs`��6�-�:�"�O�Q�	�*�
	F��-�-� �C�L�
.��Srr)Nr9)ra�re�compilerrrrbrr�<module>res3���
��B�J�J�2�3�	��\S�\Sr