AlkantarClanX12

Your IP : 3.142.98.111


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/http/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/http/__pycache__/cookiejar.cpython-35.opt-2.pyc



���],�@s�ddddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZydd	lZ	Wne
k
r�dd	lZ	YnXdd	lZ
dd
lmZdZd	add
�Zee
jj�ZdZdd�ZdZdd�ZdddddddgZdddddd d!d"d#d$d%d&gZgZx!eD]Zejej ��qSWd	d'd(�Z!d	d)d*�Z"d+d	d,d	d-d	d.d	iZ#ej$d/ej%�Z&d0d1�Z'd2d3�Z(ej$d4ej%�Z)ej$d5ej*ej%B�Z+ej$d6ej,ej%B�Z-d7d8�Z.ej$d9ej,ej%B�Z/d:d;�Z0d<d=�Z1ej$d>�Z2ej$d?�Z3ej$d@�Z4ej$dA�Z5dBdC�Z6ej$dD�Z7dEdF�Z8dGdH�Z9dIdJ�Z:ej$dKej%�Z;dLdM�Z<dNdO�Z=dPdQ�Z>dRdS�Z?ej$dTej%�Z@dUdV�ZAdWdX�ZBdYdZ�ZCd[d\�ZDd]ZEej$d^�ZFd_d`�ZGdadb�ZHdcdd�ZIdedf�ZJGdgd�d�ZKGdhd�d�ZLGdid�deL�ZMdjdk�ZNdldm�ZOGdndo�do�ZPGdpd�d�ZQGdqd�deR�ZSGdrd�deQ�ZTdsdt�ZUGdud�deT�ZVGdvd�deT�ZWd	S)w�Cookie�	CookieJar�CookiePolicy�DefaultCookiePolicy�
FileCookieJar�LWPCookieJar�	LoadError�MozillaCookieJar�N)�timegmFcGs8ts
dSts+ddl}|jd�atj|�S)Nr	zhttp.cookiejar)�debug�logger�logging�	getLogger)�argsr
�r�./opt/alt/python35/lib64/python3.5/cookiejar.py�_debug.srzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsgddl}ddl}ddl}|j�}|jd|�|j�}|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|koEdknr�d|koadknr�d|ko}dknr�d|ko�dknr�d|ko�dknr�t|�SdSdS)	N����r	��;�=)�
EPOCH_YEARr
)�tt�year�monthZmday�hour�min�secrrr�_timegmKs
"DT
r-ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs\|dkrtjj�}ntjj|�}d|j|j|j|j|j|jfS)Nz%04d-%02d-%02d %02d:%02d:%02dZ)	�datetime�utcnow�utcfromtimestampr(r)�dayr*�minute�second)�t�dtrrr�	time2isozYs
r6cCsq|dkrtjj�}ntjj|�}dt|j�|jt|jd|j|j	|j
|jfS)Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr )r.r/r0�DAYSZweekdayr1�MONTHSr)r(r*r2r3)r4r5rrr�
time2netscapels!r9ZGMT�UTCZUT�Zz^([-+])?(\d\d?):?(\d\d)?$cCs�d}|tkrd}nvtj|�}|r�dt|jd��}|jd�ru|dt|jd��}|jd�dkr�|}|S)Nr	ir��<r �-)�	UTC_ZONES�TIMEZONE_RE�search�int�group)�tz�offset�mrrr�offset_from_tz_string�s	rGc
Cst|�}|tjkrdSytj|j��d}Wndtk
r�yt|�}Wntk
rtdSYnXd|ko�dknr�|}ndSYnX|dkr�d}|dkr�d}|dkr�d}t|�}t|�}t|�}t|�}|dkr�tjtj��d}|d}	|}
|||	}|	|
}	t	|	�dkr�|	dkr�|d}n
|d}t
|||||||f�}|dk	r�|dkr�d}|j�}t|�}|dkr�dS||}|S)Nr r!r	i��d�2r:)
rBr.ZMAXYEAR�MONTHS_LOWER�index�lower�
ValueError�time�	localtime�absr-�upperrG)
r1�mon�yr�hrr+r,rDZimonZcur_yrrF�tmpr4rErrr�	_str2time�sV

			



!
rVzV^[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*$cCs4tj|�}|r�|j�}tj|dj��d}t|d�|t|d�t|d�t|d�t|d�f}t|�S|j	�}t
jd|d�}dgd\}}}}}}	}
tj|�}|dk	r|j�\}}}}}}	}
ndSt
||||||	|
�S)	Nr rr	r<����)�STRICT_DATE_RErA�groupsrJrKrLrB�floatr-�lstrip�
WEEKDAY_RE�sub�LOOSE_HTTP_DATE_RErV)�textrF�grRr'r1rSrTr+r,rDrrr�	http2time�s-
"$rda�^
    (\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)NrZ)r^�ISO_DATE_RErAr\rV)
rbr1rRrSrTr+r,rDrF�_rrr�iso2time's
"'rgcCs7|jd�\}}|jd|�|j|d�S)Nr	)�span�string)�match�start�endrrr�	unmatchedHsrmz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c
Csg}xr|D]j}|}g}xB|rctj|�}|r�t|�}|jd�}tj|�}|r�t|�}|jd�}tjd|�}nEtj|�}|r�t|�}|jd�}|j�}nd}|j	||f�q"|j
�jd�r?|j
�dd�}|r6|j	|�g}q"tj
dd|�\}}	|}q"W|r
|j	|�q
W|S)Nr z\1�,z^[=\s;]*rY)�HEADER_TOKEN_RErArmrC�HEADER_QUOTED_VALUE_RE�HEADER_ESCAPE_REr`�HEADER_VALUE_RE�rstrip�appendr^�
startswith�re�subn)
Z
header_values�resultrbZ	orig_text�pairsrF�name�valueZnon_junkZ
nr_junk_charsrrr�split_header_wordsQs>.
	
	
r|z([\"\\])cCs�g}x�|D]�}g}xk|D]c\}}|dk	rvtjd|�sftjd|�}d|}d||f}|j|�q W|r
|jdj|��q
Wdj|�S)Nz^\w+$z\\\1z"%s"z%s=%sz; z, )rvrA�HEADER_JOIN_ESCAPE_REr`rt�join)Zlists�headersry�attr�k�vrrr�join_header_words�s

r�cCsB|jd�r|dd�}|jd�r>|dd�}|S)N�"r ���)ru�endswith)rbrrr�strip_quotes�s
r�cCsnd}g}x[|D]S}g}d}xt|jd	��D]\}}|j�}|jd
�\}}	}
|j�}|s�|dkr;Pnq;|	r�|
j�nd}
|dkr)|j�}||kr�|}|dkr�|
dk	r�t|
�}
d}n*|dkr)|
dk	r)tt|
��}
|j||
f�q;W|r|sY|jd�|j|�qW|S)N�expires�domain�path�secure�version�port�max-ageF�;�=r	T�0)r�r�r�r�r�r�r�)r�r�)�	enumerate�split�strip�	partitionrLr�rdrt)Z
ns_headersZknown_attrsrxZ	ns_headerry�version_set�iiZparam�key�sep�val�lcrrr�parse_ns_headers�s@
"	
r�z\.\d+$cCsKtj|�rdS|dkr#dS|ddksC|ddkrGdSdS)NFrYr	�.r Tr�)�IPV4_RErA)rbrrr�is_HDNs r�cCs�|j�}|j�}||kr(dSt|�s8dS|j|�}|dks_|dkrcdS|jd�svdSt|dd��s�dSdS)NTFr r	r�r�)rLr��rfindru)�A�B�irrr�domain_matchsr�cCstj|�rdSdS)NFT)r�rA)rbrrr�liberal_is_HDNBsr�cCs�|j�}|j�}t|�o-t|�sD||kr@dSdS|jd�}|rl|j|�rldS|r�||kr�dSdS)NTFr�)rLr�rur�)r�r��initial_dotrrr�user_domain_matchLsr�z:\d+$cCs_|j�}tjj|�d}|dkr@|jdd�}tjd|d�}|j�S)Nr rYZHost)�get_full_url�urllib�parse�urlparseZ
get_header�cut_port_rer`rL)�request�url�hostrrr�request_hostasr�cCsIt|�}}|jd�dkr?tj|�r?|d}||fS)Nr�r z.localr�)r��findr�rA)r��erhn�req_hostrrr�eff_request_hostqs%
r�cCsJ|j�}tjj|�}t|j�}|jd�sFd|}|S)N�/)r�r�r�Zurlsplit�escape_pathr�ru)r�r��partsr�rrr�request_path|s
r�cCsy|j}|jd�}|dkro||dd�}yt|�Wqutk
rktd|�dSYquXnt}|S)N�:r	r znonnumeric port: '%s')r�r�rBrMr�DEFAULT_HTTP_PORT)r�r�r�r�rrr�request_port�s	

r�z%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd|jd�j�S)Nz%%%sr )rCrQ)rjrrr�uppercase_escaped_char�sr�cCs+tjj|t�}tjt|�}|S)N)r�r��quote�HTTP_PATH_SAFE�ESCAPED_CHAR_REr`r�)r�rrrr��s
r�cCsn|jd�}|dkrj||dd�}|jd�}t|�rj|dksb|dkrjd|S|S)Nr�r	r �local)r�r�)�hr��brrr�reach�s$r�cCs0t|�}t|t|j��s(dSdSdS)NTF)r�r�r�Zorigin_req_host)r�r�rrr�is_third_party�s
r�c@smeZdZddd�Zdd�Zddd�Zd	d
�Zddd�Zd
d�Zdd�Z	dS)rFcCs|dk	rt|�}|dk	r6tt|��}|dkrZ|dkrZtd��||_||_||_||_||_|j�|_	||_
||_|	|_|
|_
||_||_|
|_||_||_||_tj|�|_dS)NTz-if port is None, port_specified must be false)rBr]rMr�rzr{r��port_specifiedrLr��domain_specified�domain_initial_dotr��path_specifiedr�r��discard�comment�comment_url�rfc2109�copy�_rest)�selfr�rzr{r�r�r�r�r�r�r�r�r�r�r�r��restr�rrr�__init__�s.
															zCookie.__init__cCs
||jkS)N)r�)r�rzrrr�has_nonstandard_attrszCookie.has_nonstandard_attrNcCs|jj||�S)N)r��get)r�rz�defaultrrr�get_nonstandard_attrszCookie.get_nonstandard_attrcCs||j|<dS)N)r�)r�rzr{rrr�set_nonstandard_attrszCookie.set_nonstandard_attrcCs>|dkrtj�}|jdk	r:|j|kr:dSdS)NTF)rNr�)r��nowrrr�
is_expireds
zCookie.is_expiredcCsx|jdkrd}n
d|j}|j||j}|jdk	rad|j|jf}n	|j}d||fS)NrYr�z%s=%sz<Cookie %s for %s>)r�r�r�r{rz)r��p�limitZ	namevaluerrr�__str__%s	
	zCookie.__str__cCs�g}x:dD]2}t||�}|jd|t|�f�q
W|jdt|j��|jdt|j��d|jjdj|�fS)Nr�rzr{r�r�r�r�r�r�r�r�r�r�r�r�z%s=%szrest=%sz
rfc2109=%sz%s(%s)z, )r�rzr{r�r�r�r�r�r�r�r�r�r�r�r�)�getattrrt�reprr�r��	__class__�__name__r~)r�rrzr�rrr�__repr__/s
!zCookie.__repr__)
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_okGszCookiePolicy.set_okcCs
t��dS)N)r�)r�r�r�rrr�	return_okPszCookiePolicy.return_okcCsdS)NTr)r�r�r�rrr�domain_return_okTszCookiePolicy.domain_return_okcCsdS)NTr)r�r�r�rrr�path_return_okYszCookiePolicy.path_return_okN)r�r�r�r�r�r�r�rrrrr>s		c@sjeZdZdZdZdZdZeeBZdddddddddedddd	�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)6rr rrWr	NTFc

Cs�||_||_||_||_||_||_|	|_|
|_||_||_	|dk	rxt
|�|_n	f|_|dk	r�t
|�}||_dS)N)
�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�is 
											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||�r
dSq
WdS)NTF)r�r�)r�r�Zblocked_domainrrr�
is_blocked�szDefaultCookiePolicy.is_blockedcCs|jS)N)r�)r�rrrr��sz#DefaultCookiePolicy.allowed_domainscCs%|dk	rt|�}||_dS)N)r�r�)r�r�rrr�set_allowed_domains�sz'DefaultCookiePolicy.set_allowed_domainscCs>|jdkrdSx$|jD]}t||�rdSqWdS)NFT)r�r�)r�r�Zallowed_domainrrr�is_not_allowed�sz"DefaultCookiePolicy.is_not_allowedcCsWtd|j|j�x:dD]2}d|}t||�}|||�sd	SqWd
S)Nz - checking cookie %s=%sr��
verifiabilityrzr�r�r�Zset_ok_FT)r�r�rzr�r�r�)rrzr{r�)r�r�r��n�fn_name�fnrrrr��s

zDefaultCookiePolicy.set_okcCs{|jdkr)td|j|j�dS|jdkrP|jrPtd�dS|jdkrw|jrwtd�dSdS)Nz0   Set-Cookie2 without version attribute (%s=%s)Fr	z$   RFC 2965 cookies are switched offz$   Netscape cookies are switched offT)r�rrzr{r�r�)r�r�r�rrr�set_ok_version�s

z"DefaultCookiePolicy.set_ok_versioncCse|jrat|�ra|jdkr;|jr;td�dS|jdkra|jratd�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�s

z(DefaultCookiePolicy.set_ok_verifiabilitycCsB|jdkr>|jr>|jjd�r>td|j�dSdS)Nr	�$z'   illegal name (starts with '$'): '%s'FT)r�r�rzrur)r�r�r�rrr�set_ok_name�s
zDefaultCookiePolicy.set_ok_namecCsm|jrit|�}|jdks<|jdkri|jri|j|j|�ritd|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|j�r&td|j�dS|j|j�rLtd|j�dS|jr�t|�\}}|j}|jr|jd�dkr|jd�}|jdd|�}|dkr||dd�}||d|�}	|	j	�d$krt
|�dkrtd|�dS|jd�r=|dd�}
n|}
|
jd�dk}|r||dkr|td|�dS|j
dkr�|j|�r�|jd�r�d|j|�r�td ||�dS|j
dks�|j|j@rt||�std!||�dS|j
dks4|j|j@r�|dt
|��}|jd�dkr�tj|�r�td"||�dSd#S)%Nz"   domain %s is in user block-listFz&   domain %s is not in user allow-listr�rr	r �co�ac�com�edu�org�net�gov�milrB�aero�biz�cat�coop�info�jobs�mobi�museumrz�pro�travel�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)rrr	r
rrr
rrBrrrrrrrrrzrrr)r�r�rr�r�r�r��countr�rL�lenrur�r�r�r��DomainRFC2965Matchr��DomainStrictNoDotsr�rA)
r�r�r�r�r�r�r��jZtldZsldZundotted_domainZ
embedded_dotsZhost_prefixrrr�
set_ok_domain�sf			



z!DefaultCookiePolicy.set_ok_domaincCs�|jr�t|�}|dkr*d}nt|�}xr|jjd�D]G}yt|�Wn#tk
r�td|�dSYnX||krIPqIWtd||j�dSdS)N�80rnz   bad port %s (not numeric)Fz$   request port (%s) not found in %sT)r�r��strr�r�rBrMr)r�r�r��req_portr�rrr�set_ok_port%s"		

	
zDefaultCookiePolicy.set_ok_portcCsWtd|j|j�x:dD]2}d|}t||�}|||�sd	SqWd
S)Nz - checking cookie %s=%sr�r�r�r�r�r�Z
return_ok_FT)r�r�r�r�r�r�)rrzr{r�)r�r�r�r�r�r�rrrr�:s	

zDefaultCookiePolicy.return_okcCsR|jdkr'|jr'td�dS|jdkrN|jrNtd�dSdS)Nr	z$   RFC 2965 cookies are switched offFz$   Netscape cookies are switched offT)r�r�rr�)r�r�r�rrr�return_ok_versionLs

z%DefaultCookiePolicy.return_ok_versioncCse|jrat|�ra|jdkr;|jr;td�dS|jdkra|jratd�dSdS)Nr	z>   third-party RFC 2965 cookie during unverifiable transactionFz>   third-party Netscape cookie during unverifiable transactionT)rr�r�r�rr�)r�r�r�rrr�return_ok_verifiabilityUs

z+DefaultCookiePolicy.return_ok_verifiabilitycCs*|jr&|jdkr&td�dSdS)NZhttpsz(   secure cookie with non-secure requestFT)r��typer)r�r�r�rrr�return_ok_secureas
z$DefaultCookiePolicy.return_ok_securecCs$|j|j�r td�dSdS)Nz   cookie expiredFT)r��_nowr)r�r�r�rrr�return_ok_expiresgs
z%DefaultCookiePolicy.return_ok_expirescCsl|jrht|�}|dkr'd}x>|jjd�D]}||kr:Pq:Wtd||j�dSdS)Nr rnz0   request port %s does not match cookie port %sFT)r�r�r�r)r�r�r�r"r�rrr�return_ok_portms	
z"DefaultCookiePolicy.return_ok_portcCs�t|�\}}|j}|r>|jd�r>d|}n|}|jdkr�|j|j@r�|jr�||kr�td�dS|jdkr�t||�r�td||�dS|jdkr�d|j	|�r�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�rur�r��DomainStrictNonDomainr�rr�r�)r�r�r�r�r�r��	dotdomainrrr�return_ok_domain{s&	


#
z$DefaultCookiePolicy.return_ok_domaincCs�t|�\}}|jd�s+d|}|jd�sDd|}|rg|jd�rgd|}n|}|j|�p�|j|�s�dS|j|�r�td|�dS|j|�r�td|�dSdS)Nr�Fz"   domain %s is in user block-listz&   domain %s is not in user allow-listT)r�rur�r�rr�)r�r�r�r�r�r,rrrr��s"




z$DefaultCookiePolicy.domain_return_okcCs�td|�t|�}t|�}||kr5dS|j|�rq|jd�sm|||d�dkrqdStd||�dS)Nz- checking cookie path=%sTr�r z  %s does not path-match %sF)rr�rrur�)r�r�r�rZpathlenrrrr��s
)z"DefaultCookiePolicy.path_return_ok)r�r�r�rr+rZ
DomainLiberalZDomainStrictr�r�r�r�r�r�r�r�rrrrrr#r�r$r%r'r)r*r-r�r�rrrrr_sJ
	;	cCs"t|j��}t|j|�S)N)�sorted�keys�mapr�)Zadictr/rrr�vals_sorted_by_key�sr1ccsgt|�}xT|D]L}d}y|jWntk
r>YnXd}t|�EdH|s|VqWdS)NFT)r1�items�AttributeError�
deepvalues)�mapping�values�objrrrr4�s

r4c@seZdZdS)�AbsentN)r�r�r�rrrrr8�sr8c@sxeZdZejd�Zejd�Zejd�Zejd�Zejd�Z	ejdej
�Zddd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zdddd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Z dS)2rz\Wz([\"\\])z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs:|dkrt�}||_tj�|_i|_dS)N)r�_policy�
_threading�RLock�
_cookies_lock�_cookies)r��policyrrrr��s
		zCookieJar.__init__cCs
||_dS)N)r9)r�r>rrr�
set_policy�szCookieJar.set_policycCs�g}|jj||�sgStd|�|j|}x�|j�D]x}|jj||�sdqF||}xM|j�D]?}|jj||�s�td�q{td�|j|�q{WqFW|S)Nz!Checking %s for cookies to returnz   not returning cookiez   it's a match)	r9r�rr=r/r�r6r�rt)r�r�r��cookiesZcookies_by_pathr�Zcookies_by_namer�rrr�_cookies_for_domain�s 




zCookieJar._cookies_for_domaincCs=g}x0|jj�D]}|j|j||��qW|S)N)r=r/�extendrA)r�r�r@r�rrr�_cookies_for_requestszCookieJar._cookies_for_requestc	Cs�|jddd�dd�d}g}x�|D]�}|j}|sgd}|dkrg|jd|�|jdk	r�|jj|j�r�|dkr�|jjd	|j�}n	|j}|jdkr�|j|j�n|jd
|j|f�|dkr/|j	r |jd|j
�|jjd�ru|j}|j
rd|jd�rd|d
d�}|jd|�|jdk	r/d}|jr�|d|j}|j|�q/W|S)Nr�cSs
t|j�S)N)rr�)�arrr�<lambda>sz)CookieJar._cookie_attrs.<locals>.<lambda>�reverseTFr	z$Version=%sz\\\1z%s=%sz
$Path="%s"r�r z$Domain="%s"z$Portz="%s")�sortr�rtr{�non_word_rerA�quote_rer`rzr�r�r�rur�r�r�)	r�r@r��attrsr�r�r{r�r�rrr�
_cookie_attrss>

	!			
	zCookieJar._cookie_attrsc
Cs�td�|jj�z�ttj��|j_|_|j|�}|j|�}|r�|j	d�s�|j
ddj|��|jjr�|jj
r�|j	d�r�x.|D]&}|jdkr�|j
dd�Pq�WWd|jj�X|j�dS)N�add_cookie_headerrz; ZCookie2r z$Version="1")rr<�acquirerBrNr9r(rCrKZ
has_headerZadd_unredirected_headerr~r�r�r��release�clear_expired_cookies)r�r�r@rJr�rrrrLCs$


	zCookieJar.add_cookie_headercCsg}d}d}x�|D]�}|d\}}d}d}	i}
i}x�|d
d�D]}\}}
|j�}||ks�||kr�|}||kr�|
dkr�d}
||
kr�qX|dkr�|
dkr�td�d}	P|
j�}
|dkr|rqX|
dkrtd�qX|dkryd}yt|
�}
Wn#tk
retd�d}	PYnXd}|j|
}
||ks�||kr�|
dkr�|dkr�td|�d}	P|
|
|<qX|
||<qXW|	r�q|j|||
|f�qW|S)Nr�r�r�r��max-ager�r�r�r��
commenturlr	Fr Tz%   missing value for domain attributezM   missing or invalid value for expires attribute: treating as session cookiez?   missing or invalid (non-numeric) value for max-age attributez!   missing value for %s attribute)r�r�)r�r�rPr�r�r�r�rQ)r�r�rQ)rLrrBrMr(rt)r��	attrs_set�
cookie_tuples�
boolean_attrs�value_attrsZcookie_attrsrzr{Zmax_age_setZ
bad_cookie�standardr�r�r�r�rrr�_normalized_cookie_tuplesdsl








z#CookieJar._normalized_cookie_tuplesc!Cs�|\}}}}|jdt�}|jdt�}|jdt�}	|jdt�}
|jdd�}|dk	r�yt|�}Wntk
r�dSYnX|jdd�}|jdd�}
|jd	d�}|jd
d�}|tk	r|dkrd}t|�}nxd}t|�}|jd
�}|dkrv|dkrb|d|�}n|d|d�}t|�dkr�d
}|tk	}d}|r�t|j	d��}|tkr�t
|�\}}|}n|j	d�s�d|}d}|	tk	rF|	dkr(t|�}	qLd}tj
dd|	�}	nd}	|
tkrgd}
d}
nR|
|jkr�y|j|||�Wntk
r�YnXtd|||�dSt||||	||||||||
|
|||�S)Nr�r�r�r�r�r�Fr�r�rQrYTr�r r	r�z\s+z2Expiring cookie, domain='%s', path='%s', name='%s'r�)r�r8rBrMr�r�r�r�boolrur�r�rvr`r(�clear�KeyErrorrr)r��tupr�rzr{rVr�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_tuplecCsO|j|�}g}x3|D]+}|j||�}|r|j|�qW|S)N)rWr\rt)r�rRr�rSr@r[r�rrr�_cookies_from_attrs_set!s
z!CookieJar._cookies_from_attrs_setcCsjt|jdd�}|dkr.|jj}x5|D]-}|jdkr5d|_|r5d|_q5WdS)Nr�r Tr	)r�r9r�r�r�)r�r@Z
rfc2109_as_nsr�rrr�_process_rfc2109_cookies*s

	z"CookieJar._process_rfc2109_cookiesc
Cs�|j�}|jdg�}|jdg�}|jj}|jj}|rV|s�|rd|s�|rr|s�|r�|r�gSy|jt|�|�}Wntk
r�t�g}YnX|r�|r�y|jt	|�|�}	Wntk
rt�g}	YnX|j
|	�|rpi}
x*|D]"}d|
|j|j|j
f<q,W|
dd�}t||	�}	|	r�|j|	�|S)NzSet-Cookie2z
Set-CookiecSs"|j|j|jf}||kS)N)r�r�rz)Z	ns_cookie�lookupr�rrr�no_matching_rfc2965bsz3CookieJar.make_cookies.<locals>.no_matching_rfc2965)rZget_allr9r�r�r]r|�	Exceptionrr�r^r�r�rz�filterrB)
r��responser�rZrfc2965_hdrsZns_hdrsr�r�r@Z
ns_cookiesr_r�r`rrr�make_cookies6sB



 
zCookieJar.make_cookiesc
Csg|jj�zEttj��|j_|_|jj||�rQ|j|�Wd|jj�XdS)N)	r<rMrBrNr9r(r��
set_cookierN)r�r�r�rrr�set_cookie_if_okls
zCookieJar.set_cookie_if_okc
Cs�|j}|jj�zc|j|kr5i||j<||j}|j|kr^i||j<||j}|||j<Wd|jj�XdS)N)r=r<rMr�r�rzrN)r�r��c�c2Zc3rrrreys	




zCookieJar.set_cookiec
Cs�td|j��|jj�zottj��|j_|_xI|j||�D]5}|jj	||�rUtd|�|j
|�qUWWd|jj�XdS)Nzextract_cookies: %sz setting cookie: %s)rrr<rMrBrNr9r(rdr�rerN)r�rcr�r�rrr�extract_cookies�s

zCookieJar.extract_cookiescCs�|dk	rE|dks$|dkr0td��|j|||=nW|dk	rz|dkritd��|j||=n"|dk	r�|j|=n	i|_dS)Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rMr=)r�r�r�rzrrrrY�s		
zCookieJar.clearcCs\|jj�z:x3|D]+}|jr|j|j|j|j�qWWd|jj�XdS)N)r<rMr�rYr�r�rzrN)r�r�rrr�clear_session_cookies�s

	$zCookieJar.clear_session_cookiescCsn|jj�zLtj�}x9|D]1}|j|�r#|j|j|j|j�q#WWd|jj�XdS)N)	r<rMrNr�rYr�r�rzrN)r�r�r�rrrrO�s


$zCookieJar.clear_expired_cookiescCs
t|j�S)N)r4r=)r�rrr�__iter__�szCookieJar.__iter__cCs%d}x|D]}|d}q
W|S)Nr	r r)r�r�r�rrr�__len__�s
zCookieJar.__len__cCsGg}x!|D]}|jt|��q
Wd|jjdj|�fS)Nz<%s[%s]>z, )rtr�r�r�r~)r��rr�rrrr��s
zCookieJar.__repr__cCsGg}x!|D]}|jt|��q
Wd|jjdj|�fS)Nz<%s[%s]>z, )rtr!r�r�r~)r�rmr�rrrr��s
zCookieJar.__str__)!r�r�r�rv�compilerHrIZstrict_domain_reZ	domain_reZdots_re�ASCII�magic_rer�r?rArCrKrLrWr\r]r^rdrfrerirYrjrOrkrlr�r�rrrrr�s6;!a\	6

c@seZdZdS)rN)r�r�r�rrrrr�sc@sdeZdZddddd�Zddddd�Zddddd�Zdddd	d
�ZdS)rNFc	Cs[tj||�|dk	r?y|dWntd��YnX||_t|�|_dS)NrYzfilename must be string-like)rr�rM�filenamerX�	delayload)r�rqrrr>rrrr��s	zFileCookieJar.__init__cCs
t��dS)N)r�)r�rq�ignore_discard�ignore_expiresrrr�save�szFileCookieJar.savecCsc|dkr3|jdk	r'|j}ntt��t|��}|j||||�WdQRXdS)N)rqrM�MISSING_FILENAME_TEXT�open�_really_load)r�rqrsrtrrrr�load�szFileCookieJar.loadcCs�|dkr3|jdk	r'|j}ntt��|jj�zWtj|j�}i|_y|j|||�Wnt	k
r�||_�YnXWd|jj
�XdS)N)rqrMrvr<rMr��deepcopyr=ry�OSErrorrN)r�rqrsrtZ	old_staterrr�reverts
	
	zFileCookieJar.revert)r�r�r�r�ruryr|rrrrr�s
	cCs�|j|jfd|jfd|jfg}|jdk	rR|jd|jf�|jrh|jd
�|jr~|jd�|jr�|jd�|j	r�|jd�|j
r�|jdtt|j
��f�|j
r�|jd�|jr
|jd
|jf�|jr)|jd|jf�t|jj��}x.|D]&}|j|t|j|�f�qEW|jdt|j�f�t|g�S)Nr�r�r��	path_spec�	port_spec�
domain_dotr�r�r�r�rQr�)r}N)r~N)rN)r�N)r�N)rzr{r�r�r�rtr�r�r�r�r�r6r]r�r�r�r.r�r/r!r�r�)r�r�r/r�rrr�lwp_cookie_str"s6	
	
	
	
			
		
$r�c@sCeZdZdddd�Zddddd�Zdd	�ZdS)
rTcCsztj�}g}xQ|D]I}|r2|jr2q|rK|j|�rKq|jdt|��qWdj|dg�S)NzSet-Cookie3: %s�
rY)rNr�r�rtr�r~)r�rsrtr�rmr�rrr�
as_lwp_strKs
zLWPCookieJar.as_lwp_strNFcCsv|dkr3|jdk	r'|j}ntt��t|d��-}|jd�|j|j||��WdQRXdS)N�wz#LWP-Cookies-2.0
)rqrMrvrw�writer�)r�rqrsrtrrrrru[s
zLWPCookieJar.savecCs�|j�}|jj|�s4d|}t|��tj�}d}d}	d}
y_xX|j�}|dkrqP|j|�s�qX|t|�d�j�}x
t|g�D]�}|d\}
}i}i}x|	D]}d||<q�Wx�|dd�D]�\}}|dk	r$|j	�}nd}||
ksB||	krH|}||	krs|dkrfd}|||<q�||
kr�|||<q�|||<q�W|j
}|d�}|d�}|dk	r�t|�}|dkr�d}|d�}|jd�}t|d�|
||d	�|d�|||d�|d
�|d�|d�|||d
�|d�|�}|r�|j
r�q�|r�|j|�r�q�|j|�q�WqXWWnCtk
r��Yn/tk
r�t�td||f��YnXdS)Nz5%r does not look like a Set-Cookie3 (LWP) format filezSet-Cookie3:r~r}rr�r�r�r�r�r�r�r�rQrYr	Fr Tr�z&invalid Set-Cookie3 format file %r: %r)r~r}rr�r�)r�r�r�r�r�r�rQ)�readlinerprArrNrurr�r|rLr�rgrr�r�rer{rar)r�rrqrsrt�magicrr��headerrTrU�line�datarzr{rVr�r�r�r�r�r�r�r�r�rgrrrrxgs�


					

zLWPCookieJar._really_load)r�r�r�r�rurxrrrrr>s
c@sFeZdZejd�ZdZdd�Zddddd�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.

cCs�tj�}|j�}|jj|�s:td|��y`xY|j�}|dkrYP|jd�rx|dd�}|j�jd�s@|j�dkr�q@|jd�\}}	}
}}}
}|dk}|	dk}	|
dkr�|}
d}|jd	�}d
}|dkr#d}d}t	d|
|dd
||	||
d
|||ddi�}|ro|j
roq@|r�|j|�r�q@|j|�q@WWnCt
k
r��Yn/tk
r�t�td
||f��YnXdS)Nz4%r does not look like a Netscape format cookies filerYr�r �#r�	�TRUEr�FTr	z+invalid Netscape format cookies file %r: %rr�)r�r)rNr�rprArr�r�rur�rr�r�rer{rar)r�rrqrsrtr�r�r�r�r�r�r�r�rzr{r�r�rgrrrrx�s`
$		

zMozillaCookieJar._really_loadNFcCsq|dkr3|jdk	r'|j}ntt��t|d��(}|j|j�tj�}x|D]�}|r�|jr�qh|r�|j|�r�qh|j	r�d}nd}|j
jd�r�d}nd}|jdk	r�t
|j�}	nd}	|jdkrd}
|j}n|j}
|j}|jdj|j
||j||	|
|g�d�qhWWdQRXdS)Nr�r��FALSEr�rYr�r�)rqrMrvrwr�r�rNr�r�r�r�rur�r!r{rzr~r�)r�rqrsrtrr�r�r�r�r�rzr{rrrrus<
					zMozillaCookieJar.save)	r�r�r�rvrnrpr�rxrurrrrr�sA)X�__all__r�r.rvrNZurllib.parser�Zurllib.request�	threadingr:�ImportError�dummy_threadingZhttp.clientZhttpZcalendarr
rrrr!�clientZ	HTTP_PORTr�rvrr&r-r7r8rJr)rtrLr6r9r?rnror@rGrVr[�Ir_�Xrardrergrmrorprrrqr|r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr1r4r8rr{rrr�rrrrrr�<module>s�


88!UD'

#b!�_��:x