§
    xÅjPy  ã                  ó’  — 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
mZmZ d dlmZ d dlmZmZmZ d dlZddlmZmZmZ ddlmZmZ dd	lmZmZmZmZm Z  dd
l!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3 ddlm4Z4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z: ddl;m<Z< ddl=m>Z> g d¢Z? e@ejA         B                    dd¦  «        ¦  «        ZC G d„ de<¦  «        ZD G d„ d¦  «        ZE	 	 d:d;d$„ZF	 d d%lGmHZH d d&lIm.ZJ eHjK        eHjK        eHjL        eHjL        d'œZMd(d)d(d)d'œZNd<d/„ZOn# eP$ r d<d0„ZOY nw xY wd=d3„ZQdddd4œd>d9„ZRdS )?é    )ÚannotationsN)ÚAsyncIteratorÚ	GeneratorÚSequence)ÚTracebackType)ÚAnyÚCallableÚLiteralé   )ÚClientProtocolÚbackoffÚprocess_exception)ÚHeadersÚHeadersLike)ÚInvalidProxyMessageÚInvalidProxyStatusÚInvalidStatusÚ
ProxyErrorÚSecurityError)ÚClientExtensionFactory)Ú enable_client_permessage_deflate)Úvalidate_subprotocols)Ú
USER_AGENTÚResponse)Ú
CONNECTINGÚEvent)ÚProxyÚ	get_proxyÚparse_proxyÚprepare_connect_request)ÚStreamReader)Ú
LoggerLikeÚOriginÚPathLikeÚSubprotocol)ÚWebSocketURIÚ	parse_urié   )Ú
Connection)Úrace_events)ÚconnectÚunix_connectÚClientConnectionÚWEBSOCKETS_MAX_REDIRECTSÚ10c                  óJ   ‡ — e Zd ZdZdddddœdˆ fd„Zdefdd„Zd ˆ fd„Zˆ xZS )!r-   al  
    :mod:`trio` implementation of a WebSocket client connection.

    :class:`ClientConnection` provides :meth:`recv` and :meth:`send` coroutines
    for receiving and sending messages.

    It supports asynchronous iteration to receive messages::

        async for message in websocket:
            await process(message)

    The iterator exits normally when the connection is closed with close code
    1000 (OK) or 1001 (going away) or without a close code. It raises a
    :exc:`~websockets.exceptions.ConnectionClosedError` when the connection is
    closed with any other code.

    The ``ping_interval``, ``ping_timeout``, ``close_timeout``, and
    ``max_queue`` arguments have the same meaning as in :func:`connect`.

    Args:
        nursery: Trio nursery.
        stream: Trio stream connected to a WebSocket server.
        protocol: Sans-I/O connection.

    é   é
   é   ©Úping_intervalÚping_timeoutÚclose_timeoutÚ	max_queueÚnurseryútrio.NurseryÚstreamútrio.abc.StreamÚprotocolr   r5   úfloat | Noner6   r7   r8   ú*int | None | tuple[int | None, int | None]ÚreturnÚNonec          	     óŒ   •— |  t          ¦   «                              |||||||¬¦  «         t          j        ¦   «         | _        d S )Nr4   )ÚsuperÚ__init__Útrior   Úresponse_rcvd)	Úselfr9   r;   r=   r5   r6   r7   r8   Ú	__class__s	           €úGC:\Projects\Historical\venv\Lib\site-packages\websockets/trio/client.pyrD   zClientConnection.__init__D   sW   ø€ ð 	Ð%Ý‰Œ×ÒØØØØ'Ø%Ø'Øð 	ñ 	
ô 	
ð 	
õ "œZ™\œ\ˆÔÐÐó    NÚadditional_headersúHeadersLike | NoneÚuser_agent_headerú
str | Nonec              ƒ  ó  K  — | j                              ¦   «         | _        |�| j        j                             |¦  «         |� | j        j                             d|¦  «         |                      t          ¬¦  «        4 ƒd{V —† | j                              | j        ¦  «         ddd¦  «        ƒd{V —† n# 1 ƒd{V —†swxY w Y   t          | j
        | j        ¦  «        ƒ d{V —† | j         j        �| j         j        ‚dS )z1
        Perform the opening handshake.

        Nz
User-Agent)Úexpected_state)r=   r+   ÚrequestÚheadersÚupdateÚ
setdefaultÚsend_contextr   Úsend_requestr*   rF   Ústream_closedÚhandshake_exc)rG   rK   rM   s      rI   Ú	handshakezClientConnection.handshake[   s‡  è è € ð ”}×,Ò,Ñ.Ô.ˆŒØÐ)ØŒLÔ ×'Ò'Ð(:Ñ;Ô;Ð;ØÐ(ØŒLÔ ×+Ò+¨LÐ:KÑLÔLÐLØ×$Ò$µJÐ$Ñ?Ô?ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ØŒM×&Ò& t¤|Ñ4Ô4Ð4ð	5ð 	5ð 	5ñ 	5ô 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5øøøð 	5ð 	5ð 	5ð 	5õ ˜$Ô,¨dÔ.@ÑAÔAÐAÐAÐAÐAÐAÐAÐAð Œ=Ô&Ð2Ø”-Ô-Ð-ð 3Ð2s   Â B7Â7
CÃCÚeventr   c                óÊ   •— | j         €9t          |t          ¦  «        sJ ‚|| _         | j                             ¦   «          dS t          ¦   «                              |¦  «         dS )z.
        Process one incoming event.

        N)ÚresponseÚ
isinstancer   rF   ÚsetrC   Úprocess_event)rG   rZ   rH   s     €rI   r_   zClientConnection.process_eventu   se   ø€ ð Œ=Ð Ý˜e¥XÑ.Ô.Ð.Ð.Ð.Ø!ˆDŒMØÔ×"Ò"Ñ$Ô$Ð$Ð$Ð$õ ‰GŒG×!Ò! %Ñ(Ô(Ð(Ð(Ð(rJ   )r9   r:   r;   r<   r=   r   r5   r>   r6   r>   r7   r>   r8   r?   r@   rA   )rK   rL   rM   rN   r@   rA   )rZ   r   r@   rA   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__rD   r   rY   r_   Ú__classcell__)rH   s   @rI   r-   r-   )   sŸ   ø€ € € € € ðð ð@ ')Ø%'Ø&(Ø@Bð*ð *ð *ð *ð *ð *ð *ð *ð2 26Ø(2ð.ð .ð .ð .ð .ð4)ð )ð )ð )ð )ð )ð )ð )ð )ð )rJ   r-   c                  óš   — e Zd ZdZddddddddedddeddddeddddd	œdMd4„ZdNd6„ZdOd7„Z	dPd;„Z
dQd?„ZdPd@„ZdRdA„ZdSdH„ZdTdI„ZdSdJ„ZdUdL„ZdS )Vr+   aq  
    Connect to the WebSocket server at ``uri``.

    :func:`connect` should be treated as an asynchronous context manager
    yielding a :class:`ClientConnection`, which can then receive and send
    messages::

        from websockets.trio.client import connect

        async with connect(...) as websocket:
            ...

    The connection is closed automatically when exiting the context.

    :func:`connect` can also be treated as an infinite asynchronous iterator
    to reconnect automatically on errors::

        async for websocket in connect(...):
            try:
                ...
            except websockets.exceptions.ConnectionClosed:
                continue

    If the connection fails with a transient error, it is retried with
    exponential backoff. If it fails with a fatal error, the exception is
    raised, breaking out of the loop.

    The connection is closed automatically after each iteration of the loop.

    :func:`connect` cannot be awaited directly. This is because it runs a task
    to manage the connection and Trio doesn't support spawning tasks without a
    context that ensures completion.

    Args:
        uri: URI of the WebSocket server.
        stream: Preexisting TCP stream. ``stream`` overrides the host and port
            from ``uri``. You may call :func:`~trio.open_tcp_stream` to create a
            suitable TCP stream.
        ssl: Configuration for enabling TLS on the connection.
        server_hostname: Host name for the TLS handshake. ``server_hostname``
            overrides the host name from ``uri``.
        origin: Value of the ``Origin`` header, for servers that require it.
        extensions: List of supported extensions, in order in which they
            should be negotiated and run.
        subprotocols: List of supported subprotocols, in order of decreasing
            preference.
        compression: The "permessage-deflate" extension is enabled by default.
            Set ``compression`` to :obj:`None` to disable it. See the
            :doc:`compression guide <../../topics/compression>` for details.
        additional_headers: Arbitrary HTTP headers to add to the handshake
            request.
        user_agent_header: Value of  the ``User-Agent`` request header.
            It defaults to ``"Python/x.y.z websockets/X.Y"``.
            Setting it to :obj:`None` removes the header.
        proxy: If a proxy is configured, it is used by default. Set ``proxy``
            to :obj:`None` to disable the proxy or to the address of a proxy
            to override the system configuration. See the :doc:`proxy docs
            <../../topics/proxies>` for details.
        proxy_ssl: Configuration for enabling TLS on the proxy connection.
        proxy_server_hostname: Host name for the TLS handshake with the proxy.
            ``proxy_server_hostname`` overrides the host name from ``proxy``.
        process_exception: When reconnecting automatically, tell whether an
            error is transient or fatal. The default behavior is defined by
            :func:`~websockets.client.process_exception`. Refer to its
            documentation for details.
        open_timeout: Timeout for opening the connection in seconds.
            :obj:`None` disables the timeout.
        ping_interval: Interval between keepalive pings in seconds.
            :obj:`None` disables keepalive.
        ping_timeout: Timeout for keepalive pings in seconds.
            :obj:`None` disables timeouts.
        close_timeout: Timeout for closing the connection in seconds.
            :obj:`None` disables the timeout.
        reconnect_delays: Delays in seconds between reconnection attempts.
            Default is exponential backoff with 5s jitter, capped at 60s.
        max_size: Maximum size of incoming messages in bytes.
            :obj:`None` disables the limit. You may pass a ``(max_message_size,
            max_fragment_size)`` tuple to set different limits for messages and
            fragments when you expect long messages sent in short fragments.
        max_queue: High-water mark of the buffer where frames are received.
            It defaults to 16 frames. The low-water mark defaults to ``max_queue
            // 4``. You may pass a ``(high, low)`` tuple to set the high-water
            and low-water marks. If you want to disable flow control entirely,
            you may set it to ``None``, although that's a bad idea.
        logger: Logger for this client.
            It defaults to ``logging.getLogger("websockets.client")``.
            See the :doc:`logging guide <../../topics/logging>` for details.
        create_connection: Factory for the :class:`ClientConnection` managing
            the connection. Set it to a wrapper or a subclass to customize
            connection handling.

    Any other keyword arguments are passed to :func:`~trio.open_tcp_stream`.
    For example, you can set ``host`` and ``port`` to connect to a different
    host and port from those found in ``uri``. This only changes the destination
    of the TCP connection. The host name from ``uri`` is still used in the TLS
    handshake for secure connections and in the ``Host`` header.

    Raises:
        InvalidURI: If ``uri`` isn't a valid WebSocket URI.
        InvalidProxy: If ``proxy`` isn't a valid proxy.
        OSError: If the TCP connection fails.
        InvalidHandshake: If the opening handshake fails.
        TimeoutError: If the opening handshake times out.

    NÚdeflateTr2   r1   i   r3   )r;   ÚsslÚserver_hostnameÚoriginÚ
extensionsÚsubprotocolsÚcompressionrK   rM   ÚproxyÚ	proxy_sslÚproxy_server_hostnamer   Úopen_timeoutr5   r6   r7   Úreconnect_delaysÚmax_sizer8   ÚloggerÚcreate_connectionÚuriÚstrr;   útrio.abc.Stream | Nonerg   ússl_module.SSLContext | Nonerh   rN   ri   úOrigin | Nonerj   ú'Sequence[ClientExtensionFactory] | Nonerk   úSequence[Subprotocol] | Nonerl   rK   rL   rM   rm   ústr | Literal[True] | Nonern   ro   r   ú'Callable[[Exception], Exception | None]rp   r>   r5   r6   r7   rq   úCallable[[], Generator[float]]rr   r?   r8   rs   úLoggerLike | Nonert   útype[ClientConnection] | NoneÚkwargsr   r@   rA   c               óP  — || _         t          |¦  «        | _        | j        j        s|�t	          d¦  «        ‚|�t          |¦  «         |dk    rt          |¦  «        }n|�t	          d|› �¦  «        ‚|€t          j        d¦  «        }|€t          }|| _
        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        t1          |||||¬¦  «        | _        t1          ||||¬¦  «        | _        d S )Nz-ssl argument is incompatible with a ws:// URIrf   zunsupported compression: zwebsockets.client)ri   rj   rk   rr   rs   r4   )ru   r'   Úws_uriÚsecureÚ
ValueErrorr   r   ÚloggingÚ	getLoggerr-   r;   rg   rh   rK   rM   rm   rn   ro   r   rp   rq   rs   rt   Úopen_tcp_stream_kwargsÚdictÚprotocol_kwargsÚconnection_kwargs)rG   ru   r;   rg   rh   ri   rj   rk   rl   rK   rM   rm   rn   ro   r   rp   r5   r6   r7   rq   rr   r8   rs   rt   r�   s                            rI   rD   zconnect.__init__ó   sc  € ðH ˆŒÝ ‘n”nˆŒØŒ{Ô!ð 	N c oÝÐLÑMÔMÐMàÐ#Ý! ,Ñ/Ô/Ð/à˜)Ò#Ð#Ý9¸*ÑEÔEˆJˆJØÐ$ÝÐF¸ÐFÐFÑGÔGÐGàˆ>ÝÔ&Ð':Ñ;Ô;ˆFàÐ$Ý 0ÐàˆŒØˆŒØ.ˆÔØ"4ˆÔØ!2ˆÔØˆŒ
Ø"ˆŒØ%:ˆÔ"Ø!2ˆÔØ(ˆÔØ 0ˆÔØˆŒØ!2ˆÔØ&,ˆÔ#Ý#ØØ!Ø%ØØð 
ñ  
ô  
ˆÔõ "&Ø'Ø%Ø'Øð	"
ñ "
ô "
ˆÔÐÐrJ   r<   c              ƒ  ó>  K  — | j                              ¦   «         }|                     dd¦  «        }| j        }|rd}|du rt	          | j        ¦  «        }|r-t          j        |                     d¦  «        ¦  «        ƒ d{V —†S |�Ât          |¦  «        }|j	        dd…         dk    r1t          || j        |                     dd¦  «        ¬	¦  «        ƒ d{V —†S |j	        dd
…         dk    rM|j	        dk    r| j        �t          d¦  «        ‚t          || j        f| j        | j        | j        dœ|¤Žƒ d{V —†S t!          d¦  «        ‚|                     d| j        j        ¦  «         |                     d| j        j        ¦  «         t          j        di |¤Žƒ d{V —†S )zFOpen a TCP or Unix connection to the server, possibly through a proxy.ÚunixFNTÚpathé   ÚsocksÚlocal_address)Ú
local_addré   ÚhttpÚhttpsz8proxy_ssl argument is incompatible with an http:// proxy©rM   rg   rh   z&parse_proxy returned unsupported proxyÚhostÚport© )rˆ   ÚcopyÚpoprm   r   rƒ   rE   Úopen_unix_socketr   ÚschemeÚconnect_socks_proxyrn   r…   Úconnect_http_proxyrM   ro   ÚAssertionErrorrT   r—   r˜   Úopen_tcp_stream)rG   r�   r�   rm   Úproxy_parseds        rI   r¡   zconnect.open_tcp_streamF  s   è è € àÔ,×1Ò1Ñ3Ô3ˆØ�zŠz˜& %Ñ(Ô(ˆà”
ˆØð 	ØˆEØ�Dˆ=ˆ=Ý˜dœkÑ*Ô*ˆEàð #	8ÝÔ.¨v¯zªz¸&Ñ/AÔ/AÑBÔBÐBÐBÐBÐBÐBÐBÐBàÐÝ& uÑ-Ô-ˆLàÔ" 2 A 2Ô&¨'Ò1Ð1Ý0Ø Ø”Kð  &Ÿzšz¨/¸4Ñ@Ô@ðñ ô ð ð ð ð ð ð ð ð Ô$ R a RÔ(¨FÒ2Ð2ØÔ&¨'Ò1Ð1°d´nÐ6PÝ$ØRñô ð õ 0Ø Ø”Kðð '+Ô&<ØœØ$(Ô$>ðð ð ðð ð ð ð ð ð ð ð õ %Ð%MÑNÔNÐNð ×Ò˜f d¤kÔ&6Ñ7Ô7Ð7Ø×Ò˜f d¤kÔ&6Ñ7Ô7Ð7ÝÔ-Ð7Ð7°Ð7Ð7Ð7Ð7Ð7Ð7Ð7Ð7Ð7rJ   c              ƒ  óè   K  — | j         €t          j        ¦   «         }n| j         }| j        €| j        j        }n| j        }t          j        |||d¬¦  «        }|                     ¦   «         ƒ d{V —† |S )zEnable TLS on the connection.NT©rh   Úhttps_compatible)	rg   Ú
ssl_moduleÚcreate_default_contextrh   rƒ   r—   rE   Ú	SSLStreamÚdo_handshake)rG   r;   rg   rh   Ú
ssl_streams        rI   Ú
enable_tlszconnect.enable_tlsv  s�   è è € àŒ8ÐÝÔ3Ñ5Ô5ˆCˆCà”(ˆCØÔÐ'Ø"œkÔ.ˆOˆOà"Ô2ˆOÝ”^ØØØ+Ø!ð	
ñ 
ô 
ˆ
ð ×%Ò%Ñ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'ØÐrJ   r9   r:   r-   c              ƒ  ó  K  — | j         €|                      ¦   «         ƒ d{V —†}n| j         }	 | j        j        r|                      |¦  «        ƒ d{V —†}t          | j        fi | j        ¤Ž} | j        |||fi | j        ¤Ž}| 	                    | j
        | j        ¦  «        ƒ d{V —† n`# t          j        $ r* t          j        |¦  «        ƒ d{V —† t          d¦  «        ‚t           $ r t          j        |¦  «        ƒ d{V —† ‚ w xY w|S )zCreate a WebSocket connection.Nznursery should be canceled)r;   r¡   rƒ   r„   r«   r   rŠ   rt   r‹   rY   rK   rM   rE   Ú	CancelledÚaclose_forcefullyr    Ú	Exception)rG   r9   r;   r=   Ú
connections        rI   Úopen_connectionzconnect.open_connection‰  s¢  è è € àŒ;ÐØ×/Ò/Ñ1Ô1Ð1Ð1Ð1Ð1Ð1Ð1ˆFˆFà”[ˆFð!	ØŒ{Ô!ð 7Ø#Ÿš¨vÑ6Ô6Ð6Ð6Ð6Ð6Ð6Ð6�å%Ø”ðð àÔ&ðð ˆHð 0˜Ô/ØØØðð ð Ô(ð	ð ˆJð ×&Ò&ØÔ'ØÔ&ñô ð ð ð ð ð ð ð ð øõ
 Œ~ð 	?ð 	?ð 	?ÝÔ(¨Ñ0Ô0Ð0Ð0Ð0Ð0Ð0Ð0Ð0õ !Ð!=Ñ>Ô>Ð>Ýð 	ð 	ð 	õ Ô(¨Ñ0Ô0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Øð	øøøð Ðs   ­A9B' Â'ADÚexcr¯   úException | strc                óR  — t          |t          ¦  «        r|j        j        dv rd|j        j        v s|S | j        }t          j                             | j	        |j        j        d         ¦  «        }t          |¦  «        }| j        �t          d|› d�¦  «        S |j        r|j        st          d|› �¦  «        S |j        |j        k    s |j        |j        k    s|j        |j        k    r¾| j                             dd¦  «        rt          d	|› d
�¦  «        S | j                             d¦  «        €| j                             d¦  «        �t          d	|› d�¦  «        S | j        �Bt)          d„ t)          | j        ¦  «                             ¦   «         D ¦   «         ¦  «        | _        |S )z¬
        Determine whether a connection error is a redirect that can be followed.

        Return the new URI if it's a valid redirect. Else, return an exception.

        )é,  i-  i.  i/  i3  i4  ÚLocationNzcannot follow redirect to z with a preexisting streamz)cannot follow redirect to non-secure URI r�   Fz'cannot follow cross-origin redirect to z with a Unix socketr—   r˜   z with an explicit host or portc              3  óP   K  — | ]!\  }}|                      ¦   «         d v¯||fV — Œ"dS ))ÚauthorizationÚcookiezproxy-authorizationN)Úlower)Ú.0ÚkeyÚvalues      rI   ú	<genexpr>z+connect.process_redirect.<locals>.<genexpr>ó  s\   è è € ð ð á&˜C ØŸ9š9™;œ;ØQðRð Rð ˜e˜ðRð Rð Rð Rðð rJ   )r]   r   r\   Ústatus_coderR   rƒ   ÚurllibÚparseÚurljoinru   r'   r;   r…   r„   r   r—   r˜   rˆ   ÚgetrK   r   Ú	raw_items)rG   r²   Ú
old_ws_uriÚnew_uriÚ
new_ws_uris        rI   Úprocess_redirectzconnect.process_redirectµ  sú  € õ �s�MÑ*Ô*ð	à”Ô(ððð ð ˜cœlÔ2Ð2Ð2àˆJà”[ˆ
Ý”,×&Ò& t¤x°´Ô1EÀjÔ1QÑRÔRˆÝ˜wÑ'Ô'ˆ
ð Œ;Ð"ÝØP¨WÐPÐPÐPñô ð ð
 Ôð 	X ZÔ%6ð 	XÝ Ð!VÈWÐ!VÐ!VÑWÔWÐWð Ô Ô!2Ò2Ð2ØŒ *¤/Ò1Ð1ØŒ *¤/Ò1Ð1ð Ô*×.Ò.¨v°uÑ=Ô=ð Ý!ð*¸gð *ð *ð *ñô ð ð Ô+×/Ò/°Ñ7Ô7ÐCØÔ.×2Ò2°6Ñ:Ô:ÐFå!ð5¸gð 5ð 5ð 5ñô ð ð Ô&Ð2Ý*1ðð å*1°$Ô2IÑ*JÔ*J×*TÒ*TÑ*VÔ*Vðñ ô ñ+ô +�Ô'ð ˆrJ   c              ƒ  ó|  K  — 	 | j         €t          j        ¦   «         nt          j        | j         ¦  «        5  t	          t
          ¦  «        D ]¥}	 |                      |¦  «        ƒ d {V —†}|                     ¦   «          |c cd d d ¦  «         S # t          $ rW}|  	                    |¦  «        }t          |t          ¦  «        r||u r‚ ||‚|| _        t          |¦  «        | _        Y d }~Œžd }~ww xY wt          dt
          › d�¦  «        ‚# 1 swxY w Y   d S # t          j        $ r}t!          d¦  «        |‚d }~ww xY w)Nz
more than z
 redirectsz"timed out during opening handshake)rp   rE   ÚCancelScopeÚ
fail_afterÚrangeÚMAX_REDIRECTSr±   Ústart_keepaliver¯   rÈ   r]   ru   r'   rƒ   r   ÚTooSlowErrorÚTimeoutError)rG   r9   Ú_r°   r²   Ú
exc_or_uris         rI   r+   zconnect.connectý  sé  è è € ð	Nð Ô$Ð,õ Ô Ñ"Ô"Ð"å”_ TÔ%6Ñ7Ô7ðPð Põ
 �}Ñ-Ô-ð Pð P�Að*Ø+/×+?Ò+?ÀÑ+HÔ+HÐ%HÐ%HÐ%HÐ%HÐ%HÐ%H˜
ð  #×2Ò2Ñ4Ô4Ð4Ø)Ð)Ð)ð1Pð Pð Pð Pñ Pô Pð Pð Pøõ %ð %ð %ð %Ø%)×%:Ò%:¸3Ñ%?Ô%?˜
Ý% jµ)Ñ<Ô<ð 
%à)¨SÐ0Ð0Ø %à&0°cÐ 9ð (2˜DœHÝ*3°JÑ*?Ô*?˜DœKØ$˜H˜H˜H˜Høøøøð%øøøõ$ (Ð(Nµ]Ð(NÐ(NÐ(NÑOÔOÐOð5Pð Pð Pð Pøøøð Pð Pð Pð Pð Pð Pøõ8 Ô ð 	Nð 	Nð 	NåÐCÑDÔDÈ#ÐMøøøøð	Nøøøse   „3D ·D
ÁBÁ*D
ÂD Â
C/ÂAC*Ã%D
Ã*C/Ã/D
Ä
DÄD ÄDÄD ÄD;Ä&D6Ä6D;c              ƒ  ód  K  — |                       ¦   «         ƒ d {V —† 	 |                      | j        ¦  «        ƒ d {V —†| _        | j                             ¦   «         ƒ d {V —†S # t
          $ rC}|                      t          |¦  «        ||j        ¦  «        ƒ d {V —† t          d¦  «        ‚d }~ww xY w)Nz4expected __aexit_nursery__ to re-raise the exception)
Ú__aenter_nursery__r+   r9   r°   Ú
__aenter__ÚBaseExceptionÚ__aexit_nursery__ÚtypeÚ__traceback__r    )rG   r²   s     rI   rÕ   zconnect.__aenter__$  sâ   è è € Ø×%Ò%Ñ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'ð	YØ$(§L¢L°´Ñ$>Ô$>Ð>Ð>Ð>Ð>Ð>Ð>ˆDŒOØœ×3Ò3Ñ5Ô5Ð5Ð5Ð5Ð5Ð5Ð5Ð5øÝð 	Yð 	Yð 	YØ×(Ò(­¨c©¬°C¸Ô9JÑKÔKÐKÐKÐKÐKÐKÐKÐKÝ Ð!WÑXÔXÐXøøøøð	Yøøøs   žAA" Á"
B/Á,>B*Â*B/Úexc_typeútype[BaseException] | NoneÚ	exc_valueúBaseException | NoneÚ	tracebackúTracebackType | Nonec              ƒ  óà   K  — 	 	 | j                              |||¦  «        ƒ d {V —†	 | ` |                      |||¦  «        ƒ d {V —† S # | ` w xY w# |                      |||¦  «        ƒ d {V —† w xY w)N)r°   Ú	__aexit__r×   )rG   rÚ   rÜ   rÞ   s       rI   rá   zconnect.__aexit__-  s´   è è € ð	Ið$Ø!œ_×6Ò6°xÀÈIÑVÔVÐVÐVÐVÐVÐVÐVÐVà�Oà×(Ò(¨°9¸iÑHÔHÐHÐHÐHÐHÐHÐHÐHÐHøð �OÐ#Ð#Ð#Ð#øà×(Ò(¨°9¸iÑHÔHÐHÐHÐHÐHÐHÐHÐHÐHøøøs   …!A §A ÁAÁA ÁA-c              ƒ  óÀ   K  — t          | d¦  «        rt          d¦  «        ‚t          j        ¦   «         | _        | j                             ¦   «         ƒ d {V —†| _        d S )NÚnursery_managerzconnect() isn't reentrant)ÚhasattrÚRuntimeErrorrE   Úopen_nurseryrã   rÕ   r9   )rG   s    rI   rÔ   zconnect.__aenter_nursery__;  se   è è € Ý�4Ð*Ñ+Ô+ð 	<ÝÐ:Ñ;Ô;Ð;Ý#Ô0Ñ2Ô2ˆÔØ!Ô1×<Ò<Ñ>Ô>Ð>Ð>Ð>Ð>Ð>Ð>ˆŒˆˆrJ   c              ƒ  óR  K  — 	 | j                              |||¦  «        ƒ d {V —† nw# t          $ rj}t          |t          ¦  «        sJ ‚	 t
          j                             |¦  «         n(# t
          j        j        $ r t          d¦  «        |‚w xY wY d }~nd }~ww xY w| ` d S # | ` w xY w)Nz8unexpected multiple exceptions; please file a bug report)
rã   rá   rÖ   r]   ÚBaseExceptionGrouprE   Ú_utilÚ!raise_single_exception_from_groupÚMultipleExceptionErrorr    )rG   rÚ   rÜ   rÞ   r²   s        rI   r×   zconnect.__aexit_nursery__A  sù   è è € ð	%ØÔ&×0Ò0°¸9ÀiÑPÔPÐPÐPÐPÐPÐPÐPÐPÐPøÝð 	ð 	ð 	Ý˜cÕ#5Ñ6Ô6Ð6Ð6Ð6ðÝ”
×<Ò<¸SÑAÔAÐAÐAøÝ”:Ô4ð ð ð Ý$ØNñô àððøøøð BÐAÐAÐAÐAøøøøð	øøøð Ð$Ð$Ð$ø�Ð$Ð$Ð$Ð$Ð$sC   „"' ¦B" §
B±BÁ	A)Á(BÁ)%BÂBÂB" ÂBÂB" Â"B&úAsyncIterator[ClientConnection]c               ó&  K  — d }	 	 | 4 ƒd {V —†}|W V — d d d ¦  «        ƒd {V —† n# 1 ƒd {V —†swxY w Y   d }nÖ# t           $ rÉ}	 |                      |¦  «        }n# t           $ r}|}Y d }~nd }~ww xY w||u r‚ |�||‚|€|                      ¦   «         }t          |¦  «        }| j                             d|t          j        |¦  «        d                              ¦   «         ¦  «         t          j
        |¦  «        ƒ d {V —† Y d }~nd }~ww xY w�Œ)NTz0connect failed; reconnecting in %.1f seconds: %sr   )r¯   r   rq   Únextrs   ÚinforÞ   Úformat_exception_onlyÚstriprE   Úsleep)rG   Údelaysr°   r²   Únew_excÚ
raised_excÚdelays          rI   Ú	__aiter__zconnect.__aiter__[  sÿ  è è € Ø*.ˆð#	ð"Øð %ð %ð %ð %ð %ð %ð % :Ø$Ð$Ð$Ð$Ð$ð%ð %ð %ñ %ô %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %ð %øøøð %ð %ð %ð %ðB ��øõ? ð (ð (ð (ð
)Ø"×4Ò4°SÑ9Ô9�G�GøÝ ð )ð )ð )Ø(�G�G�G�G�G�Gøøøøð)øøøð
 ˜c�>�>ØØÐ&Ø! sÐ*ð �>Ø!×2Ò2Ñ4Ô4�FÝ˜V™œ�Ø”× Ò ØFØÝÔ3°CÑ8Ô8¸Ô;×AÒAÑCÔCñô ð õ
 ”j Ñ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'Ð'øøøøð7(øøøñ	#	sR   ‡; �'•; §
1±; ´1µ; »
DÁAÁD	Á
A2Á&A-Á(D	Á-A2Á2BD	Ä	D)2ru   rv   r;   rw   rg   rx   rh   rN   ri   ry   rj   rz   rk   r{   rl   rN   rK   rL   rM   rN   rm   r|   rn   rx   ro   rN   r   r}   rp   r>   r5   r>   r6   r>   r7   r>   rq   r~   rr   r?   r8   r?   rs   r   rt   r€   r�   r   r@   rA   )r@   r<   )r;   r<   r@   r<   )r9   r:   r@   r-   )r²   r¯   r@   r³   )r@   r-   )rÚ   rÛ   rÜ   rÝ   rÞ   rß   r@   rA   )r@   rA   )r@   rì   )r`   ra   rb   rc   r   r   r   rD   r¡   r«   r±   rÈ   r+   rÕ   rá   rÔ   r×   r÷   r™   rJ   rI   r+   r+   …   sg  € € € € € ðhð hðd *.Ø,0Ø&*à $Ø>BØ59Ø"+à15Ø(2Ø,0Ø26Ø,0ØEVà%'Ø&(Ø%'Ø&(Ø;Bà?DØ@Bà$(à;?ðAQ
ð Q
ð Q
ð Q
ð Q
ð Q
ðf.8ð .8ð .8ð .8ð`ð ð ð ð&*ð *ð *ð *ðXFð Fð Fð FðP Nð  Nð  Nð  NðNYð Yð Yð YðIð Ið Ið Ið?ð ?ð ?ð ?ð%ð %ð %ð %ð4%ð %ð %ð %ð %ð %rJ   r+   rŽ   úPathLike | Noneru   rN   r�   r   r@   c                óÐ   — |                      d¦  «        }| €|€t          d¦  «        ‚| �|�t          d¦  «        ‚|€|                      d¦  «        €d}nd}t          d
|d| d	œ|¤ŽS )aã  
    Connect to a WebSocket server listening on a Unix socket.

    This function accepts the same keyword arguments as :func:`connect`.

    It's only available on Unix.

    It's mainly useful for debugging servers listening on Unix sockets.

    Args:
        path: File system path to the Unix socket.
        uri: URI of the WebSocket server. ``uri`` defaults to
            ``ws://localhost/`` or, when a ``ssl`` argument is provided, to
            ``wss://localhost/``.

    r;   Nzmissing path argumentz path is incompatible with streamrg   zws://localhost/zwss://localhost/T)ru   r�   rŽ   r™   )rÃ   r…   r+   )rŽ   ru   r�   r;   s       rI   r,   r,   ƒ  s‡   € ð* �ZŠZ˜Ñ!Ô!€FØ€|˜˜ÝÐ0Ñ1Ô1Ð1Ø	Ð	˜fÐ0ÝÐ;Ñ<Ô<Ð<à
€{Ø�:Š:�eÑÔÐ$Ø#ˆCˆCà$ˆCåÐ;�s ¨DÐ;Ð;°FÐ;Ð;Ð;rJ   )Ú	ProxyType)r   )Úsocks5hÚsocks5Úsocks4aÚsocks4TFrm   r   rƒ   r&   r<   c           	   ‹  óR  K  — t          t          | j                 | j        | j        | j        | j        t          | j                 ¦  «        }	 t          j	         |j
        |j        |j        fi |¤Žƒ d{V —†¦  «        S # t          $ r ‚ t          $ r}t          d¦  «        |‚d}~ww xY w)z0Connect via a SOCKS proxy and return the socket.Nz failed to connect to SOCKS proxy)Ú
SocksProxyÚSOCKS_PROXY_TYPESr�   r—   r˜   ÚusernameÚpasswordÚSOCKS_PROXY_RDNSrE   ÚSocketStreamr+   ÚOSErrorr¯   r   )rm   rƒ   r�   Úsocks_proxyr²   s        rI   rž   rž   Ã  sÕ   è è € õ !Ý˜eœlÔ+ØŒJØŒJØŒNØŒNÝ˜Uœ\Ô*ñ
ô 
ˆð	JÝÔ$Ø)�kÔ)¨&¬+°v´{ÐMÐMÀfÐMÐMÐMÐMÐMÐMÐMÐMñô ð øõ ð 	ð 	ð 	ØÝð 	Jð 	Jð 	JÝÐ?Ñ@Ô@ÀcÐIøøøøð	Jøøøs   Á0A= Á=B&ÂB!Â!B&c              ‹  ó$   K  — t          d¦  «        ‚)Nz6connecting through a SOCKS proxy requires python-socks)ÚImportError)rm   rƒ   r�   s      rI   rž   rž   ­  s   è è € õ
 ÐRÑSÔSÐSrJ   r;   r   c              ƒ  ó  K  — t          ¦   «         }t          j        |j        |j        |j        d¬¦  «        }	 	 |                      d¦  «        ƒ d {V —†}|r|                     |¦  «         n|                     ¦   «          t          |¦  «         ŒW# t          $ rS}t          |j        t          ¦  «        sJ ‚|j        }d|j        cxk    rdk     r
n n|cY d }~S t          |¦  «        ‚d }~wt          $ r}t!          d¦  «        |‚d }~ww xY w)NT)rm   i   éÈ   rµ   z0did not receive a valid HTTP response from proxy)r!   r   rÁ   Ú	read_lineÚ
read_exactÚread_to_eofÚreceive_someÚ	feed_dataÚfeed_eofrî   ÚStopIterationr]   r½   r¿   r   r¯   r   )r;   ÚreaderÚparserÚdatar²   r\   s         rI   Úread_connect_responser  Þ  sX  è è € Ý‰^Œ^€FÝŒ^ØÔØÔØÔØð	ñ ô €Fðð	Ø×,Ò,¨TÑ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ˆDØð "Ø× Ò  Ñ&Ô&Ð&Ð&à—’Ñ!Ô!Ð!Ý�‰LŒLˆLð	øõ ð /ð /ð /Ý˜#œ)¥XÑ.Ô.Ð.Ð.Ð.Ø”9ˆØ�(Ô&Ð,Ð,Ò,Ð,¨Ò,Ð,Ð,Ð,Ð,ØˆOˆOˆOˆOˆOˆOå$ XÑ.Ô.Ð.øøøøÝð ð ð Ý!Ø>ñ
ô 
àð	øøøøðøøøs0   ¹AB Â
DÂ9C)ÃDÃC)Ã)DÃ6DÄDr–   rM   rg   rx   rh   c             ‹  óú  K  — t          j        | j        | j        fi |¤Žƒ d {V —†}	 | j        dk    rR|€t          j        ¦   «         }|€| j        }t          j        |||d¬¦  «        }|                     ¦   «         ƒ d {V —† |}t          | ||¦  «        }| 
                    |¦  «        ƒ d {V —† t          |¦  «        ƒ d {V —† n5# t           j        t          f$ r t          j        |¦  «        ƒ d {V —† ‚ w xY w|S )Nr•   Tr¤   )rE   r¡   r—   r˜   r�   r¦   r§   r¨   r©   r    Úsend_allr  r­   r¯   r®   )	rm   rƒ   rM   rg   rh   r�   r;   rª   rQ   s	            rI   rŸ   rŸ   û  sa  è è € õ Ô'¨¬
°E´JÐIÐIÀ&ÐIÐIÐIÐIÐIÐIÐIÐI€FðàŒ<˜7Ò"Ð"Øˆ{Ý Ô7Ñ9Ô9�ØÐ&Ø"'¤*�ÝœØØØ /Ø!%ð	ñ ô ˆJð ×)Ò)Ñ+Ô+Ð+Ð+Ð+Ð+Ð+Ð+Ð+ØˆFõ *¨%°Ð9JÑKÔKˆØ�oŠo˜gÑ&Ô&Ð&Ð&Ð&Ð&Ð&Ð&Ð&Ý# FÑ+Ô+Ð+Ð+Ð+Ð+Ð+Ð+Ð+Ð+øåŒN�IÐ&ð ð ð ÝÔ$ VÑ,Ô,Ð,Ð,Ð,Ð,Ð,Ð,Ð,Øðøøøð €Ms   §BC Ã2C8)NN)rŽ   rø   ru   rN   r�   r   r@   r+   )rm   r   rƒ   r&   r�   r   r@   r<   )r;   r<   r@   r   )rm   r   rƒ   r&   rM   rN   rg   rx   rh   rN   r�   r   r@   r<   )SÚ
__future__r   r†   Úosrg   r¦   rÞ   Úurllib.parserÀ   Úcollections.abcr   r   r   Útypesr   Útypingr   r	   r
   rE   Úclientr   r   r   Údatastructuresr   r   Ú
exceptionsr   r   r   r   r   Úextensions.baser   Úextensions.permessage_deflater   rR   r   Úhttp11r   r   r=   r   r   rm   r   r   r   r    Ústreamsr!   r"   r#   r$   r%   ru   r&   r'   r°   r)   Úutilsr*   Ú__all__ÚintÚenvironrÃ   rÍ   r-   r+   r,   Úpython_socksrú   Úpython_socks.async_.trior   ÚSOCKS5ÚSOCKS4r  r  rž   r	  r  rŸ   r™   rJ   rI   ú<module>r.     sé  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ø Ð Ð Ð Ð Ð Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )à €€€à ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1ðð ð ð ð ð ð ð ð ð ð ð ð ð ð 5Ð 4Ð 4Ð 4Ð 4Ð 4Ø LÐ LÐ LÐ LÐ LÐ LØ +Ð +Ð +Ð +Ð +Ð +Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JØ "Ð "Ð "Ð "Ð "Ð "Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ø "Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð ð :Ð
9Ð
9€à��B”J—N’NÐ#=¸tÑDÔDÑEÔE€ðX)ð X)ð X)ð X)ð X)�zñ X)ô X)ð X)ðx{ð {ð {ð {ð {ñ {ô {ð {ð~ !Øð!<ð !<ð !<ð !<ð !<ðH4JØ&Ð&Ð&Ð&Ð&Ð&Ø<Ð<Ð<Ð<Ð<Ð<ð Ô#ØÔ"ØÔ#ØÔ"ð	ð Ðð ØØØð	ð ÐðJð Jð Jð Jð Jøð1 ð Tð Tð TðTð Tð Tð Tð Tð TðTøøøðfð ð ð ðB %)Ø(,Ø"&ð%ð %ð %ð %ð %ð %ð %ð %s   Ã8D+ Ä+	D7Ä6D7