Ë
    ·�©jEG  ã                  ó  — d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 ddlmZ ddlmZmZmZmZmZ ddlmZ g d	¢Z d
j,                  ej.                  Ž Zej2                  j5                  dde› de› �«      Zej2                  j5                  dde› de› �«      Z eej2                  j5                  dd«      «      Z eej2                  j5                  dd«      «      Z eej2                  j5                  dd«      «      Z dd„Z! ejD                  d«      Z# ejD                  d«      Z$ejJ                   G d„ d«      «       Z&ejJ                   G d„ d«      «       Z'ef	 	 	 	 	 d d„Z(	 	 	 	 d!d„Z)	 	 	 	 	 	 	 	 	 	 	 	 d"d„Z*y)#é    )ÚannotationsN)Ú	Generator)ÚCallableé   )ÚHeaders)ÚHeaderLineTooLongÚRequestLineTooLongÚSecurityErrorÚStatusLineTooLongÚTooManyHeaders)Úversion)ÚSERVERÚ
USER_AGENTÚRequestÚResponsez{}.{}ÚWEBSOCKETS_USER_AGENTzPython/z websockets/ÚWEBSOCKETS_SERVERÚWEBSOCKETS_MAX_NUM_HEADERSÚ128ÚWEBSOCKETS_MAX_LINE_LENGTHÚ8192ÚWEBSOCKETS_MAX_BODY_SIZEÚ	1_048_576c                ó&   — | j                  d¬«      S )zG
    Decode a bytestring for interpolating into an error message.

    Úbackslashreplace©Úerrors)Údecode)Úvalues    úX/var/www/html/streamforge-license/venv/lib/python3.12/site-packages/websockets/http11.pyÚdr!   8   s   € ð
 �<‰<Ð1ˆ<Ó2Ð2ó    s   [-!#$%&\'*+.^_`|~0-9a-zA-Z]+s   [\x09\x20-\x7e\x80-\xff]*c                  ó„   — e Zd ZU dZded<   ded<   dZded<   dZded	<   d
Zded<   edd„«       Z	e
	 	 	 	 dd„«       Zdd„Zy
)r   aé  
    WebSocket handshake request.

    ``method`` and ``path`` must contain only ASCII characters. ``headers``
    should contain only ASCII characters; however, non-ASCII header values are
    tolerated and encoded as ISO-8859-1.

    Attributes:
        path: Request path, including optional query.
        headers: Request headers.
        method: Request method; WebSocket handshake requests use GET.
        protocol: Request protocol; WebSocket handshake requests use HTTP/1.1.
    ÚstrÚpathr   ÚheadersÚGETÚmethodzHTTP/1.1ÚprotocolNúException | NoneÚ
_exceptionc                óN   — t        j                  dt        «       | j                  S )NzIRequest.exception is deprecated; use ServerProtocol.handshake_exc instead©ÚwarningsÚwarnÚDeprecationWarningr+   ©Úselfs    r    Ú	exceptionzRequest.exceptionn   s    € ä�‰ØWÜô	
ð �‰Ðr"   c              #  ó,  K  — 	 t        |t        «      E d{  –—† }	 |j                  dd«      \  }}}|dvrt	        dt        |«      › �«      ‚|j                  d«      }|j                  d«      }|j                  d«      }	t        |«      E d{  –—† }
d	|
v rt        d
«      ‚d|
v rt        |
d   «      dk7  rt	        d«      ‚ | |	|
||«      S 7 Œ¶# t        $ r}t        d«      |‚d}~ww xY w# t        $ r t	        dt        |«      › �«      d‚w xY w7 Œ‚­w)a¢  
        Parse a WebSocket handshake request.

        This is a generator-based coroutine.

        The request method and path must contain only ASCII characters. The
        request path isn't URL-decoded or validated in any way. Request headers
        should contain only ASCII characters; however, non-ASCII header values
        are tolerated and decoded with ISO-8859-1.

        :meth:`parse` doesn't read the request body because WebSocket handshake
        requests don't have one. If the request contains a body, it may be read
        from the data stream after :meth:`parse` returns.

        Args:
            read_line: Generator-based coroutine that reads a LF-terminated
                line or raises an exception if there isn't enough data

        Raises:
            EOFError: If the connection is closed without a full HTTP request.
            RequestLineTooLong: If the request line is too long.
            HeaderLineTooLong: If a header line is too long.
            TooManyHeaders: If there are too many headers.
            UnicodeDecodeError: If the request method or path isn't ASCII.
            ValueError: If the request isn't well formatted.

        Nz1connection closed while reading HTTP request lineó    é   zinvalid HTTP request line: ©ó   HTTP/1.1s   HTTP/1.0ú5unsupported protocol; expected HTTP/1.1 or HTTP/1.0: ÚasciiúTransfer-Encodingz!transfer codings aren't supportedúContent-Lengthr   zunsupported request body)
Ú
parse_liner	   ÚEOFErrorÚsplitÚ
ValueErrorr!   r   Úparse_headersÚNotImplementedErrorÚint)ÚclsÚ	read_lineÚrequest_lineÚexcÚ
raw_methodÚraw_pathÚraw_protocolr(   r)   r%   r&   s              r    ÚparsezRequest.parsev   sO  è ø€ ðP	YÜ&0°Ô<NÓ&O×OˆLð	XØ1=×1CÑ1CÀDÈ!Ó1LÑ.ˆJ˜ ,ð Ð9Ñ9ÜØGÜ�\“?Ð#ð%óð ð ×"Ñ" 7Ó+ˆØ×&Ñ& wÓ/ˆð �‰˜wÓ'ˆä*¨9Ó5×5ˆð  'Ñ)Ü%Ð&IÓJÐJà˜wÑ&ô �7Ð+Ñ,Ó-°Ò2Ü Ð!;Ó<Ð<á�4˜ &¨(Ó3Ð3ðC PùÜò 	YÜÐNÓOÐUXÐXûð	Yûô
 ò 	XÜÐ:¼1¸\»?Ð:KÐLÓMÐSWÐWð	Xúð 6úsU   ‚D„C —C˜C �C- ³ADÂDÂ>DÃC Ã	C*ÃC%Ã%C*Ã*DÃ-"DÄDc                ó´   — | j                   › d| j                  › d| j                  › d�}|j                  d«      }|| j                  j                  «       z  }|S )z;
        Serialize a WebSocket handshake request.

        ú ú
r:   )r(   r%   r)   Úencoder&   Ú	serialize)r2   rF   Úrequests      r    rP   zRequest.serializeÂ   sT   € ð Ÿ+™+˜ a¨¯	©	 {°!°D·M±M°?À$ÐGˆØ×%Ñ% gÓ.ˆØ�4—<‘<×)Ñ)Ó+Ñ+ˆØˆr"   ©Úreturnr*   )rE   úJCallable[[int, type[Exception]], Generator[None, None, bytes | bytearray]]rS   zGenerator[None, None, Request]©rS   Úbytes)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r(   r)   r+   Úpropertyr3   ÚclassmethodrK   rP   © r"   r    r   r   T   s{   … ñð ƒIØÓð €FˆCÓØ€HˆcÓð $(€JÐ Ó'àòó ðð ðI4ð
ðI4ð
 
(òI4ó ðI4ôV
r"   r   c                  óŽ   — e Zd ZU dZded<   ded<   ded<   dZd	ed
<   dZded<   edd„«       Ze		 d	 	 	 	 	 	 	 	 	 dd„«       Z
dd„Zy)r   aw  
    WebSocket handshake response.

    ``reason_phrase`` and ``headers`` should contain only ASCII characters;
    however, non-ASCII reason phrases and header values are tolerated and
    encoded as ISO-8859-1.

    Attributes:
        status_code: Response code.
        reason_phrase: Response reason.
        headers: Response headers.
        body: Response body.

    rC   Ústatus_coder$   Úreason_phraser   r&   r"   úbytes | bytearrayÚbodyNr*   r+   c                óN   — t        j                  dt        «       | j                  S )NzJResponse.exception is deprecated; use ClientProtocol.handshake_exc insteadr-   r1   s    r    r3   zResponse.exceptionç   s"   € ä�‰ð7äô	
ð
 �‰Ðr"   c              #  ó  K  — 	 t        |t        «      E d{  –—† }	 |j                  dd«      \  }}}	|r|dvr3t	        dt        |«      › �«      ‚|dk7  rt	        d	t        |«      › �«      ‚	 t        |«      }
d|
cxk  rdk  sn t	        dt        |«      › �«      ‚t        j                  |	«      st	        dt        |	«      › �«      ‚|	j                  d«      }t        |«      E d{  –—† }|rd}nt        |
||||«      E d{  –—† } | |
|||«      S 7 Œû# t        $ r}t        d«      |‚d}~ww xY w# t        $ r t	        dt        |«      › �«      d‚w xY w# t        $ r t	        d
t        |«      › �«      d‚w xY w7 Œ”7 Œz­w)a¡  
        Parse a WebSocket handshake response.

        This is a generator-based coroutine.

        The reason phrase and headers should contain only ASCII characters;
        however, non-ASCII reason phrases and header values are tolerated and
        decoded as ISO-8859-1.

        Args:
            read_line: Generator-based coroutine that reads a LF-terminated
                line or raises an exception if there isn't enough data.
            read_exact: Generator-based coroutine that reads the requested
                bytes or raises an exception if there isn't enough data.
            read_to_eof: Generator-based coroutine that reads until the end
                of the stream.

        Raises:
            EOFError: If the connection is closed without a full HTTP response.
            StatusLineTooLong: If the status line is too long.
            HeaderLineTooLong: If a header line is too long.
            TooManyHeaders: If there are too many headers.
            SecurityError: If the response body exceeds a security limit.
            LookupError: If the response isn't well formatted.
            ValueError: If the response isn't well formatted.

        Nz0connection closed while reading HTTP status liner5   r6   zinvalid HTTP status line: r7   r9   r8   z)unsupported protocol; expected HTTP/1.1: z+invalid status code; expected integer; got éd   iX  u-   invalid status code; expected 100â€“599; got zinvalid HTTP reason phrase: ú
iso-8859-1r"   )r=   r   r>   r?   r@   r!   rC   Ú	_value_reÚ	fullmatchr   rA   Ú	read_body)rD   rE   Ú
read_exactÚread_to_eofÚproxyÚstatus_linerG   r)   Úraw_status_codeÚ
raw_reasonr`   Úreasonr&   rc   s                 r    rK   zResponse.parseð   s×  è ø€ ðR	XÜ%/°	Ô;LÓ%M×MˆKð	VØ4?×4EÑ4EÀdÈAÓ4NÑ1ˆH�o zñ ØÐ9Ñ9Ü ØKÜ˜“~Ð&ð(óð ð
 ˜;Ò&Ü Ø?ÄÀ+ÃÐ?OÐPóð ð	Ü˜oÓ.ˆKð
 �kÔ' CÔ'ÜØ?ÄÀ/Ó@RÐ?SÐTóð ô ×"Ñ" :Ô.ÜÐ;¼A¸j»M¸?ÐKÓLÐLð ×"Ñ" <Ó0ˆä*¨9Ó5×5ˆñ Ø‰Dä'Ø˜W i°¸[ó÷ ˆDñ �; ¨°Ó6Ð6ð] NùÜò 	XÜÐMÓNÐTWÐWûð	Xûô
 ò 	VÜÐ9¼!¸K».Ð9IÐJÓKÐQUÐUð	Vûô ò 	ÜØ=¼aÀÓ>PÐ=QÐRóàðð	úð 6øðús   ‚F „D —D˜D �D2 ³9F Á-E Á8A/F Ã'E<Ã(F ÄE>ÄF ÄD Ä	D/ÄD*Ä*D/Ä/F Ä2"EÅF Å"E9Å9F Å>F c                óº   — d| j                   › d| j                  › d�}|j                  d«      }|| j                  j	                  «       z  }|| j
                  z  }|S )z<
        Serialize a WebSocket handshake response.

        z	HTTP/1.1 rM   rN   rg   )r`   ra   rO   r&   rP   rc   )r2   rn   Úresponses      r    rP   zResponse.serializeJ  s`   € ð " $×"2Ñ"2Ð!3°1°T×5GÑ5GÐ4HÈÐMˆØ×%Ñ% lÓ3ˆØ�D—L‘L×*Ñ*Ó,Ñ,ˆØ�D—I‘IÑˆØˆr"   rR   )F)
rE   rT   rk   ú9Callable[[int], Generator[None, None, bytes | bytearray]]rl   rT   rm   ÚboolrS   zGenerator[None, None, Response]rU   )rW   rX   rY   rZ   r[   rc   r+   r\   r3   r]   rK   rP   r^   r"   r    r   r   Ï   sœ   … ñð ÓØÓØÓØ!€DÐ
Ó!à#'€JÐ Ó'àòó ðð ð ðW7ð
ðW7ð
 NðW7ð
ðW7ð ðW7ð 
)òW7ó ðW7ôr
r"   r   c              #  óz   K  —  | t         |«      E d{  –—† }|j                  d«      st        d«      ‚|dd S 7 Œ%­w)aä  
    Parse a single line.

    CRLF is stripped from the return value.

    Args:
        read_line: Generator-based coroutine that reads a LF-terminated line
            or raises an exception if there isn't enough data.
        too_long_exc_type: exception to raise if the line is too long;
            defaults to :exc:`SecurityError`.

    Raises:
        EOFError: If the connection is closed without a CRLF.
        SecurityError: If the response exceeds a security limit.

    Nó   
zline without CRLFéþÿÿÿ)ÚMAX_LINE_LENGTHÚendswithr>   )rE   Útoo_long_exc_typeÚlines      r    r=   r=   W  sB   è ø€ ñ,  ¤Ð1BÓC×C€Dà�=‰=˜Ô!ÜÐ*Ó+Ð+Ø��ˆ9Ðð	 Dús   ‚;“9”&;c              #  ó¢  K  — t        «       }t        t        dz   «      D ]Ö  }	 t        | t        «      E d{  –—† }|dk(  r |S 	 |j                  dd«      \  }}t        j                  |«      st        dt        |«      › �«      ‚|j                  d«      }t        j                  |«      st        d	t        |«      › �«      ‚|j                  d
«      }|j                  d«      }|j                  ||«       ŒØ t        dt        › d�«      ‚7 ŒÔ# t
        $ r}t        d«      |‚d}~ww xY w# t        $ r t        dt        |«      › �«      d‚w xY w­w)a-  
    Parse HTTP headers.

    Headers should contain only ASCII characters; however, non-ASCII values are
    tolerated and decoded as ISO-8859-1.

    Args:
        read_line: Generator-based coroutine that reads a LF-terminated line
            or raises an exception if there isn't enough data.

    Raises:
        EOFError: If the connection is closed without complete headers.
        HeaderLineTooLong: If a header line is too long.
        TooManyHeaders: If there are too many headers.
        ValueError: If the request isn't well formatted.

    r   Nz,connection closed while reading HTTP headersr"   ó   :zinvalid HTTP header line: zinvalid HTTP header name: s    	zinvalid HTTP header value: r:   rg   zexpected no more than z headers)r   ÚrangeÚMAX_NUM_HEADERSr=   r   r>   r?   r@   r!   Ú	_token_reri   Ústriprh   r   Úset_insecurer   )	rE   r&   Ú_r|   rG   Úraw_nameÚ	raw_valueÚnamer   s	            r    rA   rA   t  sc  è ø€ ô4 ‹i€GÜ”? QÑ&Ó'ò Qˆð	TÜ(¨Ô4EÓF×FˆDð �3Š;Øð4 €Nð1	OØ"&§*¡*¨T°1Ó"5ÑˆH�iô ×"Ñ" 8Ô,ÜÐ9¼!¸H»+¸ÐGÓHÐHØ—O‘O FÓ+ˆ	Ü×"Ñ" 9Ô-ÜÐ:¼1¸Y»<¸.ÐIÓJÐJà�‰˜wÓ'ˆð × Ñ  Ó.ˆð 	×Ñ˜T 5Õ)ð7Qô< Ð5´oÐ5FÀhÐOÓPÐPð9 GùÜò 	TÜÐIÓJÐPSÐSûð	Tûô ò 	OÜÐ9¼!¸D»'¸ÐCÓDÈ$ÐNð	OüsP   ‚ E£D¶D·D»EÁD*ÁB2EÄDÄ	D'ÄD"Ä"D'Ä'EÄ*"EÅEc              #  ój  K  — d| cxk  rdk  sn | dk(  s| dk(  ry|j                  d«      x}�ü|dk7  rt        d|› d	�«      ‚d}	 t        |t        «      E d {  –—† }|j	                  d
d«      d   }t        |«      dkD  r!|j                  d¬«      }	t        d|	› d�«      ‚t        |d«      }
|
dk(  rnbt        |«      |
z   t        kD  rt        d|
› dt        |«      › d�«      ‚| ||
«      E d {  –—† z  } |d«      E d {  –—† dk7  rt        d«      ‚ŒÐt        |«      E d {  –—†  |S |j                  d«      x}�Pt        |«      dkD  rt        d|› d�«      ‚t        |«      }|t        kD  rt        d|› d�«      ‚ ||«      E d {  –—† S  |t        t        «      E d {  –—† S 7 �ŒN7 Œ¹7 Œ©7 Œ‰7 Œ&7 Œ­w)Nrf   éÈ   éÌ   i0  r"   r;   Úchunkedztransfer coding z isn't supportedó   ;r   r   é   r   r   zchunk too large: 0xz bytesé   zchunk too large: z bytes after r6   rw   zchunk without CRLFr<   é   zbody too large: )ÚgetrB   r=   r
   r?   Úlenr   rC   ÚMAX_BODY_SIZEr@   rA   )r`   r&   rE   rk   rl   Úcodingrc   Úchunk_size_lineÚraw_chunk_sizeÚstr_chunk_sizeÚ
chunk_sizeÚraw_content_lengthÚcontent_lengths                r    rj   rj   ²  sú  è ø€ ð ˆkÔ˜CÔ ;°#Ò#5¸ÈÒ9KØð —K‘KÐ 3Ó4Ð
4ˆ&Ð	AØ�YÒÜ%Ð(8¸¸Ð@PÐ&QÓRÐRàˆØÜ)3°I¼}Ó)M×MˆOØ,×2Ñ2°4¸Ó;¸AÑ>ˆNä�>Ó" RÒ'Ø!/×!6Ñ!6Ð>PÐ!6Ó!Q�Ü#Ð&9¸.Ð9IÈÐ$PÓQÐQÜ˜^¨RÓ0ˆJØ˜QŠØÜ�4‹y˜:Ñ%¬Ò5Ü#Ø'¨
 |°=ÄÀTÃÀÈ6ÐRóð ð ™z¨*Ó5×5Ñ5ˆDÙ% a›=×(¨WÒ4Ü Ð!5Ó6Ð6ð! ô$ ! Ó+×+Ð+Øˆà '§¡Ð,<Ó =Ð
=Ð
Ð	JäÐ!Ó" RÒ'ÜÐ"2Ð3EÐ2FÀfÐ MÓNÐNÜÐ/Ó0ˆØœMÒ)ÜÐ"2°>Ð2BÀ&Ð IÓJÐJÙ% nÓ5×5Ð6ñ '¤}´mÓD×DÐEð= Nùð 6øØ(øð 	,øð 6øð Eúsn   ‚AF3ÁF&ÁBF3Ã/F)Ã0F3ÄF+Ä!F3Ä#F-Ä$A$F3ÆF/Æ	F3Æ!F1Æ"F3Æ)F3Æ+F3Æ-F3Æ/F3Æ1F3)r   rb   rS   r$   )rE   rT   r{   ztype[Exception]rS   ú(Generator[None, None, bytes | bytearray])rE   rT   rS   zGenerator[None, None, Headers])r`   rC   r&   r   rE   rT   rk   rt   rl   rT   rS   rš   )+Ú
__future__r   ÚdataclassesÚosÚreÚsysr.   Úcollections.abcr   Útypingr   Údatastructuresr   Ú
exceptionsr   r	   r
   r   r   r   Úwebsockets_versionÚ__all__ÚformatÚversion_infoÚPYTHON_VERSIONÚenvironr�   r   r   rC   r€   ry   r’   r!   Úcompiler�   rh   Ú	dataclassr   r   r=   rA   rj   r^   r"   r    ú<module>r¬      sî  ðÝ "ã Û 	Û 	Û 
Û Ý %Ý å #÷õ õ 3ò€ð  �—‘ ×!1Ñ!1Ð2€ð �Z‰Z�^‰^ØØˆnÐ˜\Ð*<Ð)=Ð>ó€
ð 
�‰�‰ØØˆnÐ˜\Ð*<Ð)=Ð>ó
€ñ �b—j‘j—n‘nÐ%AÀ5ÓIÓJ€ñ �b—j‘j—n‘nÐ%AÀ6ÓJÓK€ñ �B—J‘J—N‘NÐ#=¸{ÓKÓL€ó3ð ˆB�J‰JÐ7Ó8€	ð ˆB�J‰JÐ4Ó5€	ð ×Ñ÷wð wó ðwðt ×Ñ÷Dð Dó ðDðV *7ð	ððð 'ð	ð
 .óð:;ðð;ð $ó	;ð|;FØð;Fàð;Fðð;Fð Jð;Fðð;Fð .ô;Fr"   