HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyo
�
1�3\c@@s`dZddlmZmZddlZejd�Zddd�Zde	fd��YZ
dS(	s0This was forked from cpython's wsgiref.headers module to work on bytes.

Header from old file showing copyright is below.

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.
i(tabsolute_importtprint_functionNs[ \(\)<>@,;:\\"/\[\]\?=]icC@sx|dk	rpt|�dkrp|s3tj|�r_|jdd�jdd�}d||fSd||fSn|SdS(	s}Convenience function to format and return a key=value pair.
    This will quote the value if needed or if quote is true.
    is\s\\t"s\"s%s="%s"s%s=%sN(tNonetlent	tspecialstsearchtreplace(tparamtvaluetquote((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt_formatparamstHeaderscB@s�eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zdd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�ZRS(s,Manage a collection of HTTP response headerscC@sF|dk	r|ng}t|�tk	r9td��n||_dS(Ns+Headers must be a list of name/value tuples(Rttypetlistt	TypeErrort_headers(tselftheaders((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__init__"s
	cC@s0t|�tkr|Stdt|���dS(sConvert/check value type.u2Header names/values must be of type bytes (got %s)N(R
tbytestAssertionErrortrepr(RR	((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt_convert_string_type,scC@s
t|j�S(s9Return the total number of headers, including duplicates.(RR(R((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__len__3scC@s3||=|jj|j|�|j|�f�dS(sSet the value of a header.N(RtappendR(Rtnametval((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__setitem__7s	cC@sO|j|j��}g|jD]"}|dj�|kr|^q|j(dS(sxDelete all occurrences of a header, if present.
        Does *not* raise an exception if the header is missing.
        iN(RtlowerR(RRtkv((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__delitem__=scC@s
|j|�S(sFGet 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.
        (tget(RR((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__getitem__DscC@s|j|�dk	S(s/Return true if the message contains the header.N(R R(RR((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__contains__MscC@sI|j|j��}g|jD]&}|dj�|kr|d^qS(spReturn 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.
        ii(RRR(RRR((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pytget_allRscC@sI|j|j��}x-|jD]"\}}|j�|kr|SqW|S(s:Get the first header value for 'name', or return 'default'(RRR(RRtdefaulttktv((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyR ]s
cC@s g|jD]\}}|^q
S(s)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(RR%R&((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pytkeysfscC@s g|jD]\}}|^q
S(s 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(RR%R&((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pytvaluesoscC@s|jS(sGet 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.
        (R(R((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pytitemsxscC@sd|jj|jfS(Ns%s(%r)(t	__class__t__name__R(R((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__repr__�scC@s1djg|jD]}d|^qddg�S(skstr() returns the formatted headers, complete with end line,
        suitable for direct HTTP transmission.s
s%s: %st(tjoinR(RR((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt__str__�scC@st|�jd�S(Ns
iso-8859-1(tstrtencode(R((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt	__bytes__�scC@sO|j|�}|dkrG|jj|j|�|j|�f�|S|SdS(s�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'.N(R RRRR(RRR	tresult((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt
setdefault�scK@s�g}|dk	r1|j|�}|j|�nx�|j�D]t\}}|j|�}|dkr�|j|jdd��q>|j|�}|jt|jdd�|��q>W|jj|j|�dj|�f�dS(sbExtended 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.
        t_t-s; N(RRRR)RRRR.(Rt_namet_valuet_paramstpartsR%R&((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt
add_header�s&	N(R+t
__module__t__doc__RRRRRRR!R"R#R R'R(R)R,R/R2R4R;(((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyRs$
																			(R=t
__future__RRtretcompileRRRtobjectR(((sA/usr/lib64/python2.7/site-packages/mercurial/hgweb/wsgiheaders.pyt<module>s