ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/usr/lib64/python3.6/http/__pycache__/
Upload File :
Current File : //proc/self/root/proc/self/root/usr/lib64/python3.6/http/__pycache__/cookiejar.cpython-36.opt-2.pyc

3

��dr+�@s&ddddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd	lZydd	lZ	Wne
k
rldd	lZ	YnXdd	lZ
dd
lmZdZd	add
�Zee
jj�ZdZdd�ZdZdd�ZdddddddgZdddddd d!d"d#d$d%d&gZgZxeD]Zejej ��q�Wdtd'd(�Z!dud)d*�Z"d	d	d	d	d+�Z#ej$d,ej%�Z&d-d.�Z'd/d0�Z(ej$d1ej%�Z)ej$d2ej*ej%B�Z+ej$d3ej,ej%B�Z-d4d5�Z.ej$d6ej,ej%B�Z/d7d8�Z0d9d:�Z1ej$d;�Z2ej$d<�Z3ej$d=�Z4ej$d>�Z5d?d@�Z6ej$dA�Z7dBdC�Z8dDdE�Z9dFdG�Z:ej$dHej%�Z;dIdJ�Z<dKdL�Z=dMdN�Z>dOdP�Z?ej$dQej%�Z@dRdS�ZAdTdU�ZBdVdW�ZCdXdY�ZDdZZEej$d[�ZFd\d]�ZGd^d_�ZHd`da�ZIdbdc�ZJGddd�d�ZKGded�d�ZLGdfd�deL�ZMdgdh�ZNdidj�ZOGdkdl�dl�ZPGdmd�d�ZQGdnd�deR�ZSGdod�deQ�ZTdpdq�ZUGdrd�deT�ZVGdsd�deT�ZWd	S)v�Cookie�	CookieJar�CookiePolicy�DefaultCookiePolicy�
FileCookieJar�LWPCookieJar�	LoadError�MozillaCookieJar�N)�timegmFcGs(tsdStsddl}|jd�atj|�S)Nr	zhttp.cookiejar)�debug�logger�loggingZ	getLogger)�argsr
�r�&/usr/lib64/python3.6/http/cookiejar.py�_debug.s
rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}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|ko2dknr�d|koJdknr�d|kobdknr�d|kozdknr�d|ko�dknr�t|�SdSdS)	N����r	��;�=)�
EPOCH_YEARr
)�tt�year�monthZmday�hour�min�secrrr�_timegmKs
8Hr,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtjj�}ntjj|�}d|j|j|j|j|j|jfS)Nz%04d-%02d-%02d %02d:%02d:%02dZ)	�datetime�utcnow�utcfromtimestampr'r(�dayr)�minute�second)�t�dtrrr�	time2isozYs
r5cCsR|dkrtjj�}ntjj|�}dt|j�|jt|jd|j|j	|j
|jfS)Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr)r-r.r/�DAYSZweekdayr0�MONTHSr(r'r)r1r2)r3r4rrr�
time2netscapelsr8)ZGMT�UTCZUT�Zz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTtj|�}|rfdt|jd��}|jd�rR|dt|jd��}|jd�dkrf|}|S)Nr	ir��<r�-)�	UTC_ZONES�TIMEZONE_RE�search�int�group)�tz�offset�mrrr�offset_from_tz_string�s

rFc
Cs�t|�}|tjkrdSytj|j��d}WnXtk
r�yt|�}Wntk
r\dSXd|kopdknr||}ndSYnX|dkr�d}|dkr�d}|dkr�d}t|�}t|�}t|�}t|�}|dk�r0tjtj��d}|d}	|}
|||	}|	|
}	t	|	�dk�r0|	dk�r(|d}n|d}t
|||||||f�}|dk	�r�|dk�r^d}|j�}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�tj|�}|rl|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)	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|j�}dgd\}}}}}}}tj|�}|dk	rL|j�\}}}}}}}}	ndSt|||||||�S)NrW)r[�ISO_DATE_REr@rYrS)
r_r0rPrQrRr*r+rCrE�_rrr�iso2time's

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







ryz([\"\\])cCs�g}xt|D]l}g}xN|D]F\}}|dk	rTtjd|�sHtjd|�}d|}d||f}|j|�qW|r
|jdj|��q
Wdj|�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|jd�r|dd�}|jd�r,|dd�}|S)N�"r���)rr�endswith)r_rrr�strip_quotes�s


r�cCsd}g}x�|D]�}g}d}x�t|jd	��D]�\}}|j�}|jd
�\}}	}
|j�}|sd|dkr*Pnq*|	rp|
j�nd}
|dkr�|j�}||kr�|}|dkr�|
dk	r�t|
�}
d}n|dkr�|
dk	r�tt|
��}
|j||
f�q*W|r|�s�|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�	partitionrKr�rarq)Z
ns_headersZknown_attrsruZ	ns_headerrv�version_setZiiZparam�key�sep�val�lcrrr�parse_ns_headers�s@

r�z\.\d+$cCs:tj|�rdS|dkrdS|ddks2|ddkr6dSdS)NFrVr	�.rTr�)�IPV4_REr@)r_rrr�is_HDNs
r�cCsl|j�}|j�}||krdSt|�s(dS|j|�}|dksB|dkrFdS|jd�sTdSt|dd��shdSdS)NTFrr	r�r�)rKr��rfindrr)�A�B�irrr�domain_matchs

r�cCstj|�rdSdS)NFT)r�r@)r_rrr�liberal_is_HDNBs
r�cCsb|j�}|j�}t|�ot|�s0||kr,dSdS|jd�}|rL|j|�rLdS|r^||kr^dSdS)NTFr�)rKr�rrr�)r�r��initial_dotrrr�user_domain_matchLs
r�z:\d+$cCsB|j�}tjj|�d}|dkr,|jdd�}tjd|d�}|j�S)NrrVZHost)�get_full_url�urllib�parseZurlparseZ
get_header�cut_port_rer]rK)�request�url�hostrrr�request_hostasr�cCs6t|�}}|jd�dkr.tj|�r.|d}||fS)Nr�rz.localr�)r��findr�r@)r��erhn�req_hostrrr�eff_request_hostqsr�cCs4|j�}tjj|�}t|j�}|jd�s0d|}|S)N�/)r�r�r�Zurlsplit�escape_pathr�rr)r�r��partsr�rrr�request_path|s

r�cCs^|j}|jd�}|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|jd�j�S)Nz%%%sr)rBrO)rgrrr�uppercase_escaped_char�sr�cCstjj|t�}tjt|�}|S)N)r�r�Zquote�HTTP_PATH_SAFE�ESCAPED_CHAR_REr]r�)r�rrrr��s
r�cCsP|jd�}|dkrL||dd�}|jd�}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��||_||_||_||_||_|j�|_	||_
||_|	|_|
|_
||_||_|
|_||_||_||_tj|�|_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|jj||�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,|dkrtj�}|jdk	r(|j|kr(dSdS)NTF)rMr�)r��nowrrr�
is_expireds
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||�}|jd|t|�f�q
W|jdt|j��|jdt|j��d|jjdj|�fS)Nr�rwrxr�r�r�r�r�r�r�r�r�r�r�r�z%s=%szrest=%sz
rfc2109=%sz%s(%s)z, )r�rwrxr�r�r�r�r�r�r�r�r�r�r�r�)�getattrrq�reprr�r��	__class__�__name__r{)r�rrwr}rrr�__repr__/s
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_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@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
|�|_nf|_|dk	rft
|�}||_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||�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||�}|||�sd	SqWd
S)Nz - checking cookie %s=%sr��
verifiabilityrwr�r�r�Zset_ok_FT)r�r�rwr�r�r�)rrwrxr�)r�r�r��n�fn_name�fnrrrr��s


zDefaultCookiePolicy.set_okcCs^|jdkrtd|j|j�dS|jdkr<|jr<td�dS|jdkrZ|jrZtd�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,|jjd�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|j�rHtd|j|�dSdS)Nr	z7   path attribute %s is not a prefix of request path %sFT)r�r�r�r�rrr�r)r�r�r��req_pathrrr�set_ok_path�s

zDefaultCookiePolicy.set_ok_pathc
Cs�|j|j�rtd|j�dS|j|j�r8td|j�dS|j�r�t|�\}}|j}|jr�|jd�dkr�|jd�}|jdd|�}|dkr�||dd�}||d|�}	|	j	�d$kr�t
|�dkr�td|�dS|jd��r�|dd�}
n|}
|
jd�dk}|�r|dk�rtd|�dS|j
dk�rb|j|��rb|jd��rbd|j|��rbtd ||�dS|j
dk�s||j|j@�r�t||��s�td!||�dS|j
dk�s�|j|j@�r�|dt
|��}|jd�dk�r�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�milrA�aero�biz�cat�coop�info�jobs�mobi�museumrw�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)rrrrrrrrrArr	r
rrr
rrrwrrr)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�sf

z!DefaultCookiePolicy.set_ok_domaincCs�|jr�t|�}|dkrd}nt|�}x\|jjd�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||�}|||�sd	SqWd
S)Nz - checking cookie %s=%sr�r�r�r�r�r�Z
return_ok_FT)r�r�r�r�r�r�)rrwrxr�)r�r�r�r�r�r�rrrr�:s	


zDefaultCookiePolicy.return_okcCs@|jdkr|jrtd�dS|jdkr<|jr<td�dSdS)Nr	z$   RFC 2965 cookies are switched offFz$   Netscape cookies are switched offT)r�r�rr�)r�r�r�rrr�return_ok_versionLsz%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_verifiabilityUsz+DefaultCookiePolicy.return_ok_verifiabilitycCs |jr|jdkrtd�dSdS)NZhttpsz(   secure cookie with non-secure requestFT)r��typer)r�r�r�rrr�return_ok_secureasz$DefaultCookiePolicy.return_ok_securecCs|j|j�rtd�dSdS)Nz   cookie expiredFT)r��_nowr)r�r�r�rrr�return_ok_expiresgsz%DefaultCookiePolicy.return_ok_expirescCsP|jrLt|�}|dkrd}x0|jjd�D]}||kr(Pq(Wtd||j�dSdS)Nrrkz0   request port %s does not match cookie port %sFT)r�r�r�r)r�r�r�rr�rrr�return_ok_portms
z"DefaultCookiePolicy.return_ok_portcCs�t|�\}}|j}|r,|jd�r,d|}n|}|jdkrb|j|j@rb|jrb||krbtd�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�rrr�r��DomainStrictNonDomainr�rr�r�)r�r�r�r�r�r��	dotdomainrrr�return_ok_domain{s&

z$DefaultCookiePolicy.return_ok_domaincCs�t|�\}}|jd�sd|}|jd�s0d|}|rJ|jd�rJd|}n|}|j|�p`|j|�sfdS|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�rrr�r�rr�)r�r�r�r�r�r%rrrr��s"






z$DefaultCookiePolicy.domain_return_okcCs0td|�t|�}|j|�s,td||�dSdS)Nz- checking cookie path=%sz  %s does not path-match %sFT)rr�rr)r�r�r�r�rrrr��s

z"DefaultCookiePolicy.path_return_ok)r�r�r�rr$rZ
DomainLiberalZDomainStrictr�r�r�r�r�r�r�r�r�r�r�r�rrr�rrr r"r#r&r�r�rrrrr_sJ	;	cCst|j��}t|j|�S)N)�sorted�keys�mapr�)Zadictr(rrr�vals_sorted_by_key�sr*ccsZt|�}xL|D]D}d}y
|jWntk
r4YnXd}t|�EdH|s|VqWdS)NFT)r*�items�AttributeError�
deepvalues)�mapping�values�objrrrr-�s

r-c@seZdZdS)�AbsentN)r�r�r�rrrrr1�sr1c@s�eZdZejd�Zejd�Zejd�Zejd�Zejd�Z	ejdej
�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�}||_tj�|_i|_dS)N)r�_policy�
_threading�RLock�
_cookies_lock�_cookies)r��policyrrrr��s

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

zCookieJar._cookies_for_domaincCs.g}x$|jj�D]}|j|j||��qW|S)N)r6r(�extendr:)r�r�r9r�rrr�_cookies_for_request�szCookieJar._cookies_for_requestc	CsF|jdd�dd�d}g}�x$|D�]}|j}|sLd}|dkrL|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��r|j}|j
o�|jd��r|dd�}|jd
|�|jdk	r"d}|j�r4|d|j}|j|�q"W|S)NcSs
t|j�S)N)rr�)�arrr�<lambda>sz)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�r9r��attrsr�r�rxr�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; ZCookie2rz$Version="1")rr5�acquirerArMr2r!r<rDZ
has_headerZadd_unredirected_headerr{r�r�r��release�clear_expired_cookies)r�r�r9rCr�rrrrE?s$






zCookieJar.add_cookie_headercCs�g}d}d}�x||D�]r}|d\}}d}d}	i}
i}�x4|d
d�D�]"\}}
|j�}||ksh||krl|}||kr�|
dkr�d}
||
kr�qF|dkr�|
dkr�td�d}	P|
j�}
|dkr�|r�qF|
dkr�td�qF|dk�rd}yt|
�}
Wn$tk
�rtd�d}	PYnXd}|j|
}
||k�s2||k�rb|
dk�rX|dk�rXtd|�d}	P|
|
|<qF|
||<qFW|	�rvq|j|||
|f�qW|S)Nr�r�r�r��max-ager�r�r�r��
commenturlr	FrTz%   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�rIr�r�r�r�rJ)r�r�rJ)rKrrArLr!rq)r��	attrs_set�
cookie_tuples�
boolean_attrs�value_attrsZcookie_attrsrwrxZmax_age_setZ
bad_cookie�standardr�r~rr�rrr�_normalized_cookie_tuples`sl






z#CookieJar._normalized_cookie_tuplesc!Cs$|\}}}}|jdt�}|jdt�}|jdt�}	|jdt�}
|jdd�}|dk	rryt|�}Wntk
rpdSX|jdd�}|jdd�}
|jd	d�}|jd
d�}|tk	r�|dkr�d}t|�}nXd}t|�}|jd
�}|dk�r|dkr�|d|�}n|d|d�}t|�dk�rd
}|tk	}d}|�r8t|j	d��}|tk�rTt
|�\}}|}n|j	d��shd|}d}|	tk	�r�|	dk�r�t|�}	nd}tj
dd|	�}	nd}	|
tk�r�d}
d}
nH|
|jk�r�y|j|||�Wntk
�r�YnXtd|||�dSt||||	||||||||
|
|||�S)Nr�r�r�r�r�r�Fr�r�rJrVTr�rr	r�z\s+z2Expiring cookie, domain='%s', path='%s', name='%s'r�)r�r1rArLr�r�r�r�boolrrr�r�rsr]r!�clear�KeyErrorrr)r��tupr�rwrxrOr�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:|j|�}g}x&|D]}|j||�}|r|j|�qW|S)N)rPrUrq)r�rKr�rLr9rTr�rrr�_cookies_from_attrs_sets

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


z"CookieJar._process_rfc2109_cookiesc
Cs6|j�}|jdg�}|jdg�}|jj}|jj}|r<|s`|rH|s`|rT|s`|rd|rdgSy|jt|�|�}Wntk
r�t�g}YnX|o�|�r2y|jt	|�|�}	Wntk
r�t�g}	YnX|j
|	�|�r"i}
x |D]}d|
|j|j|j
f<q�W|
fdd�}t||	�}	|	�r2|j|	�|S)NzSet-Cookie2z
Set-CookiecSs|j|j|jf}||kS)N)r�r�rw)Z	ns_cookie�lookupr�rrr�no_matching_rfc2965^sz3CookieJar.make_cookies.<locals>.no_matching_rfc2965)rZget_allr2r�r�rVry�	Exceptionrr�rWr�r�rw�filterr;)
r��responser�r|Zrfc2965_hdrsZns_hdrsr�r�r9Z
ns_cookiesrXr�rYrrr�make_cookies2sB






zCookieJar.make_cookiesc
CsN|jj�z2ttj��|j_|_|jj||�r:|j|�Wd|jj�XdS)N)	r5rFrArMr2r!r��
set_cookierG)r�r�r�rrr�set_cookie_if_okhs
zCookieJar.set_cookie_if_okc
Csl|j}|jj�zJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<Wd|jj�XdS)N)r6r5rFr�r�rwrG)r�r��cZc2Zc3rrrr^us






zCookieJar.set_cookiec
Cs|td|j��|jj�zRttj��|j_|_x6|j||�D]&}|jj	||�r>td|�|j
|�q>WWd|jj�XdS)Nzextract_cookies: %sz setting cookie: %s)rrr5rFrArMr2r!r]r�r^rG)r�r\r�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)rLr6)r�r�r�rwrrrrR�s
zCookieJar.clearcCsH|jj�z,x&|D]}|jr|j|j|j|j�qWWd|jj�XdS)N)r5rFr�rRr�r�rwrG)r�r�rrr�clear_session_cookies�s

zCookieJar.clear_session_cookiescCsT|jj�z8tj�}x*|D]"}|j|�r|j|j|j|j�qWWd|jj�XdS)N)	r5rFrMr�rRr�r�rwrG)r�r�r�rrrrH�s



zCookieJar.clear_expired_cookiescCs
t|j�S)N)r-r6)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]}|jt|��q
Wd|jjdj|�fS)Nz<%s[%s]>z, )rqr�r�r�r{)r��rr�rrrr��s
zCookieJar.__repr__cCs6g}x|D]}|jt|��q
Wd|jjdj|�fS)Nz<%s[%s]>z, )rqrr�r�r{)r�rer�rrrr��s
zCookieJar.__str__)N)NNN)!r�r�r�rs�compilerArBZstrict_domain_reZ	domain_reZdots_re�ASCII�magic_rer�r8r:r<rDrErPrUrVrWr]r_r^rarRrbrHrcrdr�r�rrrrr�s6





;!a\	6


c@seZdZdS)rN)r�r�r�rrrrr�sc@s4eZdZddd�Zddd�Zd
dd�Zdd	d
�ZdS)rNFc	CsJtj||�|dk	r6y|dWntd��YnX||_t|�|_dS)NrVzfilename must be string-like)rr�rL�filenamerQ�	delayload)r�rirjr7rrrr��szFileCookieJar.__init__cCs
t��dS)N)r�)r�ri�ignore_discard�ignore_expiresrrr�save�szFileCookieJar.savecCsJ|dkr"|jdk	r|j}ntt��t|��}|j||||�WdQRXdS)N)rirL�MISSING_FILENAME_TEXT�open�_really_load)r�rirkrlrrrr�load�s

zFileCookieJar.loadcCs�|dkr"|jdk	r|j}ntt��|jj�zFtj|j�}i|_y|j|||�Wnt	k
rn||_�YnXWd|jj
�XdS)N)rirLrnr5rFr��deepcopyr6rq�OSErrorrG)r�rirkrlZ	old_staterrr�reverts

zFileCookieJar.revert)NFN)NFF)NFF)NFF)r�r�r�r�rmrqrtrrrrr�s



	cCs$|j|jfd|jfd|jfg}|jdk	r8|jd|jf�|jrH|jd
�|jrX|jd�|jrh|jd�|j	rx|jd�|j
r�|jdtt|j
��f�|j
r�|jd�|jr�|jd
|jf�|jr�|jd|jf�t|jj��}x$|D]}|j|t|j|�f�q�W|jdt|j�f�t|g�S)Nr�r�r��	path_spec�	port_spec�
domain_dotr�r�r�r�rJr�)ruN)rvN)rwN)r�N)r�N)rwrxr�r�r�rqr�r�r�r�r�r5rZr�r�r�r'r�r(rr�r�)r�r�r(r~rrr�lwp_cookie_strs6







rxc@s(eZdZd
dd�Zddd�Zdd	�ZdS)rTcCs\tj�}g}x>|D]6}|r$|jr$q|r6|j|�r6q|jdt|��qWdj|dg�S)NzSet-Cookie3: %s�
rV)rMr�r�rqrxr{)r�rkrlr�rer�rrr�
as_lwp_strGs
zLWPCookieJar.as_lwp_strNFcCsX|dkr"|jdk	r|j}ntt��t|d��"}|jd�|j|j||��WdQRXdS)N�wz#LWP-Cookies-2.0
)rirLrnro�writerz)r�rirkrlrrrrrmWs

zLWPCookieJar.savecCsL|j�}|jj|�s$d|}t|��tj�}d}d}	d}
�yʐx�|j�}|dkrRP|j|�s^q@|t|�d�j�}�x�t|g�D�]x}|d\}
}i}i}x|	D]}d||<q�Wx�|dd�D]t\}}|dk	r�|j	�}nd}||
k�s�||	k�r�|}||	k�r|dk�rd}|||<q�||
k�r*|||<q�|||<q�W|j
}|d�}|d�}|dk	�r^t|�}|dk�rld}|d�}|jd�}t|d�|
||d	�|d�|||d�|d
�|d�|d�|||d
�|d�|�}|�r�|j
�r�q�|�r�|j|��r�q�|j|�q�Wq@WWnBtk
�r�Yn,tk
�rFt�td||f��YnXdS)Nz5%r does not look like a Set-Cookie3 (LWP) format filezSet-Cookie3:rvrurwr�r�r�r�r�r�r�r�rJrVr	FrTr�z&invalid Set-Cookie3 format file %r: %r)rvrurwr�r�)r�r�r�r�r�r�rJ)�readlinerhr@rrMrrrr�ryrKr�rdrr�r�r^rsrZr)r�rrirkrl�magicrr��headerrMrN�line�datarwrxrOr�r~rr�r�r�r�r�r�r`rrrrpcs�











zLWPCookieJar._really_load)TT)NFF)r�r�r�rzrmrprrrrr:s

c@s,eZdZejd�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.

cCsntj�}|j�}|jj|�s(td|���y�x�|j�}|dkr@P|jd�rV|dd�}|j�jd�s.|j�dkrrq.|jd�\}}	}
}}}
}|dk}|	dk}	|
dkr�|}
d}|jd	�}d
}|dkr�d}d}t	d|
|dd
||	||
d
|||ddi�}|�r|j
�rq.|�r|j|��rq.|j|�q.WWnBt
k
�r>�Yn,tk
�rht�td
||f��YnXdS)Nz4%r does not look like a Netscape format cookies filerVryr�#r��	�TRUEr�FTr	z+invalid Netscape format cookies file %r: %rr�)r�r�)rMr}rhr@rr�r�rrr�rr�r�r^rsrZr)r�rrirkrlr�r~r�r�r�r�r�r�rwrxr�r�r`rrrrp�s`

zMozillaCookieJar._really_loadNFcCs|dkr"|jdk	r|j}ntt��t|d���}|j|j�tj�}x�|D]�}|rZ|jrZqH|rl|j|�rlqH|j	rxd}nd}|j
jd�r�d}nd}|jdk	r�t
|j�}	nd}	|jdkr�d}
|j}n|j}
|j}|jdj|j
||j||	|
|g�d�qHWWdQRXdS)Nr{r�ZFALSEr�rVr�ry)rirLrnror|rrMr�r�r�r�rrr�rrxrwr{r�)r�rirkrlrr�r�r�r�r�rwrxrrrrms<



zMozillaCookieJar.save)NFF)	r�r�r�rsrfrhrrprmrrrrr�s
A)N)N)X�__all__r�r-rsrMZurllib.parser�Zurllib.requestZ	threadingr3�ImportErrorZdummy_threadingZhttp.clientZhttpZcalendarr
rrrrZclientZ	HTTP_PORTr�rnrr%r,r6r7rIr(rqrKr5r8r>rfrgr?rFrSrX�Ir\�Xr^rarbrdrjrlrmrornryrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr*r-r1rrsrrrxrrrrrr�<module>s�



88!



U
D'


#b!\:x

Zerion Mini Shell 1.0