File: //lib/python3.12/wsgiref/__pycache__/headers.cpython-312.pyc
�
    )!�hn  �                   �P   � d Z ddlZ ej                  d�      Zdd�Z G d� 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        |�      dkD  rH|st        j                  |�      r*|j                  dd�      j                  dd�      }| �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      �&/usr/lib/python3.12/wsgiref/headers.py�_formatparamr   
   s\   � �
 
��S��Z�!�^��I�$�$�U�+��M�M�$��/�7�7��U�C�E� %�u�-�-�#�U�+�+���    c                   �z   � e Zd ZdZdd�Zd� Zd� Zd� Zd� Zd� Z	d	� Z
d
� Zdd�Zd� Z
d
� Zd� Zd� Zd� Zd� Zd� Zd� Zy)�Headersz,Manage a collection of HTTP response headersNc                 �   � |�|ng }t        |�      t        urt        d�      �|| _        	 |D ]'