Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/http/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/http/__pycache__/cookiejar.cpython-37.opt-2.pyc

B

YI~d�+�@sddddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZ	dd	l
Zdd
lm
Z
dZd	add
�Zeejj�ZdZdd�ZdZdd�ZdddddddgZdddddd d!d"d#d$d%d&gZgZxeD]Ze�e���q�Wdtd'd(�Zdud)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:�Z/e�"d;�Z0e�"d<�Z1e�"d=�Z2e�"d>�Z3d?d@�Z4e�"dA�Z5dBdC�Z6dDdE�Z7dFdG�Z8e�"dHej#�Z9dIdJ�Z:dKdL�Z;dMdN�Z<dOdP�Z=e�"dQej#�Z>dRdS�Z?dTdU�Z@dVdW�ZAdXdY�ZBdZZCe�"d[�ZDd\d]�ZEd^d_�ZFd`da�ZGdbdc�ZHGddd�d�ZIGded�d�ZJGdfd�deJ�ZKdgdh�ZLdidj�ZMGdkdl�dl�ZNGdmd�d�ZOGdnd�deP�ZQGdod�deO�ZRdpdq�ZSGdrd�deR�ZTGdsd�deR�ZUd	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�3/opt/alt/python37/lib64/python3.7/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_exception9s
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�_timegmHs
8Hr,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)�t�dtrrr�	time2isozVs
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)r1r2)r3r4rrr�
time2netscapeis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|�}|tjkrdSyt�|���d}WnXtk
r�yt|�}Wntk
r\dSXd|krrdkr|nn|}ndSYnX|dkr�d}|dkr�d}|dkr�d}t|�}t|�}t|�}t|�}|dk�r0t�t���d}|d}	|}
|||	}|	|
}	t	|	�dk�r0|	dk�r(|d}n|d}t
|||||||f�}|dk	�r�|dk�r^d}|��}t|�}|dk�r|dS||}|S)Nrr r	i��d�2r9)
rAr-ZMAXYEAR�MONTHS_LOWER�index�lower�
ValueError�timeZ	localtime�absr,�upperrF)
r0�mon�yr�hrr*r+rCZimonZcur_yrrEZtmpr3rDrrr�	_str2time�sV







rSzV^[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_RErS)�textrE�grPr&r0rQrRr*r+rCrrr�	http2time�s
"
raa�^
    (\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)NrW)r[�ISO_DATE_REr@rYrS)
r_r0rPrQrRr*r+rCrE�_rrr�iso2time*s

rdcCs*|�d�\}}|jd|�|j|d�S)Nr	)�span�string)�match�start�endrrr�	unmatchedKsrjz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c
Csg}�x|D]�}|}g}x�|r�t�|�}|r�t|�}|�d�}t�|�}|rlt|�}|�d�}t�d|�}n.t�|�}|r�t|�}|�d�}|��}nd}|�	||f�q|�
��d�r�|�
�dd�}|r�|�	|�g}qt�
dd|�\}}	|}qW|r|�	|�qW|S)Nrz\1�,z^[=\s;]*rV)�HEADER_TOKEN_REr@rjrB�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_wordsTs>.







ryz([\"\\])cCs�g}xt|D]l}g}xN|D]F\}}|dk	rTt�d|�sHt�d|�}d|}d||f}|�|�qW|r
|�d�|��q
Wd�|�S)Nz^\w+$z\\\1z"%s"z%s=%sz; z, )rsr@�HEADER_JOIN_ESCAPE_REr]rq�join)Zlists�headersrv�attr�k�vrrr�join_header_words�s
r�cCs0|�d�r|dd�}|�d�r,|dd�}|S)N�"r���)rr�endswith)r_rrr�strip_quotes�s


r�cCsd}g}x�|D]�}g}d}x�t|�d��D]�\}}|��}|�d�\}}	}
|��}|sd|dkr*Pnq*|	rp|
��nd}
|dkr�|��}||kr�|}|dkr�|
dk	r�t|
�}
d}n|dkr�|
dk	r�tt|
��}
|�||
f�q*W|r|s�|�d	�|�|�qW|S)
N)�expires�domain�path�secure�version�portzmax-ageF�;�=r	r�Tr�)r��0)�	enumerate�split�strip�	partitionrKr�rarq)Z
ns_headersZknown_attrsruZ	ns_headerrv�version_set�iiZparam�key�sep�val�lcrrr�parse_ns_headers�s>

r�z\.\d+$cCs:t�|�rdS|dkrdS|ddks2|ddkr6dSdS)NFrVr	�.r�T)�IPV4_REr@)r_rrr�is_HDNs
r�cCsl|��}|��}||krdSt|�s(dS|�|�}|dksB|dkrFdS|�d�sTdSt|dd��shdSdS)NTFr�r	r�r)rKr��rfindrr)�A�B�irrr�domain_matchs

r�cCst�|�rdSdS)NFT)r�r@)r_rrr�liberal_is_HDNEs
r�cCs`|��}|��}t|�r t|�s0||kr,dSdS|�d�}|rL|�|�rLdS|s\||kr\dSdS)NTFr�)rKr�rrr�)r�r��initial_dotrrr�user_domain_matchOs
r�z:\d+$cCsB|��}tj�|�d}|dkr,|�dd�}t�d|d�}|��S)NrrVZHost)�get_full_url�urllib�parseZurlparseZ
get_header�cut_port_rer]rK)�request�url�hostrrr�request_hostdsr�cCs4t|�}}|�d�dkr,t�|�s,|d}||fS)Nr�r�z.local)r��findr�r@)r��erhn�req_hostrrr�eff_request_hosttsr�cCs4|��}tj�|�}t|j�}|�d�s0d|}|S)N�/)r�r�r�Zurlsplit�escape_pathr�rr)r�r��partsr�rrr�request_paths

r�cCs^|j}|�d�}|dkrV||dd�}yt|�WqZtk
rRtd|�dSXnt}|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)rBrO)rgrrr�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)rArZrLr�rwrxr��port_specifiedrKr��domain_specified�domain_initial_dotr��path_specifiedr�r��discard�comment�comment_url�rfc2109�copy�_rest)�selfr�rwrxr�r�r�r�r�r�r�r�r�r�r�r��restr�rrr�__init__�s.

zCookie.__init__cCs
||jkS)N)r�)r�rwrrr�has_nonstandard_attrszCookie.has_nonstandard_attrNcCs|j�||�S)N)r��get)r�rw�defaultrrr�get_nonstandard_attrszCookie.get_nonstandard_attrcCs||j|<dS)N)r�)r�rwrxrrr�set_nonstandard_attrszCookie.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)NrVr�z%s=%sz<Cookie %s for %s>)r�r�r�rxrw)r��p�limitZ	namevaluerrr�__str__(s


zCookie.__str__cCspg}x,dD]$}t||�}|�d|t|�f�q
W|�dt|j��|�dt|j��d|jjd�|�fS)N)r�rwrxr�r�r�r�r�r�r�r�r�r�r�r�z%s=%szrest=%sz
rfc2109=%sz%s(%s)z, )�getattrrq�reprr�r��	__class__�__name__r{)r�rrwr}rrr�__repr__2s

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��dS)N)�NotImplementedError)r��cookier�rrr�set_okJszCookiePolicy.set_okcCs
t��dS)N)r�)r�r�r�rrr�	return_okSszCookiePolicy.return_okcCsdS)NTr)r�r�r�rrr�domain_return_okWszCookiePolicy.domain_return_okcCsdS)NTr)r�r�r�rrr�path_return_ok\szCookiePolicy.path_return_okN)r�r�r�r�r�r�r�rrrrrAs		c@s�eZdZdZdZdZdZeeBZdddddddddeddfdd	�Zd
d�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.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)6rrrrTr	NTFc

Csp||_||_||_||_||_||_|	|_|
|_||_||_	|dk	rPt
|�|_nd|_|dk	rft
|�}||_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�tuple�_blocked_domains�_allowed_domains)
r��blocked_domains�allowed_domainsr�r�r�r�r�r�r�r�r�r�rrrr�ls 
zDefaultCookiePolicy.__init__cCs|jS)N)r�)r�rrrr��sz#DefaultCookiePolicy.blocked_domainscCst|�|_dS)N)r�r�)r�r�rrr�set_blocked_domains�sz'DefaultCookiePolicy.set_blocked_domainscCs"x|jD]}t||�rdSqWdS)NTF)r�r�)r�r�Zblocked_domainrrr�
is_blocked�s
zDefaultCookiePolicy.is_blockedcCs|jS)N)r�)r�rrrr��sz#DefaultCookiePolicy.allowed_domainscCs|dk	rt|�}||_dS)N)r�r�)r�r�rrr�set_allowed_domains�sz'DefaultCookiePolicy.set_allowed_domainscCs0|jdkrdSx|jD]}t||�rdSqWdS)NFT)r�r�)r�r�Zallowed_domainrrr�is_not_allowed�s

z"DefaultCookiePolicy.is_not_allowedcCsBtd|j|j�x,dD]$}d|}t||�}|||�sdSqWdS)Nz - checking cookie %s=%s)r��
verifiabilityrwr�r�r�Zset_ok_FT)rrwrxr�)r�r�r��n�fn_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	z$   RFC 2965 cookies are switched offz$   Netscape cookies are switched offT)r�rrwrxr�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)�unverifiabler�r�r�rr�)r�r�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�rwrrr)r�r�r�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)Nz"   domain %s is in user block-listFz&   domain %s is not in user allow-listr�rr	r)�coZacZcomZeduZorgZnetZgovZmilrAZaeroZbiz�catZcoop�infoZjobsZmobiZmuseumrwZproZtravel�euz&   country-code second level domain %sz.localz/   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)r�r�rr�r�r�r��countr�rK�lenrrr�r�r�r��DomainRFC2965Matchr��DomainStrictNoDotsr�r@)
r�r�r�r�r�r�r��jZtldZsldZundotted_domainZ
embedded_dotsZhost_prefixrrr�
set_ok_domain�sb


z!DefaultCookiePolicy.set_ok_domainc	Cs�|jr�t|�}|dkrd}nt|�}x\|j�d�D]:}yt|�Wntk
r`td|�dSX||kr2Pq2Wtd||j�dSdS)N�80rkz   bad port %s (not numeric)Fz$   request port (%s) not found in %sT)r�r��strr�r�rArLr)r�r�r��req_portr�rrr�set_ok_port(s"

zDefaultCookiePolicy.set_ok_portcCsBtd|j|j�x,dD]$}d|}t||�}|||�sdSqWdS)Nz - checking cookie %s=%s)r�r�r�r�r�r�Z
return_ok_FT)rrwrxr�)r�r�r�r�r�r�rrrr�=s	


zDefaultCookiePolicy.return_okcCs<|jdkr|jstd�dS|jdkr8|js8td�dSdS)Nr	z$   RFC 2965 cookies are switched offFz$   Netscape cookies are switched offT)r�r�rr�)r�r�r�rrr�return_ok_versionOsz%DefaultCookiePolicy.return_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)r�r�r�r�rr�)r�r�r�rrr�return_ok_verifiabilityXsz+DefaultCookiePolicy.return_ok_verifiabilitycCs |jr|jdkrtd�dSdS)NZhttpsz(   secure cookie with non-secure requestFT)r��typer)r�r�r�rrr�return_ok_securedsz$DefaultCookiePolicy.return_ok_securecCs|�|j�rtd�dSdS)Nz   cookie expiredFT)r��_nowr)r�r�r�rrr�return_ok_expiresjsz%DefaultCookiePolicy.return_ok_expirescCsP|jrLt|�}|dkrd}x0|j�d�D]}||kr(Pq(Wtd||j�dSdS)Nr
rkz0   request port %s does not match cookie port %sFT)r�r�r�r)r�r�r�rr�rrr�return_ok_portps
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�rrr�r��DomainStrictNonDomainr�rr�r�)r�r�r�r�r�r��	dotdomainrrr�return_ok_domain~s&

z$DefaultCookiePolicy.return_ok_domaincCs�t|�\}}|�d�sd|}|�d�s0d|}|rH|�d�sHd|}n|}|�|�sd|�|�sddS|�|�r|td|�dS|�|�r�td|�dSdS)Nr�Fz"   domain %s is in user block-listz&   domain %s is not in user allow-listT)r�rrr�r�rr�)r�r�r�r�r�rrrrr��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�rrrr�)r�r�r�r�Zpathlenrrrr��s

z"DefaultCookiePolicy.path_return_ok)r�r�r�rrrZ
DomainLiberalZDomainStrictr�r�r�r�r�r�r�r�r�r�r�r�r	r
r�rrrrrrr�r�rrrrrbsJ	;	cCst|���}t|j|�S)N)�sorted�keys�mapr�)Zadictrrrr�vals_sorted_by_key�src	csZt|�}xL|D]D}d}y
|jWntk
r4YnXd}t|�EdH|s|VqWdS)NFT)r�items�AttributeError�
deepvalues)�mapping�values�objrrrr�s

rc@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\Wz([\"\\])z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs(|dkrt�}||_t��|_i|_dS)N)r�_policy�
_threading�RLock�
_cookies_lock�_cookies)r��policyrrrr��s

zCookieJar.__init__cCs
||_dS)N)r#)r�r(rrr�
set_policy�szCookieJar.set_policycCs�g}|j�||�sgStd|�|j|}xd|��D]X}|j�||�sHq4||}x:|��D].}|j�||�svtd�qZtd�|�|�qZWq4W|S)Nz!Checking %s for cookies to returnz   not returning cookiez   it's a match)	r#r�rr'rr�r r�rq)r�r�r��cookiesZcookies_by_pathr�Zcookies_by_namer�rrr�_cookies_for_domain�s 

zCookieJar._cookies_for_domaincCs.g}x$|j��D]}|�|�||��qW|S)N)r'r�extendr+)r�r�r*r�rrr�_cookies_for_requestszCookieJar._cookies_for_requestc	CsF|jdd�dd�d}g}�x$|D�]}|j}|sLd}|dkrL|�d|�|jdk	r~|j�|j�r~|dkr~|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	r"d}|j�r4|d|j}|�|�q"W|S)NcSs
t|j�S)N)rr�)�arrr�<lambda>�z)CookieJar._cookie_attrs.<locals>.<lambda>T)r��reverseFr	z$Version=%sz\\\1z%s=%sz
$Path="%s"r�rz$Domain="%s"z$Portz="%s")�sortr�rqrx�non_word_rer@�quote_rer]rwr�r�r�rrr�r�r�)	r�r*r��attrsr�r�rxr�r�rrr�
_cookie_attrss>



zCookieJar._cookie_attrscCs�td�|j��z�tt���|j_|_|�|�}|�|�}|r^|�	d�s^|�
dd�|��|jjr�|jj
s�|�	d�s�x$|D]}|jdkr~|�
dd�Pq~WWd|j��X|��dS)N�add_cookie_headerrz; ZCookie2rz$Version="1")rr&�acquirerArMr#rr-r6Z
has_headerZadd_unredirected_headerr{r�r�r��release�clear_expired_cookies)r�r�r*r5r�rrrr7Fs$







zCookieJar.add_cookie_headerc
Cs�g}d}d}�x||D�]r}|d\}}d}d}	i}
i}�x4|dd�D�]"\}}
|��}||ksh||krl|}||kr�|
dkr�d}
||
kr�qF|dkr�|
dkr�td�d}	P|
��}
|d	kr�|r�qF|
dkr�td
�qF|dk�rd}yt|
�}
Wn$tk
�rtd�d}	PYnXd	}|j|
}
||k�s2||k�rb|
dk�rX|d
k�rXtd|�d}	P|
|
|<qF|
||<qFW|	�rvq|�|||
|f�qW|S)N)r�r�)r�r�zmax-ager�r�r�r��
commenturlr	FrTr�z%   missing value for domain attributer�zM   missing or invalid value for expires attribute: treating as session cookiezmax-agez?   missing or invalid (non-numeric) value for max-age attribute)r�r�r;z!   missing value for %s attribute)rKrrArLrrq)r��	attrs_set�
cookie_tuples�
boolean_attrs�value_attrsZcookie_attrsrwrxZmax_age_setZ
bad_cookie�standardr�r~rr�rrr�_normalized_cookie_tuplesgsf






z#CookieJar._normalized_cookie_tuplescCs$|\}}}}|�dt�}|�dt�}|�dt�}	|�dt�}
|�dd�}|dk	rryt|�}Wntk
rpdSX|�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}|�r8t|�	d��}|tk�rTt
|�\}}|}n|�	d��shd|}d}|	tk	�r�|	dk�r�t|�}	nd}t�
dd|	�}	nd}	|
tk�r�d}
d}
nH|
|jk�r�y|�|||�Wntk
�r�YnXtd|||�dSt||||	||||||||
|
|||�S)Nr�r�r�r�r�r�Fr�r�r;rVTr�r�r	rr�z\s+z2Expiring cookie, domain='%s', path='%s', name='%s')r�r"rArLr�r�r�r�boolrrr�r�rsr]r�clear�KeyErrorrr)r��tupr�rwrxr@r�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_tuplecCs:|�|�}g}x&|D]}|�||�}|r|�|�qW|S)N)rArFrq)r�r<r�r=r*rEr�rrr�_cookies_from_attrs_set$s

z!CookieJar._cookies_from_attrs_setcCsLt|jdd�}|dkr |jj}x&|D]}|jdkr&d|_|r&d|_q&WdS)Nr�rTr	)r�r#r�r�r�)r�r*Z
rfc2109_as_nsr�rrr�_process_rfc2109_cookies-s


z"CookieJar._process_rfc2109_cookiesc
Cs>|��}|�dg�}|�dg�}tt���|j_|_|jj}|jj}|sN|rf|sV|rf|s^|rf|sj|sjgSy|�t	|�|�}Wnt
k
r�t�g}YnX|�r:|�r:y|�t|�|�}	Wnt
k
r�t�g}	YnX|�
|	�|�r*i}
x |D]}d|
|j|j|jf<q�W|
fdd�}t||	�}	|	�r:|�|	�|S)NzSet-Cookie2z
Set-CookiecSs|j|j|jf}||kS)N)r�r�rw)Z	ns_cookie�lookupr�rrr�no_matching_rfc2965fsz3CookieJar.make_cookies.<locals>.no_matching_rfc2965)rZget_allrArMr#rr�r�rGry�	Exceptionrr�rHr�r�rw�filterr,)
r��responser�r|Zrfc2965_hdrsZns_hdrsr�r�r*Z
ns_cookiesrIr�rJrrr�make_cookies9sD





zCookieJar.make_cookiescCsN|j��z2tt���|j_|_|j�||�r:|�|�Wd|j��XdS)N)	r&r8rArMr#rr��
set_cookier9)r�r�r�rrr�set_cookie_if_okps
zCookieJar.set_cookie_if_okcCsl|j}|j��zJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<Wd|j��XdS)N)r'r&r8r�r�rwr9)r�r��cZc2Zc3rrrrO}s






zCookieJar.set_cookiecCsftd|���|j��z<x6|�||�D]&}|j�||�r(td|�|�|�q(WWd|j��XdS)Nzextract_cookies: %sz setting cookie: %s)	rrr&r8rNr#r�rOr9)r�rMr�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�rwrrrrC�s
zCookieJar.clearcCsH|j��z,x&|D]}|jr|�|j|j|j�qWWd|j��XdS)N)r&r8r�rCr�r�rwr9)r�r�rrr�clear_session_cookies�s

zCookieJar.clear_session_cookiescCsT|j��z8t��}x*|D]"}|�|�r|�|j|j|j�qWWd|j��XdS)N)	r&r8rMr�rCr�r�rwr9)r�r�r�rrrr:�s



zCookieJar.clear_expired_cookiescCs
t|j�S)N)rr')r�rrr�__iter__�szCookieJar.__iter__cCsd}x|D]}|d}q
W|S)Nr	rr)r�r�r�rrr�__len__�s
zCookieJar.__len__cCs6g}x|D]}|�t|��q
Wd|jjd�|�fS)Nz<%s[%s]>z, )rqr�r�r�r{)r��rr�rrrr��s
zCookieJar.__repr__cCs6g}x|D]}|�t|��q
Wd|jjd�|�fS)Nz<%s[%s]>z, )rqrr�r�r{)r�rVr�rrrr��s
zCookieJar.__str__)N)NNN)!r�r�r�rs�compiler3r4Zstrict_domain_reZ	domain_reZdots_re�ASCII�magic_rer�r)r+r-r6r7rArFrGrHrNrPrOrRrCrSr:rTrUr�r�rrrrr�s6





;!a\	7


c@seZdZdS)rN)r�r�r�rrrrr�sc@s4eZdZddd�Zddd�Zd
dd�Zdd	d
�ZdS)rNFcCsJt�||�|dk	r6y|dWntd��YnX||_t|�|_dS)NrVzfilename must be string-like)rr�rL�filenamerB�	delayload)r�rZr[r(rrrr��szFileCookieJar.__init__cCs
t��dS)N)r�)r�rZ�ignore_discard�ignore_expiresrrr�save�szFileCookieJar.savec	CsJ|dkr"|jdk	r|j}ntt��t|��}|�||||�WdQRXdS)N)rZrL�MISSING_FILENAME_TEXT�open�_really_load)r�rZr\r]rrrr�loads

zFileCookieJar.loadcCs�|dkr"|jdk	r|j}ntt��|j��zFt�|j�}i|_y|�|||�Wnt	k
rn||_�YnXWd|j�
�XdS)N)rZrLr_r&r8r�Zdeepcopyr'rb�OSErrorr9)r�rZr\r]Z	old_staterrr�revert	s

zFileCookieJar.revert)NFN)NFF)NFF)NFF)r�r�r�r�r^rbrdrrrrr�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���}x$|D]}|�|t|j|�f�q�W|�dt|j�f�t|g�S)
Nr�r�r�)�	path_specN)�	port_specN)�
domain_dotN)r�Nr�)r�Nr�r;r�)rwrxr�r�r�rqr�r�r�r�r�r5rZr�r�r�rr�rrr�r�)r�r�rr~rrr�lwp_cookie_str$s6







rhc@s(eZdZd
dd�Zddd�Zdd	�ZdS)rTcCsXt��}g}x:|D]2}|s"|jr"q|s2|�|�r2q|�dt|��qWd�|dg�S)NzSet-Cookie3: %s�
rV)rMr�r�rqrhr{)r�r\r]r�rVr�rrr�
as_lwp_strMs

zLWPCookieJar.as_lwp_strNFc	CsX|dkr"|jdk	r|j}ntt��t|d��"}|�d�|�|�||��WdQRXdS)N�wz#LWP-Cookies-2.0
)rZrLr_r`�writerj)r�rZr\r]rrrrr^]s

zLWPCookieJar.savecCsD|��}|j�|�s$d|}t|��t��}d}d}	d}
�yx�|��}|dkrRP|�|�s^q@|t|�d���}�x�t|g�D�]p}|d\}
}i}i}x|	D]}d||<q�Wx�|dd�D]p\}}|dk	r�|�	�}nd}||
ks�||	kr�|}||	k�r|dk�rd	}|||<q�||
k�r&|||<q�|||<q�W|j
}|d
�}|d�}|dk	�rZt|�}|dk�rhd	}|d�}|�d
�}t|d�|
||d�|d�|||d�|d�|d�|d�|||d�|d�|�}|�s�|j
�r�q�|�s�|�|��r�q�|�|�q�Wq@WWnBtk
�r�Yn,tk
�r>t�td||f��YnXdS)Nz5%r does not look like a Set-Cookie3 (LWP) format filezSet-Cookie3:)rfrergr�r�)r�r�r�r�r�r�r;rVr	FrTr�r�r�r�r�r�rfrgr�rer�r�r;z&invalid Set-Cookie3 format file %r: %r)�readlinerYr@rrMrrrr�ryrKr�rdrr�r�rOrcrKr)r�rrZr\r]�magicrr��headerr>r?�line�datarwrxr@r�r~rr�r�r�r�r�r�rQrrrrais�











zLWPCookieJar._really_load)TT)NFF)r�r�r�rjr^rarrrrr@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.

cCsdt��}|��}|j�|�s(td|��y�x�|��}|dkr>P|�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,WWnBt
k
�r4�Yn,tk
�r^t�td||f��YnXdS)
Nz4%r does not look like a Netscape format cookies filerVrir�)�#r��	�TRUEr�FTr	z+invalid Netscape format cookies file %r: %r)rMrmrYr@rr�r�rrr�rr�r�rOrcrKr)r�rrZr\r]r�rnrpr�r�r�r�r�rwrxr�r�rQrrrra�s`


zMozillaCookieJar._really_loadNFc
Cs|dkr"|jdk	r|j}ntt��t|d���}|�|j�t��}x�|D]�}|sX|jrXqH|sh|�|�rhqH|j	rtd}nd}|j
�d�r�d}nd}|jdk	r�t
|j�}	nd}	|jdkr�d}
|j}n|j}
|j}|�d�|j
||j||	|
|g�d�qHWWdQRXdS)NrkrtZFALSEr�rVrsri)rZrLr_r`rlrorMr�r�r�r�rrr�rrxrwr{r�)r�rZr\r]rr�r�r�r�r�rwrxrrrr^ s<




zMozillaCookieJar.save)NFF)	r�r�r�rsrWrYrorar^rrrrr�s
A)N)N)V�__all__r�r-rsrMZurllib.parser�Zurllib.requestZ	threadingr$Zhttp.clientZhttpZcalendarr
rrrrZclientZ	HTTP_PORTr�r_rr%r,r6r7rIr(rqrKr5r8r>rWrXr?rFrSrX�Ir\�Xr^rarbrdrjrlrmrornryrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr"rrcrrrhrrrrrr�<module>s�



88!



U
D'


#b!`:x

Hacked By AnonymousFox1.0, Coded By AnonymousFox