AlkantarClanX12

Your IP : 3.145.18.135


Current Path : /opt/alt/python311/lib64/python3.11/http/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/http/__pycache__/cookiejar.cpython-311.opt-2.pyc

�

c��f�.����	gd�ZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZddl
mZdZdad�ZdZdZeejj��Zejd��Zd	Zd
Zd�ZdZd
�Zgd�Zgd�Z d�e D��Z!dKd�Z"dKd�Z#ddddd�Z$ejdej%��Z&d�Z'd�Z(ejdej%��Z)ejdej*ej%z��Z+ejdej,ej%z��Z-d�Z.ejdej,ej%z��Z/d�Z0d�Z1ejd��Z2ejd��Z3ejd ��Z4ejd!��Z5d"�Z6ejd#��Z7d$�Z8d%�Z9d&�Z:ejd'ej%��Z;d(�Z<d)�Z=d*�Z>d+�Z?ejd,ej%��Z@d-�ZAd.�ZBd/�ZCd0�ZDd1ZEejd2��ZFd3�ZGd4�ZHd5�ZId6�ZJGd7�d8��ZKGd9�d:��ZLGd;�d<eL��ZMd=�ZNGd>�d?��ZOGd@�dA��ZPGdB�dCeQ��ZRGdD�dEeP��ZSdF�ZTGdG�dHeS��ZUGdI�dJeS��ZVdS)L)�Cookie�	CookieJar�CookiePolicy�DefaultCookiePolicy�
FileCookieJar�LWPCookieJar�	LoadError�MozillaCookieJar�N)�timegmFc�p�tsdStsddl}|�d��atj|�S)Nr
zhttp.cookiejar)�debug�logger�logging�	getLogger)�argsrs  �5/opt/alt/python311/lib64/python3.11/http/cookiejar.py�_debugr,sA�������5������"�"�#3�4�4���<�����HTTPOnlyz
#HttpOnly_z#( Netscape)? HTTP Cookie FilezQa filename was not supplied (nor was the CookieJar instance initialised with one)zr# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

c���ddl}ddl}ddl}|���}|�d|��|���}|�d|zd���dS)Nr
zhttp.cookiejar bug!
%s�)�
stacklevel)�io�warnings�	traceback�StringIO�	print_exc�getvalue�warn)rrr�f�msgs     r�_warn_unhandled_exceptionr"Bsz��#�"�"�"�"�"�"�"�"�"�"�"�
���
�
�A�
����a� � � �
�*�*�,�,�C��M�M�+�c�1�a�M�@�@�@�@�@ri�c��|dd�\}}}}}}|tkr_d|cxkrdkrRnnOd|cxkrdkrBnn?d|cxkrdkr2nn/d|cxkrdkr"nnd|cxkrdkrnnt|��SdS)	N����r
��;�=)�
EPOCH_YEARr)�tt�year�month�mday�hour�min�secs       r�_timegmr3Qs���(*�2�A�2��%�D�%��t�S�#�	
��	�	�!�u�"2�"2�"2�"2��"2�"2�"2�"2�"2��d�����b������	
�d�����b������q�C�~�~�~�~�2�~�~�~�~�~�A��N�N�N�N��N�N�N�N�N��b�z�z���tr)�Mon�Tue�Wed�Thu�Fri�Sat�Sun)�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decc�6�g|]}|�����S�)�lower)�.0r.s  r�
<listcomp>rK\s ��2�2�2�%����
�
�2�2�2rc���	|�tj���}ntj�|��}d|j|j|j|j|j|jfzS)Nz%04d-%02d-%02d %02d:%02d:%02dZ)	�datetime�utcnow�utcfromtimestampr-r.�dayr0�minute�second��t�dts  r�	time2isozrV^sh��
�	�y�
�
�
%�
%�
'�
'���
�
�
/�
/��
2�
2��+�
����2�6�2�7�B�I�r�y�/B�B�Brc�.�	|�tj���}ntj�|��}dt|���|jt|jdz
|j|j	|j
|jfzS)Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr%)rMrNrO�DAYS�weekdayrP�MONTHSr.r-r0rQrRrSs  r�
time2netscaper[qs~��	�	�y�
�
�
%�
%�
'�
'���
�
�
/�
/��
2�
2��0��R�Z�Z�\�\��B�F�F�2�8�A�:�$6�
����"�)�R�Y�40�0�0r)�GMT�UTC�UT�Zz^([-+])?(\d\d?):?(\d\d)?$c�V�d}|tvrd}n�t�|��}|r~dt|�d����z}|�d��r(|dt|�d����zz}|�d��dkr|}|S)Nr
ir��<r%�-)�	UTC_ZONES�TIMEZONE_RE�search�int�group)�tz�offset�ms   r�offset_from_tz_stringrl�s���
�F�	�Y���������r�"�"���	!��C�����
�
�O�O�+�F��w�w�q�z�z�
7��"�s�1�7�7�1�:�:���"6�6���w�w�q�z�z�S� � � ����Mrc	�.�t|��}|tjkrdS	t�|�����dz}nI#t$r<	t|��}n#t$rYYdSwxYwd|cxkrdkrnn|}nYdSYnwxYw|�d}|�d}|�d}t|��}t|��}t|��}t|��}|dkrctjtj����d}|dz}	|}
||z|	z
}|	|
z
}	t|	��dkr|	dkr|dz}n|dz
}t|||||||f��}|�0|�d}|���}t|��}|�dS||z
}|S)Nr%r&r
i��d�2r])
rgrM�MAXYEAR�MONTHS_LOWER�indexrI�
ValueError�time�	localtime�absr3�upperrl)
rP�mon�yr�hrr1r2ri�imon�cur_yrrk�tmprTrjs
             r�	_str2timer~�s���	�R���B�	�H�����t��� � ������-�-�a�/�����	�	�	�	��s�8�8�D�D���	�	�	��4�4�4�	������?�?�?�?��?�?�?�?�?��C�C��4�4�
�C�	����
�z��2�
�{�!�C�
�{�!�C�

�c�(�(�C�	�R���B�

�c�(�(�C�

�c�(�(�C�	�D�y�y����	���,�,�Q�/���S�L����
�&�[�1�_��
��G���q�6�6�B�;�;��1�u�u�2��8�b�b��C�x�"�	��S�#�r�3��R�0�1�1�A��}�
�:��B�
�X�X�Z�Z��&�r�*�*���>��4�
��J���Hs5�/A�
B�A.�-B�.
A=�8B�<A=�=B�BzV^[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*
    )?$c	���	t�|��}|r�|���}t�|d�����dz}t
|d��|t
|d��t
|d��t
|d��t|d��f}t|��S|�	��}t�d|d��}dgdz\}}}}}}	}
t�|��}|�|���\}}}}}}	}
ndSt||||||	|
��S)	Nr%rr
ra����)�STRICT_DATE_RErf�groupsrqrrrIrg�floatr3�lstrip�
WEEKDAY_RE�sub�LOOSE_HTTP_DATE_REr~)�textrk�grxr,rPryrzr1r2ris           r�	http2timer��s?���:	���d�#�#�A���
�H�H�J�J��� � ��1������.�.��2���!�A�$�i�i��c�!�A�$�i�i��!�A�$�i�i��Q�q�T���E�!�A�$�K�K�1���r�{�{��
�;�;�=�=�D��>�>�"�d�A�&�&�D�'+�V�A�X�"�C��b�"�c�3��	�!�!�$�'�'�A��}�)*�����&��S�"�b�#�s�B�B��t��S�#�r�2�s�C��4�4�4ra�^
    (\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	���	|���}dgdz\}}}}}}}t�|��}|�|���\}}}}}}}}	ndSt	|||||||��S)Nr�)r��ISO_DATE_RErfr�r~)
r�rPrxryrzr1r2rirk�_s
          r�iso2timer�2s���
��;�;�=�=�D�'+�V�A�X�"�C��b�"�c�3��	���4� � �A��}�-.�H�H�J�J�)��C��b�#�s�B����t��S�#�r�2�s�C��4�4�4rc�r�	|�d��\}}|jd|�|j|d�zS)Nr
)�span�string)�match�start�ends   r�	unmatchedr�Ss9��3����A���J�E�3��<�������S�T�T� 2�2�2rz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c�b�	g}|D�]�}|}g}|�r�t�|��}|r�t|��}|�d��}t�|��}|r@t|��}|�d��}t
�d|��}nWt�|��}|r9t|��}|�d��}|���}nd}|�	||f��nx|�
���d��r6|�
��dd�}|r|�	|��g}ntj
dd|��\}}	|}|���|r|�	|�����|S)Nr%z\1�,z^[=\s;]*r�)�HEADER_TOKEN_RErfr�rh�HEADER_QUOTED_VALUE_RE�HEADER_ESCAPE_REr��HEADER_VALUE_RE�rstrip�appendr��
startswith�re�subn)
�
header_values�resultr��	orig_text�pairsrk�name�value�non_junk�
nr_junk_charss
          r�split_header_wordsr�\s���+�Z�F��#'�#'���	����	 ��&�&�t�,�,�A��
 � ��|�|���w�w�q�z�z��*�1�1�$�7�7���%�$�Q�<�<�D��G�G�A�J�J�E�,�0�0���>�>�E�E�'�.�.�t�4�4�A��%�(��|�|�� !����
�
�� %�������!%�����d�E�]�+�+�+�+������)�)�#�.�.�
 ��{�{�}�}�Q�R�R�(���.�&�-�-��.�.�.����+-�'�+�r�4�*H�*H�'��-� ��?�	 �@�&�&�-�-��&�&�&���Mr�([\"\\])c�J�	g}|D]�}g}|D]X\}}|�<tjd|��s t�d|��}d|z}|�d|��}|�|���Y|r(|�d�|������d�|��S)Nz^\w+$�\\\1z"%s"�=�; �, )r�rf�HEADER_JOIN_ESCAPE_REr�r��join)�lists�headersr��attr�k�vs      r�join_header_wordsr��s���
��G��	1�	1�����	�	�D�A�q��}��y��1�-�-�#�-�1�1�'�1�=�=�A���
�A� �q�q�!�!�$���K�K��N�N�N�N��0�����	�	�$���0�0�0���9�9�W���rc��|�d��r
|dd�}|�d��r
|dd�}|S)N�"r%���)r��endswith�r�s r�strip_quotesr��sI�����s�����A�B�B�x���}�}�S�����C�R�C�y���Krc��	d}g}|D�]6}g}d}t|�d����D]�\}}|���}|�d��\}}	}
|���}|s	|dkrn��Q|	r|
���nd}
|dkrX|���}||vr|}|dkr|
�t|
��}
d}n$|dkr|
�t
t|
����}
|�||
f����|r,|s|�d	��|�|����8|S)
N)�expires�domain�path�secure�version�port�max-ageF�;r�r
r�Tr�)r��0)�	enumerate�split�strip�	partitionrIr�r�r�)�
ns_headers�known_attrsr��	ns_headerr��version_set�ii�param�key�sep�val�lcs            r�parse_ns_headersr��s|��
�1�K��F��+!�+!�	�����#�9�?�?�3�#7�#7�8�8�	%�	%�I�B���K�K�M�M�E�!�O�O�C�0�0�M�C��c��)�)�+�+�C��
���7�7��E��"%�.�#�)�)�+�+�+�$�C��Q�w�w��Y�Y�[�[����$�$��C��)�#�#���*�3�/�/��"&�K�K��I�%�%���'��S�(9�(9�:�:���L�L�#�s��$�$�$�$��	!��
/����-�.�.�.��M�M�%� � � ���Mrz\.\d+$c��	t�|��rdS|dkrdS|ddks|ddkrdSdS)NFr�r
�.r�T��IPV4_RErfr�s r�is_HDNr�sQ��4��~�~�d�����u��r�z�z��u��A�w�#�~�~��b��S����u��4rc�0�	|���}|���}||krdSt|��sdS|�|��}|dks|dkrdS|�d��sdSt|dd���sdSdS)NTFr�r
r�r%)rIr��rfindr�)�A�B�is   r�domain_matchr�&s����,	
���	�	�A�	���	�	�A��A�v�v��t��!�9�9���u�	����
�
�A��B�w�w�!�q�&�&��u��<�<������u��!�A�B�B�%�=�=���u��4rc�@�	t�|��rdSdS�NFTr�r�s r�liberal_is_HDNr�Ms'���
�~�~�d�����u��4rc��	|���}|���}t|��rt|��s
||krdSdS|�d��}|r|�|��rdS|s||krdSdS)NTFr�)rIr�r�r�)r�r��initial_dots   r�user_domain_matchr�Ws����
	
���	�	�A�	���	�	�A��1����.��"3�"3����6�6��4��u��,�,�s�#�#�K���q�z�z�!�}�}���t���1��6�6��t��5rz:\d+$c��	|���}tj�|��d}|dkr|�dd��}t
�d|d��}|���S)Nr%r��Host)�get_full_url�urllib�parse�urlparse�
get_header�cut_port_rer�rI)�request�url�hosts   r�request_hostr�lsw����
�
�
 �
 �C��<� � ��%�%�a�(�D��r�z�z��!�!�&�"�-�-���?�?�2�t�Q�'�'�D��:�:�<�<�rc��	t|��x}}|�d��dkrt�|��s|dz}||fS)Nr�r��.local)r��findr�rf)r��erhn�req_hosts   r�eff_request_hostr�|sW���
#�7�+�+�+�D�8��}�}�S���R������x�(@�(@���(�"���T�>�rc���	|���}tj�|��}t	|j��}|�d��sd|z}|S)N�/)r�r�r��urlsplit�escape_pathr�r�)r�r��partsr�s    r�request_pathr�s\��@�
�
�
�
 �
 �C��L�!�!�#�&�&�E��u�z�"�"�D��?�?�3�����T�z���Krc���|j}|�d��}|dkr?||dzd�}	t|��n(#t$rt	d|��YdSwxYwt
}|S)N�:r
r%znonnumeric port: '%s')r�r�rgrsr�DEFAULT_HTTP_PORT)r�r�r�r�s    r�request_portr�s����<�D��	�	�#���A��A�v�v��A�a�C�D�D�z��	���I�I�I�I���	�	�	��*�D�1�1�1��4�4�	����!���Ks�A�A�Az%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])c�V�d|�d�����zS)Nz%%%sr%)rhrw)r�s r�uppercase_escaped_charr�s#���E�K�K��N�N�(�(�*�*�*�*rc��	tj�|t��}t�t|��}|S�N)r�r��quote�HTTP_PATH_SAFE�ESCAPED_CHAR_REr�r)r�s rrr�s9��O��<���d�N�3�3�D����5�t�<�<�D��Krc���	|�d��}|dkrB||dzd�}|�d��}t|��r|dks|dkrd|zS|S)Nr�r
r%�local)r�r�)�hr��bs   r�reachr�sm���2	
���s���A��A�v�v�
�a��c�d�d�G��
�F�F�3�K�K���!�9�9�	�!�q�&�&�A��L�L��q�5�L��Hrc�n�	t|��}t|t|j����sdSdS�NTF)r�r�r�origin_req_host)r�r�s  r�is_third_partyr�s=����G�$�$�H���%��(?�"@�"@�A�A���t��urc�B�eZdZ		d
d�Zd�Zdd�Zd�Zdd�Zd�Zd	�Z	dS)rFc���|�t|��}|�tt|����}|�|durtd���||_||_||_||_||_|���|_	||_
||_|	|_|
|_
||_||_|
|_||_||_||_t)j|��|_dS)NTz-if port is None, port_specified must be false)rgr�rsr�r�r�r��port_specifiedrIr��domain_specified�domain_initial_dotr��path_specifiedr�r��discard�comment�comment_url�rfc2109�copy�_rest)�selfr�r�r�r�rr�rrr�rr�r�rrr�restr s                  r�__init__zCookie.__init__�s�����#�g�,�,����#�e�G�n�n�*=�*=���<�N�d�2�2��L�M�M�M������	���
���	�,����l�l�n�n��� 0���
#5�����	�,���������������&�������Y�t�_�_��
�
�
rc��||jvSr
�r")r#r�s  r�has_nonstandard_attrzCookie.has_nonstandard_attr#s���t�z�!�!rNc�8�|j�||��Sr
)r"�get)r#r��defaults   r�get_nonstandard_attrzCookie.get_nonstandard_attr%s���z�~�~�d�G�,�,�,rc��||j|<dSr
r')r#r�r�s   r�set_nonstandard_attrzCookie.set_nonstandard_attr's�� ��
�4���rc�X�|�tj��}|j�
|j|krdSdSr)rtr�)r#�nows  r�
is_expiredzCookie.is_expired*s/���;�d�i�k�k���L�$�4�<�3�+>�+>��4��urc��|j�d}n
d|jz}|j|z|jz}|j�|j�d|j��}n|j}d|�d|�d�S)Nr�rr�z<Cookie z for �>)r�r�r�r�r�)r#�p�limit�	namevalues    r�__str__zCookie.__str__0sf���9��"�a�a��d�i�-�a���a��$�)�+���:�!�#'�9�9�9�d�j�j�9�I�I��	�I��'0�y�y�%�%�%�8�8rc�p�g}dD]9}t||��}|�|�dt|�������:|�dt|j��z��|�dt|j��z��|jj�dd�|���d�S)N)r�r�r�r�rr�rrr�rr�r�rrrr�zrest=%sz
rfc2109=%s�(r��))�getattrr��reprr"r �	__class__�__name__r�)r#rr�r�s    r�__repr__zCookie.__repr__:s������	6�	6�D��4��&�&�D��K�K�4�4�4��d����4�5�5�5�5����I��T�Z� 0� 0�0�1�1�1����L�4���#5�#5�5�6�6�6��>�2�2�2�D�I�I�d�O�O�O�O�D�Dr)Fr
)
r>�
__module__�__qualname__r%r(r,r.r1r7r?rHrrrr�s��������6�(%�(%�(%�(%�T"�"�"�-�-�-�-�!�!�!�����9�9�9�E�E�E�E�Errc�(�eZdZ	d�Zd�Zd�Zd�ZdS)rc� �	t���r
��NotImplementedError�r#�cookier�s   r�set_okzCookiePolicy.set_okRs��	�"�#�#�#rc� �	t���r
rDrFs   r�	return_okzCookiePolicy.return_ok[s��O�!�#�#�#rc��	dS�NTrH)r#r�r�s   r�domain_return_okzCookiePolicy.domain_return_ok_���	��trc��	dSrLrH)r#r�r�s   r�path_return_okzCookiePolicy.path_return_okdrNrN)r>r@rArHrJrMrPrHrrrrIsU�������$�$�$�$�$�$����
����rrc
���eZdZ	dZdZdZdZeezZdddddddddedddf
d	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS) rr%rr�r
NTF)�https�wssc��	||_||_||_||_||_||_|	|_|
|_||_||_	|
|_
|�t|��|_nd|_|�t|��}||_
dS)NrH)�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_domainsrUrVrWrXrYrZr[r\r]r^r_s              rr%zDefaultCookiePolicy.__init__ts���	P� ��
����#6�� �(���*���+F��(�&<��#� 0���,H��)�"4��� 0����&�$)�/�$:�$:�D�!�!�$&�D�!��&�#�O�4�4�O� /����rc��	|jSr
)ra�r#s rrcz#DefaultCookiePolicy.blocked_domains�s��B��$�$rc�0�	t|��|_dSr
)r`ra)r#rcs  r�set_blocked_domainsz'DefaultCookiePolicy.set_blocked_domains�s��2� %�o� 6� 6����rc�@�|jD]}t||��rdS�dSr)rar�)r#r��blocked_domains   r�
is_blockedzDefaultCookiePolicy.is_blocked�s7��"�3�	�	�N� ���8�8�
��t�t�
��urc��	|jSr
)rbrfs rrdz#DefaultCookiePolicy.allowed_domains�s��K��$�$rc�8�	|�t|��}||_dSr
)r`rb)r#rds  r�set_allowed_domainsz'DefaultCookiePolicy.set_allowed_domains�s&��;��&�#�O�4�4�O� /����rc�R�|j�dS|jD]}t||��rdS�dSr�)rbr�)r#r��allowed_domains   r�is_not_allowedz"DefaultCookiePolicy.is_not_allowed�sE��� �(��5�"�3�	�	�N� ���8�8�
��u�u�
��trc��	td|j|j��dD]&}d|z}t||��}|||��sdS�'dS)N� - checking cookie %s=%s)r��
verifiabilityr�r�r�r��set_ok_FT�rr�r�r;�r#rGr��n�fn_name�fns      rrHzDefaultCookiePolicy.set_ok�sq��	�	�)�6�;���E�E�E�N�	�	�A���k�G���w�'�'�B��2�f�g�&�&�
��u�u�
��trc���|j�td|j|j��dS|jdkr|jstd��dS|jdkr|jstd��dSdS)Nz0   Set-Cookie2 without version attribute (%s=%s)Fr
�$   RFC 2965 cookies are switched off�$   Netscape cookies are switched offT)r�rr�r�rVrUrFs   r�set_ok_versionz"DefaultCookiePolicy.set_ok_version�s����>�!�
�E��;���
.�
.�
.��5��>�A���d�l���9�:�:�:��5�
�^�q�
 �
 ���
 ��9�:�:�:��5��trc��|jrUt|��rF|jdkr|jrt	d��dS|jdkr|jrt	d��dSdS�Nr
z>   third-party RFC 2965 cookie during unverifiable transactionFz>   third-party Netscape cookie during unverifiable transactionT��unverifiablerr�rZrr[rFs   r�set_ok_verifiabilityz(DefaultCookiePolicy.set_ok_verifiability�s�����	�N�7�$;�$;�	��~��!�!�d�&F�!��8�9�9�9��u���1�$�$��)D�$��8�9�9�9��u��trc��|jdkr8|jr1|j�d��rt	d|j��dSdS)Nr
�$z'   illegal name (starts with '$'): '%s'FT)r�r]r�r�rrFs   r�set_ok_namezDefaultCookiePolicy.set_ok_name�sN��
�N�a���D�$E���K�"�"�3�'�'�
 ��<�f�k�J�J�J��5��trc���|jr_t|��}|jdks|jdkr:|jr3|�|j|��st
d|j|��dSdS)Nr
z7   path attribute %s is not a prefix of request path %sFT)rrr�r^rPr�r)r#rGr��req_paths    r�set_ok_pathzDefaultCookiePolicy.set_ok_path�s~��� �	�#�G�,�,�H���!�#�#��.�A�%�%�$�*A�%��'�'���W�=�=�&��!�"(�+�x�9�9�9��u��trc�|�|�|j��rtd|j��dS|�|j��rtd|j��dS|j�rQt|��\}}|j}|jr�|�d��dkr�|�d��}|�dd|��}|dkrU||dzd�}||dz|�}	|	�	��dvr%t|��dkrtd	|��dS|�d��r|dd�}
n|}
|
�d��dk}|s'|�
d
��std|��dS|jdkrm|�
|��sX|�
|
�d
���s@|�d��s+d|z�
|��std||��dS|jdks|j|jzr#t#||��std
||��dS|jdks|j|jzr^|dt|���}|�d��dkr-t&�|��std||��dSdS)N�"   domain %s is in user block-listF�&   domain %s is not in user allow-listr�rr
r%)�co�ac�com�edu�org�net�gov�milrg�aero�biz�cat�coop�info�jobs�mobi�museumr��pro�travel�euz&   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)rkr�rrqrr�rY�countr�rI�lenr�r�r�r�r\�DomainRFC2965Matchr��DomainStrictNoDotsr�rf)
r#rGr�r�r�r�r��j�tld�sld�undotted_domain�
embedded_dots�host_prefixs
             r�
set_ok_domainz!DefaultCookiePolicy.set_ok_domain�s���?�?�6�=�)�)�	��7���G�G�G��5����v�}�-�-�	��;�V�]�K�K�K��5��"�2	!�-�g�6�6�N�H�d��]�F��!�
%�v�|�|�C�'8�'8�A�'=�'=��L�L��%�%���L�L��a��+�+����6�6� ��1����,�C� ��1��Q��-�C��y�y�{�{�''�'�'�,/�s�8�8�q�=�=��G��P�P�P�$�u�� � ��%�%�
)�"(����*���"(��,�1�1�#�6�6�!�;�M� �
����x�)@�)@�
��H������u��~��"�"����v�.�.�!����/�'A�'A�'A�B�B�!�����-�-�!��d�(�,�,�V�4�4�!��?���)�)�)�!�5����"�"��&��)@�@�#�#�D�&�1�1�!�� �!%�v�/�/�/� �5����"�"��&��)@�@�#�&�}��V����}�5���$�$�S�)�)�Q�.�.����x�0�0�/��K�&��0�0�0� �5��trc�:�|jr�t|��}|�d}nt|��}|j�d��D]=}	t|��n"#t$rtd|��YdSwxYw||krn�>td||j��dSdS)N�80r�z   bad port %s (not numeric)Fz$   request port (%s) not found in %sT)rr�strr�r�rgrsr�r#rGr��req_portr4s     r�set_ok_portzDefaultCookiePolicy.set_ok_port3s���� �	�#�G�,�,�H�������x�=�=���[�&�&�s�+�+�
�
��!���F�F�F�F��!�!�!�!��9�1�=�=�=� �5�5�5�!������=�=��E�!��=����.�.�.��u��ts�A�A7�6A7c��	td|j|j��dD]&}d|z}t||��}|||��sdS�'dS)Nrs)r�rtr�r�r�r��
return_ok_FTrvrws      rrJzDefaultCookiePolicy.return_okHsl��	�	�)�6�;���E�E�E�R�	�	�A�"�1�n�G���w�'�'�B��2�f�g�&�&�
��u�u�
��trc��|jdkr|jstd��dS|jdkr|jstd��dSdS)Nr
r|Fr}T)r�rVrrUrFs   r�return_ok_versionz%DefaultCookiePolicy.return_ok_versionZsW���>�A���d�l���9�:�:�:��5�
�^�q�
 �
 ���
 ��9�:�:�:��5��trc��|jrUt|��rF|jdkr|jrt	d��dS|jdkr|jrt	d��dSdSr�r�rFs   r�return_ok_verifiabilityz+DefaultCookiePolicy.return_ok_verifiabilitycs�����	�N�7�$;�$;�	��~��!�!�d�&F�!��%�&�&�&��u���1�$�$��)D�$��%�&�&�&��u��trc�R�|jr|j|jvrtd��dSdS)Nz(   secure cookie with non-secure requestFT)r��typer_rrFs   r�return_ok_securez$DefaultCookiePolicy.return_ok_secureos4���=�	�W�\��1F�F�F��=�>�>�>��5��trc�\�|�|j��rtd��dSdS)Nz   cookie expiredFT)r1�_nowrrFs   r�return_ok_expiresz%DefaultCookiePolicy.return_ok_expiresus3�����T�Y�'�'�	��&�'�'�'��5��trc��|jrPt|��}|�d}|j�d��D]
}||krn�td||j��dSdS)Nr�r�z0   request port %s does not match cookie port %sFT)r�rr�rr�s     r�return_ok_portz"DefaultCookiePolicy.return_ok_port{s~���;�
	�#�G�,�,�H������[�&�&�s�+�+�
�
����=�=��E�!��I����.�.�.��u��trc��t|��\}}|j}|r|�d��sd|z}n|}|jdkr-|j|jzr|js||krtd��dS|jdkr#t||��std||��dS|jdkr+d|z�	|��std||��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�r�r�r\�DomainStrictNonDomainrrr�r�)r#rGr�r�r�r��	dotdomains       r�return_ok_domainz$DefaultCookiePolicy.return_ok_domain�s ��)�'�2�2���$�����	�&�+�+�C�0�0�	��f��I�I��I�
�N�a���
�
"�T�%?�
?�
 ��'�
 �,2�d�N�N��-�
.�
.�
.��5��>�A���l�4��&@�&@���/�04�f�
>�
>�
>��5��>�Q����D��':�':�9�'E�'E����!�6�
+�
+�
+��5��trc���t|��\}}|�d��sd|z}|�d��sd|z}|r|�d��sd|z}n|}|�|��s|�|��sdS|�|��rt	d|��dS|�|��rt	d|��dSdS)Nr�Fr�r�T)r�r�r�rkrrq)r#r�r�r�r�r�s      rrMz$DefaultCookiePolicy.domain_return_ok�s	��*�'�2�2���$��"�"�3�'�'�	$��8�|�H����s�#�#�	��t�8�D��	�&�+�+�C�0�0�	��f��I�I��I��!�!�)�,�,�	��
�
�i�0H�0H�	��5��?�?�6�"�"�	��7��@�@�@��5����v�&�&�	��;�V�D�D�D��5��trc��td|��t|��}t|��}||krdS|�|��r(|�d��s|||dz�dkrdStd||��dS)Nz- checking cookie path=%sTr�r%z  %s does not path-match %sF)rrr�r�r�)r#r�r�r��pathlens     rrPz"DefaultCookiePolicy.path_return_ok�s����*�D�1�1�1���(�(���d�)�)���t����4��!�!�$�'�'�	��}�}�S�!�!�	�%-�g�g�a�i�.?�%@�C�%G�%G��4��,�h��=�=�=��ur)r>r@rAr�r�r��
DomainLiberal�DomainStrictr%rcrhrkrdrnrqrHr~r�r�r�r�r�rJr�r�r�r�r�r�rMrPrHrrrrjs�������L��������M�%�&;�;�L�"&�t���%)�#�$�-1�(-�"/�.3�$)�"2�!0�!0�!0�!0�F%�%�%�7�7�7����%�%�%�0�0�0�������&
�
�
�
�
�
����	�	�	�:�:�:�x���*���$���
�
�
�������������6���4����rrc#��K�	t|�����D]:}d}	|jd}t|��Ed{V��n#t$rYnwxYw|s|V��;dSr�)�list�values�items�
deepvalues�AttributeError)�mapping�objs  rr�r��s�����3��G�N�N�$�$�%�%�
�
����	'��I�I��G�!�#���&�&�&�&�&�&�&�&��	�	�	�	��D�	����
�	��I�I�I��
�
s�A	�	
A�Ac��eZdZdS)�AbsentN�r>r@rArHrrr�r����������rr�c�^�eZdZ	ejd��Zejd��Zejd��Zejd��Zejd��Z	ejdej
��Zdd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Z dS)rz\Wr�z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)Nc�r�|�t��}||_tj��|_i|_dSr
)r�_policy�
_threading�RLock�
_cookies_lock�_cookies�r#�policys  rr%zCookieJar.__init__�s5���>�(�*�*�F����'�-�/�/�����
�
�
rc��||_dSr
)r�r�s  r�
set_policyzCookieJar.set_policy�s
������rc��g}|j�||��sgStd|��|j|}|���D]�}|j�||��s�||}|���D]Q}|j�||��std���-td��|�|���R��|S)Nz!Checking %s for cookies to returnz   not returning cookiez   it's a match)	r�rMrr��keysrPr�rJr�)r#r�r��cookies�cookies_by_pathr��cookies_by_namerGs        r�_cookies_for_domainzCookieJar._cookies_for_domain�s������|�,�,�V�W�=�=�	��I��2�F�;�;�;��-��/��#�(�(�*�*�		'�		'�D��<�.�.�t�W�=�=�
��-�d�3�O�)�0�0�2�2�
'�
'���|�-�-�f�g�>�>���4�5�5�5���(�)�)�)����v�&�&�&�&�
'��rc��	g}|j���D]+}|�|�||�����,|Sr
)r�r��extendr�)r#r�r�r�s    r�_cookies_for_requestzCookieJar._cookies_for_request
sS��@����m�(�(�*�*�	F�	F�F��N�N�4�3�3�F�G�D�D�E�E�E�E��rc�@�	|�d�d���d}g}|D�]|}|j}|s d}|dkr|�d|z��|j�F|j�|j��r'|dkr!|j�d|j��}n|j}|j�|�|j��n|�|j�d|����|dkr�|j	r|�d	|j
z��|j�d
��rE|j}|j
s|�d
��r
|dd�}|�d|z��|j�+d
}|jr
|d|jzz}|�|����~|S)Nc�*�t|j��Sr
)r�r�)�as r�<lambda>z)CookieJar._cookie_attrs.<locals>.<lambda>s��3�q�v�;�;�rT)r��reverseFr
z$Version=%sr�r�z
$Path="%s"r�r%z$Domain="%s"z$Portz="%s")�sortr�r�r��non_word_rerf�quote_rer�r�rr�r�r�rr�r)	r#r�r��attrsrGr�r�r�r4s	         r�
_cookie_attrszCookieJar._cookie_attrss���	�	���.�.���=�=�=������(	$�(	$�F��n�G��
:�"���Q�;�;��L�L���!8�9�9�9�
��)�� �'�'���5�5�*�:A�A�+�+��
�)�)�'�6�<�@�@�������|�#����V�[�)�)�)�)��������U�U�;�<�<�<���{�{��(�=��L�L����!;�<�<�<��=�+�+�C�0�0�:�#�]�F�"�5�,��)�)�#�.�.�,�!'�������L�L��&�!8�9�9�9��;�*��A��,�8���6�;�!6�7���L�L��O�O�O���rc���	td��|j���	tt	j����x|j_|_|�|��}|�|��}|r>|�	d��s)|�
dd�|����|jjrI|jj
s=|�	d��s(|D]%}|jdkr|�
dd��n�&|j���n#|j���wxYw|���dS)N�add_cookie_headerrr��Cookie2r%z$Version="1")rr��acquirergrtr�r�r�r��
has_header�add_unredirected_headerr�rVrXr��release�clear_expired_cookies)r#r�r�r�rGs     rr�zCookieJar.add_cookie_headerLsx��	�
	�"�#�#�#���"�"�$�$�$�	)�,/��	���,<�,<�<�D�L���	��/�/��8�8�G��&�&�w�/�/�E��
4��)�)�(�3�3�4��3�3� �$�)�)�E�"2�"2�4�4�4���$�
�T�\�-F�
��&�&�y�1�1�
�%���F��~��*�*��7�7�	�>�R�R�R���+�

��&�&�(�(�(�(��D��&�&�(�(�(�(�����"�"�$�$�$�$�$s�C0D5�5Ec�x�	g}d}d}|D�].}|d\}}d}d}	i}
i}|dd�D]�\}}
|���}||vs||vr|}||vr|
�d}
||
vr�0|dkr)|
�td��d}	n�|
���}
|d	kr|r�h|
�td
���z|dkrAd}	t|
��}
n"#t$rtd��d}	Yn@wxYwd	}|j|
z}
||vs||vr"|
�|d
vrtd|z��d}	n|
|
|<��|
||<��|	r��|�|||
|f����0|S)N)rr�)r�r�r�r�r�r�r�
commenturlr
Fr%Tr�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�rr�z!   missing value for %s attribute)rIrrgrsr�r�)r#�	attrs_set�
cookie_tuples�
boolean_attrs�value_attrs�cookie_attrsr�r��max_age_set�
bad_cookie�standardr$r�r�r�s               r�_normalized_cookie_tuplesz#CookieJar._normalized_cookie_tuplesms��	��
�+�
�0��
&�H	@�H	@�L�&�q�/�K�D�%� �K��J��H��D�$�Q�R�R�(�2
 �2
 ���1��W�W�Y�Y����$�$��m�(;�(;��A��
�%�%�!�)��A���=�=����=�=��y��F�G�G�G�%)�
������	�	�A��	�>�>�"�!� ��y�� F�G�G�G� ��	�>�>�"&�K����F�F����%����� 2�3�3�3�%)�
����	����"�A��	�A�
�A���$�$�!�}�*<�*<��	��!B�B�B��B�Q�F�G�G�G�%)�
���"#�H�Q�K�K��D��G�G��
��� � �$��x��!>�?�?�?�?��s�-B=�=C�Cc�2�|\}}}}|�dt��}|�dt��}|�dt��}	|�dt��}
|�dd��}|�"	t|��}n#t$rYdSwxYw|�dd��}|�dd��}
|�d	d��}|�d
d��}|tur|dkrd}t	|��}n_d}t|��}|�d
��}|dkr|dkr|d|�}n
|d|dz�}t|��dkrd
}|tu}d}|r"t|�	d����}|turt|��\}}|}n|�	d��sd|z}d}|	tur+|	�t|��}	nd}tj
dd|	��}	nd}	|
turd}
d}
nH|
|jkr=	|�|||��n#t $rYnwxYwt#d|||��dSt%||||	||||||||
|
|||��S)Nr�r�r�r�r�r�Frrr�r�Tr�r�r
r%r�z\s+z2Expiring cookie, domain='%s', path='%s', name='%s')r*r�rgrsrrr�r��boolr�r�rr�r�r��clear�KeyErrorrr)r#�tupr�r�r�rr$r�r�r�r�r�r�rrrrr�rrr�r�rs                       r�_cookie_from_cookie_tuplez#CookieJar._cookie_from_cookie_tuple�s
��'*�#��e�X�t����h��/�/���|�|�F�F�+�+���|�|�F�F�+�+���,�,�y�&�1�1���,�,�y�$�/�/����
��g�,�,�����
�
�
��t�t�
�������h��.�.���,�,�y�%�0�0���,�,�y�$�/�/���l�l�<��6�6���v���$�"�*�*�!�N��t�$�$�D�D�"�N���(�(�D��
�
�3���A��B�w�w��a�<�<�����8�D�D����1���:�D��4�y�y�A�~�~�c�t�"��/��"���	>�!%�f�&7�&7��&<�&<�!=�!=���V���-�g�6�6�N�H�d��F�F��"�"�3�'�'�	 ���Z�F����v����|�$�G�,�,���!%���v�f�b�$�/�/����D��f����G��G�G�
��	�
!�
!�
��
�
�6�4��.�.�.�.���
�
�
���
�����G��4��
'�
'�
'��4��g��E��N��.�0B��N�����!��
�
�
	s$�
B�
B+�*B+�?I�
I$�#I$c��|�|��}g}|D]/}|�||��}|r|�|���0|Sr
)rr
r�)r#r�r�r�r�r	rGs       r�_cookies_from_attrs_setz!CookieJar._cookies_from_attrs_set*s[���6�6�y�A�A�
��� �	.�	.�C��3�3�C��A�A�F��-�w�~�~�f�-�-�-���rc��t|jdd��}|�
|jj}|D]}|jdkrd|_|rd|_�dS)NrWr%Tr
)r;r�rVr�r )r#r��
rfc2109_as_nsrGs    r�_process_rfc2109_cookiesz"CookieJar._process_rfc2109_cookies3sh�����.C�T�J�J�
�� � $�� 4�4�M��	'�	'�F��~��"�"�!%��� �'�&'�F�N��
	'�	'rc��	|���}|�dg��}|�dg��}ttj����x|j_|_|jj}|jj}|s|r|s|r|s|r|s|sgS	|�t|��|��}n #t$rt��g}YnwxYw|r�|r�	|�t|��|��}	n #t$rt��g}	YnwxYw|�
|	��|r3i}
|D]}d|
|j|j|jf<�|
fd�}t#||	��}	|	r|�|	��|S)NzSet-Cookie2z
Set-Cookiec�2�|j|j|jf}||vSr
)r�r�r�)�	ns_cookie�lookupr�s   r�no_matching_rfc2965z3CookieJar.make_cookies.<locals>.no_matching_rfc2965ls ��#�*�I�N�I�N�J�C��f�,�,r)r��get_allrgrtr�r�rVrUrr��	Exceptionr"r�rr�r�r��filterr�)
r#�responser�r��rfc2965_hdrs�ns_hdrsrVrUr��
ns_cookiesrrGrs
             r�make_cookieszCookieJar.make_cookies?s��O��-�-�/�/�����}�b�9�9���/�/�,��3�3��(+�D�I�K�K�(8�(8�8����D�I��,�&���<�(���	�g�	��	�!(�	��	�&.�	��	�#*�	��I�	��2�2�"�<�0�0�'�;�;�G�G���	�	�	�%�'�'�'��G�G�G�	�����	+�x�	+�
 �!�9�9�$�W�-�-�w�8�8�
�
���
 �
 �
 �)�+�+�+��
�
�
�
 ����
�)�)�*�5�5�5��
E���%�M�M�F�HL�F�F�M�6�;���D�E�E�:@�-�-�-�-�$�$7��D�D�
��
+����z�*�*�*��s$�#C�C�C�'#D�D(�'D(c�l�	|j���	ttj����x|j_|_|j�||��r|�|��|j���dS#|j���wxYwr
)	r�r�rgrtr�r�rH�
set_cookier�rFs   r�set_cookie_if_okzCookieJar.set_cookie_if_okvs���;���"�"�$�$�$�	)�,/��	���,<�,<�<�D�L���	��|�"�"�6�7�3�3�
(�����'�'�'�
��&�&�(�(�(�(�(��D��&�&�(�(�(�(���s�A!B�B3c�L�	|j}|j���	|j|vr
i||j<||j}|j|vr
i||j<||j}|||j<|j���dS#|j���wxYwr
)r�r�r�r�r�r�r�)r#rG�c�c2�c3s     rrzCookieJar.set_cookie�s���M��M����"�"�$�$�$�	)��}�A�%�%�"�q���'7��6�=�!�B��{�"�$�$��b���o��F�K��B�$�B�v�{�O���&�&�(�(�(�(�(��D��&�&�(�(�(�(���s�A
B�B#c��	td|�����|j���	|�||��D]B}|j�||��r%td|��|�|���C	|j���dS#|j���wxYw)Nzextract_cookies: %sz setting cookie: %s)	rr�r�r�rr�rHrr�)r#rr�rGs    r�extract_cookieszCookieJar.extract_cookies�s���O��$�h�m�m�o�o�6�6�6���"�"�$�$�$�	)��+�+�H�g�>�>�
,�
,���<�&�&�v�w�7�7�,��0�&�9�9�9��O�O�F�+�+�+��
,�

��&�&�(�(�(�(�(��D��&�&�(�(�(�(���s�AB3�3Cc���	|�)|�|�td���|j|||=dS|�!|�td���|j||=dS|�
|j|=dSi|_dS)Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rsr�)r#r�r�r�s    rrzCookieJar.clear�s���
	�����D�L� �N�P�P�P��
�f�%�d�+�D�1�1�1�
�
��~� �D�F�F�F��
�f�%�d�+�+�+�
�
��
�f�%�%�%��D�M�M�Mrc��	|j���	|D]/}|jr&|�|j|j|j���0	|j���dS#|j���wxYwr
)r�r�rrr�r�r�r�)r#rGs  r�clear_session_cookieszCookieJar.clear_session_cookies�s���	�	
��"�"�$�$�$�	)��
H�
H���>�H��J�J�v�}�f�k�6�;�G�G�G��
H�
��&�&�(�(�(�(�(��D��&�&�(�(�(�(���s�2A*�*Bc�R�	|j���	tj��}|D]=}|�|��r&|�|j|j|j���>	|j���dS#|j���wxYwr
)	r�r�rtr1rr�r�r�r�)r#r0rGs   rr�zCookieJar.clear_expired_cookies�s���	�	
��"�"�$�$�$�	)��)�+�+�C��
H�
H���$�$�S�)�)�H��J�J�v�}�f�k�6�;�G�G�G��
H�
��&�&�(�(�(�(�(��D��&�&�(�(�(�(���s�AB�B&c�*�t|j��Sr
)r�r�rfs r�__iter__zCookieJar.__iter__�s���$�-�(�(�(rc� �	d}|D]}|dz}�|S)Nr
r%rH)r#r�rGs   r�__len__zCookieJar.__len__�s$��1�
���%�%�F��A��A�A��rc��g}|D]$}|�t|�����%d|jj�dd�|���d�S�N�<�[r�z]>)r�r<r=r>r��r#�rrGs   rr?zCookieJar.__repr__�sS�����2�2�F�A�H�H�T�&�\�\�2�2�2�2�2�!�^�4�4�4�d�i�i��l�l�l�l�C�Crc��g}|D]$}|�t|�����%d|jj�dd�|���d�Sr/)r�r�r=r>r�r2s   rr7zCookieJar.__str__�sS�����1�1�F�A�H�H�S��[�[�1�1�1�1�1�!�^�4�4�4�d�i�i��l�l�l�l�C�Crr
)NNN)!r>r@rAr��compiler�r��strict_domain_re�	domain_re�dots_re�ASCII�magic_rer%r�r�r�r�r�rr
rrrrrr%rr(r�r+r-r?r7rHrrrr�s���������"�*�U�#�#�K��r�z�+�&�&�H�!�r�z�+�.�.����
�8�$�$�I��b�j��!�!�G��r�z�6���A�A�H�����������$���9�9�9�v%�%�%�B_�_�_�BZ�Z�Z�x���
'�
'�
'�5�5�5�n)�)�)�)�)�)�
)�
)�
)�����6
)�
)�
)�)�)�)�&)�)�)����D�D�D�
D�D�D�D�Drrc��eZdZdS)rNr�rHrrrr�r�rrc�4�eZdZ	dd�Zdd�Zdd�Z		dd�ZdS)	rNFc��	t�||��|�tj|��}||_t|��|_dSr
)rr%�os�fspath�filenamer�	delayload)r#r@rAr�s    rr%zFileCookieJar.__init__�sL��	�
	���4��(�(�(����y��*�*�H� ��
��i������rc� �	t���r
rD)r#r@�ignore_discard�ignore_expiress    r�savezFileCookieJar.save�s��%�!�#�#�#rc���	|�#|j�|j}ntt���t|��5}|�||||��ddd��dS#1swxYwYdSr
)r@rs�MISSING_FILENAME_TEXT�open�_really_load�r#r@rCrDr s     r�loadzFileCookieJar.loads���'����}�(�T�]�(�(�"�#8�9�9�9�
�(�^�^�	K�q����a��>�>�J�J�J�	K�	K�	K�	K�	K�	K�	K�	K�	K�	K�	K�	K����	K�	K�	K�	K�	K�	Ks�A�A �#A c��	|�#|j�|j}ntt���|j���	tj|j��}i|_	|�|||��n#t$r	||_�wxYw	|j�
��dS#|j�
��wxYwr
)r@rsrGr�r�r!�deepcopyr�rK�OSErrorr�)r#r@rCrD�	old_states     r�revertzFileCookieJar.reverts���	����}�(�T�]�(�(�"�#8�9�9�9���"�"�$�$�$�	)��
�d�m�4�4�I��D�M�
��	�	�(�N�N�C�C�C�C���
�
�
� )��
��
����D�
��&�&�(�(�(�(�(��D��&�&�(�(�(�(���s$� B,�"A:�9B,�:B
�
B,�,C)NFN�NFF)r>r@rAr%rErKrPrHrrrr�ss������@�
)�
)�
)�
)�$�$�$�$�K�K�K�K�#�49�)�)�)�)�)�)rrc���	|j|jfd|jfd|jfg}|j�|�d|jf��|jr|�d��|jr|�d��|jr|�d��|j	r|�d��|j
r6|�dtt|j
����f��|j
r|�d	��|jr|�d
|jf��|jr|�d|jf��t!|j�����}|D]1}|�|t'|j|��f���2|�dt'|j��f��t+|g��S)
Nr�r�r�)�	path_specN)�	port_specN)�
domain_dotN)r�Nr�)rNrr�r�)r�r�r�r�r�r�rrrr�r�rVr�rrr�sortedr"r�r�r�r�)rGrr�r�s    r�lwp_cookie_strrW's����
�+�v�|�	$�
�&�+�	�
�F�M�	"�	$�A��{�����&�&�+�)>� ?� ?� ?�
��;�a�h�h�':�;�;�;�
��;�a�h�h�':�;�;�;�
� �@�!�(�(�+?�"@�"@�"@�
�}�0�a�h�h�/�0�0�0�
�~�B�q�x�x��(��v�~�)>�)>�?�?�!A�B�B�B�
�~�2�q�x�x� 1�2�2�2�
�~�<�q�x�x��F�N� ;�<�<�<�
��G�1�8�8�\�6�3E�$F�G�G�G��&�,�#�#�%�%�&�&�D�
�,�,��	���!�S���a��)�)�*�+�+�+�+��H�H�i��V�^�,�,�
-�.�.�.��a�S�!�!�!rc�&�eZdZ	dd�Zdd�Zd�ZdS)	rTc��	tj��}g}|D]I}|s|jr�|s|�|��r�$|�dt	|��z���Jd�|dgz��S)NzSet-Cookie3: %s�
r�)rtrr1r�rWr�)r#rCrDr0r3rGs      r�
as_lwp_strzLWPCookieJar.as_lwp_strPs���	�
�i�k�k�����	A�	A�F�!�
�f�n�
��!�
�f�&7�&7��&<�&<�
��
�H�H�&���)?�)?�?�@�@�@�@��y�y��B�4�� � � rNFc��|�#|j�|j}ntt���tjtj|tjtjztjzd��d��5}|�	d��|�	|�
||����ddd��dS#1swxYwYdS)N��wz#LWP-Cookies-2.0
)r@rsrGr>�fdopenrH�O_CREAT�O_WRONLY�O_TRUNC�writer[rJs     rrEzLWPCookieJar.save`s	�����}�(�T�]�(�(�"�#8�9�9�9�
�Y��G�H�b�j�2�;�6���C�U�K�K��
�
�	E��
�G�G�(�)�)�)�
�G�G�D�O�O�N�N�C�C�D�D�D�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E�	E����	E�	E�	E�	E�	E�	Es�3?B?�?C�Cc���|���}|j�|��sd|z}t|���t	j��}d}d}	d}
		|���}|dkrdS|�|��s�3|t
|��d����}t|g��D�]f}|d\}
}i}i}|	D]}d||<�|dd�D]E\}}|�|�	��}nd}||
vs||	vr|}||	vr
|�d	}|||<�6||
vr|||<�@|||<�F|j
}|d
��}|d��}|�t|��}|�d	}|d��}|�d
��}t|d��|
||d��|d��|||d��|d��|d��|d��|||d��|d��|��}|s	|j
r��8|s|�|��r��Q|�|����h���#t $r�t"$r$t%��td|�d|�����wxYw)Nz5%r does not look like a Set-Cookie3 (LWP) format filezSet-Cookie3:)rTrSrUr�r)r�r�r�r�r�rr�r%r�r
FTr�rr�r�r�r�rTrUr�rSr�rr�z invalid Set-Cookie3 format file �: )�readliner:rfrrtr�r�r�r�rIr*r�rrr1rrNrr")r#r r@rCrD�magicr!r0�headerr�r��line�datar�r�rr$r�r�r�rr�rr�rr!s                          rrIzLWPCookieJar._really_loados%���
�
�����}�#�#�E�*�*�	!��$�%�C��C�.�.� ��i�k�k����.�
�0��
;	.�4
'��z�z�|�|���2�:�:�u�u����v�.�.����C��K�K�L�L�)�/�/�1�1��.��v�6�6�-'�-'�D�"&�q�'�K�D�%�!�H��D�*�,�,��&+����� $�Q�R�R��(�(���1��=�!"�����B�B�!%�B��+�-�-�2��3F�3F� "�A��
�-�-� �y�d�!�*+�H�Q�K�K��+�-�-�*+�H�Q�K�K�&'�D��G�G� ��A��a�	�l�l�G��a�	�l�l�G��*�"*�7�"3�"3����"&���Q�x�[�[�F�'-�'8�'8��'=�'=�$��q�q��|�|�T�5� �q��y�y�!�!�K�.�.�%�'7���<��� �q��y�y�!�!�K�.�.� �q��{�{�&�&� �q��|�|� �q����#�	%�	%�A�*�!�a�i�!� �)�!�a�l�l�3�.?�.?�!� ��O�O�A�&�&�&�&�i4
'��j�	�	�	���	.�	.�	.�%�'�'�'��)�%�X�X�t�t�-�.�.�
.�	.���s�H3�:F9H3�38I+)TTrQ)r>r@rAr[rErIrHrrrrCsY������
�!�!�!�!� 
E�
E�
E�
E�L.�L.�L.�L.�L.rrc��eZdZ	d�Zdd�ZdS)r	c���tj��}t�|�����st	d|z���		|���}i}|dkrdS|�t��r&d|t<|tt��d�}|�	d��r
|dd�}|�
���d��s|�
��dkr��|�d��\}}	}
}}}
}|dk}|	dk}	|
dkr|}
d}|�d	��}d
}|dkrd}d}td|
|dd
||	||
d
|||dd|��}|s	|j
r��;|s|�|��r��T|�|����j#t $r�t"$r$t%��t	d
|�d|�����wxYw)Nz4%r does not look like a Netscape format cookies filer%r�rZr�)�#r��	�TRUEr�FTr
z%invalid Netscape format cookies file re)rt�NETSCAPE_MAGIC_RGXr�rfrr��HTTPONLY_PREFIX�
HTTPONLY_ATTRr�r�r�r�rrr1rrNrr")r#r r@rCrDr0rir$r�rr�r�r�r�r�r�rr!s                  rrIzMozillaCookieJar._really_load�sf���i�k�k��!�'�'��
�
���5�5�	��F�����
�?	.�7
#��z�z�|�|�����2�:�:�u�u�
�?�?�?�3�3�7�*,�D��'���O� 4� 4� 5� 5�6�D��=�=��&�&�8�t�C�R�C�y���J�J�L�L�+�+�J�7�7���J�J�L�L�B�&�&���
�
�4�(�(�M��(�$����u� �F�*��$4��$>� ��2�:�:�!�D� �E�$�/�/��4�4�� ���b�=�=�"�G�"�G��1�d�E���!�#3�[���!�"�"����	!�	!��&��!�)���%��!�,�,�s�*;�*;�������"�"�"�o7
#��r�	�	�	���	.�	.�	.�%�'�'�'��)�%�X�X�t�t�-�.�.�
.�	.���s�F>�2EF>�>8G6NFc
�P�|�#|j�|j}ntt���tjtj|tjtjztjzd��d��5}|�	t��tj��}|D]�}|j}|s|j
r�|s|�|��r�+|jrd}nd}|�d��rd}	nd}	|j�t%|j��}
nd}
|j�
d}|j}n|j}|j}|�t,��r
t.|z}|�	d�||	|j||
||g��dz����	ddd��dS#1swxYwYdS)	Nr]r^ro�FALSEr�r�rnrZ)r@rsrGr>r_rHr`rarbrc�NETSCAPE_HEADER_TEXTrtr�rr1r�r�r�r�r�r�r(rrrqr�r�)
r#r@rCrDr r0rGr�r�r�r�r�r�s
             rrEzMozillaCookieJar.save's�����}�(�T�]�(�(�"�#8�9�9�9�
�Y��G�H�b�j�2�;�6���C�U�K�K��
�
�"	��
�G�G�(�)�)�)��)�+�+�C��
�
�����%��&�.���%��&�*;�*;�C�*@�*@����=�'�6�&�&�&�f��$�$�S�)�)�,��;�;�$+�k��>�-�!�&�.�1�1�G�G� �G��<�'��D�"�K�E�E�!�;�D�"�L�E��.�.�}�=�=�6�,�v�5�F�����I�I�v�{�F�K�%�w��e�=�>�>�������3
�
"	�"	�"	�"	�"	�"	�"	�"	�"	�"	�"	�"	����"	�"	�"	�"	�"	�"	s�3DF�F�"FrQ)r>r@rArIrErHrrr	r	�s@�������>G.�G.�G.�R'�'�'�'�'�'rr	r
)W�__all__r>r!rMr�rt�urllib.parser��urllib.request�	threadingr��http.client�http�calendarrr
rrrrrqr��client�	HTTP_PORTrr5rprGrur"r+r3rXrZrqrVr[rdr9rerlr~r��Ir��Xr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrrrrrrr�r�rrNrrrWrr	rHrr�<module>r�s����6M�M�M��
�	�	�	���������	�	�	�	�����#�#�#�#�#�#�#�#���������������
��	
������
����C���-�.�.���R�Z� @�A�A��:����A�A�A��
����9�8�8��
4�
4�
4��2�2�6�2�2�2��B�B�B�B�&0�0�0�0�(��T��=�=�	��b�j�5�r�x�@�@�����6
�6
�6
�p���,�-/�X�7�7���R�Z�2�B�D�2�8�O�E�E�
��R�Z��&
�D�2�8�O�)���*65�65�65�p�b�j�
� �4�"�)��#���$5�5�5�B3�3�3�
$���$6�7�7��#���$M�N�N��#���$9�:�:���2�:�h�'�'��S�S�S�j#��
�;�/�/�����2���A�A�A�H�"�*�Y���
)�
)��
�
�
�%�%�%�N������(�b�j��2�8�,�,����� 	�	�	������� $���"�*�9�:�:��+�+�+����!
�!
�!
�F���"_E�_E�_E�_E�_E�_E�_E�_E�D��������B_�_�_�_�_�,�_�_�_�B���"��������LD�LD�LD�LD�LD�LD�LD�LD�`���������4)�4)�4)�4)�4)�I�4)�4)�4)�n"�"�"�8x.�x.�x.�x.�x.�=�x.�x.�x.�vP�P�P�P�P�}�P�P�P�P�Pr