î
i f ã @ sJ d Z d d l Z e j d ƒ Z d d d d „ Z Gd d „ d ƒ Z d S) 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 C sx | d k rp t | ƒ d k rp | s3 t j | ƒ r_ | j d d ƒ j d d ƒ } d | | f Sd | | f Sn | Sd S) z~Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true.
Nr ú\z\\ú"z\"z%s="%s"z%s=%s)ÚlenÚ tspecialsÚsearchÚreplace)ZparamÚvalueZquote© r
ú4/opt/alt/python34/lib64/python3.4/wsgiref/headers.pyÚ_formatparam
s r c @ så e Z d Z d Z d d „ Z d d „ Z d d „ Z d d „ Z d
d „ Z d d
„ Z d d „ Z
d d „ Z d d d „ Z d d „ Z
d d „ Z d d „ Z d d „ Z d d „ Z d d „ Z d! d" „ Z d# d$ „ Z d S)%ÚHeadersz,Manage a collection of HTTP response headersc C s. t | ƒ t k r! t d ƒ ‚ n | | _ d S)Nz+Headers must be a list of name/value tuples)ÚtypeÚlistÚ TypeErrorÚ_headers)ÚselfZheadersr
r
r Ú__init__ s zHeaders.__init__c C s5 t | ƒ t k r | St d j t | ƒ ƒ ƒ ‚ d S)zConvert/check value type.z1Header names/values must be of type str (got {0})N)r ÚstrÚAssertionErrorÚformatÚrepr)r r r
r
r Ú_convert_string_type) s zHeaders._convert_string_typec C s
t | j ƒ S)z9Return the total number of headers, including duplicates.)r r )r r
r
r Ú__len__0 s zHeaders.__len__c C s3 | | =| j j | j | ƒ | j | ƒ f ƒ d S)zSet the value of a header.N)r Úappendr )r ÚnameÚvalr
r
r Ú__setitem__4 s zHeaders.__setitem__c sB | j ˆ j ƒ ƒ ‰ ‡ f d d † | j Dƒ | j d d …