+
    i                        ^ RI Ht ^ RIt^ RIt^RIHtHt ^RIHtH	t	H
t
 ^RIHtHt ^RIHtHt ^RIHtHt . ROtR R	 ltR
 R ltR R ltR R ltR# )    )annotationsN)HeadersMultipleValuesError)InvalidHeaderInvalidHeaderValueInvalidUpgrade)parse_connectionparse_upgrade)ConnectionOptionUpgradeProtocol)
accept_keygenerate_keyc                    V ^8  d   QhRRRR/#    headersr   returnstr )formats   "b/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/websockets/legacy/handshake.py__annotate__r      s      7 s     c                @    \        4       pRV R&   RV R&   WR&   RV R&   V# )z
Build a handshake request to send to the server.

Update request headers passed in argument.

Args:
    headers: Handshake request headers.

Returns:
    ``key`` that must be passed to :func:`check_response`.

	websocketUpgrade
ConnectionSec-WebSocket-Key13Sec-WebSocket-Version)r   r   keys   & r   build_requestr#      s8     .C$GI%GL#& '+G#$Jr   c                    V ^8  d   QhRRRR/# r   r   )r   s   "r   r   r   %   s     = =7 =s =r   c                2   \        V P                  R4       Uu. uF  p\        V4      NK  	  up. 4      p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   \	        RRP                  V4      4      h\        V P                  R4       Uu. uF  p\        V4      NK  	  up. 4      p\        V4      ^8X  d   V^ ,          P                  4       R8X  g   \	        RRP                  V4      4      h V R,          p \        P                  ! TP                  4       RR7      p\        T4      ^8w  d   \#        RT4      h T R,          pTR8w  d   \#        RT4      hT# u upi u upi   \         d   p\        R4      ThR	p?i\         d   p\        RR
4      ThR	p?ii ; i  \        P                    d   p\#        RT4      ThR	p?ii ; i  \         d   p\        R4      ThR	p?i\         d   p\        RR
4      ThR	p?ii ; i)a.  
Check a handshake request received from the client.

This function doesn't verify that the request is an HTTP/1.1 or higher GET
request and doesn't perform ``Host`` and ``Origin`` checks. These controls
are usually performed earlier in the HTTP request handling code. They're
the responsibility of the caller.

Args:
    headers: Handshake request headers.

Returns:
    ``key`` that must be passed to :func:`build_response`.

Raises:
    InvalidHandshake: If the handshake request is invalid.
        Then, the server must return a 400 Bad Request error.

r   c              3  F   "   T F  qP                  4       R 8H  x  K  	  R# 5iupgradeNlower.0values   & r   	<genexpr> check_request.<locals>.<genexpr>=        Bze{{}	)z   !TF, r   r   r   Nmultiple values)validater    r   )sumget_allr	   anyr   joinr
   lenr*   KeyErrorr   r   base64	b64decodeencodebinasciiErrorr   )r   r-   
connectionr(   s_w_keyexcraw_keys_w_versions   &       r   check_requestrE   %   s   ( *-.5ool.KL.KU	%	 .KLb*J 3BzB333BzBBB\499Z+@AA%(+2??9+EF+E%u	+EF&G LA'!*"2"2"4"CY		'(:;;M-.H""7>>#3dC 7|r !4g>>Q56 d !8+FFNQ 	M 	G  :/0c9 M/1BCLM
 >> H !4g>CGH  >34#= Q35FGSPQsw   E1"E6	E; &F5 	G ;F2FF2F2 F--F25G
GGH*G66HHHHc               $    V ^8  d   QhRRRRRR/# r   r   r   r"   r   r   Noner   )r   s   "r   r   r   e   s!     2 2G 2# 2$ 2r   c                6    RV R&   RV R&   \        V4      V R&   R# )z
Build a handshake response to send to the client.

Update response headers passed in argument.

Args:
    headers: Handshake response headers.
    key: Returned by :func:`check_request`.

r   r   r   Sec-WebSocket-AcceptN)acceptr!   s   &&r   build_responserL   e   s'     %GI%GL&,SkG"#r   c               $    V ^8  d   QhRRRRRR/# rG   r   )r   s   "r   r   r   u   s&     )E )EG )E# )E$ )Er   c                   \        V P                  R4       Uu. uF  p\        V4      NK  	  up. 4      p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   \	        RRP                  V4      4      h\        V P                  R4       Uu. uF  p\        V4      NK  	  up. 4      p\        V4      ^8X  d   V^ ,          P                  4       R8X  g   \	        RRP                  V4      4      h V R	,          pT\        T4      8w  d   \        R	T4      hR
# u upi u upi   \         d   p\        R	4      ThR
p?i\         d   p\        R	R4      ThR
p?ii ; i)aw  
Check a handshake response received from the server.

This function doesn't verify that the response is an HTTP/1.1 or higher
response with a 101 status code. These controls are the responsibility of
the caller.

Args:
    headers: Handshake response headers.
    key: Returned by :func:`build_request`.

Raises:
    InvalidHandshake: If the handshake response is invalid.

r   c              3  F   "   T F  qP                  4       R 8H  x  K  	  R# 5ir'   r)   r+   s   & r   r.   !check_response.<locals>.<genexpr>   r0   r1   TF r   r   r2   rJ   Nr3   )r5   r6   r	   r7   r   r8   r
   r9   r*   r:   r   r   rK   r   )r   r"   r-   r@   r(   
s_w_acceptrB   s   &&     r   check_responserS   u   sL     *-.5ool.KL.KU	%	 .KLb*J 3BzB333BzBBB\388J+?@@%(+2??9+EF+E%u	+EF&G LA'!*"2"2"4"CY		'(:;;P34
 VC[  !7DD !/ 	M 	G  =23< P24EFCOPs5   D-"D2	D7 7E.EE.E.E))E.)r#   rE   rL   rS   )
__future__r   r;   r>   datastructuresr   r   
exceptionsr   r   r   r   r	   r
   typingr   r   utilsr   rK   r   __all__r#   rE   rL   rS   r   r   r   <module>rZ      s>    "   9 J J 5 6 6 Q*=@2 )Er   