+
     ]i  c                  s    R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHt ]P                  '       d   ^RI	H
t
 Rt ! R R]4      tRR R	 lltR
 R ltRR R lltR# )zHThe match_hostname() function from Python 3.5, essential when using SSL.)annotationsN)IPv4AddressIPv6Address)_TYPE_PEER_CERT_RET_DICTz3.5.0.1c                  s    ] tR t^tRtR# )CertificateError N)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__static_attributes__r       D/usr/lib/python3.14/site-packages/urllib3/util/ssl_match_hostname.pyr   r      s    r   r   c               (    V ^8  d   QhRRRRRRRR/# )	   dnz
typing.Anyhostnamestrmax_wildcardsZintreturnztyping.Match[str] | None | boolr   Zformat   "r   __annotate__r      s,     5 55!5255$5r   c                sn   . pV '       g   R# V P                  R4      pV^ ,          pVR,          pVP                  R4      pWr8  d   \        R\        V 4      ,           4      hV'       g+   \	        V P                  4       VP                  4       8H  4      # VR8X  d   VP                  R4       MVP                  R4      '       g   VP                  R4      '       d'   VP                  \        P                  ! V4      4       M5VP                  \        P                  ! V4      P                  RR	4      4       V F(  pVP                  \        P                  ! V4      4       K*  	  \        P                  ! R
RP                  V4      ,           R,           \        P                  4      p	V	P                  V4      # )z`Matching according to RFC 6125, section 6.4.3

http://tools.ietf.org/html/rfc6125#section-6.4.3
FZ.:   NNZ*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)ZsplitZcountr   reprboolZlowerappendZ
startswithreZescapeZreplaceZcompilejoinZ
IGNORECASEZmatch)
r
   r   r   ZpatsZpartsZleftmostZ	remainderZ	wildcardsZfragZpats
   &&&       r   _dnsname_matchr      sL    D HHTNEQxHb	Is#I 
 :T"XE
 	

 BHHJ(.."2233
 3 	G			V	$	$(;(;F(C(C
 	BIIh'( 	BIIh'//w?@ BIIdO$  **UUZZ--5r}}
EC99Xr   c               s$    V ^8  d   QhRRRRRR/# )r	   ipnamer   host_ipzIPv4Address | IPv6Addressr   r   r   r   r   r   r   r   P   s"     - -S -+D - -r   c                s    \         P                  ! V P                  4       4      p\        VP                  VP                  8H  4      # )am  Exact matching of IP addresses.

RFC 9110 section 4.3.5: "A reference identity of IP-ID contains the decoded
bytes of the IP address. An IP version 4 address is 4 octets, and an IP
version 6 address is 16 octets. [...] A reference identity of type IP-ID
matches if the address is identical to an iPAddress value of the
subjectAltName extension of the certificate."
)	ipaddress
ip_addressZrstripr   Zpacked)r   r   Zips   && r   _ipaddress_matchr   P   s2     
		fmmo	.B		W^^+,,r   c               r   )	r	   certz_TYPE_PEER_CERT_RET_DICT | Noner   r   hostname_checks_common_namer   r   ZNoner   r   r   r   r   r   _   s<     @R @R
)@R@R "&@R 
	@Rr   c                s   V '       g   \        R4      h RV9   d*   \        P                  ! VRVP                  R4       4      pM\        P                  ! V4      p . pV P	                  RR4      pV Fi  w  rgVR8X  d,   Vf   \        Wq4      '       d    R# VP                  V4       K7  VR8X  g   K@  Ve   \        Ws4      '       d    R# VP                  V4       Kk  	  V'       d`   Vf\   V'       gT   V P	                  RR4       F=  pV F4  w  rgVR8X  g   K  \        Wq4      '       d     R# VP                  V4       K6  	  K?  	  \        V4      ^8  d1   \        R	V: R
RP                  \        \        V4      4      : 24      h\        V4      ^8X  d   \        R	V: RV^ ,          : 24      h\        R4      h  \          d    Rp ELoi ; i)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_REQUIREDZ%NZsubjectAltNameZDNSz
IP AddressZsubjectZ
commonNamez	hostname z doesn't match either of z, z doesn't match z/no appropriate subjectAltName fields were foundr   )
ValueErrorr   r   ZrfindZgetr   r   r   Zlenr   r   Zmapr   )	r   r   r   r   ZdnsnamesZsanZkeyZvalueZsubs	   &&&      r   match_hostnamer!   _   s    -
 	

 (?**84IhnnS6I+JKG**84G
 H'+xx0@"'EC 
%<>%#B#BOOE"L "'7'G'GOOE"  #wx88Ir*C!
,&%e66OOE*	 " + 8}q,4diiD(@S6TV
 	
 
X!	8,ohqk_UVVPQQG  s   /F; F; ;GG)r   )F)Z__doc__Z
__future__r    r   r   Ztypingr   r   ZTYPE_CHECKINGZssl_r   Z__version__r    r   r   r   r!   r   r   r   <module>r"      sR    N #  	  .	.	z 	5p-@R @Rr   