+
    i                        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                      ] tR t^tRtR# )CertificateError N)__name__
__module____qualname____firstlineno____static_attributes__r       e/Users/ahmad/.openclaw/workspace/venv/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_wildcardsintreturnztyping.Match[str] | None | boolr   )formats   "r   __annotate__r      s,     5 55!5255$5r   c                n   . 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
F.:   NN*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr   reprboollowerappend
startswithreescapereplacecompilejoin
IGNORECASEmatch)
r   r   r   patspartsleftmost	remainder	wildcardsfragpats
   &&&       r   _dnsname_matchr3      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               $    V ^8  d   QhRRRRRR/# )r   ipnamer   host_ipzIPv4Address | IPv6Addressr   r!   r   )r   s   "r   r   r   P   s"     - -S -+D - -r   c                    \         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_addressrstripr!   packed)r5   r6   ips   && r   _ipaddress_matchr=   P   s2     
		fmmo	.B		W^^+,,r   c               (    V ^8  d   QhRRRRRRRR/# )	r   certz_TYPE_PEER_CERT_RET_DICT | Noner   r   hostname_checks_common_namer!   r   Noner   )r   s   "r   r   r   _   s<     @R @R
)@R@R "&@R 
	@Rr   c                   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_REQUIRED%NsubjectAltNameDNSz
IP Addresssubject
commonNamez	hostname z doesn't match either of z, z doesn't match z/no appropriate subjectAltName fields were foundr   )
ValueErrorr8   r9   rfindgetr3   r#   r=   lenr   r)   mapr    )	r?   r   r@   r6   dnsnamessankeyvaluesubs	   &&&      r   match_hostnamerR   _   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)__doc__
__future__r   r8   r%   typingr   r   TYPE_CHECKINGssl_r   __version__rH   r   r3   r=   rR   r   r   r   <module>rY      sR    N #  	  .	.	z 	5p-@R @Rr   