<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>

‹“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 j e ƒ Z e j d ƒ Z d	 d
 „  Z Gd d „  d e ƒ Z d S)z7
The httplib2 algorithms ported for use with requests.
é    N)Úparsedate_tz)ÚCaseInsensitiveDicté   )Ú	DictCache)Ú
Serializerz9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?c             C   s<   t  j |  ƒ j ƒ  } | d | d | d | d | d f S)z‡Parses 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-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/cachecontrol/controller.pyÚ	parse_uri   s    r   c               @   s”   e  Z d  Z d Z d d d d d d „ Z e d d „  ƒ Z e d d	 „  ƒ Z d
 d „  Z d d „  Z	 d d „  Z
 d d d d „ Z d d „  Z d S)ÚCacheControllerz9An interface to see if request should cached or not.
    NTc             C   sL   | d  k r t  ƒ  n | |  _ | |  _ | p3 t ƒ  |  _ | pB d |  _ d  S)NéÈ   éË   é,  é-  )r   r   r   r   )r   ÚcacheÚcache_etagsr   Ú
serializerÚcacheable_status_codes)Úselfr   r   r   Ústatus_codesr   r   r   Ú__init__"   s    	zCacheController.__init__c       	      C   s”   t  | ƒ \ } } } } } | s) | r9 t d | ƒ ‚ | j ƒ  } | j ƒ  } | s] d } | rx d j | | g ƒ p{ | } | 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   |  j  | ƒ S)N)r+   )r#   r   r   r   r   Ú	cache_url>   s    zCacheController.cache_urlc       
      C   s£  d t  d f d t  d f d t  d f d d d d d d d	 d d
 d d d d d d d  d t  d f i } | j d | j d d ƒ ƒ } i  } x| j d ƒ D]} | j ƒ  s¯ qš | j d d ƒ } | d j ƒ  } y | | \ } }	 Wn% t k
 rt j d | ƒ wš Yn X| s|	 r%d  | | <| rš y | | d j ƒ  ƒ | | <Wqš t k
 rs|	 rot j d | ƒ Yqš t k
 ršt j d | | j	 ƒ Yqš Xqš W| S)!Nzmax-ageTz	max-staleFz	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)NF)NF)NF)NF)NF)NF)NF)NF)
Ú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   sî  |  j  | j ƒ } t j d | ƒ |  j | j ƒ } d | k rQ t j d ƒ d Sd | k r~ | d d k r~ t j d ƒ d S|  j j | ƒ } | d k r­ t j d	 ƒ d S|  j j	 | | ƒ } | sÙ t j
 d
 ƒ d S| j d k rÿ d } t j | ƒ | St | j ƒ } | s!d | k r[d | k rJt j d ƒ |  j j | ƒ t j d ƒ d St j ƒ  } t j t | d ƒ ƒ }	 t d | |	 ƒ }
 t j d |
 ƒ |  j | ƒ } d } d | k rá| d } t j d | ƒ nZ d | k r;t | d ƒ } | d k	 r;t j | ƒ |	 } t d | ƒ } t j d | ƒ d | k ra| d } t j d | ƒ d | k r‘| d } |
 | 7}
 t j d |
 ƒ | |
 k rÁt j d ƒ t j d | |
 ƒ | Sd | k rêt j d ƒ |  j 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,   Úurlr7   r8   rE   r<   r   r3   r   ÚloadsÚwarningÚstatusr   ÚdeleteÚtimeÚcalendarÚtimegmr   Úmax)r   Úrequestr,   ÚccÚ
cache_dataÚrespÚmsgr<   ÚnowrF   Úcurrent_ageÚresp_ccÚfreshness_lifetimerH   Úexpire_timeÚ	min_freshr   r   r   Úcached_requestx   sv    





zCacheController.cached_requestc             C   s†   |  j  | j ƒ } |  j j | |  j j | ƒ ƒ } i  } | r‚ t | j ƒ } d | k rh | d | d <d | k r‚ | d | d <| S)NrG   ÚETagzIf-None-Matchzlast-modifiedzLast-ModifiedzIf-Modified-Since)r,   rI   r   rJ   r   r3   r   r<   )r   rR   r,   rU   Únew_headersr<   r   r   r   Úconditional_headersç   s    !z#CacheController.conditional_headersc             C   s»  | p |  j  } | j | k r8 t j d | j | ƒ d St | j ƒ } | d k	 r d | k r | d j ƒ  r t | d ƒ t | ƒ k r d S|  j	 | j ƒ } |  j	 | ƒ } |  j
 | j ƒ }	 t j d |	 ƒ d }
 d | k r÷ d }
 t j d ƒ d | k rd }
 t j d	 ƒ |
 rK|  j j |	 ƒ rKt j d
 ƒ |  j j |	 ƒ |
 rUd Sd | j d d ƒ k r~t j d ƒ d S|  j rËd | k rËt j d ƒ |  j j |	 |  j j | | d | ƒƒ nì | j d k rt j d ƒ |  j j |	 |  j j | | ƒ ƒ n« d | k r·d | k rl| d d k rlt j d ƒ |  j j |	 |  j j | | d | ƒƒ nK d | k r·| d r·t j d ƒ |  j 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: *"rG   zCaching due to etagÚbodyi-  zCaching permanant redirectrF   zmax-ager   z'Caching b/c date exists and max-age > 0rH   zCaching b/c of expires header)r   rL   r7   r8   r   r<   Úisdigitr2   ÚlenrE   r,   rI   r   r3   rM   r   Úsetr   Údumps)r   rR   Úresponserc   r   r   Úresponse_headersÚcc_reqrS   r,   Úno_storer   r   r   Úcache_response÷   s^    	"%	"
	zCacheController.cache_responsec                s§   |  j  | j ƒ } |  j j | |  j j | ƒ ƒ } | s= | Sd g ‰  | j j t ‡  f d d †  | j j	 ƒ  Dƒ ƒ ƒ d | _
 |  j j | |  j j | | ƒ ƒ | S)zéOn 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   s3   |  ]) \ } } | j  ƒ  ˆ  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,   rI   r   rJ   r   r3   r<   ÚupdateÚdictÚitemsrL   rf   rg   )r   rR   rh   r,   Úcached_responser   )rp   r   Úupdate_cached_responseR  s    !				"z&CacheController.update_cached_response)r;   Ú
__module__Ú__qualname__Ú__doc__r   Úclassmethodr+   r,   rE   r]   r`   rl   rv   r   r   r   r   r      s   6o[r   )ry   ÚloggingÚrerO   rN   Úemail.utilsr   Zpip._vendor.requests.structuresr   r   r   Ú	serializer   Ú	getLoggerr;   r7   Úcompiler   r   Úobjectr   r   r   r   r   Ú<module>   s   	