Ë A`ÿ˜0ò'ãóP—dZddlZejd«Zdd„ZGd„d«Zy)a0This 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. éNs[ ()<>@,;:\\"/\[\]?=]có´—|�Ut|«dkDrG|stj|«r)|jdd«jdd«}d||fzSd||fzS|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ó\s\\ó"z\"s%s="%s"s%s=%s)ÚlenÚ tspecialsÚsearchÚreplace)ÚparamÚvalueÚquotes ú?usr/lib/python3.12/site-packages/mercurial/hgweb/wsgiheaders.pyÚ _formatparamrsd€ð МS ›Z¨!š^Ù ”I×$Ñ$ UÔ+Ø—M‘M %¨Ó1×9Ñ9¸$ÀÓFˆEØ ¨ Ñ.Ð .à˜u e˜nÑ,Ð ,àˆ ócóz—eZdZdZdd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z dd „Z d „Z d „Zd„Zd„Zd„Zd„Zd„Zd„Zy)ÚHeadersz,Manage a collection of HTTP response headersNcó°—|�|ng}t|«tur td«‚||_ |D]'\}}|j |«|j |«Œ)y)Ns+Headers must be a list of name/value tuples)ÚtypeÚlistÚ TypeErrorÚ_headersÚ_convert_string_type)ÚselfÚheadersÚkÚvs r Ú__init__zHeaders.__init__#sZ€Ø$Ð0‘'°bˆÜ �‹=¤Ñ $ÜÐJÓKÐ K؈Œ Ø Û‘��1Ø×)Ñ)¨!Ô,Ø×)Ñ)¨!Õ,ñ rcóV—t|«tur|Stdt|«z«‚)zConvert/check value type.z2Header names/values must be of type bytes (got %s))rÚbytesÚAssertionErrorÚrepr)rr s r rzHeaders._convert_string_type-s1€ä �‹;œ%Ñ ØˆLÜð 'Ü)-¨e«ñ 5ó ð rcó,—t|j«S)z9Return the total number of headers, including duplicates.)rr©rs r Ú__len__zHeaders.__len__6s€ä�4—=‘=Ó!Ð!rcó€—||=|jj|j|«|j|«f«y)zSet the value of a header.N)rÚappendr)rÚnameÚvals r Ú __setitem__zHeaders.__setitem__:s9€à �ˆJØ � ‰ ×ÑØ × &Ñ & tÓ ,¨d×.GÑ.GÈÓ.LÐ Mõ rcóÈ—|j|j««}|jD�cgc]}|dj«|k7sŒ|‘Œc}|jddycc}w)zxDelete 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__AsO€ð×(Ñ(¨¯©«Ó6ˆØ)-¯ªÓP© 2¸"¸Q¹%¿+¹+»-È4Ó:OšB¨ÑPˆ� ‰ ‘aÑùÒPs ®AÁ Acó$—|j|«S)aFGet 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__Hs€ð�x‰x˜‹~Ðrcó(—|j|«duS)z/Return true if the message contains the header.Nr0r2s r Ú __contains__zHeaders.__contains__Qs€à�x‰x˜‹~ TÐ)Ð)rcó²—|j|j««}|jD�cgc]}|dj«|k(sŒ|d‘Œ c}Scc}w)apReturn 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_allUsK€ð×(Ñ(¨¯©«Ó6ˆØ $§ ¢ ÓG¡ ˜"°°A±·±³À$Ó1F��1“  ÑGÐGùÒGs ®AÁ Acóš—|j|j««}|jD]\}}|j«|k(sŒ|cS|S)z:Get the first header value for 'name', or return 'default'r*)rr&Údefaultrrs r r1z Headers.get_sD€à×(Ñ(¨¯©«Ó6ˆØ—M”M‰DˆAˆqØ�w‰w‹y˜DÓ Ø’ð"ðˆ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.valuespr?r@có —|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.itemsys€ð�}‰}™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.s s%s: %sr)Újoinr)rr-s r Ú__str__zHeaders.__str__…s;€ð�|‰|Ø&*§m¢mÓ 4¡m ˆY˜‹^ mÑ 4¸¸S°zÑ Aó ð ùÚ 4sš 2có6—t|«jd«S)Nz iso-8859-1)ÚstrÚ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'.)r1rr%r)rr&r Úresults r Ú setdefaultzHeaders.setdefault�sU€ð—‘˜$“ˆØ ˆ>Ø �M‰M× Ñ à×-Ñ-¨dÓ3Ø×-Ñ-¨eÓ4ðô ð ˆLàˆMrc óØ—g}|�"|j|«}|j|«|j«D]v\}}|j|«}|€"|j|jdd««Œ;|j|«}|jt |jdd«|««Œx|j j|j|«dj |«f«y)abExtended 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ó_ó-s; )rr%rDr rrrL)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 t¨TÓ2Õ3à×-Ñ-¨aÓ0�Ø— ‘ œ\¨!¯)©)°D¸$Ó*?ÀÓCÕDð $ð � ‰ ×ÑØ × &Ñ & uÓ -¨u¯z©z¸%Ó/@Ð Aõ r)N)rIÚ __module__Ú __qualname__Ú__doc__rrr#r(r.r3r5r8r1r>rBrDrJrMrQrTr\©rr rr s]„Ù6ó-ò ò"ò òQòò*òHóò-ò-ò òCò ò.òó  rr)Nr7)r_ÚreÚcompilerrrr`rr Úrcs1ðñó à ˆB�J‰JÐ0Ó 1€ ó ÷X òX r