JFIF  x x C         C     "        } !1AQa "q2 #B R $3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz        w !1AQ aq"2 B #3R br $4 % &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz   ?  N m? j EP ó Åßjc@s{dZddlmZmZddlZejdƒZejdƒZejdƒZddd„Z d d d „ƒYZ dS( sÓ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. iÿÿÿÿ(tListTypet TupleTypeNs[ \(\)<>@,;:\\"/\[\]\?=]s[\x00-\x1F\x7F]s[\x00-\x08\x0A-\x1F\x7F]icCsx|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((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt _formatparams tHeaderscBs§eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z e Z d„Z dd „Z d „Zd „Zd „Zd „Zd„Zd„Zd„ZRS(s,Manage a collection of HTTP response headerscCset|ƒtk r!tdƒ‚n||_x4|D],\}}|j|tƒ|j|tƒq1WdS(Ns+Headers must be a list of name/value tuples(ttypeRt TypeErrort_headerst_convert_string_typetTruetFalse(tselftheaderstktv((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt__init__'s  cCs4|r tnt}|j|ƒr0tdƒ‚n|S(s£Reject control characters in header names/values. HTAB (\x09) is allowed in header values but not in header names (RFC 9110 Section 5.5). s)Control characters not allowed in headers(t_name_disallowed_ret_value_disallowed_reRt ValueError(RR tnametregex((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyR0scCs t|jƒS(s9Return the total number of headers, including duplicates.(RR(R((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt__len__;scCs9||=|jj|j|tƒ|j|tƒfƒdS(sSet the value of a header.N(RtappendRRR(RRtval((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt __setitem__?s cCsR|j|jƒtƒ}g|jD]"}|djƒ|kr"|^q"|j(dS(syDelete all occurrences of a header, if present. Does *not* raise an exception if the header is missing. iN(RtlowerRR(RRtkv((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt __delitem__FscCs |j|ƒS(sHGet 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((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt __getitem__Ns cCs|j|ƒdk S(s/Return true if the message contains the header.N(R$R(RR((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pythas_keyYscCsL|j|jƒtƒ}g|jD]&}|djƒ|kr"|d^q"S(sqReturn 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(RR!RR(RRR"((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pytget_all`scCsL|j|jƒtƒ}x-|jD]"\}}|jƒ|kr"|Sq"W|S(s:Get the first header value for 'name', or return 'default'(RR!RR(RRtdefaultRR((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyR$ls cCs 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(RRR((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pytkeysuscCs 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(RRR((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pytvaluesscCs|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((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pytitems‰scCs d|jS(Ns Headers(%r)(R(R((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt__repr__“scCs1djg|jD]}d|^qddgƒS(skstr() returns the formatted headers, complete with end line, suitable for direct HTTP transmission.s s%s: %st(tjoinR(RR"((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt__str__–scCsU|j|ƒ}|dkrM|jj|j|tƒ|j|tƒ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$RRRRRR(RRR tresult((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt setdefault›s  cKsîg}|dk r4|j|tƒ}|j|ƒnxˆ|jƒD]z\}}|j|tƒ}|dkr‡|j|jddƒƒqA|j|tƒ}|jt|jddƒ|ƒƒqAW|jj|j|tƒdj |ƒfƒdS(sfExtended 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( RRRRR+RRR RR.(Rt_namet_valuet_paramstpartsRR((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyt add_header©s  & N(t__name__t __module__t__doc__RRRR R#R%R&t __contains__R'RR$R)R*R+R,R/R1R8(((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyR #s$       (( R;ttypesRRtretcompileRRRRR R (((s4/opt/alt/python27/lib64/python2.7/wsgiref/headers.pyts