zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
U
I=®d@ã@sxdZddlZddlZzddlmZWnek
r<dZYnXdZGdd„deƒZddd    „Z    d
d „Z
d d „Z dd„Z dS)zJThe match_hostname() function from Python 3.3.3, essential when using SSL.éN)Ú    ipaddressz3.5.0.1c@s eZdZdS)ÚCertificateErrorN)Ú__name__Ú
__module__Ú __qualname__©rrúvD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.pyrsréc
Csòg}|s dS| d¡}|d}|dd…}| d¡}||krLtdt|ƒƒ‚|s`| ¡| ¡kS|dkrt| d¡n>| d    ¡sˆ| d    ¡rš| t |¡¡n| t |¡     d
d ¡¡|D]}| t |¡¡q¶t 
d d   |¡dtj ¡}    |      |¡S)zhMatching according to RFC 6125, section 6.4.3
 
    http://tools.ietf.org/html/rfc6125#section-6.4.3
    FÚ.rr    NÚ*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)ÚsplitÚcountrÚreprÚlowerÚappendÚ
startswithÚreÚescapeÚreplaceÚcompileÚjoinÚ
IGNORECASEÚmatch)
ÚdnÚhostnameZ max_wildcardsZpatsÚpartsZleftmostÚ    remainderÚ    wildcardsÚfragÚpatrrrÚ_dnsname_matchs,
 
 
ÿ r cCs&t|tƒr"tjdkr"t|ddd}|S)N)éÚasciiÚstrict)ÚencodingÚerrors)Ú
isinstanceÚstrÚsysÚ version_infoÚunicode)ÚobjrrrÚ _to_unicodeOsr,cCst t|ƒ ¡¡}||kS)zˆExact matching of IP addresses.
 
    RFC 6125 explicitly doesn't define an algorithm for this
    (section 1.7.2 - "Out of Scope").
    )rÚ
ip_addressr,Úrstrip)ÚipnameÚhost_ipÚiprrrÚ_ipaddress_matchUsr2cCsŒ|s tdƒ‚zt t|ƒ¡}WnPtk
r6d}Yn:tk
rLd}Yn$tk
rntdkrhd}n‚YnXg}| dd¡}|D]^\}}|dkr¸|dkr¬t||ƒr¬dS| |¡q„|dkr„|dk    rØt    ||ƒrØdS| |¡q„|s0| dd¡D]8}|D].\}}|dkrþt||ƒr"dS| |¡qþqöt
|ƒd    kr\t d
|d   t t|ƒ¡fƒ‚n,t
|ƒd    kr€t d ||d fƒ‚nt dƒ‚dS)a)Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed, but IP addresses are not accepted for *hostname*.
 
    CertificateError is raised on failure. On success, the function
    returns nothing.
    ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNÚsubjectAltNamerÚDNSz
IP AddressÚsubjectÚ
commonNamer    z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)Ú
ValueErrorrr-r,Ú UnicodeErrorÚAttributeErrorÚgetr rr2ÚlenrrÚmapr)Úcertrr0ÚdnsnamesÚsanÚkeyÚvalueÚsubrrrÚmatch_hostnameasVÿ      ÿÿÿrC)r    ) Ú__doc__rr(Ú pip._vendorrÚ ImportErrorÚ __version__r7rr r,r2rCrrrrÚ<module>s
 
6