b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/Cookie.pyo
Size21.9 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:32
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
ñ� ]c@s»dZddkZyddklZlZWn)ej
oddklZlZnXddkZddkZdddddd gZ d
i
Z d i
Z d i
Z
defd
��YZeieidZh£dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6dUdV6dWdX6dYdZ6d[d\6d]d^6d_d`6dadb6dcdd6dedf6dgdh6didj6dkdl6dmdn6dodp6dqdr6dsdt6dudv6dwdx6dydz6d{d|6d}d~6dd�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d�6d�d 6d¡d¢6d£d¤6d¥d¦6d§d¨6d©dª6d«d¬6d­d®6d¯d°6d±d²6d³d´6dµd¶6d·d¸6d¹dº6d»d¼6d½d¾6d¿dÀ6dÁdÂ6dÃdÄ6dÅdÆ6dÇdÈ6dÉdÊ6dËdÌ6dÍdÎ6dÏdÐ6dÑdÒ6dÓdÔ6dÕdÖ6d×dØ6dÙdÚ6dÛdÜ6dÝdÞ6dßdà6dádâ6dãdä6dådæ6dçdè6dédê6dëdì6dídî6dïdð6dñdò6dódô6dõdö6d÷dø6dùdú6dûdü6dýdþ6dÿd6dd6dd6dd6dd6d d
6d d 6d
d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6dQdR6dSdT6Zd
i
dU�edV�D��ZeeeidW�ZeidX�ZeidY�ZdZ�Zd[d\d]d^d_d`dagZddbdcdddedfdgdhdidjdkdldmg
Zdneedo�Zdpe fdq��YZ!drZ"eidse"dte"du�Z#de fdv��YZ$de$fdw��YZ%de$fdx��YZ&de$fdy��YZ'e'Z(dz�Z)e*d{jo e)�ndS(|s)
Here's a sample session to show how to use this module.
At the moment, this is the only documentation.

The Basics
----------

Importing is easy..

>>> import Cookie

Most of the time you start by creating a cookie. Cookies come in
three flavors, each with slightly different encoding semantics, but
more on that later.

>>> C = Cookie.SimpleCookie()
>>> C = Cookie.SerialCookie()
>>> C = Cookie.SmartCookie()

[Note: Long-time users of Cookie.py will remember using
Cookie.Cookie() to create an Cookie object. Although deprecated, it
is still supported by the code. See the Backward Compatibility notes
for more information.]

Once you've created your Cookie, you can add values just as if it were
a dictionary.

>>> C = Cookie.SmartCookie()
>>> C["fig"] = "newton"
>>> C["sugar"] = "wafer"
>>> C.output()
'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer'

Notice that the printable representation of a Cookie is the
appropriate format for a Set-Cookie: header. This is the
default behavior. You can change the header and printed
attributes by using the .output() function

>>> C = Cookie.SmartCookie()
>>> C["rocky"] = "road"
>>> C["rocky"]["path"] = "/cookie"
>>> print C.output(header="Cookie:")
Cookie: rocky=road; Path=/cookie
>>> print C.output(attrs=[], header="Cookie:")
Cookie: rocky=road

The load() method of a Cookie extracts cookies from a string. In a
CGI script, you would use this method to extract the cookies from the
HTTP_COOKIE environment variable.

>>> C = Cookie.SmartCookie()
>>> C.load("chips=ahoy; vienna=finger")
>>> C.output()
'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger'

The load() method is darn-tootin smart about identifying cookies
within a string. Escaped quotation marks, nested semicolons, and other
such trickeries do not confuse it.

>>> C = Cookie.SmartCookie()
>>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
>>> print C
Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"

Each element of the Cookie also supports all of the RFC 2109
Cookie attributes. Here's an example which sets the Path
attribute.

>>> C = Cookie.SmartCookie()
>>> C["oreo"] = "doublestuff"
>>> C["oreo"]["path"] = "/"
>>> print C
Set-Cookie: oreo=doublestuff; Path=/

Each dictionary element has a 'value' attribute, which gives you
back the value associated with the key.

>>> C = Cookie.SmartCookie()
>>> C["twix"] = "none for you"
>>> C["twix"].value
'none for you'


A Bit More Advanced
-------------------

As mentioned before, there are three different flavors of Cookie
objects, each with different encoding/decoding semantics. This
section briefly discusses the differences.

SimpleCookie

The SimpleCookie expects that all values should be standard strings.
Just to be sure, SimpleCookie invokes the str() builtin to convert
the value to a string, when the values are set dictionary-style.

>>> C = Cookie.SimpleCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
>>> C["number"].value
'7'
>>> C["string"].value
'seven'
>>> C.output()
'Set-Cookie: number=7\r\nSet-Cookie: string=seven'


SerialCookie

The SerialCookie expects that all values should be serialized using
cPickle (or pickle, if cPickle isn't available). As a result of
serializing, SerialCookie can save almost any Python object to a
value, and recover the exact same object when the cookie has been
returned. (SerialCookie can yield some strange-looking cookie
values, however.)

>>> C = Cookie.SerialCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
>>> C["number"].value
7
>>> C["string"].value
'seven'
>>> C.output()
'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string="S\'seven\'\\012p1\\012."'

Be warned, however, if SerialCookie cannot de-serialize a value (because
it isn't a valid pickle'd object), IT WILL RAISE AN EXCEPTION.


SmartCookie

The SmartCookie combines aspects of each of the other two flavors.
When setting a value in a dictionary-fashion, the SmartCookie will
serialize (ala cPickle) the value *if and only if* it isn't a
Python string. String objects are *not* serialized. Similarly,
when the load() method parses out values, it attempts to de-serialize
the value. If it fails, then it fallsback to treating the value
as a string.

>>> C = Cookie.SmartCookie()
>>> C["number"] = 7
>>> C["string"] = "seven"
>>> C["number"].value
7
>>> C["string"].value
'seven'
>>> C.output()
'Set-Cookie: number="I7\\012."\r\nSet-Cookie: string=seven'


Backwards Compatibility
-----------------------

In order to keep compatibilty with earlier versions of Cookie.py,
it is still possible to use Cookie.Cookie() to create a Cookie. In
fact, this simply returns a SmartCookie.

>>> C = Cookie.Cookie()
>>> print C.__class__.__name__
SmartCookie


Finis.
iÿÿÿÿN(tdumpstloadst CookieErrort
BaseCookiet SimpleCookiet SerialCookiet SmartCookietCookiets; t cBseZRS((t__name__t
__module__(((s/usr/lib64/python2.6/Cookie.pyRçss!#$%&'*+-.^_`|~s\000ts\001ss\002ss\003ss\004ss\005ss\006ss\007ss\010ss\011s s\012s
s\013s s\014s s\015s
s\016ss\017ss\020ss\021ss\022ss\023ss\024ss\025ss\026ss\027ss\030ss\031ss\032ss\033ss\034ss\035ss\036ss\037ss\"t"s\\s\s\177ss\200s�s\201s�s\202s�s\203s�s\204s�s\205s�s\206s�s\207s�s\210s�s\211s�s\212s�s\213s�s\214s�s\215s�s\216s�s\217s�s\220s�s\221s�s\222s�s\223s�s\224s�s\225s�s\226s�s\227s�s\230s�s\231s�s\232s�s\233s�s\234s�s\235s�s\236s�s\237s�s\240s s\241s¡s\242s¢s\243s£s\244s¤s\245s¥s\246s¦s\247s§s\250s¨s\251s©s\252sªs\253s«s\254s¬s\255s­s\256s®s\257s¯s\260s°s\261s±s\262s²s\263s³s\264s´s\265sµs\266s¶s\267s·s\270s¸s\271s¹s\272sºs\273s»s\274s¼s\275s½s\276s¾s\277s¿s\300sÀs\301sÁs\302sÂs\303sÃs\304sÄs\305sÅs\306sÆs\307sÇs\310sÈs\311sÉs\312sÊs\313sËs\314sÌs\315sÍs\316sÎs\317sÏs\320sÐs\321sÑs\322sÒs\323sÓs\324sÔs\325sÕs\326sÖs\327s×s\330sØs\331sÙs\332sÚs\333sÛs\334sÜs\335sÝs\336sÞs\337sßs\340sàs\341sás\342sâs\343sãs\344säs\345sås\346sæs\347sçs\350sès\351sés\352sês\353sës\354sìs\355sís\356sîs\357sïs\360sðs\361sñs\362sòs\363sós\364sôs\365sõs\366sös\367s÷s\370søs\371sùs\372sús\373sûs\374süs\375sýs\376sþs\377sÿccsx|]}t|�VqWdS(N(tchr(t.0tx((s/usr/lib64/python2.6/Cookie.pys <genexpr>3s icCsCd||||�jo|Sdttti||��dSdS(NRR
(t _nulljointmapt _Translatortget(tstrt
LegalCharstidmapt translate((s/usr/lib64/python2.6/Cookie.pyt_quote5ss\\[0-3][0-7][0-7]s[\\].c
Cs¸t|�djo|S|ddjp|ddjo|S|dd!}d}t|�}g}xGd|jo
|jno(ti||�}ti||�}| o| o|i||�Pnd}}|o|id�}n|o|id�}n|oL| p
||jo7|i|||!�|i||d�|d}qg|i|||!�|itt||d|d!d���|d}qgWt|�S(NiiR
iÿÿÿÿiii( tlent
_OctalPatttsearcht
_QuotePatttappendtstartRtintR(RtitntrestOmatchtQmatchtjtk((s/usr/lib64/python2.6/Cookie.pyt_unquoteGs8"
 
+tMontTuetWedtThutFritSattSuntJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDecic
Csoddkl}l}|�}|||�\ }}}} }
} } }
}d|| ||||| |
| fS(Niÿÿÿÿ(tgmtimettimes#%s, %02d-%3s-%4d %02d:%02d:%02d GMT(R=R<(tfuturet weekdaynamet monthnameR<R=tnowtyeartmonthtdaythhtmmtsstwdtytz((s/usr/lib64/python2.6/Cookie.pyt_getdates
 +tMorselcBs¬eZhdd6dd6dd6dd6dd6d d 6d
d
6d d 6Zd
�Zd�Zd�Zeeei d�Z
ddd�Z e Z
d�Zdd�Zdd�ZRS(texpirestPathtpathtCommenttcommenttDomaintdomainsMax-Agesmax-agetsecurethttponlytVersiontversioncCsBd|_|_|_x$|iD]}ti||d�q!WdS(NR(tNonetkeytvaluet coded_valuet _reservedtdictt __setitem__(tselftK((s/usr/lib64/python2.6/Cookie.pyt__init__ªs
cCsG|i�}||ijotd|��nti|||�dS(NsInvalid Attribute %s(tlowerR\RR]R^(R_R`tV((s/usr/lib64/python2.6/Cookie.pyR^³s cCs|i�|ijS(N(RbR\(R_R`((s/usr/lib64/python2.6/Cookie.pyt
isReservedKeyºscCsv|i�|ijotd|��nd||||�jotd|��n||_||_||_dS(Ns!Attempt to set a reserved key: %sRsIllegal key value: %s(RbR\RRYRZR[(R_RYtvalt coded_valRRR((s/usr/lib64/python2.6/Cookie.pytset¾s  s Set-Cookie:cCsd||i|�fS(Ns%s %s(t OutputString(R_tattrstheader((s/usr/lib64/python2.6/Cookie.pytoutputÎscCs#d|ii|it|i�fS(Ns <%s: %s=%s>(t __class__R
RYtreprRZ(R_((s/usr/lib64/python2.6/Cookie.pyt__repr__Ós cCsd|i|�fS(Ns�
<script type="text/javascript">
<!-- begin hiding
document.cookie = "%s";
// end hiding -->
</script>
(Rh(R_Ri((s/usr/lib64/python2.6/Cookie.pyt js_output×scCs�g}|i}|d|i|if�|djo
|i}n|i�}|i�x7|D]/\}}|djoq`n||joq`n|djo>t|�td�jo%|d|i|t|�f�q`|djo8t|�td�jo|d|i||f�q`|djo|t |i|��q`|djo|t |i|��q`|d|i||f�q`Wt
|�S( Ns%s=%sRRMismax-ages%s=%dRTRU( RRYR[RXR\titemstsortttypeRKRt_semispacejoin(R_RitresulttRARpR`Rc((s/usr/lib64/python2.6/Cookie.pyRhâs. 

 
 

&%&

N(R
R R\RaR^Rdt _LegalCharst_idmaptstringRRgRXRkt__str__RnRoRh(((s/usr/lib64/python2.6/Cookie.pyRL�s$

    s.[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]s (?x)(?P<key>sI+?)\s*=\s*(?P<val>"(?:[^\\"]|\\.)*"|\w{3},\s[\w\d-]{9,11}\s[\d:]{8}\sGMT|s*)\s*;?cBszeZd�Zd�Zd d�Zd�Zd�Zd ddd�ZeZ d�Z
d d �Z d
�Z e
d �ZRS(
cCs
||fS(s
real_value, coded_value = value_decode(STRING)
Called prior to setting a cookie's value from the network
representation. The VALUE is the value read from HTTP
header.
Override this function to modify the behavior of cookies.
((R_Re((s/usr/lib64/python2.6/Cookie.pyt value_decode(scCst|�}||fS(sýreal_value, coded_value = value_encode(VALUE)
Called prior to setting a cookie's value from the dictionary
representation. The VALUE is the value being assigned.
Override this function to modify the behavior of cookies.
(R(R_Retstrval((s/usr/lib64/python2.6/Cookie.pyt value_encode2s cCs|o|i|�ndS(N(tload(R_tinput((s/usr/lib64/python2.6/Cookie.pyRa<scCs?|i|t��}|i|||�ti|||�dS(s+Private method for setting a cookie's valueN(RRLRgR]R^(R_RYt
real_valueR[tM((s/usr/lib64/python2.6/Cookie.pyt__set@scCs,|i|�\}}|i|||�dS(sDictionary style assignment.N(R|t_BaseCookie__set(R_RYRZtrvaltcval((s/usr/lib64/python2.6/Cookie.pyR^Gss Set-Cookie:s
cCsYg}|i�}|i�x-|D]%\}}|i|i||��q#W|i|�S(s"Return a string suitable for HTTP.(RpRqRRktjoin(R_RiRjtsepRtRpR`Rc((s/usr/lib64/python2.6/Cookie.pyRkMs 
 cCsmg}|i�}|i�x4|D],\}}|id|t|i�f�q#Wd|iit|�fS(Ns%s=%ss<%s: %s>(RpRqRRmRZRlR
t
_spacejoin(R_tLRpR`Rc((s/usr/lib64/python2.6/Cookie.pyRnYs 
 $cCsSg}|i�}|i�x*|D]"\}}|i|i|��q#Wt|�S(s(Return a string suitable for JavaScript.(RpRqRRoR(R_RiRtRpR`Rc((s/usr/lib64/python2.6/Cookie.pyRoas 
 cCsUt|�td�jo|i|�n(x$|i�D]\}}|||<q7WdS(sÝLoad cookies from a string (presumably HTTP_COOKIE) or
from a dictionary. Loading cookies from a dictionary 'd'
is equivalent to calling:
map(Cookie.__setitem__, d.keys(), d.values())
RN(Rrt_BaseCookie__ParseStringRp(R_trawdataR'tv((s/usr/lib64/python2.6/Cookie.pyR}ks 
c Cs#d}t|�}d}xd|jo
|jnoå|i||�}|pPn|id�|id�}}|id�}|ddjo|o|||d<qq|i�tijo|ot|�||<qq|i |�\} }
|i
|| |
�||}qWdS(NiRYRet$i( RRXRtgrouptendRbRLR\R(RzR�( R_RtpattR!R"R�tmatchR`RcR�R�((s/usr/lib64/python2.6/Cookie.pyt
__ParseStringzs& N(R
R RzR|RXRaR�R^RkRyRnRoR}t_CookiePatternR�(((s/usr/lib64/python2.6/Cookie.pyR$s

  
 
cBs eZdZd�Zd�ZRS(s
SimpleCookie
SimpleCookie supports strings as cookie values. When setting
the value using the dictionary assignment notation, SimpleCookie
calls the builtin str() to convert the value to a string. Values
received from HTTP are kept as strings.
cCst|�|fS(N(R((R_Re((s/usr/lib64/python2.6/Cookie.pyRz�scCst|�}|t|�fS(N(RR(R_ReR{((s/usr/lib64/python2.6/Cookie.pyR|¡s (R
R t__doc__RzR|(((s/usr/lib64/python2.6/Cookie.pyR�s cBs,eZdZdd�Zd�Zd�ZRS(s.SerialCookie
SerialCookie supports arbitrary objects as cookie values. All
values are serialized (using cPickle) before being sent to the
client. All incoming values are assumed to be valid Pickle
representations. IF AN INCOMING VALUE IS NOT IN A VALID PICKLE
FORMAT, THEN AN EXCEPTION WILL BE RAISED.

Note: Large cookie values add overhead because they must be
retransmitted on every HTTP transaction.

Note: HTTP has a 2k limit on the size of a cookie. This class
does not check for this limit, so be careful!!!
cCs$tidt�ti||�dS(Ns-SerialCookie class is insecure; do not use it(twarningstwarntDeprecationWarningRRa(R_R~((s/usr/lib64/python2.6/Cookie.pyRa´s cCstt|��|fS(N(RR((R_Re((s/usr/lib64/python2.6/Cookie.pyRz¹scCs|tt|��fS(N(RR(R_Re((s/usr/lib64/python2.6/Cookie.pyR|¼sN(R
R R�RXRaRzR|(((s/usr/lib64/python2.6/Cookie.pyR¦s
  cBs,eZdZdd�Zd�Zd�ZRS(sïSmartCookie
SmartCookie supports arbitrary objects as cookie values. If the
object is a string, then it is quoted. If the object is not a
string, however, then SmartCookie will use cPickle to serialize
the object into a string representation.

Note: Large cookie values add overhead because they must be
retransmitted on every HTTP transaction.

Note: HTTP has a 2k limit on the size of a cookie. This class
does not check for this limit, so be careful!!!
cCs$tidt�ti||�dS(Ns3Cookie/SmartCookie class is insecure; do not use it(R�R�R�RRa(R_R~((s/usr/lib64/python2.6/Cookie.pyRaÍs cCs5t|�}yt|�|fSWn||fSXdS(N(R(R(R_ReR{((s/usr/lib64/python2.6/Cookie.pyRzÒs
 cCsDt|�td�jo|t|�fS|tt|��fSdS(NR(RrRR(R_Re((s/usr/lib64/python2.6/Cookie.pyR|ØsN(R
R R�RXRaRzR|(((s/usr/lib64/python2.6/Cookie.pyRÀs   cCs%ddk}ddk}|i|�S(Niÿÿÿÿ(tdoctestRttestmod(R�R((s/usr/lib64/python2.6/Cookie.pyt_testést__main__(+R�RxtcPickleRRt ImportErrortpickletreR�t__all__R�RRsR�t ExceptionRt
ascii_letterstdigitsRvRtxrangeRwRRtcompileRRR(t _weekdaynameRXt
_monthnameRKR]RLt_LegalCharsPattR�RRRRRR�R
(((s/usr/lib64/python2.6/Cookie.pyt<module>Ís¸       2| 
t$