uawdijnntqw1x1x1
IP : 3.147.57.239
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
jackpotjunglegam
/
www
/
..
/
..
/
..
/
lib64
/
python3.8
/
http
/
__pycache__
/
cookiejar.cpython-38.pyc
/
/
U e5d#,�@sdZddddddddgZd d lZd d lZd d lZd d lZd d lZd d lZd d l Zd d l Zd d lZ d dlmZdZd ad d�Zee jj�ZdZdd�ZdZdd�ZdddddddgZddddd d!d"d#d$d%d&d'gZgZeD]Ze�e� ��q�dud(d)�Z!dvd*d+�Z"d d d d d,�Z#e�$d-ej%�Z&d.d/�Z'd0d1�Z(e�$d2ej%�Z)e�$d3ej*ej%B�Z+e�$d4ej,ej%B�Z-d5d6�Z.e�$d7ej,ej%B�Z/d8d9�Z0d:d;�Z1e�$d<�Z2e�$d=�Z3e�$d>�Z4e�$d?�Z5d@dA�Z6e�$dB�Z7dCdD�Z8dEdF�Z9dGdH�Z:e�$dIej%�Z;dJdK�Z<dLdM�Z=dNdO�Z>dPdQ�Z?e�$dRej%�Z@dSdT�ZAdUdV�ZBdWdX�ZCdYdZ�ZDd[ZEe�$d\�ZFd]d^�ZGd_d`�ZHdadb�ZIdcdd�ZJGded�d�ZKGdfd�d�ZLGdgd�deL�ZMdhdi�ZNdjdk�ZOGdldm�dm�ZPGdnd�d�ZQGdod�deR�ZSGdpd�deQ�ZTdqdr�ZUGdsd�deT�ZVGdtd�deT�ZWd S)wa�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 �Cookie� CookieJar�CookiePolicy�DefaultCookiePolicy� FileCookieJar�LWPCookieJar� LoadError�MozillaCookieJar�N)�timegmFcGs(tsdStsddl}|�d�atj|�S)Nr zhttp.cookiejar)�debug�logger�loggingZ getLogger)�argsr �r�&/usr/lib64/python3.8/http/cookiejar.py�_debug,s rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}ddl}ddl}|��}|�d|�|��}|jd|dd�dS)Nr zhttp.cookiejar bug! %s�)� stacklevel)�io�warnings� traceback�StringIO� print_exc�getvalue�warn)rrr�f�msgrrr�_warn_unhandled_exception:s ri�cCs�|dd�\}}}}}}|tkr�d|kr4dkr�nnhd|krLdkr�nnPd|krddkr�nn8d|kr|dkr�nn d|kr�dkr�nnt|�SdSdS) N����r ��;�=)� EPOCH_YEARr )�tt�year�monthZmday�hour�min�secrrr�_timegmIs&8�� �� �� r,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtj��}ntj�|�}d|j|j|j|j|j|jfS)aHReturn 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 Nz%04d-%02d-%02d %02d:%02d:%02dZ) �datetime�utcnow�utcfromtimestampr'r(�dayr)�minute�second��tZdtrrr� time2isozWs�r5cCsR|dkrtj��}ntj�|�}dt|��|jt|jd|j|j |j |jfS)z�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 Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr)r-r.r/�DAYSZweekdayr0�MONTHSr(r'r)r1r2r3rrr� time2netscapejs �r8)ZGMT�UTCZUT�Zz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTt�|�}|rfdt|�d��}|�d�rR|dt|�d��}|�d�dkrf|}|S)Nr ir��<r�-)� UTC_ZONES�TIMEZONE_RE�search�int�group)�tz�offset�mrrr�offset_from_tz_string�s rFc Cs�t|�}|tjkrdSzt�|���d}Wn^tk r�zt|�}Wntk r`YYdSXd|krvdkr�nn|}nYdSYnX|dkr�d}|dkr�d}|dkr�d}t|�}t|�}t|�}t|�}|dk�r6t�t���d}|d} |} ||| }| | } t | �dk�r6| dk�r.|d}n|d}t |||||||f�}|dk �r�|dk�rdd}|��}t|�}|dk�r�dS||}|S)Nrr r i��d�2r9) rAr-ZMAXYEAR�MONTHS_LOWER�index�lower� ValueError�time� localtime�absr,�upperrF) r0�mon�yr�hrr*r+rCZimonZcur_yrrEZtmpr4rDrrr� _str2time�sV rTzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a�^ (\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* )?$cCs�t�|�}|rl|��}t�|d���d}t|d�|t|d�t|d�t|d�t|d�f}t|�S|� �}t �d|d�}dgd \}}}}}} } t�|�}|dk r�|��\}}}}}} } ndSt |||||| | �S) a�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. rrr r;���N�)�STRICT_DATE_REr@�groupsrIrJrKrA�floatr,�lstrip� WEEKDAY_RE�sub�LOOSE_HTTP_DATE_RErT)�textrE�grQr&r0rRrSr*r+rCrrr� http2time�s$ � rba�^ (\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 Csd|��}dgd\}}}}}}}t�|�}|dk rL|��\}}}}}}}} ndSt|||||||�S)av 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 NrX)r\�ISO_DATE_REr@rZrT) r`r0rQrRrSr*r+rCrE�_rrr�iso2time+s recCs*|�d�\}}|jd|�|j|d�S)z)Return unmatched part of re.Match object.r N)�span�string)�match�start�endrrr� unmatchedLsrkz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c Cs0t|t�rt�g}|D�]}|}g}|�rt�|�}|r�t|�}|�d�}t�|�}|rxt|�}|�d�}t� d|�}n.t �|�}|r�t|�}|�d�}|��}nd}|�||f�q$|� ��d�r�|� �dd�}|r�|�|�g}q$t�dd|�\}} | dk�std|||f��|}q$|r|�|�q|S) amParse 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"')]] rz\1N�,z^[=\s;]*rWr z&split_header_words bug: '%s', '%s', %s)� isinstance�str�AssertionError�HEADER_TOKEN_REr@rkrB�HEADER_QUOTED_VALUE_RE�HEADER_ESCAPE_REr^�HEADER_VALUE_RE�rstrip�appendr\� startswith�re�subn) Z header_values�resultr`Z orig_text�pairsrE�name�valueZnon_junkZ nr_junk_charsrrr�split_header_wordsUsJ- ��r}�([\"\\])cCs|g}|D]h}g}|D]F\}}|dk rPt�d|�sDt�d|�}d|}d||f}|�|�q|r|�d�|��qd�|�S)a�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"' Nz^\w+$�\\\1z"%s"�%s=%s�; �, )rwr@�HEADER_JOIN_ESCAPE_REr^ru�join)Zlists�headersrz�attr�k�vrrr�join_header_words�sr�cCs0|�d�r|dd�}|�d�r,|dd�}|S)N�"r���)rv�endswith�r`rrr�strip_quotes�s r�cCs�d}g}|D]�}g}d}t|�d��D]�\}}|��}|�d�\}} } |��}|sb|dkr&q�nq&| rn| ��nd} |dkr�|��}||kr�|}|dkr�| dk r�t| �} d}n|d kr�| dk r�tt| ��} |�|| f�q&|r|s�|�d �|�|�q|S)a5Ad-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. )�expires�domain�path�secure�version�port�max-ageF�;�=r Nr�Tr�)r��0)� enumerate�split�strip� partitionrKr�rbru)Z ns_headersZknown_attrsryZ ns_headerrz�version_setZiiZparam�key�sep�val�lcrrr�parse_ns_headers�s> r�z\.\d+$cCs:t�|�rdS|dkrdS|ddks2|ddkr6dSdS)z*Return True if text is a host domain name.FrWr �.r�T��IPV4_REr@r�rrr�is_HDNs r�cCsl|��}|��}||krdSt|�s(dS|�|�}|dksB|dkrFdS|�d�sTdSt|dd��shdSdS)a�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. TFr�r r�rN)rKr��rfindrv)�A�B�irrr�domain_matchs r�cCst�|�rdSdS)zdReturn True if text is a sort-of-like a host domain name. For accepting/blocking domains. FTr�r�rrr�liberal_is_HDNFs r�cCs`|��}|��}t|�r t|�s0||kr,dSdS|�d�}|rL|�|�rLdS|s\||kr\dSdS)z\For blocking/accepting domains. A and B may be host domain names or IP addresses. TFr�)rKr�rvr�)r�r��initial_dotrrr�user_domain_matchPs r�z:\d+$cCsB|��}tj�|�d}|dkr,|�dd�}t�d|d�}|��S)z�Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. rrWZHost)�get_full_url�urllib�parseZurlparseZ get_header�cut_port_rer^rK)�request�url�hostrrr�request_hostesr�cCs4t|�}}|�d�dkr,t�|�s,|d}||fS)zzReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. r�r��.local)r��findr�r@)r��erhn�req_hostrrr�eff_request_hostusr�cCs4|��}tj�|�}t|j�}|�d�s0d|}|S)z6Path component of request-URI, as defined by RFC 2965.�/)r�r�r�Zurlsplit�escape_pathr�rv)r�r��partsr�rrr�request_path�s r�cCs`|j}|�d�}|dkrX||dd�}zt|�Wq\tk rTtd|�YdSXnt}|S)N�:r rznonnumeric port: '%s')r�r�rArLr�DEFAULT_HTTP_PORT)r�r�r�r�rrr�request_port�s r�z%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd|�d���S)Nz%%%sr)rBrP)rhrrr�uppercase_escaped_char�sr�cCstj�|t�}t�t|�}|S)zEEscape any invalid characters in HTTP URL, and uppercase all escapes.)r�r�Zquote�HTTP_PATH_SAFE�ESCAPED_CHAR_REr^r�)r�rrrr��s r�cCsP|�d�}|dkrL||dd�}|�d�}t|�rL|dksD|dkrLd|S|S)aBReturn 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�r rNZlocal)r�r�)�hr��brrr�reach�s r�cCs$t|�}t|t|j��sdSdSdS)z� 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. TFN)r�r�r�Zorigin_req_host)r�r�rrr�is_third_party�s r�c@sNeZdZdZddd�Zdd�Zddd �Zd d�Zddd �Zdd�Z dd�Z dS)ra�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. FcCs�|dk rt|�}|dk r$tt|��}|dkr<|dkr<td��||_||_||_||_||_|��|_ ||_ ||_| |_| |_ ||_||_| |_||_||_||_t�|�|_dS)NTz-if port is None, port_specified must be false)rAr[rLr�r{r|r��port_specifiedrKr��domain_specified�domain_initial_dotr��path_specifiedr�r��discard�comment�comment_url�rfc2109�copy�_rest)�selfr�r{r|r�r�r�r�r�r�r�r�r�r�r�r��restr�rrr�__init__�s. zCookie.__init__cCs ||jkS�N�r�)r�r{rrr�has_nonstandard_attrszCookie.has_nonstandard_attrNcCs|j�||�Sr�)r��get)r�r{�defaultrrr�get_nonstandard_attrszCookie.get_nonstandard_attrcCs||j|<dSr�r�)r�r{r|rrr�set_nonstandard_attr szCookie.set_nonstandard_attrcCs,|dkrt��}|jdk r(|j|kr(dSdS�NTF)rMr�)r��nowrrr� is_expired#s zCookie.is_expiredcCsX|jdkrd}n d|j}|j||j}|jdk rFd|j|jf}n|j}d||fS)NrWr�r�z<Cookie %s for %s>)r�r�r�r|r{)r��p�limitZ namevaluerrr�__str__)s zCookie.__str__cCslg}dD]$}t||�}|�d|t|�f�q|�dt|j��|�dt|j��d|jjd�|�fS)N)r�r{r|r�r�r�r�r�r�r�r�r�r�r�r�r�zrest=%sz rfc2109=%sz%s(%s)r�)�getattrru�reprr�r�� __class__�__name__r�)r�rr{r�rrr�__repr__3s zCookie.__repr__)F)N)N)r�� __module__�__qualname__�__doc__r�r�r�r�r�r�r�rrrrr�s� * c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S)ra 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 customized policy. cCs t��dS)z�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��NotImplementedError�r��cookier�rrr�set_okKszCookiePolicy.set_okcCs t��dS)zAReturn true if (and only if) cookie should be returned to server.Nr�r�rrr� return_okTszCookiePolicy.return_okcCsdS)zMReturn false if cookies should not be returned, given cookie domain. Tr)r�r�r�rrr�domain_return_okXszCookiePolicy.domain_return_okcCsdS)zKReturn false if cookies should not be returned, given cookie path. Tr)r�r�r�rrr�path_return_ok]szCookiePolicy.path_return_okN)r�r�r�r�r�r�r�r�rrrrrBs c @s�eZdZdZdZdZdZdZeeBZdddddddddeddd f d d�Z dd �Z dd�Zdd�Zdd�Z dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�ZdS)8rzBImplements the standard rules for accepting and returning cookies.rrrUr NTF)ZhttpsZwsscCsv||_||_||_||_||_||_| |_| |_||_||_ | |_ |dk rVt|�|_nd|_|dk rlt|�}||_ dS)zAConstructor arguments should be passed as keyword arguments only.Nr)�netscape�rfc2965�rfc2109_as_netscape�hide_cookie2� strict_domain�strict_rfc2965_unverifiable�strict_ns_unverifiable�strict_ns_domain�strict_ns_set_initial_dollar�strict_ns_set_path�secure_protocols�tuple�_blocked_domains�_allowed_domains)r��blocked_domains�allowed_domainsr�r�r�r�r�r�r�r�r�r�r�rrrr�ms"zDefaultCookiePolicy.__init__cCs|jS)z4Return the sequence of blocked domains (as a tuple).)r�r�rrrr�sz#DefaultCookiePolicy.blocked_domainscCst|�|_dS)z$Set the sequence of blocked domains.N)r�r)r�rrrr�set_blocked_domains�sz'DefaultCookiePolicy.set_blocked_domainscCs |jD]}t||�rdSqdSr�)rr�)r�r�Zblocked_domainrrr� is_blocked�s zDefaultCookiePolicy.is_blockedcCs|jS)z=Return None, or the sequence of allowed domains (as a tuple).)rrrrrr�sz#DefaultCookiePolicy.allowed_domainscCs|dk rt|�}||_dS)z-Set the sequence of allowed domains, or None.N)r�r)r�rrrr�set_allowed_domains�sz'DefaultCookiePolicy.set_allowed_domainscCs.|jdkrdS|jD]}t||�rdSqdS)NFT)rr�)r�r�Zallowed_domainrrr�is_not_allowed�s z"DefaultCookiePolicy.is_not_allowedcCsNtd|j|j�|jdk st�dD]&}d|}t||�}|||�s"dSq"dS)z� 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). � - checking cookie %s=%sN)r�� verifiabilityr{r�r�r�Zset_ok_FT)rr{r|ror��r�r�r��nZfn_name�fnrrrr��s zDefaultCookiePolicy.set_okcCsZ|jdkrtd|j|j�dS|jdkr:|js:td�dS|jdkrV|jsVtd�dSdS)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr �$ RFC 2965 cookies are switched off�$ Netscape cookies are switched offT)r�rr{r|r�r�r�rrr�set_ok_version�s �z"DefaultCookiePolicy.set_ok_versioncCsJ|jrFt|�rF|jdkr*|jr*td�dS|jdkrF|jrFtd�dSdS�Nr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionT�Zunverifiabler�r�r�rr�r�rrr�set_ok_verifiability�sz(DefaultCookiePolicy.set_ok_verifiabilitycCs0|jdkr,|jr,|j�d�r,td|j�dSdS)Nr �$z' illegal name (starts with '$'): '%s'FT)r�r�r{rvrr�rrr�set_ok_name�s �zDefaultCookiePolicy.set_ok_namecCsL|jrHt|�}|jdks(|jdkrH|jrH|�|j|�sHtd|j|�dSdS)Nr z7 path attribute %s is not a prefix of request path %sFT)r�r�r�r�r�r�r)r�r�r��req_pathrrr�set_ok_path�s ����zDefaultCookiePolicy.set_ok_pathc Cs�|�|j�rtd|j�dS|�|j�r8td|j�dS|j�r�t|�\}}|j}|jr�|�d�dkr�|�d�}|�dd|�}|dkr�||dd�}||d|�} | � �dkr�t |�dkr�td |�dS|�d�r�|dd�} n|} | �d�dk}|�s|d k�rtd|�dS|j dk�rX|�|��sX|�d��sXd|�|��sXtd||�dS|j dk�sr|j|j@�r�t||��s�td ||�dS|j dk�s�|j|j@�r�|dt |��}|�d�dk�r�t�|��s�td||�dSdS)N�" domain %s is in user block-listF�& domain %s is not in user allow-listr�rr r)�coZacZcomZeduZorgZnetZgovZmilrAZaeroZbiz�catZcoop�infoZjobsZmobiZmuseumr{ZproZtravelZeuz& country-code second level domain %sr�z/ non-local domain %s contains no embedded dotzO effective request-host %s (even with added initial dot) does not end with %sz5 effective request-host %s does not domain-match %sz. host prefix %s for domain %s contains a dotT)rr�rrr�r�r��countr�rK�lenrvr�r�r�r��DomainRFC2965Matchr��DomainStrictNoDotsr�r@) r�r�r�r�r�r�r��jZtldZsldZundotted_domainZ embedded_dotsZhost_prefixrrr� set_ok_domain�s| � ���� �� ���z!DefaultCookiePolicy.set_ok_domainc Cs�|jr�t|�}|dkrd}nt|�}|j�d�D]@}zt|�Wn"tk rbtd|�YdSX||kr0q�q0td||j�dSdS)N�80rlz bad port %s (not numeric)Fz$ request port (%s) not found in %sT)r�r�rnr�r�rArLr�r�r�r�Zreq_portr�rrr�set_ok_port+s& �zDefaultCookiePolicy.set_ok_portcCs@td|j|j�dD]&}d|}t||�}|||�sdSqdS)z� 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). r )r�r r�r�r�r�Z return_ok_FT)rr{r|r�rrrrr�@s zDefaultCookiePolicy.return_okcCs<|jdkr|jstd�dS|jdkr8|js8td�dSdS)Nr rFrT)r�r�rr�r�rrr�return_ok_versionRsz%DefaultCookiePolicy.return_ok_versioncCsJ|jrFt|�rF|jdkr*|jr*td�dS|jdkrF|jrFtd�dSdSrrr�rrr�return_ok_verifiability[sz+DefaultCookiePolicy.return_ok_verifiabilitycCs"|jr|j|jkrtd�dSdS)Nz( secure cookie with non-secure requestFT)r��typer�rr�rrr�return_ok_securegsz$DefaultCookiePolicy.return_ok_securecCs|�|j�rtd�dSdS)Nz cookie expiredFT)r��_nowrr�rrr�return_ok_expiresmsz%DefaultCookiePolicy.return_ok_expirescCsN|jrJt|�}|dkrd}|j�d�D]}||kr&qJq&td||j�dSdS)Nr#rlz0 request port %s does not match cookie port %sFT)r�r�r�rr$rrr�return_ok_portss�z"DefaultCookiePolicy.return_ok_portcCs�t|�\}}|j}|r*|�d�s*d|}n|}|jdkr^|j|j@r^|js^||kr^td�dS|jdkr�t||�s�td||�dS|jdkr�d|� |�s�td||�dSdS)Nr�r zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) r�r�rvr�r��DomainStrictNonDomainr�rr�r�)r�r�r�r�r�r�� dotdomainrrr�return_ok_domain�s6 �����z$DefaultCookiePolicy.return_ok_domaincCs�t|�\}}|�d�sd|}|�d�s0d|}|rH|�d�sHd|}n|}|�|�sd|�|�sddS|�|�r|td|�dS|�|�r�td|�dSdS)Nr�FrrT)r�rvr�rrr)r�r�r�r�r�r.rrrr��s" z$DefaultCookiePolicy.domain_return_okcCsbtd|�t|�}t|�}||kr&dS|�|�rR|�d�sN|||d�dkrRdStd||�dS)Nz- checking cookie path=%sTr�rz %s does not path-match %sF)rr�rrvr�)r�r�r�rZpathlenrrrr��s ��z"DefaultCookiePolicy.path_return_ok) r�r�r�r�r r-rZ DomainLiberalZDomainStrictr�rrrrrrr�rrrrr"r%r�r&r'r)r+r,r/r�r�rrrrrcsT� # ; cCst|���}t|j|�Sr�)�sorted�keys�mapr�)Zadictr1rrr�vals_sorted_by_key�sr3c csVt|�}|D]D}d}z |jWntk r2YnXd}t|�EdH|s|VqdS)zBIterates over nested mapping, depth-first, in sorted order by key.FTN)r3�items�AttributeError� deepvalues)�mapping�values�objrrrr6�s r6c@seZdZdS)�AbsentN�r�r�r�rrrrr:�sr:c@s�eZdZdZe�d�Ze�d�Ze�d�Ze�d�Z e�d�Z e�dej�Zd3d d �Z dd�Zd d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd4d%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z d1d2�Z!dS)5rz�Collection of HTTP cookies. You may not need to know about this class: try urllib.request.build_opener(HTTPCookieProcessor).open(url). z\Wr~z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs(|dkrt�}||_t��|_i|_dSr�)r�_policy� _threading�RLock� _cookies_lock�_cookies�r��policyrrrr��s zCookieJar.__init__cCs ||_dSr�)r<rArrr� set_policy�szCookieJar.set_policycCs�g}|j�||�sgStd|�|j|}|��D]T}|j�||�sFq2||}|��D].}|j�||�srtd�qVtd�|�|�qVq2|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) r<r�rr@r1r�r8r�ru)r�r�r��cookiesZcookies_by_pathr�Zcookies_by_namer�rrr�_cookies_for_domain�s zCookieJar._cookies_for_domaincCs*g}|j��D]}|�|�||��q|S)z2Return a list of cookies to be returned to server.)r@r1�extendrE)r�r�rDr�rrr�_cookies_for_requestszCookieJar._cookies_for_requestc Cs<|jdd�dd�d}g}|D�]}|j}|sHd}|dkrH|�d|�|jdk rz|j�|j�rz|dkrz|j�d |j�}n|j}|jdkr�|�|j�n|�d |j|f�|dkr|j r�|�d|j �|j�d��r|j}|j s�|�d�r�|d d�}|�d|�|jdk rd}|j�r,|d|j}|�|�q|S)z�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). cSs t|j�Sr�)rr�)�arrr�<lambda>�z)CookieJar._cookie_attrs.<locals>.<lambda>T)r��reverseFr z$Version=%sNrr�z $Path="%s"r�rz$Domain="%s"z$Portz="%s")�sortr�rur|�non_word_rer@�quote_rer^r{r�r�r�rvr�r�r�) r�rDr��attrsr�r�r|r�r�rrr� _cookie_attrssF �� � zCookieJar._cookie_attrscCs�td�|j��z�tt���|j_|_|�|�}|� |�}|r^|� d�s^|�dd�|��|jj r�|jjs�|� d�s�|D]}|jdkr||�dd�q�q|W5|j��X|��dS)z�Add correct Cookie: header to request (urllib.request.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. �add_cookie_headerrr�ZCookie2rz$Version="1"N)rr?�acquire�releaserArMr<r*rGrPZ has_headerZadd_unredirected_headerr�r�r�r��clear_expired_cookies)r�r�rDrOr�rrrrQIs* �� zCookieJar.add_cookie_headerc Cs�g}d}d}|D�]z}|d\}}d}d} i} i}|dd�D�]0\}} |��}||ks`||krd|}||krx| dkrxd} || kr�q>|dkr�| dkr�td �d} �qr| ��} |d kr�|r�q>| dkr�td�q>|dk�r d}zt| �} Wn*tk �rtd �d} Y�qrYnXd }|j| } ||k�s4||k�rh| dk�r^|dk�r^td|�d} �qr| | |<q>| ||<q>| �rzq|�||| |f�q|S)aReturn 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�r�r�r�r�r�� commenturlr FrNTr�z% missing value for domain attributer�zM missing or invalid value for expires attribute: treating as session cookier�z? missing or invalid (non-numeric) value for max-age attribute)r�r�rUz! missing value for %s attribute)rKrrArLr*ru)r�� attrs_set� cookie_tuples� boolean_attrs�value_attrsZcookie_attrsr{r|Zmax_age_setZ bad_cookie�standardr�r�r�r�rrr�_normalized_cookie_tuplesjsh � z#CookieJar._normalized_cookie_tuplescCs&|\}}}}|�dt�}|�dt�}|�dt�} |�dt�} |�dd�}|dk rtzt|�}Wntk rrYdSX|�dd�}|�dd�} |�d d�}|�d d�}|tk r�|dkr�d}t|�}nXd}t|�}|�d �}|dk�r|dkr�|d|�}n|d|d�}t|�dk�rd }|tk }d}|�r:t|� d��}|tk�rVt |�\}}|}n|� d��sjd|}d}| tk �r�| dk�r�t|�} nd}t� dd| �} nd} | tk�r�d} d} nH| |jk�rz|�|||�Wntk �r�YnXtd|||�dSt|||| |||||||| | |||�S)Nr�r�r�r�r�r�Fr�r�rUrWTr�r�r rr�z\s+z2Expiring cookie, domain='%s', path='%s', name='%s')r�r:rArLr�r�r�r�boolrvr�r�rwr^r*�clear�KeyErrorrr)r��tupr�r{r|rZr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�_cookie_from_cookie_tuple�s� ��z#CookieJar._cookie_from_cookie_tuplecCs6|�|�}g}|D]}|�||�}|r|�|�q|Sr�)r[r`ru)r�rVr�rWrDr_r�rrr�_cookies_from_attrs_set's z!CookieJar._cookies_from_attrs_setcCsHt|jdd�}|dkr |jj}|D]}|jdkr$d|_|r$d|_q$dS)Nr�rTr )r�r<r�r�r�)r�rDZ rfc2109_as_nsr�rrr�_process_rfc2109_cookies0s z"CookieJar._process_rfc2109_cookiesc Cs:|��}|�dg�}|�dg�}tt���|j_|_|jj}|jj}|sN|rf|sV|rf|s^|rf|sj|sjgSz|�t |�|�}Wnt k r�t�g}YnX|�r6|�r6z|�t|�|�} Wnt k r�t�g} YnX|� | �|�r&i} |D]}d| |j|j|jf<q�| fdd�}t|| �} | �r6|�| �|S)zAReturn sequence of Cookie objects extracted from response object.zSet-Cookie2z Set-CookieNcSs|j|j|jf}||kSr�)r�r�r{)Z ns_cookie�lookupr�rrr�no_matching_rfc2965isz3CookieJar.make_cookies.<locals>.no_matching_rfc2965)rZget_allrArMr<r*r�r�rar}� Exceptionrr�rbr�r�r{�filterrF) r��responser�r�Zrfc2965_hdrsZns_hdrsr�r�rDZ ns_cookiesrcr�rdrrr�make_cookies<s^������� � zCookieJar.make_cookiescCsN|j��z2tt���|j_|_|j�||�r:|�|�W5|j��XdS)z-Set a cookie if policy says it's OK to do so.N) r?rRrSrArMr<r*r�� set_cookier�rrr�set_cookie_if_okss zCookieJar.set_cookie_if_okcCsl|j}|j��zJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<W5|j��XdS)z?Set a cookie, without checking whether or not it should be set.N)r@r?rRrSr�r�r{)r�r��cZc2Zc3rrrri�s zCookieJar.set_cookiecCsbtd|���|j��z8|�||�D]&}|j�||�r&td|�|�|�q&W5|j��XdS)zAExtract cookies from response, where allowable given the request.zextract_cookies: %sz setting cookie: %sN) rrr?rRrSrhr<r�ri)r�rgr�r�rrr�extract_cookies�s zCookieJar.extract_cookiescCst|dk r2|dks|dkr td��|j|||=n>|dk rX|dkrJtd��|j||=n|dk rj|j|=ni|_dS)a�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. Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rLr@)r�r�r�r{rrrr]�s�� zCookieJar.clearcCsD|j��z(|D]}|jr|�|j|j|j�qW5|j��XdS)z�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)r?rRrSr�r]r�r�r{)r�r�rrr�clear_session_cookies�s zCookieJar.clear_session_cookiescCsP|j��z4t��}|D]"}|�|�r|�|j|j|j�qW5|j��XdS)a�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) r?rRrSrMr�r]r�r�r{)r�r�r�rrrrT�s zCookieJar.clear_expired_cookiescCs t|j�Sr�)r6r@rrrr�__iter__�szCookieJar.__iter__cCsd}|D]}|d}q|S)z#Return number of contained cookies.r rr)r�r�r�rrr�__len__�s zCookieJar.__len__cCs2g}|D]}|�t|��qd|jjd�|�fS�Nz<%s[%s]>r�)rur�r�r�r��r��rr�rrrr��szCookieJar.__repr__cCs2g}|D]}|�t|��qd|jjd�|�fSrp)rurnr�r�r�rqrrrr��szCookieJar.__str__)N)NNN)"r�r�r�r�rw�compilerMrNZstrict_domain_reZ domain_reZdots_re�ASCII�magic_rer�rCrErGrPrQr[r`rarbrhrjrirlr]rmrTrnror�r�rrrrr�s8 ;!a\ 7 c@seZdZdS)rNr;rrrrr�sc@s8eZdZdZddd�Zd dd�Zddd �Zdd d�ZdS)rz6CookieJar that can be loaded from and saved to a file.NFcCs2t�||�|dk rt�|�}||_t|�|_dS)z} Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. N)rr��os�fspath�filenamer\� delayload)r�rxryrBrrrr��s zFileCookieJar.__init__cCs t��dS)zSave cookies to a file.Nr�)r�rx�ignore_discard�ignore_expiresrrr�save�szFileCookieJar.savec CsJ|dkr"|jdk r|j}ntt��t|��}|�||||�W5QRXdS)zLoad cookies from a file.N)rxrL�MISSING_FILENAME_TEXT�open�_really_load�r�rxrzr{rrrr�loads zFileCookieJar.loadcCs�|dkr"|jdk r|j}ntt��|j��zFt�|j�}i|_z|� |||�Wnt k rn||_�YnXW5|j��XdS)z�Clear all cookies and reload cookies from a saved file. Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens. N)rxrLr}r?rRrSr�Zdeepcopyr@r��OSError)r�rxrzr{Z old_staterrr�revert s zFileCookieJar.revert)NFN)NFF)NFF)NFF)r�r�r�r�r�r|r�r�rrrrr�s �cCs |j|jfd|jfd|jfg}|jdk r8|�d|jf�|jrH|�d�|jrX|�d�|jrh|�d�|j rx|�d�|j r�|�d tt|j ��f�|j r�|�d �|jr�|�d|jf�|jr�|�d|jf�t|j���}|D]}|�|t|j|�f�q�|�d t|j�f�t|g�S)z�Return string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. r�r�Nr�)� path_specN)� port_specN)� domain_dotN)r�Nr�)r�Nr�rUr�)r{r|r�r�r�rur�r�r�r�r�r5r[r�r�r�r0r�r1rnr�r�)r�r�r1r�rrr�lwp_cookie_str$s: � � r�c@s,eZdZdZddd�Zddd�Zd d �ZdS) ra[ The LWPCookieJar saves a sequence of "Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl library, not known to be compatible with any browser, but which is easy to read and doesn't lose information about RFC 2965 cookies. Additional methods as_lwp_str(ignore_discard=True, ignore_expired=True) TcCsTt��}g}|D]2}|s |jr q|s0|�|�r0q|�dt|��qd�|dg�S)z�Return cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save zSet-Cookie3: %s� rW)rMr�r�rur�r�)r�rzr{r�rrr�rrr� as_lwp_strMs zLWPCookieJar.as_lwp_strNFc CsX|dkr"|jdk r|j}ntt��t|d��"}|�d�|�|�||��W5QRXdS)N�wz#LWP-Cookies-2.0 )rxrLr}r~�writer�r�rrrr|]s zLWPCookieJar.savecCs0|��}|j�|�s$d|}t|��t��}d}d} d} �z�|��}|dkrP�q�|�|�s\q<|t|�d���}t|g�D�]f}|d\} }i}i}| D]}d||<q�|dd�D]n\}}|dk r�|� �}nd}|| ks�|| kr�|}|| k�r|dkr�d }|||<q�|| k�r|||<q�|||<q�|j }|d �}|d�}|dk �rJt|�}|dk�rXd }|d�}|�d �}t|d�| ||d�|d�|||d�|d�|d�|d�|||d�|d�|�}|�s�|j �r�qz|�s�|�|��r�qz|�|�qzq<WnBtk �r�Yn,tk �r*t�td||f��YnXdS)Nz5%r does not look like a Set-Cookie3 (LWP) format filezSet-Cookie3:)r�r�r�r�r�)r�r�r�r�r�r�rUrWr FrTr�r�r�r�r�r�r�r�r�r�r�r�rUz&invalid Set-Cookie3 format file %r: %r)�readlinerur@rrMrvrr�r}rKr�rerr�r�rir�rer)r�rrxrzr{�magicrr��headerrXrY�line�datar{r|rZr�r�r�r�r�r�r�r�r�rkrrrris�� � �zLWPCookieJar._really_load)TT)NFF)r�r�r�r�r�r|rrrrrr@s c@s0eZdZdZe�d�ZdZdd�Zd dd �Z dS)ra� WARNING: you may want to backup your browser's cookies file if you use this class to save cookies. I *think* it works, but there have been bugs in the past! This class differs from CookieJar only in the format it uses to save and load cookies to and from a file. This class uses the Mozilla/Netscape `cookies.txt' format. lynx uses this file format, too. Don't expect cookies saved while the browser is running to be noticed by the browser (in fact, Mozilla on unix will overwrite your saved cookies if you change them on disk while it's running; on Windows, you probably can't save at all while the browser is running). Note that the Mozilla/Netscape format will downgrade RFC2965 cookies to Netscape cookies on saving. In particular, the cookie version and port number information is lost, together with information about whether or not Path, Port and Discard were specified by the Set-Cookie2 (or Set-Cookie) header, and whether or not the domain as set in the HTTP header started with a dot (yes, I'm aware some domains in Netscape files start with a dot and some don't -- trust me, you really don't want to know any more about this). Note that though Mozilla and Netscape use the same format, they use slightly different headers. The class saves cookies using the Netscape header by default (Mozilla can cope with that). z#( Netscape)? HTTP Cookie Filezr# Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This is a generated file! Do not edit. cCstt��}|��}|j�|�s(td|���z|��}|dkr@�q*|�d�rV|dd�}|���d�s,|��dkrrq,|�d�\}} } }}} }|dk}| dk} | dkr�|} d}|�d�}| |ks�t �d }|dkr�d}d }t d| |dd || || d |||ddi�}|�s |j�r q,|�s|�|��rq,|� |�q,WnBtk �rD�Yn,tk �rnt�td||f��YnXdS) Nz4%r does not look like a Netscape format cookies filerWr�r�)�#r� �TRUEr�FTr z+invalid Netscape format cookies file %r: %r)rMr�rur@rr�r�rvr�rorr�r�rir�rer)r�rrxrzr{r�r�r�r�r�r�r�r�r{r|r�r�rkrrrr�st�� �� � �zMozillaCookieJar._really_loadNFc Cs�|dkr"|jdk r|j}ntt��t|d���}|�|j�t��}|D]�}|sV|jrVqF|sf|�|�rfqF|j rrd}nd}|j �d�r�d}nd}|jdk r�t |j�} nd} |jdkr�d} |j}n|j} |j}|�d�|j ||j|| | |g�d�qFW5QRXdS)Nr�r�ZFALSEr�rWr�r�)rxrLr}r~r�r�rMr�r�r�r�rvr�rnr|r{r�r�)r�rxrzr{rr�r�r�r�r�r{r|rrrr| sH ���zMozillaCookieJar.save)NFF) r�r�r�r�rwrsrur�rr|rrrrr�s A)N)N)Xr��__all__rvr�r-rwrMZurllib.parser�Zurllib.requestZ threadingr=Zhttp.clientZhttpZcalendarr rrrrnZclientZ HTTP_PORTr�r}rr%r,r6r7rIr(rurKr5r8r>rsrtr?rFrTrY�Ir]�Xr_rbrcrerkrprqrsrrr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr3r6r:rr�rrr�rrrrrr�<module>s�� � 8� � �8 �! U D' #b!b7x
/home/jackpotjunglegam/www/../../../lib64/python3.8/http/__pycache__/cookiejar.cpython-38.pyc