MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.144.38.184
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /../lib64/python2.7/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //../lib64/python2.7/cookielib.pyo
�
m��fc@s�dZddddddddd	g	Zd
dlZd
dlZd
dlZd
dlZd
dlZyd
dlZWne	k
r�d
dl
ZnXd
dlZd
dlm
Z
eZead
�Zeej�ZdZd�ZdZd�ZdddddddgZdddddddd d!d"d#d$gZgZx!eD]Zejej��qCWed%�Z ed&�Z!ied'6ed(6ed)6ed*6Z"ej#d+�Z$d,�Z%d-�Z&ej#d.�Z'ej#d/ej(�Z)ej#d0ej*�Z+d1�Z,ej#d2ej*�Z-d3�Z.d4�Z/ej#d5�Z0ej#d6�Z1ej#d7�Z2ej#d8�Z3d9�Z4ej#d:�Z5d;�Z6d<�Z7d=�Z8ej#d>�Z9d?�Z:d@�Z;dA�Z<dB�Z=ej#dC�Z>dD�Z?dE�Z@dF�ZAdG�ZBdHZCej#dI�ZDdJ�ZEdK�ZFdL�ZGdM�ZHdfdN��YZIdfdO��YZJdeJfdP��YZKdQ�ZLdR�ZMdSfdT��YZNdfdU��YZOdePfdV��YZQdeOfdW��YZRd
dXlSmTZTmUZUd
dYlVmWZWdS(Zs�HTTP cookie handling for web clients.

This module has (now fairly distant) origins in Gisle Aas' Perl module
HTTP::Cookies, from the libwww-perl library.

Docstrings, comments and debug strings in this code refer to the
attributes of the HTTP cookie system as cookie-attributes, to distinguish
them clearly from Python attributes.

Class diagram (note that BSDDBCookieJar and the MSIE* classes are not
distributed with the Python standard library, but are available from
http://wwwsearch.sf.net/):

                        CookieJar____
                        /     \      \
            FileCookieJar      \      \
             /    |   \         \      \
 MozillaCookieJar | LWPCookieJar \      \
                  |               |      \
                  |   ---MSIEBase |       \
                  |  /      |     |        \
                  | /   MSIEDBCookieJar BSDDBCookieJar
                  |/
               MSIECookieJar

tCookiet	CookieJartCookiePolicytDefaultCookiePolicyt
FileCookieJartLWPCookieJartlwp_cookie_strt	LoadErrortMozillaCookieJari����N(ttimegmcGs;ts
dSts.ddl}|jd�antj|�S(Ni����t	cookielib(tdebugtloggertloggingt	getLogger(targsR
((s!/usr/lib64/python2.7/cookielib.pyt_debug+ssQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsgddl}ddl}ddl}|j�}|jd|�|j�}|jd|dd�dS(Ni����scookielib bug!
%st
stackleveli(twarningst	tracebacktStringIOt	print_exctNonetgetvaluetwarn(RRRtftmsg((s!/usr/lib64/python2.7/cookielib.pyt_warn_unhandled_exception9s
$i�cCs�|d \}}}}}}|tkr�d|ko?dknr�d|ko[dknr�d|kowdknr�d|ko�dknr�d|ko�dknr�t|�SdSdS(	Niiiiiii;i=(t
EPOCH_YEARR	R(ttttyeartmonthtmdaythourtmintsec((s!/usr/lib64/python2.7/cookielib.pyt_timegmHs
DT
tMontTuetWedtThutFritSattSuntJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDeccCsZ|dkrtj�}ntj|�d \}}}}}}d||||||fS(sHReturn a string representing time in seconds since epoch, t.

    If the function is called without an argument, it will use the current
    time.

    The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ",
    representing Universal Time (UTC, aka GMT).  An example of this format is:

    1994-11-24 08:49:37Z

    is%04d-%02d-%02d %02d:%02d:%02dZN(Rttimetgmtime(ttRtmonR R!R"R#((s!/usr/lib64/python2.7/cookielib.pyt	time2isozVs
%cCsl|dkrtj�}ntj|�d \}}}}}}}dt||t|d||||fS(s�Return a string representing time in seconds since epoch, t.

    If the function is called without an argument, it will use the current
    time.

    The format of the returned string is like this:

    Wed, DD-Mon-YYYY HH:MM:SS GMT

    is"%s %02d-%s-%04d %02d:%02d:%02d GMTiN(RR8R9tDAYStMONTHS(R:RR;R R!R"R#twday((s!/usr/lib64/python2.7/cookielib.pyt
time2netscapegs
(tGMTtUTCtUTtZs^([-+])?(\d\d?):?(\d\d)?$cCs�d}|tkrd}ntj|�}|r�dt|jd��}|jd�rx|dt|jd��}n|jd�dkr�|}q�n|S(Niiiii<it-(Rt	UTC_ZONEStTIMEZONE_REtsearchtinttgroup(ttztoffsettm((s!/usr/lib64/python2.7/cookielib.pytoffset_from_tz_string{s	 
c
	Cs�ytj|j��d}Wn_tk
r~yt|�}Wntk
rQdSXd|koidknrw|}qdSnX|dkr�d}n|dkr�d}n|dkr�d}nt|�}t|�}t|�}t|�}t|�}|dkr�tjtj��d}|d}	|}
|||	}|	|
}	t|	�dkr�|	dkrr|d}q|d}q�nt	|||||||f�}|dk	r�|dkr�d}n|j
�}t|�}|dkr�dS||}n|S(Niiii�idi2RB(tMONTHS_LOWERtindextlowert
ValueErrorRIRR8t	localtimetabsR$tupperRN(
tdayR;tyrthrR"R#RKtimontcur_yrRMttmpR:RL((s!/usr/lib64/python2.7/cookielib.pyt	_str2time�sR

				


!	
sV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$s+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*s�^
    (\d\d?)            # day
       (?:\s+|[-\/])
    (\w+)              # month
        (?:\s+|[-\/])
    (\d+)              # year
    (?:
          (?:\s+|:)    # separator before clock
       (\d\d?):(\d\d)  # hour:min
       (?::(\d\d))?    # optional seconds
    )?                 # optional clock
       \s*
    ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+)? # timezone
       \s*
    (?:\(\w+\))?       # ASCII representation of timezone in parens.
       \s*$cCs4tj|�}|r�|j�}tj|dj��d}t|d�|t|d�t|d�t|d�t|d�f}t|�S|j	�}t
jd|d�}d	gd\}}}}}}	}
t
j|�}|d	k	r|j�\}}}}}}	}
nd	St||||||	|
�S(
s�Returns time in seconds since epoch of time represented by a string.

    Return value is an integer.

    None is returned if the format of str is unrecognized, the time is outside
    the representable range, or the timezone string is not recognized.  If the
    string contains no timezone, UTC is assumed.

    The timezone in the string may be numerical (like "-0800" or "+0100") or a
    string timezone (like "UTC", "GMT", "BST" or "EST").  Currently, only the
    timezone strings equivalent to UTC (zero offset) are known to the function.

    The function loosely parses the following formats:

    Wed, 09 Feb 1994 22:23:32 GMT       -- HTTP format
    Tuesday, 08-Feb-94 14:15:29 GMT     -- old rfc850 HTTP format
    Tuesday, 08-Feb-1994 14:15:29 GMT   -- broken rfc850 HTTP format
    09 Feb 1994 22:23:32 GMT            -- HTTP format (no weekday)
    08-Feb-94 14:15:29 GMT              -- rfc850 format (no weekday)
    08-Feb-1994 14:15:29 GMT            -- broken rfc850 format (no weekday)

    The parser ignores leading and trailing whitespace.  The time may be
    absent.

    If the year is given with only 2 digits, the function will select the
    century that makes the year closest to the current date.

    iiiiiitiN(tSTRICT_DATE_RERHtgroupsRORPRQRItfloatR$tlstript
WEEKDAY_REtsubRtLOOSE_HTTP_DATE_RER\(ttextRMtgR;RRVRWRXR"R#RK((s!/usr/lib64/python2.7/cookielib.pyt	http2time�s-
"$s�^
    (\d{4})              # year
       [-\/]?
    (\d\d?)              # numerical month
       [-\/]?
    (\d\d?)              # day
   (?:
         (?:\s+|[-:Tt])  # separator before clock
      (\d\d?):?(\d\d)    # hour:min
      (?::?(\d\d(?:\.\d*)?))?  # optional seconds (and fractional)
   )?                    # optional clock
      \s*
   ([-+]?\d\d?:?(:?\d\d)?
    |Z|z)?               # timezone  (Z is "zero meridian", i.e. GMT)
      \s*$c
Cs�|j�}dgd\}}}}}}}tj|�}|dk	rp|j�\}}}}}}}}	ndSt|||||||�S(sv
    As for http2time, but parses the ISO 8601 formats:

    1994-02-03 14:15:29 -0100    -- ISO 8601 format
    1994-02-03 14:15:29          -- zone is optional
    1994-02-03                   -- only date
    1994-02-03T14:15:29          -- Use T as separator
    19940203T141529Z             -- ISO 8601 compact format
    19940203                     -- only date

    iN(RaRtISO_DATE_RERHR_R\(
ReRVR;RWRXR"R#RKRMt_((s!/usr/lib64/python2.7/cookielib.pytiso2times
"'cCs+|jd�\}}|j| |j|S(s)Return unmatched part of re.Match object.i(tspantstring(tmatchtstarttend((s!/usr/lib64/python2.7/cookielib.pyt	unmatched=ss^\s*([^=\s;,]+)s&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"s^\s*=\s*([^\s;,]*)s\\(.)c
Csg}xr|D]j}|}g}x?|r`tj|�}|r�t|�}|jd�}tj|�}|r�t|�}|jd�}tjd|�}nEtj|�}|r�t|�}|jd�}|j�}nd}|j
||f�q"|j�jd�r<|j�d}|r3|j
|�ng}q"t
jdd|�\}}	|}q"W|r
|j
|�q
q
W|S(smParse header values into a list of lists containing key,value pairs.

    The function knows how to deal with ",", ";" and "=" as well as quoted
    values after "=".  A list of space separated tokens are parsed as if they
    were separated by ";".

    If the header_values passed as argument contains multiple values, then they
    are treated as if they were a single value separated by comma ",".

    This means that this function is useful for parsing header fields that
    follow this syntax (BNF as from the HTTP/1.1 specification, but we relax
    the requirement for tokens).

      headers           = #header
      header            = (token | parameter) *( [";"] (token | parameter))

      token             = 1*<any CHAR except CTLs or separators>
      separators        = "(" | ")" | "<" | ">" | "@"
                        | "," | ";" | ":" | "\" | <">
                        | "/" | "[" | "]" | "?" | "="
                        | "{" | "}" | SP | HT

      quoted-string     = ( <"> *(qdtext | quoted-pair ) <"> )
      qdtext            = <any TEXT except <">>
      quoted-pair       = "\" CHAR

      parameter         = attribute "=" value
      attribute         = token
      value             = token | quoted-string

    Each header is represented by a list of key/value pairs.  The value for a
    simple token (not part of a parameter) is None.  Syntactically incorrect
    headers will not necessarily be parsed as you would want.

    This is easier to describe with some examples:

    >>> split_header_words(['foo="bar"; port="80,81"; discard, bar=baz'])
    [[('foo', 'bar'), ('port', '80,81'), ('discard', None)], [('bar', 'baz')]]
    >>> split_header_words(['text/html; charset="iso-8859-1"'])
    [[('text/html', None), ('charset', 'iso-8859-1')]]
    >>> split_header_words([r'Basic realm="\"foo\bar\""'])
    [[('Basic', None), ('realm', '"foobar"')]]

    is\1t,s^[=\s;]*R]N(tHEADER_TOKEN_RERHRpRJtHEADER_QUOTED_VALUE_REtHEADER_ESCAPE_RERctHEADER_VALUE_REtrstripRtappendRat
startswithtretsubn(
t
header_valuestresultRet	orig_texttpairsRMtnametvaluetnon_junkt
nr_junk_chars((s!/usr/lib64/python2.7/cookielib.pytsplit_header_wordsFs>.
		
s([\"\\])cCs�g}x�|D]�}g}xq|D]i\}}|dk	r|tjd|�sitjd|�}d|}nd||f}n|j|�q W|r
|jdj|��q
q
Wdj|�S(s�Do the inverse (almost) of the conversion done by split_header_words.

    Takes a list of lists of (key, value) pairs and produces a single header
    value.  Attribute values are quoted if needed.

    >>> join_header_words([[("text/plain", None), ("charset", "iso-8859/1")]])
    'text/plain; charset="iso-8859/1"'
    >>> join_header_words([[("text/plain", None)], [("charset", "iso-8859/1")]])
    'text/plain, charset="iso-8859/1"'

    s^\w+$s\\\1s"%s"s%s=%ss; s, N(RRyRHtHEADER_JOIN_ESCAPE_RERcRwtjoin(tliststheadersR~tattrtktv((s!/usr/lib64/python2.7/cookielib.pytjoin_header_words�s

cCs<|jd�r|d}n|jd�r8|d }n|S(Nt"ii����(Rxtendswith(Re((s!/usr/lib64/python2.7/cookielib.pyt
_strip_quotes�s


cCshd}g}xU|D]M}g}t}xttjd|��D]�\}}|j�}|d	krhq>nd
|kr�|d}}	n'tjd|d�\}}	|j�}|d
kr|j�}
|
|kr�|
}n|dkr�t|	�}	t	}n|dkrt
t|	��}	qn|j||	f�q>W|r|sP|jd�n|j|�qqW|S(s5Ad-hoc parser for Netscape protocol cookie-attributes.

    The old Netscape cookie format for Set-Cookie can for instance contain
    an unquoted "," in the expires field, so we have to use this ad-hoc
    parser instead of split_header_words.

    XXX This may not make the best possible effort to parse all the crap
    that Netscape Cookie headers contain.  Ronald Tschalar's HTTPClient
    parser is probably better, so could do worse than following that if
    this ever gives any trouble.

    Currently, this is also used for parsing RFC 2109 cookies.

    texpirestdomaintpathtsecuretversiontportsmax-ages;\s*R]t=s\s*=\s*iit0(sexpiressdomainspathssecuresversionsportsmax-ageN(sversionR�(tFalset	enumerateRytsplitRvRRaRQR�tTrueRgRw(t
ns_headerstknown_attrsR|t	ns_headerR~tversion_settiitparamR�R�tlc((s!/usr/lib64/python2.7/cookielib.pytparse_ns_headers�s:
%		s\.\d+$cCsKtj|�rtS|dkr#tS|ddksC|ddkrGtStS(s*Return True if text is a host domain name.R]it.i����(tIPV4_RERHR�R�(Re((s!/usr/lib64/python2.7/cookielib.pytis_HDN�s cCs�|j�}|j�}||kr(tSt|�s8tS|j|�}|dks_|dkrctS|jd�svtSt|d�s�tStS(s�Return True if domain A domain-matches domain B, according to RFC 2965.

    A and B may be host domain names or IP addresses.

    RFC 2965, section 1:

    Host names can be specified either as an IP address or a HDN string.
    Sometimes we compare one host name with another.  (Such comparisons SHALL
    be case-insensitive.)  Host A's name domain-matches host B's if

         *  their host name strings string-compare equal; or

         * A is a HDN string and has the form NB, where N is a non-empty
            name string, B has the form .B', and B' is a HDN string.  (So,
            x.y.com domain-matches .Y.com but not Y.com.)

    Note that domain-match is not a commutative operation: a.b.c.com
    domain-matches .c.com, but not the reverse.

    i����iR�i(RQR�R�R�trfindRx(tAtBti((s!/usr/lib64/python2.7/cookielib.pytdomain_matchscCstj|�rtStS(sdReturn True if text is a sort-of-like a host domain name.

    For accepting/blocking domains.

    (R�RHR�R�(Re((s!/usr/lib64/python2.7/cookielib.pytliberal_is_HDN'scCs�|j�}|j�}t|�o-t|�sD||kr@tStS|jd�}|rl|j|�rltS|r�||kr�tStS(s\For blocking/accepting domains.

    A and B may be host domain names or IP addresses.

    R�(RQR�R�R�RxR�(R�R�tinitial_dot((s!/usr/lib64/python2.7/cookielib.pytuser_domain_match1ss:\d+$cCs_|j�}tj|�d}|dkr@|jdd�}ntjd|d�}|j�S(s�Return request-host, as defined by RFC 2965.

    Variation from RFC: returned value is lowercased, for convenient
    comparison.

    iR]tHost(tget_full_urlturlparset
get_headertcut_port_reRcRQ(trequestturlthost((s!/usr/lib64/python2.7/cookielib.pytrequest_hostFscCsLt|�}}|jd�dkrBtj|�rB|d}n||fS(szReturn a tuple (request-host, effective request-host name).

    As defined by RFC 2965, except both are lowercased.

    R�i����s.local(R�tfindR�RH(R�terhntreq_host((s!/usr/lib64/python2.7/cookielib.pyteff_request_hostVs%
cCsJ|j�}tj|�}t|j�}|jd�sFd|}n|S(s6Path component of request-URI, as defined by RFC 2965.t/(R�R�turlsplittescape_pathR�Rx(R�R�tpartsR�((s!/usr/lib64/python2.7/cookielib.pytrequest_pathas
cCsr|j�}|jd�}|dkrh||d}yt|�Wqntk
rdtd|�dSXnt}|S(Nt:iisnonnumeric port: '%s'(tget_hostR�RIRRRRtDEFAULT_HTTP_PORT(R�R�R�R�((s!/usr/lib64/python2.7/cookielib.pytrequest_portks

s%/;:@&=+$,!~*'()s%([0-9a-fA-F][0-9a-fA-F])cCsd|jd�j�S(Ns%%%si(RJRU(Rm((s!/usr/lib64/python2.7/cookielib.pytuppercase_escaped_char}scCsIt|t�r!|jd�}ntj|t�}tjt|�}|S(sEEscape any invalid characters in HTTP URL, and uppercase all escapes.sutf-8(	t
isinstancetunicodetencodeturllibtquotetHTTP_PATH_SAFEtESCAPED_CHAR_RERcR�(R�((s!/usr/lib64/python2.7/cookielib.pyR�s

cCsk|jd�}|dkrg||d}|jd�}t|�rg|dks\|dkrgd|Sn|S(sBReturn reach of host h, as defined by RFC 2965, section 1.

    The reach R of a host name H is defined as follows:

       *  If

          -  H is the host domain name of a host; and,

          -  H has the form A.B; and

          -  A has no embedded (that is, interior) dots; and

          -  B has at least one embedded dot, or B is the string "local".
             then the reach of H is .B.

       *  Otherwise, the reach of H is H.

    >>> reach("www.acme.com")
    '.acme.com'
    >>> reach("acme.com")
    'acme.com'
    >>> reach("acme.local")
    '.local'

    R�iitlocal(R�R�(thR�tb((s!/usr/lib64/python2.7/cookielib.pytreach�s$cCs3t|�}t|t|j���s+tStSdS(s�

    RFC 2965, section 3.3.6:

        An unverifiable transaction is to a third-party host if its request-
        host U does not domain-match the reach R of the request-host O in the
        origin transaction.

    N(R�R�R�tget_origin_req_hostR�R�(R�R�((s!/usr/lib64/python2.7/cookielib.pytis_third_party�s
cBsVeZdZed�Zd�Zdd�Zd�Zdd�Z	d�Z
d�ZRS(	s�HTTP Cookie.

    This class represents both Netscape and RFC 2965 cookies.

    This is deliberately a very simple class.  It just holds attributes.  It's
    possible to construct Cookie instances that don't comply with the cookie
    standards.  CookieJar.make_cookies is the factory function for Cookie
    objects -- it deals with cookie parsing, supplying defaults, and
    normalising to the representation used in this class.  CookiePolicy is
    responsible for checking them to see whether they should be accepted from
    and returned to the server.

    Note that the port may be present in the headers, but unspecified ("Port"
    rather than"Port=80", for example); if this is the case, port is None.

    cCs	|dk	rt|�}n|dk	r6t|�}n|dkr]|tkr]td��n||_||_||_||_||_|j	�|_
||_||_|	|_
|
|_||_||_|
|_||_||_||_tj|�|_dS(Ns-if port is None, port_specified must be false(RRIR�RRR�RR�R�tport_specifiedRQR�tdomain_specifiedtdomain_initial_dotR�tpath_specifiedR�R�tdiscardtcommenttcomment_urltrfc2109tcopyt_rest(tselfR�RR�R�R�R�R�R�R�R�R�R�R�R�R�trestR�((s!/usr/lib64/python2.7/cookielib.pyt__init__�s.
															cCs
||jkS(N(R�(R�R((s!/usr/lib64/python2.7/cookielib.pythas_nonstandard_attr�scCs|jj||�S(N(R�tget(R�Rtdefault((s!/usr/lib64/python2.7/cookielib.pytget_nonstandard_attrscCs||j|<dS(N(R�(R�RR�((s!/usr/lib64/python2.7/cookielib.pytset_nonstandard_attrscCsA|dkrtj�}n|jdk	r=|j|kr=tStS(N(RR8R�R�R�(R�tnow((s!/usr/lib64/python2.7/cookielib.pyt
is_expireds
cCsx|jdkrd}n
d|j}|j||j}|jdk	rad|j|jf}n	|j}d||fS(NR]R�s%s=%ss<Cookie %s for %s>(R�RR�R�R�R(R�tptlimitt	namevalue((s!/usr/lib64/python2.7/cookielib.pyt__str__s	
	cCs�g}x:dD]2}t||�}|jd|t|�f�q
W|jdt|j��|jdt|j��ddj|�S(NR�RR�R�R�R�R�R�R�R�R�R�R�R�R�s%s=%ssrest=%ss
rfc2109=%ss
Cookie(%s)s, (sversionsnamesvaluesportsport_specifiedsdomainsdomain_specifiedsdomain_initial_dotspathspath_specifiedssecuresexpiressdiscardscommentscomment_url(tgetattrRwtreprR�R�R�(R�RRR�((s!/usr/lib64/python2.7/cookielib.pyt__repr__s
!N(t__name__t
__module__t__doc__R�R�R�RR�R�R�R�R�(((s!/usr/lib64/python2.7/cookielib.pyR�s 			
cBs2eZdZd�Zd�Zd�Zd�ZRS(s Defines which cookies get accepted from and returned to server.

    May also modify cookies, though this is probably a bad idea.

    The subclass DefaultCookiePolicy defines the standard rules for Netscape
    and RFC 2965 cookies -- override that if you want a customised policy.

    cCs
t��dS(s�Return true if (and only if) cookie should be accepted from server.

        Currently, pre-expired cookies never get this far -- the CookieJar
        class deletes such cookies itself.

        N(tNotImplementedError(R�tcookieR�((s!/usr/lib64/python2.7/cookielib.pytset_ok.scCs
t��dS(sAReturn true if (and only if) cookie should be returned to server.N(R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pyt	return_ok7scCstS(sMReturn false if cookies should not be returned, given cookie domain.
        (R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytdomain_return_ok;scCstS(sKReturn false if cookies should not be returned, given cookie path.
        (R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytpath_return_ok@s(R�R�R�R�R�R�R�(((s!/usr/lib64/python2.7/cookielib.pyR%s
				c
Bs#eZdZdZdZdZdZeeBZdde	e
de
e
e	e
ee
e
d�Zd�Zd�Z
d�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!RS(sBImplements the standard rules for accepting and returning cookies.iiiic

Cs�||_||_||_||_||_||_|	|_|
|_||_||_	|dk	rxt|�|_n	d|_|dk	r�t|�}n||_
dS(sAConstructor arguments should be passed as keyword arguments only.N((tnetscapetrfc2965trfc2109_as_netscapethide_cookie2t
strict_domaintstrict_rfc2965_unverifiabletstrict_ns_unverifiabletstrict_ns_domaintstrict_ns_set_initial_dollartstrict_ns_set_pathRttuplet_blocked_domainst_allowed_domains(
R�tblocked_domainstallowed_domainsR�R�R�R�R�R�R�R�R�R�((s!/usr/lib64/python2.7/cookielib.pyR�Ps 
											cCs|jS(s4Return the sequence of blocked domains (as a tuple).(R(R�((s!/usr/lib64/python2.7/cookielib.pyRqscCst|�|_dS(s$Set the sequence of blocked domains.N(RR(R�R((s!/usr/lib64/python2.7/cookielib.pytset_blocked_domainstscCs+x$|jD]}t||�r
tSq
WtS(N(RR�R�R�(R�R�tblocked_domain((s!/usr/lib64/python2.7/cookielib.pyt
is_blockedxscCs|jS(s=Return None, or the sequence of allowed domains (as a tuple).(R(R�((s!/usr/lib64/python2.7/cookielib.pyR~scCs(|dk	rt|�}n||_dS(s-Set the sequence of allowed domains, or None.N(RRR(R�R((s!/usr/lib64/python2.7/cookielib.pytset_allowed_domains�scCs>|jdkrtSx$|jD]}t||�rtSqWtS(N(RRR�R�R�(R�R�tallowed_domain((s!/usr/lib64/python2.7/cookielib.pytis_not_allowed�scCsWtd|j|j�x:d	D]2}d|}t||�}|||�stSqWtS(
s�
        If you override .set_ok(), be sure to call this method.  If it returns
        false, so should your subclass (assuming your subclass wants to be more
        strict about which cookies to accept).

        s - checking cookie %s=%sR�t
verifiabilityRR�R�R�tset_ok_(sversionRsnamespathsdomainsport(RRR�R�R�R�(R�R�R�tntfn_nametfn((s!/usr/lib64/python2.7/cookielib.pyR��s

cCs{|jdkr)td|j|j�tS|jdkrP|jrPtd�tS|jdkrw|jrwtd�tStS(Ns0   Set-Cookie2 without version attribute (%s=%s)is$   RFC 2965 cookies are switched offs$   Netscape cookies are switched off(	R�RRRR�R�R�R�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytset_ok_version�s

cCsk|j�rgt|�rg|jdkr>|jr>td�tS|jdkrg|jrgtd�tSntS(Nis>   third-party RFC 2965 cookie during unverifiable transactions>   third-party Netscape cookie during unverifiable transaction(tis_unverifiableR�R�R�RR�R�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytset_ok_verifiability�s

cCsB|jdkr>|jr>|jjd�r>td|j�tStS(Nit$s'   illegal name (starts with '$'): '%s'(R�R�RRxRR�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytset_ok_name�s
cCsm|jrit|�}|jdks<|jdkri|jri|j|j�ritd|j|�tSntS(Nis7   path attribute %s is not a prefix of request path %s(	R�R�R�R�RxR�RR�R�(R�R�R�treq_path((s!/usr/lib64/python2.7/cookielib.pytset_ok_path�s	
c
Cs�|j|j�r&td|j�tS|j|j�rLtd|j�tS|jr�t|�\}}|j}|jr|jd�dkr|j	d�}|j	dd|�}|dkr||d}||d|!}	|	j
�d"krt|�dkrtd|�tSqn|jd�r4|d}
n|}
|
j
d�dk}|rs|dkrstd|�tS|jdkr�|j|�r�|jd�r�d|j|�r�td||�tSn|jdks�|j|j@rt||�std ||�tSn|jdks1|j|j@r�|t|� }|j
d�dkr~tj|�r~td!||�tSq�ntS(#Ns"   domain %s is in user block-lists&   domain %s is not in user allow-listR�iiitcotactcomtedutorgtnettgovtmilRItaerotbiztcattcooptinfotjobstmobitmuseumRtprottravelteus&   country-code second level domain %ss.locals/   non-local domain %s contains no embedded dotsO   effective request-host %s (even with added initial dot) does not end with %ss5   effective request-host %s does not domain-match %ss.   host prefix %s for domain %s contains a dot(scoRRRRRRRsintRR scatR"sinfoR$R%R&snameR'R(R)(RR�RR�R
R�R�R�tcountR�RQtlenRxR�R�R�R�tDomainRFC2965MatchR�tDomainStrictNoDotsR�RHR�(
R�R�R�R�R�R�R�tjttldtsldtundotted_domaint
embedded_dotsthost_prefix((s!/usr/lib64/python2.7/cookielib.pyt
set_ok_domain�sf			






cCs�|jr�t|�}|dkr*d}nt|�}xt|jjd�D]F}yt|�Wntk
r~td|�t	SX||krIPqIqIWtd||j�t	Snt
S(Nt80Rqs   bad port %s (not numeric)s$   request port (%s) not found in %s(R�R�RtstrR�R�RIRRRR�R�(R�R�R�treq_portR�((s!/usr/lib64/python2.7/cookielib.pytset_ok_ports"		


cCsWtd|j|j�x:d	D]2}d|}t||�}|||�stSqWtS(
s�
        If you override .return_ok(), be sure to call this method.  If it
        returns false, so should your subclass (assuming your subclass wants to
        be more strict about which cookies to return).

        s - checking cookie %s=%sR�RR�R�R�R�t
return_ok_(sversions
verifiabilityssecuresexpiressportsdomain(RRR�R�R�R�(R�R�R�R
RR((s!/usr/lib64/python2.7/cookielib.pyR�!s	

cCsR|jdkr'|jr'td�tS|jdkrN|jrNtd�tStS(Nis$   RFC 2965 cookies are switched offs$   Netscape cookies are switched off(R�R�RR�R�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_version3s

cCsk|j�rgt|�rg|jdkr>|jr>td�tS|jdkrg|jrgtd�tSntS(Nis>   third-party RFC 2965 cookie during unverifiable transactions>   third-party Netscape cookie during unverifiable transaction(RR�R�R�RR�R�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_verifiability<s

cCs-|jr)|j�dkr)td�tStS(Nthttpss(   secure cookie with non-secure request(R�tget_typeRR�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_secureHs
cCs$|j|j�r td�tStS(Ns   cookie expired(R�t_nowRR�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_expiresNs
cCsu|jrqt|�}|dkr*d}nxD|jjd�D]}||kr=Pq=q=Wtd||j�tSntS(NR5Rqs0   request port %s does not match cookie port %s(R�R�RR�RR�R�(R�R�R�R7R�((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_portTs		
c
Cs�t|�\}}|j}|r>|jd�r>d|}n|}|jdkr�|j|j@r�|jr�||kr�td�tS|jdkr�t	||�r�td||�tS|jdkr�d|j
|�r�td||�tStS(NR�isQ   cookie with unspecified domain does not string-compare equal to request domainsQ   effective request-host name %s does not domain-match RFC 2965 cookie domain %ss;   request-host %s does not match Netscape cookie domain %s(R�R�RxR�R�tDomainStrictNonDomainR�RR�R�R�R�(R�R�R�R�R�R�t	dotdomain((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_domainbs&	


#
cCs�t|�\}}|jd�s.d|}n|jd�sJd|}n|rm|jd�rmd|}n|}|j|�p�|j|�s�tS|j|�r�td|�tS|j|�r�td|�tStS(NR�s"   domain %s is in user block-lists&   domain %s is not in user allow-list(R�RxR�R�RRR
R�(R�R�R�R�R�RC((s!/usr/lib64/python2.7/cookielib.pyR�}s"




cCs@td|�t|�}|j|�s<td||�tStS(Ns- checking cookie path=%ss  %s does not path-match %s(RR�RxR�R�(R�R�R�R((s!/usr/lib64/python2.7/cookielib.pyR��s
N("R�R�R�R-RBR,t
DomainLiberaltDomainStrictRR�R�R�RRRRRR
R�RRRRR4R8R�R:R;R>R@RARDR�R�(((s!/usr/lib64/python2.7/cookielib.pyRFsL
													;										cCs&|j�}|j�t|j|�S(N(tkeystsorttmapR�(tadictRG((s!/usr/lib64/python2.7/cookielib.pytvals_sorted_by_key�s
ccsvt|�}xc|D][}t}y|jWntk
r=n#Xt}xt|�D]}|VqQW|s|VqqWdS(sBIterates over nested mapping, depth-first, in sorted order by key.N(RKR�titemstAttributeErrorR�t
deepvalues(tmappingtvaluestobjtsubobj((s!/usr/lib64/python2.7/cookielib.pyRN�s

	tAbsentcBseZRS((R�R�(((s!/usr/lib64/python2.7/cookielib.pyRS�scBs(eZdZejd�Zejd�Zejd�Zejd�Zejd�Z	dZ
dd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdddd�Zd�Zd�Zd�Zd�Zd�Zd�Z RS(s�Collection of HTTP cookies.

    You may not need to know about this class: try
    urllib2.build_opener(HTTPCookieProcessor).open(url).

    s\Ws([\"\\])s\.?[^.]*s[^.]*s^\.+s^\#LWP-Cookies-(\d+\.\d+)cCs=|dkrt�}n||_tj�|_i|_dS(N(RRt_policyt
_threadingtRLockt
_cookies_lockt_cookies(R�tpolicy((s!/usr/lib64/python2.7/cookielib.pyR��s
	cCs
||_dS(N(RT(R�RY((s!/usr/lib64/python2.7/cookielib.pyt
set_policy�scCs�g}|jj||�sgStd|�|j|}x�|j�D]~}|jj||�sgqFn||}xP|j�D]B}|jj||�s�td�q~ntd�|j|�q~WqFW|S(Ns!Checking %s for cookies to returns   not returning cookies   it's a match(	RTR�RRXRGR�RPR�Rw(R�R�R�tcookiestcookies_by_pathR�tcookies_by_nameR�((s!/usr/lib64/python2.7/cookielib.pyt_cookies_for_domain�s 




cCs=g}x0|jj�D]}|j|j||��qW|S(s2Return a list of cookies to be returned to server.(RXRGtextendR^(R�R�R[R�((s!/usr/lib64/python2.7/cookielib.pyt_cookies_for_request�sc	Cs�|jdd�dt�t}g}x�|D]�}|j}|sjt}|dkrj|jd|�qjn|jdk	r�|jj|j�r�|dkr�|j	j
d|j�}n	|j}|jdkr�|j|j�n|jd|j|f�|dkr,|jr&|jd|j
�n|jjd	�r{|j}|jrg|jd	�rg|d
}n|jd|�n|jdk	r�d}|jr�|d
|j}n|j|�q�q,q,W|S(s�Return a list of cookie-attributes to be returned to server.

        like ['foo="bar"; $Path="/"', ...]

        The $Version attribute is also added when appropriate (currently only
        once per request).

        tkeycSs
t|j�S(N(R+R�(targ((s!/usr/lib64/python2.7/cookielib.pyt<lambda>�streverseis$Version=%ss\\\1s%s=%ss
$Path="%s"R�is$Domain="%s"s$Ports="%s"N(RHR�R�R�RwR�Rtnon_word_reRHtquote_reRcRR�R�R�RxR�R�R�(	R�R[R�tattrsR�R�R�R�R�((s!/usr/lib64/python2.7/cookielib.pyt
_cookie_attrs�s>

	!			

	cCstd�|jj�z�ttj��|j_|_|j|�}|j|�}|r�|j	d�s�|j
ddj|��q�n|jjr�|jj
r�|j	d�r�x4|D])}|jdkr�|j
dd�Pq�q�WnWd|jj�X|j�dS(s�Add correct Cookie: header to request (urllib2.Request object).

        The Cookie2 header is also added unless policy.hide_cookie2 is true.

        tadd_cookie_headerRs; tCookie2is$Version="1"N(RRWtacquireRIR8RTR?R`Rht
has_headertadd_unredirected_headerR�R�R�R�treleasetclear_expired_cookies(R�R�R[RgR�((s!/usr/lib64/python2.7/cookielib.pyRi)s$


c
Csg}d}d}x|D]�}|d\}}t}t}	i}
i}x�|dD]�\}}
|j�}||ks�||kr�|}n||kr�|
dkr�t}
n||
kr�qRn|dkr�|
dkr�td
�t}	Pn|
j�}
n|dkr0|rqRn|
dkr0td�qRq0n|dkr�t}yt|
�}
Wn"tk
rvtd�t}	PnXd}|j|
}
n||ks�||kr�|
dkr�|dkr�td|�t}	Pn|
|
|<qR|
||<qRW|	r�qn|j|||
|f�qW|S(sReturn list of tuples containing normalised cookie information.

        attrs_set is the list of lists of key,value pairs extracted from
        the Set-Cookie or Set-Cookie2 headers.

        Tuples are name, value, standard, rest, where name and value are the
        cookie name and value, standard is a dictionary containing the standard
        cookie-attributes (discard, secure, version, expires or max-age,
        domain, path and port) and rest is a dictionary containing the rest of
        the cookie-attributes.

        R�R�R�R�smax-ageR�R�R�R�t
commenturliis%   missing value for domain attributesM   missing or invalid value for expires attribute: treating as session cookies?   missing or invalid (non-numeric) value for max-age attributes!   missing value for %s attribute(sdiscardssecure(sversionsexpiressmax-agesdomainspathsportscommentRpN(sportscommentRp(	R�RQRR�RRIRRR?Rw(R�t	attrs_sett
cookie_tuplest
boolean_attrstvalue_attrstcookie_attrsRR�tmax_age_sett
bad_cookietstandardR�R�R�R�((s!/usr/lib64/python2.7/cookielib.pyt_normalized_cookie_tuplesJsl


		

	


cCs�|\}}}}|jdt�}|jdt�}|jdt�}	|jdt�}
|jdd�}|dk	r�yt|�}Wq�tk
r�dSXn|jdt�}|jdt�}
|jdd�}|jd	d�}|tk	r|d
krt}t|�}nrt}t|�}|j	d�}|dkrl|d
kr[|| }ql||d }nt
|�d
kr�d}n|tk	}t}|r�t|jd��}n|tkr�t
|�\}}|}n|jd�s�d|}nt}|	tk	rE|	dkr't|�}	qKt}tjdd
|	�}	nd}	|
tkrfd}
t}
nQ|
|jkr�y|j|||�Wntk
r�nXtd|||�dSt||||	||||||||
|
|||�S(NR�R�R�R�R�R�R�R�RpR]R�i����iiR�s\s+s2Expiring cookie, domain='%s', path='%s', name='%s'(R�RSRRIRRR�R�R�R�R�R+tboolRxR�R�RyRcR?tcleartKeyErrorRR(R�ttupR�RR�RxR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�((s!/usr/lib64/python2.7/cookielib.pyt_cookie_from_cookie_tuple�s�

		
	

	cCsR|j|�}g}x6|D].}|j||�}|r|j|�qqW|S(N(RyR~Rw(R�RqR�RrR[R}R�((s!/usr/lib64/python2.7/cookielib.pyt_cookies_from_attrs_sets
cCsst|jdd�}|dkr1|jj}nx;|D]3}|jdkr8t|_|rkd|_qkq8q8WdS(NR�ii(R�RTRR�R�R�R�(R�R[t
rfc2109_as_nsR�((s!/usr/lib64/python2.7/cookielib.pyt_process_rfc2109_cookiess
	c
Cs�|j�}|jd�}|jd�}|jj}|jj}|rP|sz|r^|sz|rl|sz|r~|r~gSy|jt|�|�}Wntk
r�t�g}nX|r�|r�y|jt	|�|�}	Wntk
rt�g}	nX|j
|	�|rhi}
x*|D]"}d|
|j|j
|jf<q$W|
d�}t||	�}	n|	r�|j|	�q�n|S(sAReturn sequence of Cookie objects extracted from response object.sSet-Cookie2s
Set-CookiecSs"|j|j|jf}||kS(N(R�R�R(t	ns_cookietlookupRa((s!/usr/lib64/python2.7/cookielib.pytno_matching_rfc2965HsN(R#t
getheadersRTR�R�RR�t	ExceptionRR�R�RR�R�RtfilterR_(
R�tresponseR�R�trfc2965_hdrstns_hdrsR�R�R[t
ns_cookiesR�R�R�((s!/usr/lib64/python2.7/cookielib.pytmake_cookiessB





 cCsj|jj�zHttj��|j_|_|jj||�rT|j|�nWd|jj�XdS(s-Set a cookie if policy says it's OK to do so.N(	RWRkRIR8RTR?R�t
set_cookieRn(R�R�R�((s!/usr/lib64/python2.7/cookielib.pytset_cookie_if_okRs
cCs�|j}|jj�zi|j|kr8i||j<n||j}|j|krdi||j<n||j}|||j<Wd|jj�XdS(s?Set a cookie, without checking whether or not it should be set.N(RXRWRkR�R�RRn(R�R�tctc2tc3((s!/usr/lib64/python2.7/cookielib.pyR�_s	


cCs�td|j��|jj�zrttj��|j_|_xL|j||�D]8}|jj	||�rUtd|�|j
|�qUqUWWd|jj�XdS(sAExtract cookies from response, where allowable given the request.sextract_cookies: %ss setting cookie: %sN(RR#RWRkRIR8RTR?R�R�R�Rn(R�R�R�R�((s!/usr/lib64/python2.7/cookielib.pytextract_cookiesls

cCs�|dk	rH|dks$|dkr3td��n|j|||=nZ|dk	r�|dkrotd��n|j||=n"|dk	r�|j|=n	i|_dS(s�Clear some cookies.

        Invoking this method without arguments will clear all cookies.  If
        given a single argument, only cookies belonging to that domain will be
        removed.  If given two arguments, cookies belonging to the specified
        path within that domain are removed.  If given three arguments, then
        the cookie with the specified name, path and domain is removed.

        Raises KeyError if no matching cookie exists.

        s8domain and path must be given to remove a cookie by names.domain must be given to remove cookies by pathN(RRRRX(R�R�R�R((s!/usr/lib64/python2.7/cookielib.pyR{zs
cCs_|jj�z=x6|D].}|jr|j|j|j|j�qqWWd|jj�XdS(s�Discard all session cookies.

        Note that the .save() method won't save session cookies anyway, unless
        you ask otherwise by passing a true ignore_discard argument.

        N(RWRkR�R{R�R�RRn(R�R�((s!/usr/lib64/python2.7/cookielib.pytclear_session_cookies�s

	'cCsq|jj�zOtj�}x<|D]4}|j|�r#|j|j|j|j�q#q#WWd|jj�XdS(s�Discard all expired cookies.

        You probably don't need to call this method: expired cookies are never
        sent back to the server (provided you're using DefaultCookiePolicy),
        this method is called by CookieJar itself every so often, and the
        .save() method won't save expired cookies anyway (unless you ask
        otherwise by passing a true ignore_expires argument).

        N(	RWRkR8R�R{R�R�RRn(R�R�R�((s!/usr/lib64/python2.7/cookielib.pyRo�s


'cCs
t|j�S(N(RNRX(R�((s!/usr/lib64/python2.7/cookielib.pyt__iter__�scCs%d}x|D]}|d}q
W|S(s#Return number of contained cookies.ii((R�R�R�((s!/usr/lib64/python2.7/cookielib.pyt__len__�s
cCsDg}x!|D]}|jt|��q
Wd|jdj|�fS(Ns<%s[%s]>s, (RwR�t	__class__R�(R�trR�((s!/usr/lib64/python2.7/cookielib.pyR��s
cCsDg}x!|D]}|jt|��q
Wd|jdj|�fS(Ns<%s[%s]>s, (RwR6R�R�(R�R�R�((s!/usr/lib64/python2.7/cookielib.pyR��s
N(!R�R�R�RytcompileReRftstrict_domain_ret	domain_retdots_retmagic_reRR�RZR^R`RhRiRyR~RR�R�R�R�R�R{R�RoR�R�R�R�(((s!/usr/lib64/python2.7/cookielib.pyR�s8				;	!	a	\				6	
	
						cBseZRS((R�R�(((s!/usr/lib64/python2.7/cookielib.pyR�scBsVeZdZdedd�Zdeed�Zdeed�Zdeed�ZRS(s6CookieJar that can be loaded from and saved to a file.cCs]tj||�|dk	rAy|dWqAtd��qAXn||_t|�|_dS(s}
        Cookies are NOT loaded from the named file until either the .load() or
        .revert() method is called.

        R]sfilename must be string-likeN(RR�RRRtfilenameRzt	delayload(R�R�R�RY((s!/usr/lib64/python2.7/cookielib.pyR��s	cCs
t��dS(sSave cookies to a file.N(R�(R�R�tignore_discardtignore_expires((s!/usr/lib64/python2.7/cookielib.pytsave�scCsn|dkr6|jdk	r'|j}q6tt��nt|�}z|j||||�Wd|j�XdS(sLoad cookies from a file.N(RR�RRtMISSING_FILENAME_TEXTtopent_really_loadtclose(R�R�R�R�R((s!/usr/lib64/python2.7/cookielib.pytload�scCs�|dkr6|jdk	r'|j}q6tt��n|jj�z\tj|j�}i|_y|j	|||�Wn#t
tfk
r�||_�nXWd|jj�XdS(s�Clear all cookies and reload cookies from a saved file.

        Raises LoadError (or IOError) if reversion is not successful; the
        object's state will not be altered if this happens.

        N(
RR�RRR�RWRkR�tdeepcopyRXR�RtIOErrorRn(R�R�R�R�t	old_state((s!/usr/lib64/python2.7/cookielib.pytrevert�s
		N(	R�R�R�RR�R�R�R�R�(((s!/usr/lib64/python2.7/cookielib.pyR�s(RR(R(XR�t__all__RyR�R�R8R�t	threadingRUtImportErrortdummy_threadingthttplibtcalendarR	R�RRRRR6t	HTTP_PORTR�R�RRR$R=R>RORRwRQR<R@RFR�RGRNR\R^tIRbtXRdRgRhRjRpRrRsRuRtR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRRKRNRSRR�RRt
_LWPCookieJarRRt_MozillaCookieJarR(((s!/usr/lib64/python2.7/cookielib.pyt<module>s�	<
	
		
"		5		8	!		U			4		'	
				
				#	b!�[		��<

MMCT - 2023