£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
    ReE7                 @   s   d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ eeZedZd	d
 ZG dd deZdS )z7
The httplib2 algorithms ported for use with requests.
    N)parsedate_tz)CaseInsensitiveDict   )	DictCache)
Serializerz9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?c             C   s0   t |  }|d |d |d |d |d fS )zParses a URI using the regex given in Appendix B of RFC 3986.

        (scheme, authority, path, query, fragment) = parse_uri(uri)
    r               )URImatchgroups)urir    r   /builddir/build/BUILDROOT/alt-python37-pip-20.2.4-6.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pip/_vendor/cachecontrol/controller.py	parse_uri   s    r   c               @   s\   e Zd ZdZdddZedd Zedd	 Zd
d Zdd Z	dd Z
dddZdd ZdS )CacheControllerz9An interface to see if request should cached or not.
    NTc             C   s4   |d krt  n|| _|| _|p"t | _|p,d| _d S )N)      i,  i-  )r   cachecache_etagsr   
serializercacheable_status_codes)selfr   r   r   status_codesr   r   r   __init__"   s    zCacheController.__init__c       	      C   sh   t |\}}}}}|r|s&td| | }| }|s>d}|rPd||gpR|}|d | | }|S )z4Normalize the URL to create a safe key for the cachez(Only absolute URIs are allowed. uri = %s/?z://)r   	Exceptionlowerjoin)	clsr   scheme	authoritypathqueryfragmentrequest_uri
defrag_urir   r   r   _urlnorm*   s    zCacheController._urlnormc             C   s
   |  |S )N)r)   )r!   r   r   r   r   	cache_url>   s    zCacheController.cache_urlc       
      C   s*  t dft dft dfddddddddt dfd}|d|dd}i }x|dD ]}| s`qR|d	d
}|d  }y|| \}}	W n" tk
r   td| wRY nX |r|	sd ||< |rRy||d
  ||< W qR tk
r   |	rtd| Y qR tk
r    td||j	 Y qRX qRW |S )NTF)NF)zmax-agez	max-stalez	min-freshzno-cachezno-storezno-transformzonly-if-cachedzmust-revalidatepublicprivatezproxy-revalidatezs-maxagezcache-controlzCache-Control ,=r   r   z,Ignoring unknown cache-control directive: %sz-Missing value for cache-control directive: %sz8Invalid value for cache-control directive %s, must be %s)
intgetsplitstripKeyErrorloggerdebug
IndexError
ValueError__name__)
r   headersknown_directives
cc_headersretvalcc_directiveparts	directivetyprequiredr   r   r   parse_cache_controlB   sP    
z#CacheController.parse_cache_controlc             C   s0  |  |j}td| | |j}d|kr:td dS d|kr\|d dkr\td dS | j|}|dkr~td	 dS | j	||}|st
d
 dS |jdkrd}t| |S t|j}|rd|krd|krtd | j| td dS t }tt|d }	td||	 }
td|
 | |}d}d|kr^|d }td| nDd|krt|d }|dk	rt||	 }td|}td| d|kr|d }td| d|kr|d }|
|7 }
td|
 ||
krtd td||
 |S d|kr,td | j| dS )ze
        Return a cached response if it exists in the cache, otherwise
        return False.
        zLooking up "%s" in the cachezno-cachez-Request header has "no-cache", cache bypassedFzmax-ager   z1Request header has "max_age" as 0, cache bypassedNzNo cache entry availablez1Cache entry deserialization failed, entry ignoredi-  zVReturning cached "301 Moved Permanently" response (ignoring date and etag information)dateetagz(Purging cached response: no date or etagz!Ignoring cached response: no datezCurrent age based on date: %iz#Freshness lifetime from max-age: %iexpiresz#Freshness lifetime from expires: %iz+Freshness lifetime from request max-age: %iz	min-freshz'Adjusted current age from min-fresh: %iz2The response is "fresh", returning cached responsez%i > %iz4The cached response is "stale" with no etag, purging)r*   urlr5   r6   rC   r:   r   r1   r   loadswarningstatusr   deletetimecalendartimegmr   max)r   requestr*   cc
cache_datarespmsgr:   nowrD   current_ageresp_ccfreshness_lifetimerF   expire_time	min_freshr   r   r   cached_requestx   sv    




















zCacheController.cached_requestc             C   s`   |  |j}| j|| j|}i }|r\t|j}d|krH|d |d< d|kr\|d |d< |S )NrE   ETagzIf-None-Matchzlast-modifiedzLast-ModifiedzIf-Modified-Since)r*   rG   r   rH   r   r1   r   r:   )r   rP   r*   rS   new_headersr:   r   r   r   conditional_headers   s    
z#CacheController.conditional_headersc             C   s  |p| j }|j|kr(td|j| dS t|j}|dk	rfd|krf|d  rft|d t|krfdS | 	|j}| 	|}| 
|j}	td|	 d}
d|krd}
td d|krd}
td	 |
r| j|	rtd
 | j|	 |
rdS d|ddkrtd dS | jrLd|krLtd | j|	| jj|||d n|jdkr|td | j|	| j|| nd|kr d|kr|d dkrtd | j|	| jj|||d n:d|kr |d r td | j|	| jj|||d dS )zc
        Algorithm for caching requests.

        This assumes a requests Response object.
        zStatus code %s not in %sNzcontent-lengthz&Updating cache with response from "%s"Fzno-storeTzResponse header has "no-store"zRequest header has "no-store"z0Purging existing cache entry to honor "no-store"*varyr-   zResponse header has "Vary: *"rE   zCaching due to etag)bodyi-  zCaching permanant redirectrD   zmax-ager   z'Caching b/c date exists and max-age > 0rF   zCaching b/c of expires header)r   rJ   r5   r6   r   r:   isdigitr0   lenrC   r*   rG   r   r1   rK   r   setr   dumps)r   rP   responsera   r   r   response_headerscc_reqrQ   r*   no_storer   r   r   cache_response   s^    














zCacheController.cache_responsec                sv   |  |j}| j|| j|}|s*|S dg |jt fdd|j	 D  d|_
| j|| j|| |S )zOn a 304 we will get a new set of headers that we want to
        update our cached value with, assuming we have one.

        This should only ever be called when we've sent an ETag and
        gotten a 304 as the response.
        zcontent-lengthc             3   s&   | ]\}}|   kr||fV  qd S )N)r   ).0kv)excluded_headersr   r   	<genexpr>l  s   z9CacheController.update_cached_response.<locals>.<genexpr>r   )r*   rG   r   rH   r   r1   r:   updatedictitemsrJ   rd   re   )r   rP   rf   r*   cached_responser   )rn   r   update_cached_responseR  s    	
z&CacheController.update_cached_response)NTNN)NN)r9   
__module____qualname____doc__r   classmethodr)   r*   rC   r[   r^   rj   rt   r   r   r   r   r      s   
6o
[r   )rw   loggingrerM   rL   email.utilsr   Zpip._vendor.requests.structuresr   r   r   	serializer   	getLoggerr9   r5   compiler   r   objectr   r   r   r   r   <module>   s   

	