Hacked By AnonymousFox

Current Path : /usr/lib64/python3.8/http/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/http/__pycache__/cookiejar.cpython-38.opt-2.pyc

U

e5d#,�@sddddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZdd	l	Z
dd	lZdd
l
mZdZd	add
�Zeejj�ZdZdd�ZdZdd�ZdddddddgZdddddd d!d"d#d$d%d&gZgZeD]Ze�e���q�dtd'd(�Z dud)d*�Z!d	d	d	d	d+�Z"e�#d,ej$�Z%d-d.�Z&d/d0�Z'e�#d1ej$�Z(e�#d2ej)ej$B�Z*e�#d3ej+ej$B�Z,d4d5�Z-e�#d6ej+ej$B�Z.d7d8�Z/d9d:�Z0e�#d;�Z1e�#d<�Z2e�#d=�Z3e�#d>�Z4d?d@�Z5e�#dA�Z6dBdC�Z7dDdE�Z8dFdG�Z9e�#dHej$�Z:dIdJ�Z;dKdL�Z<dMdN�Z=dOdP�Z>e�#dQej$�Z?dRdS�Z@dTdU�ZAdVdW�ZBdXdY�ZCdZZDe�#d[�ZEd\d]�ZFd^d_�ZGd`da�ZHdbdc�ZIGddd�d�ZJGded�d�ZKGdfd�deK�ZLdgdh�ZMdidj�ZNGdkdl�dl�ZOGdmd�d�ZPGdnd�deQ�ZRGdod�deP�ZSdpdq�ZTGdrd�deS�ZUGdsd�deS�ZVd	S)v�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��}ntj�|�}d|j|j|j|j|j|jfS)Nz%04d-%02d-%02d %02d:%02d:%02dZ)	�datetime�utcnow�utcfromtimestampr'r(�dayr)�minute�second��tZdtrrr�	time2isozWs�r5cCsR|dkrtj��}ntj�|�}dt|��|jt|jd|j|j	|j
|jfS)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�zt|�}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)	Nrrr	r;����)�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)NrX)r\�ISO_DATE_REr@rZrT)
r`r0rQrRrSr*r+rCrE�_rrr�iso2time+s

recCs*|�d�\}}|jd|�|j|d�S)Nr	)�span�string)�match�start�endrrr�	unmatchedLsrkz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c
Csg}|D]�}|}g}|r�t�|�}|r�t|�}|�d�}t�|�}|rft|�}|�d�}t�d|�}n.t�|�}|r�t|�}|�d�}|��}nd}|�	||f�q|�
��d�r�|�
�dd�}|r�|�	|�g}qt�
dd|�\}}	|}q|r|�	|�q|S)Nrz\1�,z^[=\s;]*rW)�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_wordsUs>.







rz�([\"\\])cCs|g}|D]h}g}|D]F\}}|dk	rPt�d|�sDt�d|�}d|}d||f}|�|�q|r|�d�|��qd�|�S)Nz^\w+$�\\\1z"%s"�%s=%s�; �, )rtr@�HEADER_JOIN_ESCAPE_REr^rr�join)Zlists�headersrw�attr�k�vrrr�join_header_words�sr�cCs0|�d�r|dd�}|�d�r,|dd�}|S)N�"r���)rs�endswith�r`rrr�strip_quotes�s


r�cCs�d}g}|D]�}g}d}t|�d��D]�\}}|��}|�d�\}}	}
|��}|sb|dkr&q�nq&|	rn|
��nd}
|dkr�|��}||kr�|}|dkr�|
dk	r�t|
�}
d}n|dkr�|
dk	r�tt|
��}
|�||
f�q&|r|s�|�d	�|�|�q|S)
N)�expires�domain�path�secure�version�port�max-ageF�;�=r	r�Tr�)r��0)�	enumerate�split�strip�	partitionrKr�rbrr)Z
ns_headersZknown_attrsrvZ	ns_headerrw�version_setZiiZparam�key�sep�val�lcrrr�parse_ns_headers�s>
r�z\.\d+$cCs:t�|�rdS|dkrdS|ddks2|ddkr6dSdS)NFrWr	�.r�T��IPV4_REr@r�rrr�is_HDNs
r�cCsl|��}|��}||krdSt|�s(dS|�|�}|dksB|dkrFdS|�d�sTdSt|dd��shdSdS)NTFr�r	r�r)rKr��rfindrs)�A�B�irrr�domain_matchs

r�cCst�|�rdSdS�NFTr�r�rrr�liberal_is_HDNFs
r�cCs`|��}|��}t|�r t|�s0||kr,dSdS|�d�}|rL|�|�rLdS|s\||kr\dSdS)NTFr�)rKr�rsr�)r�r��initial_dotrrr�user_domain_matchPs
r�z:\d+$cCsB|��}tj�|�d}|dkr,|�dd�}t�d|d�}|��S)NrrWZHost)�get_full_url�urllib�parseZurlparseZ
get_header�cut_port_rer^rK)�request�url�hostrrr�request_hostesr�cCs4t|�}}|�d�dkr,t�|�s,|d}||fS)Nr�r��.local)r��findr�r@)r��erhn�req_hostrrr�eff_request_hostusr�cCs4|��}tj�|�}t|j�}|�d�s0d|}|S)N�/)r�r�r�Zurlsplit�escape_pathr�rs)r�r��partsr�rrr�request_path�s

r�cCs`|j}|�d�}|dkrX||dd�}zt|�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�N)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)Nr�r	rZlocal)r�r�)�hr��brrr�reach�s

r�cCs$t|�}t|t|j��sdSdSdS�NTF)r�r�r�Zorigin_req_host)r�r�rrr�is_third_party�s
r�c@sJeZdZddd�Zdd�Zddd�Zd	d
�Zddd�Zd
d�Zdd�Z	dS)rFcCs�|dk	rt|�}|dk	r$tt|��}|dkr<|dkr<td��||_||_||_||_||_|��|_	||_
||_|	|_|
|_
||_||_|
|_||_||_||_t�|�|_dS)NTz-if port is None, port_specified must be false)rAr[rLr�rxryr��port_specifiedrKr��domain_specified�domain_initial_dotr��path_specifiedr�r��discard�comment�comment_url�rfc2109�copy�_rest)�selfr�rxryr�r�r�r�r�r�r�r�r�r�r�r��restr�rrr�__init__�s.

zCookie.__init__cCs
||jkSr��r�)r�rxrrr�has_nonstandard_attrszCookie.has_nonstandard_attrNcCs|j�||�Sr�)r��get)r�rx�defaultrrr�get_nonstandard_attrszCookie.get_nonstandard_attrcCs||j|<dSr�r�)r�rxryrrr�set_nonstandard_attr szCookie.set_nonstandard_attrcCs,|dkrt��}|jdk	r(|j|kr(dSdSr�)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�ryrx)r��p�limitZ	namevaluerrr�__str__)s


zCookie.__str__cCslg}dD]$}t||�}|�d|t|�f�q|�dt|j��|�dt|j��d|jjd�|�fS)N)r�rxryr�r�r�r�r�r�r�r�r�r�r�r�r}zrest=%sz
rfc2109=%sz%s(%s)r)�getattrrr�reprr�r��	__class__�__name__r�)r�rrxr�rrr�__repr__3s
zCookie.__repr__)F)N)N)
r��
__module__�__qualname__r�r�r�r�r�r�r�rrrrr�s�
*


c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
rcCs
t��dSr���NotImplementedError�r��cookier�rrr�set_okKszCookiePolicy.set_okcCs
t��dSr�r�r�rrr�	return_okTszCookiePolicy.return_okcCsdS�NTr)r�r�r�rrr�domain_return_okXszCookiePolicy.domain_return_okcCsdSr�r)r�r�r�rrr�path_return_ok]szCookiePolicy.path_return_okN)r�r�r�r�r�r�r�rrrrrBs		c
@s�eZdZdZdZdZdZeeBZdddddddddedddf
d	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZdS)7rrrrUr	NTF)ZhttpsZwsscCsv||_||_||_||_||_||_|	|_|
|_||_||_	|
|_
|dk	rVt|�|_nd|_|dk	rlt|�}||_
dS)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|jSr�)r��r�rrrr�sz#DefaultCookiePolicy.blocked_domainscCst|�|_dSr�)r�r�)r�rrrr�set_blocked_domains�sz'DefaultCookiePolicy.set_blocked_domainscCs |jD]}t||�rdSqdSr�)r�r�)r�r�Zblocked_domainrrr�
is_blocked�s

zDefaultCookiePolicy.is_blockedcCs|jSr�)r�rrrrr�sz#DefaultCookiePolicy.allowed_domainscCs|dk	rt|�}||_dSr�)r�r�)r�rrrr�set_allowed_domains�sz'DefaultCookiePolicy.set_allowed_domainscCs.|jdkrdS|jD]}t||�rdSqdSr�)r�r�)r�r�Zallowed_domainrrr�is_not_allowed�s


z"DefaultCookiePolicy.is_not_allowedcCs@td|j|j�dD]&}d|}t||�}|||�sdSqdS)N� - checking cookie %s=%s)r��
verifiabilityrxr�r�r�Zset_ok_FT�rrxryr��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�rrxryr�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�Zunverifiabler�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�rxrsrr�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�infoZjobsZmobiZmuseumrxZproZtravelZeuz&   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�lenrsr�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]@}zt|�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��strr�r�rArLr�r�r�r�Zreq_portr�rrr�set_ok_port+s&

�zDefaultCookiePolicy.set_ok_portcCs@td|j|j�dD]&}d|}t||�}|||�sdSqdS)Nr)r�rr�r�r�r�Z
return_ok_FTr	r
rrrr�@s	

zDefaultCookiePolicy.return_okcCs<|jdkr|jstd�dS|jdkr8|js8td�dSdS)Nr	r
FrT)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_expiresmsz%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�rsr�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�rsr�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�rrsr�)r�r�r�rZpathlenrrrr��s

��z"DefaultCookiePolicy.path_return_ok)r�r�r�rr-rZ
DomainLiberalZDomainStrictr�rrrrrrr�rrrrr!r%r�r&r'r)r+r,r/r�r�rrrrrcsR�
#	;	cCst|���}t|j|�Sr�)�sorted�keys�mapr�)Zadictr1rrr�vals_sorted_by_key�sr3c	csVt|�}|D]D}d}z
|jWntk
r2YnXd}t|�EdH|s|VqdSr�)r3�items�AttributeError�
deepvalues)�mapping�values�objrrrr6�s
r6c@seZdZdS)�AbsentN�r�r�r�rrrrr:�sr:c@s�eZdZe�d�Ze�d�Ze�d�Ze�d�Ze�d�Z	e�dej
�Zd2dd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd3d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Z dS)4rz\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�rr)r�r�r��cookiesZcookies_by_pathr�Zcookies_by_namer�rrr�_cookies_for_domain�s 

zCookieJar._cookies_for_domaincCs*g}|j��D]}|�|�||��q|Sr�)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)NcSs
t|j�Sr�)rr�)�arrr�<lambda>�z)CookieJar._cookie_attrs.<locals>.<lambda>T)r��reverseFr	z$Version=%sr|r}z
$Path="%s"r�rz$Domain="%s"z$Portz="%s")�sortr�rrry�non_word_rer@�quote_rer^rxr�r�r�rsr�r�r�)	r�rDr��attrsr�r�ryr�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)N�add_cookie_headerrr~ZCookie2rz$Version="1")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}zt|
�}
Wn*tk
�rtd�d}	Y�qrYnXd	}|j|
}
||k�s4||k�rh|
dk�r^|d
k�r^td|�d}	�qr|
|
|<q>|
||<q>|	�rzq|�|||
|f�q|S)N)r�r�)r�r�r�r�r�r�r��
commenturlr	FrTr�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*rr)r��	attrs_set�
cookie_tuples�
boolean_attrs�value_attrsZcookie_attrsrxryZmax_age_setZ
bad_cookie�standardr�r�r�r�rrr�_normalized_cookie_tuplesjsh





�

z#CookieJar._normalized_cookie_tuplescCs&|\}}}}|�dt�}|�dt�}|�dt�}	|�dt�}
|�dd�}|dk	rtzt|�}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�boolrsr�r�rtr^r*�clear�KeyErrorrr)r��tupr�rxryrZr�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`rr)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)NzSet-Cookie2z
Set-CookiecSs|j|j|jf}||kSr�)r�r�rx)Z	ns_cookie�lookupr�rrr�no_matching_rfc2965isz3CookieJar.make_cookies.<locals>.no_matching_rfc2965)rZget_allrArMr<r*r�r�rarz�	Exceptionrr�rbr�r�rx�filterrF)
r��responser�r�Zrfc2965_hdrsZns_hdrsr�r�rDZ
ns_cookiesrcr�rdrrr�make_cookies<s^�������
�



zCookieJar.make_cookiescCsN|j��z2tt���|j_|_|j�||�r:|�|�W5|j��XdSr�)	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��XdSr�)r@r?rRrSr�r�rx)r�r��cZc2Zc3rrrri�s






zCookieJar.set_cookiecCsbtd|���|j��z8|�||�D]&}|j�||�r&td|�|�|�q&W5|j��XdS)Nzextract_cookies: %sz setting cookie: %s)	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)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�rxrrrr]�s��
zCookieJar.clearcCsD|j��z(|D]}|jr|�|j|j|j�qW5|j��XdSr�)r?rRrSr�r]r�r�rx)r�r�rrr�clear_session_cookies�s
zCookieJar.clear_session_cookiescCsP|j��z4t��}|D]"}|�|�r|�|j|j|j�qW5|j��XdSr�)	r?rRrSrMr�r]r�r�rx)r�r�r�rrrrT�s


zCookieJar.clear_expired_cookiescCs
t|j�Sr�)r6r@rrrr�__iter__�szCookieJar.__iter__cCsd}|D]}|d}q|S)Nr	rr)r�r�r�rrr�__len__�s
zCookieJar.__len__cCs2g}|D]}|�t|��qd|jjd�|�fS�Nz<%s[%s]>r)rrr�r�r�r��r��rr�rrrr��szCookieJar.__repr__cCs2g}|D]}|�t|��qd|jjd�|�fSrp)rrr#r�r�r�rqrrrr��szCookieJar.__str__)N)NNN)!r�r�r�rt�compilerMrNZstrict_domain_reZ	domain_reZdots_re�ASCII�magic_rer�rCrErGrPrQr[r`rarbrhrjrirlr]rmrTrnror�r�rrrrr�s6





;!a\	7


c@seZdZdS)rNr;rrrrr�sc@s4eZdZddd�Zddd�Zd
dd�Zdd	d
�ZdS)rNFcCs2t�||�|dk	rt�|�}||_t|�|_dSr�)rr��os�fspath�filenamer\�	delayload)r�rxryrBrrrr��s

zFileCookieJar.__init__cCs
t��dSr�r�)r�rx�ignore_discard�ignore_expiresrrr�save�szFileCookieJar.savec	CsJ|dkr"|jdk	r|j}ntt��t|��}|�||||�W5QRXdSr�)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��XdSr�)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�rrrrr�s


	�cCs |j|jfd|jfd|jfg}|jdk	r8|�d|jf�|jrH|�d�|jrX|�d�|jrh|�d�|j	rx|�d�|j
r�|�dtt|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)
Nr�r�r�)�	path_specN)�	port_specN)�
domain_dotN)r�Nr�)r�Nr�rUr�)rxryr�r�r�rrr�r�r�r�r�r5r[r�r�r�r0r�r1r#r�r�)r�r�r1r�rrr�lwp_cookie_str$s:
�




�
r�c@s(eZdZd
dd�Zddd�Zdd	�ZdS)rTcCsTt��}g}|D]2}|s |jr q|s0|�|�r0q|�dt|��qd�|dg�S)NzSet-Cookie3: %s�
rW)rMr�r�rrr�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 filezSet-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@rrMrsrr�rzrKr�rerr�r�rir�rer)r�rrxrzr{�magicrr��headerrXrY�line�datarxryrZr�r�r�r�r�r�r�r�r�rkrrrris��










�
�zLWPCookieJar._really_load)TT)NFF)r�r�r�r�r|rrrrrr@s

c@s,eZdZe�d�ZdZdd�Zd	dd�ZdS)
rz#( Netscape)? HTTP Cookie Filezr# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

cCsbt��}|��}|j�|�s(td|��z�|��}|dkr>�q|�d�rT|dd�}|���d�s*|��dkrpq*|�d�\}}	}
}}}
}|dk}|	dk}	|
dkr�|}
d}|�d�}d	}|dkr�d}d
}t	d|
|dd	||	||
d	|||ddi�}|s�|j
r�q*|�s|�|��rq*|�|�q*WnBt
k
�r2�Yn,tk
�r\t�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�rsr�rr�r�rir�rer)r�rrxrzr{r�r�r�r�r�r�r�r�rxryr�r�rkrrrr�sr��

��
�

�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}|jdk	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�rsr�r#ryrxr�r�)r�rxrzr{rr�r�r�r�r�rxryrrrr| sH



���zMozillaCookieJar.save)NFF)	r�r�r�rtrsrur�rr|rrrrr�s
A)N)N)W�__all__rvr�r-rtrMZurllib.parser�Zurllib.requestZ	threadingr=Zhttp.clientZhttpZcalendarr
rrrr#ZclientZ	HTTP_PORTr�r}rr%r,r6r7rIr(rrrKr5r8r>rsrtr?rFrTrY�Ir]�Xr_rbrcrerkrmrnrprorzr�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

Hacked By AnonymousFox1.0, Coded By AnonymousFox