‹“ReE7ã@sºdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ej eƒZejdƒZd d „ZGd d „d eƒZdS) z7 The httplib2 algorithms ported for use with requests. éN)Ú parsedate_tz)ÚCaseInsensitiveDicté)Ú DictCache)Ú Serializerz9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?cCs<tj|ƒjƒ}|d|d|d|d|dfS)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_urisrc@s”eZdZdZdddddd„Zedd„ƒZedd „ƒZd d „Zd d „Z dd„Z dddd„Z dd„Z dS)ÚCacheControllerz9An interface to see if request should cached or not. NTcCsL|dkrtƒn||_||_|p3tƒ|_|pBd|_dS)NéÈéËé,é-)rrrr)rÚcacheÚ cache_etagsrÚ serializerÚcacheable_status_codes)ÚselfrrrÚ status_codesrrrÚ__init__"s zCacheController.__init__c Cs”t|ƒ\}}}}}| s)| r9td|ƒ‚|jƒ}|jƒ}|s]d}|rxdj||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_urirrrÚ_urlnorm*s  !zCacheController._urlnormcCs |j|ƒS)N)r+)r#rrrrÚ cache_url>szCacheController.cache_urlc Cs£dtdfdtdfdtdfddddddd dd dd dd dd d dtdfi }|jd|jddƒƒ}i}x|jdƒD]}|jƒs¯qš|jddƒ}|djƒ}y||\}} Wn%tk r tjd|ƒwšYnX| s| r%d||<|ršy||djƒƒ|| %iz4The cached response is "stale" with no etag, purging)r,Úurlr7r8rEr<rr3rÚ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_freshrrrÚcached_requestxsv                          zCacheController.cached_requestcCs†|j|jƒ}|jj||jj|ƒƒ}i}|r‚t|jƒ}d|krh|d|d 0rHzCaching b/c of expires header)rrLr7r8rr<Úisdigitr2ÚlenrEr,rIrr3rMrÚsetrÚdumps) rrRÚresponsercrrÚresponse_headersÚcc_reqrSr,Úno_storerrrÚcache_response÷s^          " %   "    zCacheController.cache_responsecs§|j|jƒ}|jj||jj|ƒƒ}|s=|Sdg‰|jjt‡fdd†|jj ƒDƒƒƒd|_ |jj ||jj ||ƒƒ|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. zcontent-lengthc3s3|])\}}|jƒˆkr||fVqdS)N)r!)Ú.0ÚkÚv)Úexcluded_headersrrú ls z9CacheController.update_cached_response..r) r,rIrrJrr3r<ÚupdateÚdictÚitemsrLrfrg)rrRrhr,Úcached_responser)rprÚupdate_cached_responseRs!   "z&CacheController.update_cached_response) r;Ú __module__Ú __qualname__Ú__doc__rÚ classmethodr+r,rEr]r`rlrvrrrrrs  6 o [r)ryÚloggingÚrerOrNÚ email.utilsrZpip._vendor.requests.structuresrrrÚ serializerÚ getLoggerr;r7Úcompiler rÚobjectrrrrrÚs