bgMTdZddlmZddlmZddlmZddlmZddlmZmZm Z m Z ddl m Z m Z ddlZe rde_ddlZgd Zd jZd jZd jZGd deZejejzdzZiddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1id2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSidTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtduidvdwdxdydzd{d|d}d~dddddddddddddddddddddddddiddddddddddddddddddddddddddddddddddiddddddddddÓddœddǓddɓdd˓dd͓ddϓddѓddӓddՓddדddٓddۓiddݓddߓddddddddddddddddddddddddddddddidddddddddddd d d d d ddddddddddddddddddid d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdN ZefdOZejdPZejdQZdRZ gdSZ!gdTZ"de!e"fdUZ#GdVdWeZ$dXZ%ejdYe%zdZze%zd[zejZ&Gd\d]eZ'Gd^d_e'Z(dS(`af http.cookies module ported to python-future from Py3.3 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... >>> from http import cookies Most of the time you start by creating a cookie. >>> C = cookies.SimpleCookie() Once you've created your Cookie, you can add values just as if it were a dictionary. >>> C = cookies.SimpleCookie() >>> 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 = cookies.SimpleCookie() >>> 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 = cookies.SimpleCookie() >>> 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 = cookies.SimpleCookie() >>> 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 = cookies.SimpleCookie() >>> 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 = cookies.SimpleCookie() >>> C["twix"] = "none for you" >>> C["twix"].value 'none for you' 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 = cookies.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' Finis. )unicode_literals)print_function)division)absolute_import)chrdictintstr)PY2 as_native_strN) CookieError BaseCookie SimpleCookiez;  ceZdZdS)r N)__name__ __module__ __qualname__n/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/future/backports/http/cookies.pyr r sDrr z!#$%&'*+-.^_`|~:z\000z\001z\002z\003z\004z\005z\006z\007z\010 z\011 z\012 z\013 z\014 z\015z\016z\017z\020z\021z\022z\023z\024z\025z\026z\027z\030z\031z\032z\033z\034z\035z\036z\037,z\054;z\073"\"\z\\z\177€z\200z\201‚z\202ƒz\203„z\204…z\205†z\206‡z\207ˆz\210‰z\211Šz\212‹z\213Œz\214z\215Žz\216z\217z\220‘z\221’z\222“z\223”z\224•z\225–z\226—z\227˜z\230™z\231šz\232›z\233œz\234z\235žz\236Ÿz\237 z\240¡z\241¢z\242£z\243¤z\244¥z\245¦z\246§z\247¨z\250©z\251ªz\252«z\253¬z\254­z\255®z\256¯z\257°z\260±z\261²z\262³z\263´z\264µz\265¶z\266·z\267¸z\270¹z\271ºz\272»z\273¼z\274½z\275¾z\276¿z\277Àz\300Áz\301Âz\302Ãz\303Äz\304Åz\305Æz\306Çz\307Èz\310Éz\311Êz\312Ëz\313Ìz\314Íz\315Îz\316Ïz\317Ðz\320Ñz\321Òz\322Óz\323Ôz\324Õz\325Öz\326×z\327Øz\330Ùz\331Úz\332Ûz\333Üz\334Ýz\335Þz\336ßz\337àz\340áz\341âz\342ãz\343äz\344åz\345æz\346çz\347èz\350éz\351êz\352ëz\353ìz\354íz\355îz\356ïz\357ðz\360ñz\361òz\362óz\363z\364z\365z\366z\367z\370z\371z\372z\373z\374z\375z\376z\377) ôõö÷øùúûüýþÿc|tfd|Dr|Sdtd|DzdzS)zQuote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters. c3 K|]}|vV dSNr.0c LegalCharss r z_quote..s' ( (q1 ? ( ( ( ( ( (rr;c3LK|]}t||V dSr) _Translatorget)rss rrz_quote..s0BB{q!44BBBBBBr)all _nulljoin)r rs `r_quotersW ( ( ( (C ( ( (((I YBBcBBBBBBSHHrz\\[0-3][0-7][0-7]z[\\].c ft|dkr|S|ddks |ddkr|S|dd}d}t|}g}d|cxkr|krInnEt||}t||}|s |s|||dndx}}|r|d}|r|d}|rI|r||krA|||||||dz|dz}n`|||||t t||dz|dzd|dz}d|cxkr|kCnt|S)Nrr;) len _OctalPattsearch _QuotePattappendstartrr r)mystrinreso_matchq_matchjks r_unquoters 5zzA~~  Qx3%)s** !B$KE A E A C q****1*****##E1--##E1-- w  JJuQRRy ! ! !  A  ! a  A  ! a  A  G q1uu JJuQqSz " " " JJuQqSz " " "AAA JJuQqSz " " " JJs3uQqS1W~q1122 3 3 3AA' q****1****( S>>r)MonTueWedThuFriSatSun) NJanFebMarAprMayJunJulAugSepOctNovDecc ddlm}m}|}|||z\ }}}} } } } } }d|| ||||| | | fzS)Nr)gmtimetimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)rr)future weekdayname monthnamerrnowyearmonthdayhhmmsswdyzs r_getdater3su!!!!!!!! $&&C-3VC&L-A-A*D%b"b"a 0 OS)E"2D"b" E FFrc eZdZdZdddddddd d ZeddgZd Zd Zd Z e fdZddZ e Z e dZddZddZdS)MorselaA class to hold ONE (key, value) pair. In a cookie, each such pair may have several attributes, so this class is used to keep the attributes associated with the appropriate key,value pair. This class also includes a coded_value attribute, which is used to hold the network representation of the value. This is most useful when Python objects are pickled for network transit. expiresPathCommentDomainzMax-AgesecurehttponlyVersion)r pathcommentdomainmax-ager rversioncpdx|_x|_|_|jD]}t j||ddS)Nr)keyvalue coded_value _reservedr __setitem__)selfrs r__init__zMorsel.__init__^sM37774: 0> , ,C  T3 + + + + , ,rc|}||jvrtd|ztj|||dS)NzInvalid Attribute %s)lowerrr rr)rKVs rrzMorsel.__setitem__fsK GGIIDN""4q899 9 q!$$$$$rc8||jvSr)rr)rrs r isReservedKeyzMorsel.isReservedKeylswwyyDN**rc||jvrtd|ztfd|Drtd|z||_||_||_dS)Nz!Attempt to set a reserved key: %sc3 K|]}|vV dSrrrs rrzMorsel.set..ts(00qq "000000rzIllegal key value: %s)rrr anyrrr)rrval coded_valrs `rsetz Morsel.setos 99;;$. ( (ACGHH H 0000C000 0 0 =5;<< < $rN Set-Cookie:c6|d||S)Nr) OutputString)rattrsheaders routputz Morsel.output|s" &&$"3"3E":":":;;rctr/t|jtrt |j}n|j}d|jjdt |jdt|dS)N<: =>) r isinstancerunicoder __class__rrreprrr&s r__repr__zMorsel.__repr__sg  :dj'22 dj//CC*C $ 7 7 7 #DH tCyyyy: :rcZd||ddzS)Nz r;r<)r+replace)rr,s r js_outputzMorsel.js_outputs4   ''//U;; = =rcg}|j}||jd|j||j}t |}|D]\}}|dkr ||vr|dkr>t |tr)||j|dt|U|dkr1t |tr|d|j||fz|dkr$|t|j||dkr$|t|j|||j|d|t|S)Nr2rr rz%s=%dr r) rrrrsorteditemsr4r rr _semispacejoin)rr,resultrr?rrs rr+zMorsel.OutputStrings $(((D$4$45666 =NEtzz||$$ ? ?JC{{%iJuc$:$:$."5"5"5xGHHHH !!j&<&<!w$."5u!==>>>>s4>#.//0000 ""s4>#.//0000$."5"5"5uu=>>>>f%%%r)Nr)r)rrr__doc__rr(_flagsrrr" _LegalCharsr.__str__r r9r<r+rrrrr;s,  IS(J' ( (F,,,%%% +++3> % % % %<<<<G]__::_:====&&&&&&rrz.[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]z~ (?x) # This is a verbose pattern (?P # Start of group 'key' a+? # Any word of at least one letter ) # End of group 'key' ( # Optional group: there may not be a value. \s*=\s* # Equal Sign (?P # Start of group 'val' "(?:[^\\"]|\\.)*" # Any doublequoted string | # or \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT # Special case for "expires" attr | # or a,* # Any word or empty string ) # End of group 'val' )? # End of optional value group \s* # Any number of spaces. (\s+|;|$) # Ending either at space, semicolon, or EOS. c|eZdZdZdZdZddZdZdZdd Z e Z e d Z dd Z d ZefdZdS)rz'A container class for a set of Morsels.c ||fS)a 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. rr8s r value_decodezBaseCookie.value_decodes Cxrc(t|}||fS)zreal_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 rr&strvals r value_encodezBaseCookie.value_encodes Sv~rNc8|r||dSdSr)load)rinputs rrzBaseCookie.__init__s,   IIe       rc||t}||||tj|||dS)z+Private method for setting a cookie's valueN)rrr(rr)rr real_valuerMs r__setzBaseCookie.__setsJ HHS&(( # # c:{+++ sA&&&&&rcd||\}}||||dS)zDictionary style assignment.N)rL_BaseCookie__set)rrrrvalcvals rrzBaseCookie.__setitem__s5&&u-- d 3d#####rr) cg}t|}|D].\}}||||/||S)z"Return a string suitable for HTTP.)r>r?rr.join)rr,r-seprAr?rrs rr.zBaseCookie.outputsdtzz||$$ 7 7JC MM%,,uf55 6 6 6 6xxrczg}t|}|D]v\}}tr/t|jt rt |j}n|j}|t |dt|wd|j j dt|dS)Nr2r0r1r3) r>r?r r4rr5r rr7r6r _spacejoin)rlr?rrr&s rr9zBaseCookie.__repr__s tzz||$$ 6 6JC "z%+w77 "%+&&k HHC$s)))4 5 5 5 5  6 "^444jmmmmDDrcg}t|}|D]-\}}|||.t |S)z(Return a string suitable for JavaScript.)r>r?rr<r)rr,rAr?rrs rr<zBaseCookie.js_outputs^tzz||$$ 2 2JC MM%//%00 1 1 1 1   rct|tr||n|D] \}}|||< dS)zLoad 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()) N)r4r _BaseCookie__parse_stringr?)rrawdatarrs rrNzBaseCookie.loadsZ gs # # "    ( ( ( (&mmoo " " U!S rcd}t|}d}d|cxkr|kr"ndS|||}|sdS|d|d}}|d}|ddkr|r |||dd<n|t jvr=|r:|&|t jvrd||<nLt|||<n9|7| |\} } | || | ||}d|cxkr|kdSdSdS)Nrrr&$rT) rrgroupendrrrrCrrHrU) rrpattrrrRmatchrrrVrWs r__parse_stringzBaseCookie.__parse_string&s^  JJ 1jjjjqjjjjjjKKq))E U++U[[-?-?C ! A1v}}'!&Ac!""gJ 0001}99;;&-77%)AcF!)%#"!..u55 d 3d+++I91jjjjqjjjjjjjjjrr)Nr)rX)rrrrBrHrLrrUrr.rEr r9r<rN_CookiePatternrarrrrrs11''' $$$     G]__ E E_ E!!!!   *8!!!!!!rrceZdZdZdZdZdS)rz 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. c$t||fSr)rr8s rrHzSimpleCookie.value_decodeQs}}c!!rcBt|}|t|fSr)r rrJs rrLzSimpleCookie.value_encodeTsSvf~~%%rN)rrrrBrHrLrrrrrJs< """&&&&&rr))rB __future__rrrrfuture.builtinsrrr r future.utilsr r reASCIIstring__all__rZrr@r] Exceptionr ascii_lettersdigitsrDrrcompilerrr _weekdayname _monthnamerr_LegalCharsPattrjrrrrrr|s NZZv('''''%%%%%%&&&&&&////////////++++++++  BH 7 7 7 G  X      )   (6=8;MM ? W??*07? W??*07? W??+17? W ? ?+17 ?  W ?  ? +17 ?  W ?  ?? +17 ? W??+17? W??+17? W??+17? W??+17? W?? '!? !???$%%?$f%?( W)?()?(+17)?* W+?*+?*+17+?, W-?,-?,+17-?. W/?./?.+17/?0 W1?01?0+171???2 W3?23?2+173?4 W5?45?4+175?6 W7?67?6+177?8 W9?89?8+179?: W;?:;?:+17;?< W=?<=???<+17=?> W??>??>+17??@ WA?@A?@+17A?B WC?BC?B+17C?D WE?DE?D+17E?F WG?FG?F+17G?H WI???HI?H+17I?J WK?JK?J+17K?L WM?LM?L+17M?N WO?NO?N+17O?P WQ?PQ?P+17Q?R WS?RS?R+17S???T WU?TU?T+17U?V WW?VW?V+17W?X WY?XY?X+17Y?Z W[?Z[?Z+17[?\ W]?\]?\+17]?^ W_?^_???^+17_?` Wa?`a?`+17a?b Wc?bc?b+17c?d We?de?d+17e?f Wg?fg?f+17g?h Wi?hi?h+17i?j Wk???jk?j+17k?l Wm?lm?l+17m?n Wo?no?n+17o?p Wq?pq?p+17q?r Ws?rs?r+17s?t Wu?tu?t+17u??v7 7 7 7}??? B' I I I IRZ, - - RZ ! ! )))dA@@ 888 <:FFFFw&w&w&w&w&Tw&w&w&FE     " #.qqqqqqqqh & & & & &: & & & & &r