§
    xÅjåz  ã                  ó¬  — 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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m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/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5 ddlm6Z6m7Z7m8Z8m9Z9 ddl:m;Z;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	 	 d6d7d#„ZF	 d d$lGmHZH d d%lIm0ZJ eHjK        eHjK        eHjL        eHjL        d&œZMd'd(d'd(d&œZNd8d.„ZOn# eP$ r d8d/„ZOY nw xY w G d0„ d1ejQ        ¦  «        ZRdd2œd9d5„ZSdS ):é    )ÚannotationsN)ÚAsyncIteratorÚ	GeneratorÚSequence)ÚTracebackType)ÚAnyÚCallableÚLiteralÚcasté   )Ú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)ÚconnectÚunix_connectÚClientConnectionÚWEBSOCKETS_MAX_REDIRECTSÚ10c                  óL   ‡ — e Zd ZdZddddddœdˆ fd„Zdefdd„Zdˆ fd„Zˆ xZS ) r-   a  
    :mod:`asyncio` 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 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``, ``max_queue``,
    and ``write_limit`` arguments have the same meaning as in :func:`connect`.

    Args:
        protocol: Sans-I/O connection.

    é   é
   é   é €  ©Úping_intervalÚping_timeoutÚclose_timeoutÚ	max_queueÚwrite_limitÚprotocolr   r6   úfloat | Noner7   r8   r9   ú*int | None | tuple[int | None, int | None]r:   úint | tuple[int, int | None]ÚreturnÚNonec               ó–   •— |  t          ¦   «                              ||||||¬¦  «         | j                             ¦   «         | _        d S )Nr5   )ÚsuperÚ__init__ÚloopÚcreate_futureÚresponse_rcvd)Úselfr;   r6   r7   r8   r9   r:   Ú	__class__s          €úJC:\Projects\Historical\venv\Lib\site-packages\websockets/asyncio/client.pyrC   zClientConnection.__init__A   s\   ø€ ð 	Ð%Ý‰Œ×ÒØØ'Ø%Ø'ØØ#ð 	ñ 	
ô 	
ð 	
ð 48´9×3JÒ3JÑ3LÔ3LˆÔÐÐó    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        | j        gt          j        ¬¦  «        ƒ d{V —† | j         j        �| j         j        ‚dS )z1
        Perform the opening handshake.

        Nz
User-Agent)Úexpected_state)Úreturn_when)r;   r+   ÚrequestÚheadersÚupdateÚ
setdefaultÚsend_contextr   Úsend_requestÚasyncioÚwaitrF   Úconnection_lost_waiterÚFIRST_COMPLETEDÚhandshake_exc)rG   rK   rM   s      rI   Ú	handshakezClientConnection.handshakeV   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õ ŒlØÔ Ô!<Ð=ÝÔ/ð
ñ 
ô 
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð 	
ð Œ=Ô&Ð2Ø”-Ô-Ð-ð 3Ð2s   Â B7Â7
CÃCÚeventr   c                óÌ   •— | j         €:t          |t          ¦  «        sJ ‚|| _         | j                             d¦  «         dS t          ¦   «                              |¦  «         dS )z.
        Process one incoming event.

        N)ÚresponseÚ
isinstancer   rF   Ú
set_resultrB   Úprocess_event)rG   r^   rH   s     €rI   rc   zClientConnection.process_events   sg   ø€ ð Œ=Ð Ý˜e¥XÑ.Ô.Ð.Ð.Ð.Ø!ˆDŒMØÔ×)Ò)¨$Ñ/Ô/Ð/Ð/Ð/õ ‰GŒG×!Ò! %Ñ(Ô(Ð(Ð(Ð(rJ   )r;   r   r6   r<   r7   r<   r8   r<   r9   r=   r:   r>   r?   r@   )rK   rL   rM   rN   r?   r@   )r^   r   r?   r@   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__rC   r   r]   rc   Ú__classcell__)rH   s   @rI   r-   r-   (   s©   ø€ € € € € ðð ð8 ')Ø%'Ø&(Ø@BØ49ðMð Mð Mð Mð Mð Mð Mð Mð. 26Ø(2ð.ð .ð .ð .ð .ð:)ð )ð )ð )ð )ð )ð )ð )ð )ð )rJ   r-   c                  óz   — e Zd ZdZdddddededdddeddd	ddd
œdDd0„ZdEd2„ZdFd6„Z	dEd7„Z
dGd9„ZdEd:„ZdHdA„ZdIdC„ZdS )Jr+   u'  
    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.asyncio.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` can be awaited directly::

        websocket = await connect(...)

    In that case, you're responsible for closing the connection with
    :meth:`ClientConnection.close` when no longer needed.

    Args:
        uri: URI of the WebSocket server.
        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.
        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.
        write_limit: High-water mark of write buffer in bytes. It is passed to
            :meth:`~asyncio.WriteTransport.set_write_buffer_limits`. It defaults
            to 32Â KiB. You may pass a ``(high, low)`` tuple to set the
            high-water and low-water marks.
        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 the event loop's
    :meth:`~asyncio.loop.create_connection` method.

    For example:

    * You can set ``sock`` to provide a preexisting TCP socket. You may call
      :func:`socket.create_connection` (not to be confused with the event loop's
      :meth:`~asyncio.loop.create_connection` method) to create a suitable
      client socket and customize it.

    * You can set ``ssl`` to a :class:`~ssl.SSLContext` to enforce TLS settings.
      When connecting to a ``wss://`` URI, if ``ssl`` isn't provided, a TLS
      context is created with :func:`~ssl.create_default_context`.

    * You can set ``server_hostname`` to override the host name from ``uri`` in
      the TLS handshake.

    * You can configure ``ssl_handshake_timeout`` and ``ssl_shutdown_timeout``.

    * 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.

    When using a proxy:

    * Prefix keyword arguments with ``proxy_`` for configuring TLS between the
      client and an HTTPS proxy: ``proxy_ssl``, ``proxy_server_hostname``,
      ``proxy_ssl_handshake_timeout``, and ``proxy_ssl_shutdown_timeout``.
    * Use the standard keyword arguments for configuring TLS between the proxy
      and the WebSocket server: ``ssl``, ``server_hostname``,
      ``ssl_handshake_timeout``, and ``ssl_shutdown_timeout``.
    * Other keyword arguments are used only for connecting to the proxy.

    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   r4   )ÚoriginÚ
extensionsÚsubprotocolsÚcompressionrK   rM   Úproxyr   Úopen_timeoutr6   r7   r8   Úreconnect_delaysÚmax_sizer9   r:   ÚloggerÚcreate_connectionÚuriÚstrrk   úOrigin | Nonerl   ú'Sequence[ClientExtensionFactory] | Nonerm   úSequence[Subprotocol] | Nonern   rN   rK   rL   rM   ro   ústr | Literal[True] | Noner   ú'Callable[[Exception], Exception | None]rp   r<   r6   r7   r8   rq   úCallable[[], Generator[float]]rr   r=   r9   r:   r>   rs   úLoggerLike | Nonert   útype[ClientConnection] | NoneÚkwargsr   r?   r@   c               ó  ‡‡‡‡‡‡‡‡‡‡‡— || _         t          |¦  «        | _        | j        j        s$|                     d¦  «        �t          d¦  «        ‚‰�t          ‰¦  «         |dk    rt          ‰¦  «        Šn|�t          d|› �¦  «        ‚‰€t          j	        d¦  «        Š‰€t          Š|| _        || _        || _        |	| _        |
| _        || _        ‰| _        || _        dˆˆˆˆˆˆˆˆˆˆˆfd
„}|| _        d S )NÚsslz-ssl argument is incompatible with a ws:// URIrj   zunsupported compression: zwebsockets.clientru   r'   r?   r-   c                óT   •— t          | ‰	‰‰‰‰¬¦  «        } ‰|‰
‰‰‰‰¬¦  «        }|S )N)rk   rl   rm   rr   rs   r5   )r   )ru   r;   Ú
connectionr8   rt   rl   rs   r9   rr   rk   r6   r7   rm   r:   s      €€€€€€€€€€€rI   Úfactoryz!connect.__init__.<locals>.factoryC  s\   ø€ å%ØØØ%Ø)Ø!Øðñ ô ˆHð +Ð*ØØ+Ø)Ø+Ø#Ø'ðñ ô ˆJð ÐrJ   )ru   r'   r?   r-   )ru   r(   Úws_uriÚsecureÚgetÚ
ValueErrorr   r   ÚloggingÚ	getLoggerr-   rK   rM   ro   r   rp   rq   rs   Úcreate_connection_kwargsr„   )rG   ru   rk   rl   rm   rn   rK   rM   ro   r   rp   r6   r7   r8   rq   rr   r9   r:   rs   rt   r   r„   s     ```      ``` `````  rI   rC   zconnect.__init__  sY  øøøøøøøøøøø€ ð> ˆŒÝ ‘n”nˆŒØŒ{Ô!ð 	N f§j¢j°Ñ&7Ô&7Ð&CÝÐLÑMÔMÐMàÐ#Ý! ,Ñ/Ô/Ð/à˜)Ò#Ð#Ý9¸*ÑEÔEˆJˆJØÐ$ÝÐF¸ÐFÐFÑGÔGÐGàˆ>ÝÔ&Ð':Ñ;Ô;ˆFàÐ$Ý 0Ðà"4ˆÔØ!2ˆÔØˆŒ
Ø!2ˆÔØ(ˆÔØ 0ˆÔØˆŒØ(.ˆÔ%ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð, ˆŒˆˆrJ   r-   c              ƒ  ó  ‡ K  — t          j        ¦   «         }‰ j                             ¦   «         }‰ j        }|                     dd¦  «        rd}|                     d¦  «        �d}|du rt          ‰ j        ¦  «        }dˆ fd„}‰ j        j        rZ| 	                    d	d¦  «         |                     d	¦  «        €t          d
¦  «        ‚| 	                    d‰ j        j        ¦  «         |                     dd¦  «        r |j        |fi |¤Žƒ d{V —†\  }}|S |��t          |¦  «        }|j        dd…         dk    rLt!          |‰ j        |                     dd¦  «        ¬¦  «        ƒ d{V —†} |j        |fd|i|¤Žƒ d{V —†\  }}|S |j        dd…         dk    �rt|i i }}
}	|	                     ¦   «         D ]N\  }}|                     d	¦  «        s|dk    r|||<   Œ&|                     d¦  «        r||
|dd…         <   ŒI||
|<   ŒO|j        dk    r;|
 	                    d	d¦  «         |
                     d	¦  «        €t          d¦  «        ‚n$|
                     d	¦  «        �t          d¦  «        ‚t)          |‰ j        fd‰ j        i|
¤Žƒ d{V —†} |¦   «         }|                     |¦  «         |                     d	d¦  «        }|du rt/          j        ¦   «         }|� |j        |||fi |¤Žƒ d{V —†}|€J ‚|}|                     |¦  «         |S t7          d¦  «        ‚|                     d¦  «        €@| 	                    d‰ j        j        ¦  «         | 	                    d‰ j        j        ¦  «          |j        |fi |¤Žƒ d{V —†\  }}|S )zFOpen a TCP or Unix connection to the server, possibly through a proxy.ÚunixFNÚsockTr?   r-   c                 ó8   •— ‰                       ‰ j        ¦  «        S ©N)r„   r…   ©rG   s   €rI   r„   z,connect.open_tcp_connection.<locals>.factoryh  s   ø€ Ø—<’< ¤Ñ,Ô,Ð,rJ   r�   z*ssl=None is incompatible with a wss:// URIÚserver_hostnameé   ÚsocksÚ
local_addr)r•   é   ÚhttpÚproxy_é   Úhttpsz5proxy_ssl=None is incompatible with an https:// proxyz8proxy_ssl argument is incompatible with an http:// proxyrM   z&parse_proxy returned unsupported proxyÚhostÚport©r?   r-   )rX   Úget_running_loopr‹   Úcopyro   r‡   r   r…   r†   rU   rˆ   r›   ÚpopÚcreate_unix_connectionr    ÚschemeÚconnect_socks_proxyrt   ÚitemsÚ
startswithÚconnect_http_proxyrM   Úset_protocolÚ
ssl_moduleÚcreate_default_contextÚ	start_tlsÚconnection_madeÚAssertionErrorrœ   )rG   rD   r   ro   r„   Ú_rƒ   Úproxy_parsedrŽ   Ú
all_kwargsÚproxy_kwargsÚkeyÚvalueÚ	transportr�   Únew_transports   `               rI   Úopen_tcp_connectionzconnect.open_tcp_connection[  sÜ  øè è € åÔ'Ñ)Ô)ˆØÔ.×3Ò3Ñ5Ô5ˆà”
ˆØ�:Š:�f˜eÑ$Ô$ð 	ØˆEØ�:Š:�fÑÔÐ)ØˆEØ�Dˆ=ˆ=Ý˜dœkÑ*Ô*ˆEð	-ð 	-ð 	-ð 	-ð 	-ð 	-ð Œ;Ôð 	CØ×Ò˜e TÑ*Ô*Ð*Ø�zŠz˜%Ñ Ô Ð(Ý Ð!MÑNÔNÐNØ×ÒÐ/°´Ô1AÑBÔBÐBà�:Š:�f˜eÑ$Ô$ð 	Ø"= $Ô"=¸gÐ"PÐ"PÈÐ"PÐ"PÐPÐPÐPÐPÐPÐP‰MˆAˆzØÐàÑÝ& uÑ-Ô-ˆLàÔ" 2 A 2Ô&¨'Ò1Ð1å0Ø Ø”Kà%Ÿzšz¨,¸Ñ=Ô=ð	ñ ô ð ð ð ð ð ð �ð '= dÔ&<Øð'ð 'àð'ð ð'ð 'ð !ð !ð !ð !ð !ð !‘��:ð
 "Ð!àÔ$ R a RÔ(¨FÒ2Ñ2à39¸2¸r¨&˜L�
Ø",×"2Ò"2Ñ"4Ô"4ð 2ð 2‘J�C˜Ø—~’~ eÑ,Ô,ð 2°Ð7HÒ0HÐ0HØ&+˜˜s™˜ØŸš¨Ñ1Ô1ð 2Ø05˜ S¨¨¨¤WÑ-Ð-à,1˜ SÑ)Ð)àÔ&¨'Ò1Ð1Ø ×+Ò+¨E°4Ñ8Ô8Ð8Ø#×'Ò'¨Ñ.Ô.Ð6Ý(ØSñô ð ð 7ð
 $×'Ò'¨Ñ.Ô.Ð:Ý(ØVñô ð õ #5Ø Ø”Kð#ð #ð '+Ô&<ð#ð #ð	#ð #ð ð ð ð ð ð �	ð %˜W™YœY�
Ø×&Ò& zÑ2Ô2Ð2Ø—j’j ¨Ñ-Ô-�Ø˜$�;�;Ý$Ô;Ñ=Ô=�CØ�?Ø*8¨$¬.Ø! :¨sð+ð +Ø6<ð+ð +ð %ð %ð %ð %ð %ð %�Mð )Ð4Ð4Ð4Ø -�IØ×*Ò*¨9Ñ5Ô5Ð5Ø!Ð!õ %Ð%MÑNÔNÐNð �zŠz˜&Ñ!Ô!Ð)Ø×!Ò! &¨$¬+Ô*:Ñ;Ô;Ð;Ø×!Ò! &¨$¬+Ô*:Ñ;Ô;Ð;à"8 $Ô"8¸Ð"KÐ"KÀFÐ"KÐ"KÐKÐKÐKÐKÐKÐK‰MˆAˆzØÐrJ   ÚexcÚ	ExceptionúException | strc                óx  — t          |t          ¦  «        r|j        j        dv rd|j        j        v s|S | j        }t          j                             | j	        |j        j        d         ¦  «        }t          |¦  «        }| j                             d¦  «        �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  ÚLocationrŽ   Nzcannot follow redirect to z with a preexisting socketz)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)Ú.0r±   r²   s      rI   ú	<genexpr>z+connect.process_redirect.<locals>.<genexpr>þ  s\   è è € ð ð á&˜C ØŸ9š9™;œ;ØQðRð Rð ˜e˜ðRð Rð Rð Rðð rJ   )ra   r   r`   Ústatus_coderS   r…   ÚurllibÚparseÚurljoinru   r(   r‹   r‡   rˆ   r†   r   r›   rœ   rK   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Ñ'Ô'ˆ
ð Ô(×,Ò,¨VÑ4Ô4Ð@ÝØP¨WÐPÐPÐPñô ð ð
 Ôð 	X ZÔ%6ð 	XÝ Ð!VÈWÐ!VÐ!VÑWÔWÐWð Ô Ô!2Ò2Ð2ØŒ *¤/Ò1Ð1ØŒ *¤/Ò1Ð1ð Ô,×0Ò0°¸Ñ?Ô?ð Ý!ð*¸gð *ð *ð *ñô ð ð Ô-×1Ò1°&Ñ9Ô9ÐEØÔ0×4Ò4°VÑ<Ô<ÐHå!ð5¸gð 5ð 5ð 5ñô ð ð Ô&Ð2Ý*1ðð å*1°$Ô2IÑ*JÔ*J×*TÒ*TÑ*VÔ*Vðñ ô ñ+ô +�Ô'ð ˆrJ   c              ƒ  ó2  K  — 	 t          j        | j        ¦  «        4 ƒd {V —† t          t          ¦  «        D �]}|                      ¦   «         ƒ d {V —†}	 |                     | j        | j        ¦  «        ƒ d {V —† | 	                    ¦   «          |c cd d d ¦  «        ƒd {V —† S # t           j
        $ r |j                             ¦   «          ‚ t          $ rq}|j                             ¦   «          |                      |¦  «        }t          |t          ¦  «        r||u r‚ ||‚|| _        t#          |¦  «        | _        Y d }~�Œd }~ww xY wt'          dt          › d�¦  «        ‚# 1 ƒd {V —†swxY w Y   d S # t(          $ r}t)          d¦  «        |‚d }~ww xY w)Nz
more than z
 redirectsz"timed out during opening handshake)rX   Útimeoutrp   ÚrangeÚMAX_REDIRECTSrµ   r]   rK   rM   Ústart_keepaliveÚCancelledErrorr³   Úabortr·   rÊ   ra   ru   r(   r…   r   ÚTimeoutError)rG   r­   rƒ   r¶   Ú
exc_or_uris        rI   r+   zconnect.connect  s»  è è € ð*	NÝ” tÔ'8Ñ9Ô9ð %Pð %Pð %Pð %Pð %Pð %Pð %Pð %PÝ�}Ñ-Ô-ð $Pñ $P�AØ'+×'?Ò'?Ñ'AÔ'AÐ!AÐ!AÐ!AÐ!AÐ!AÐ!A�Jð *Ø(×2Ò2Ø Ô3Ø Ô2ñô ð ð ð ð ð ð ð ð< #×2Ò2Ñ4Ô4Ð4Ø)Ð)Ð)ðG%Pð %Pð %Pð %Pñ %Pô %Pð %Pð %Pð %Pð %Pð %Pð %Pð %Pð %Pøõ #Ô1ð ð ð Ø"Ô,×2Ò2Ñ4Ô4Ð4ØÝ$ð %ð %ð %ð #Ô,×2Ò2Ñ4Ô4Ð4à%)×%:Ò%:¸3Ñ%?Ô%?˜
Ý% jµ)Ñ<Ô<ð 
%à)¨SÐ0Ð0Ø %à&0°cÐ 9ð (2˜DœHÝ*3°JÑ*?Ô*?˜DœKØ$˜H˜H˜H™Høøøøð)%øøøõ4 (Ð(Nµ]Ð(NÐ(NÐ(NÑOÔOÐOðK%Pð %Pð %Pð %Pð %Pð %Pð %Pð %Pð %Pð %Pøøøð %Pð %Pð %Pð %Pð %Pð %PøõN ð 	Nð 	Nð 	NåÐCÑDÔDÈ#ÐMøøøøð	Nøøøse   „E7 £2E$Á&B&Á<E$ÂE7 Â&2E	ÃA&EÄ>E$ÅE	Å	E$Å$
E.Å.E7 Å1E.Å2E7 Å7
FÆFÆFú&Generator[Any, None, ClientConnection]c                óN   — |                       ¦   «                              ¦   «         S r�   )r+   Ú	__await__r‘   s    rI   rÖ   zconnect.__await__7  s   € à�|Š|‰~Œ~×'Ò'Ñ)Ô)Ð)rJ   c              ƒ  óœ   K  — t          | d¦  «        rt          d¦  «        ‚| ƒ d {V —†| _        | j                             ¦   «         ƒ d {V —†S )Nrƒ   zconnect() isn't reentrant)ÚhasattrÚRuntimeErrorrƒ   Ú
__aenter__r‘   s    rI   rÚ   zconnect.__aenter__=  s`   è è € Ý�4˜Ñ&Ô&ð 	<ÝÐ:Ñ;Ô;Ð;Ø $˜*˜*˜*˜*˜*˜*ˆŒØ”_×/Ò/Ñ1Ô1Ð1Ð1Ð1Ð1Ð1Ð1Ð1rJ   Úexc_typeútype[BaseException] | NoneÚ	exc_valueúBaseException | NoneÚ	tracebackúTracebackType | Nonec              ƒ  ó`   K  — 	 | j                              |||¦  «        ƒ d {V —†	 | ` S # | ` w xY wr�   )rƒ   Ú	__aexit__)rG   rÛ   rÝ   rß   s       rI   râ   zconnect.__aexit__C  sO   è è € ð	 Øœ×2Ò2°8¸YÈ	ÑRÔRÐRÐRÐRÐRÐRÐRÐRà��ø��ÐÐÐÐs   „!) ©-ú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ÚstriprX   Úsleep)rG   Údelaysrƒ   r¶   Únew_excÚ
raised_excÚdelays          rI   Ú	__aiter__zconnect.__aiter__P  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ñô ð õ
 ”m EÑ*Ô*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Ð*Ð*øøøøð7+øøøñ	#	sR   ‡; �'•; §
1±; ´1µ; »
DÁAÁD	Á
A2Á&A-Á(D	Á-A2Á2BD	Ä	D)*ru   rv   rk   rw   rl   rx   rm   ry   rn   rN   rK   rL   rM   rN   ro   rz   r   r{   rp   r<   r6   r<   r7   r<   r8   r<   rq   r|   rr   r=   r9   r=   r:   r>   rs   r}   rt   r~   r   r   r?   r@   r�   )r¶   r·   r?   r¸   )r?   rÔ   )rÛ   rÜ   rÝ   rÞ   rß   rà   r?   r@   )r?   rã   )rd   re   rf   rg   r   r   r   rC   rµ   rÊ   r+   rÖ   rÚ   râ   rî   © rJ   rI   r+   r+   ƒ   s  € € € € € ðBð BðR !%Ø>BØ59Ø"+à15Ø(2Ø,0ØEVà%'Ø&(Ø%'Ø&(Ø;Bà?DØ@BØ49à$(à;?ð7Qð Qð Qð Qð Qð Qðfcð cð cð cðJFð Fð Fð FðP+Nð +Nð +Nð +Nð^*ð *ð *ð *ð2ð 2ð 2ð 2ð	 ð 	 ð 	 ð 	 ð%ð %ð %ð %ð %ð %rJ   r+   ÚpathúPathLike | Noneru   rN   r   r   r?   c                óZ   — |€|                      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/``.

    Nr�   zws://localhost/zwss://localhost/T)ru   r�   rð   rï   )r‡   r+   )rð   ru   r   s      rI   r,   r,   x  sD   € ð* €{Ø�:Š:�eÑÔÐ$Ø#ˆCˆCà$ˆCÝÐ;�s ¨DÐ;Ð;°FÐ;Ð;Ð;rJ   )Ú	ProxyType)r   )Úsocks5hÚsocks5Úsocks4aÚsocks4TFro   r   r…   r'   úsocket.socketc           	   ‹  ó.  K  — t          t          | j                 | j        | j        | j        | 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_RDNSr+   ÚOSErrorr·   r   )ro   r…   r   Úsocks_proxyr¶   s        rI   r£   r£   ±  sÁ   è è € õ !Ý˜eœlÔ+ØŒJØŒJØŒNØŒNÝ˜Uœ\Ô*ñ
ô 
ˆð	JØ,˜Ô,¨V¬[¸&¼+ÐPÐPÈÐPÐPÐPÐPÐPÐPÐPÐPÐPøÝð 	ð 	ð 	ØÝð 	Jð 	Jð 	JÝÐ?Ñ@Ô@ÀcÐIøøøøð	Jøøøs   ÁA+ Á+BÁ?BÂBc              ‹  ó$   K  — t          d¦  «        ‚)Nz6connecting through a SOCKS proxy requires python-socks)ÚImportError)ro   r…   r   s      rI   r£   r£   ›  s   è è € õ
 ÐRÑSÔSÐSrJ   c                  óB   — e Zd Z	 ddd„Zdd„Zdd„Zdd„Zdd„Zdd„ZdS )ÚHTTPProxyConnectionNr…   r'   ro   r   rM   rN   c                ó$  — || _         || _        || _        t          ¦   «         | _        t          j        | j        j        | j        j        | j        j	        d¬¦  «        | _
        t          j        ¦   «         }|                     ¦   «         | _        d S )NT)ro   )r…   ro   rM   r"   Úreaderr   rÄ   Ú	read_lineÚ
read_exactÚread_to_eofÚparserrX   rž   rE   r`   )rG   r…   ro   rM   rD   s        rI   rC   zHTTPProxyConnection.__init__Ë  s   € ð ˆŒØˆŒ
Ø!2ˆÔå"‘n”nˆŒÝ”nØŒKÔ!ØŒKÔ"ØŒKÔ#Øð	
ñ 
ô 
ˆŒõ Ô'Ñ)Ô)ˆØ26×2DÒ2DÑ2FÔ2FˆŒˆˆrJ   r?   r@   c                óä  — | j                              ¦   «         rd S 	 t          | j        ¦  «         d S # t          $ ro}|j        }d|j        cxk    rdk     rn n| j                              |¦  «         n-| j                              t          |¦  «        ¦  «         Y d }~d S Y d }~d S d }~wt          $ r;}t          d¦  «        }||_        | j                              |¦  «         Y d }~d S d }~ww xY w)NéÈ   rº   z0did not receive a valid HTTP response from proxy)r`   Údonerå   r
  ÚStopIterationr²   rÂ   rb   Úset_exceptionr   r·   r   Ú	__cause__)rG   r¶   r`   Ú	proxy_excs       rI   Ú
run_parserzHTTPProxyConnection.run_parserà  s@  € ØŒ=×ÒÑÔð 	ØˆFð	3Ý�”ÑÔÐÐÐøÝð 	Jð 	Jð 	JØ”yˆHØ�hÔ*Ð0Ð0Ò0Ð0¨SÒ0Ð0Ð0Ð0Ð0Ø”×(Ò(¨Ñ2Ô2Ð2Ð2à”×+Ò+Õ,>¸xÑ,HÔ,HÑIÔIÐIÐIÐIÐIÐIÐIÐIð 3Ð2Ð2Ð2Ð2Ð2øøøøõ ð 	3ð 	3ð 	3Ý+ØBñô ˆIð #&ˆIÔØŒM×'Ò'¨	Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2Ð2øøøøð	3øøøs!   �3 ³
C/½AB'Â'C/Â40C*Ã*C/r³   úasyncio.BaseTransportc                ó¸   — t          t          j        |¦  «        }|| _        | j                             t          | j        | j        | j        ¦  «        ¦  «         d S r�   )	r   rX   Ú	Transportr³   Úwriter!   ro   r…   rM   )rG   r³   s     rI   r«   z#HTTPProxyConnection.connection_madeò  sU   € Ý�Ô*¨IÑ6Ô6ˆ	Ø"ˆŒØŒ×ÒÝ# D¤J°´¸TÔ=SÑTÔTñ	
ô 	
ð 	
ð 	
ð 	
rJ   ÚdataÚbytesc                ób   — | j                              |¦  «         |                      ¦   «          d S r�   )r  Ú	feed_datar  )rG   r  s     rI   Údata_receivedz!HTTPProxyConnection.data_receivedù  s.   € ØŒ×Ò˜dÑ#Ô#Ð#Ø�ŠÑÔÐÐÐrJ   c                ó`   — | j                              ¦   «          |                      ¦   «          d S r�   ©r  Úfeed_eofr  r‘   s    rI   Úeof_receivedz HTTPProxyConnection.eof_receivedý  ó,   € ØŒ×ÒÑÔÐØ�ŠÑÔÐÐÐrJ   r¶   úException | Nonec                ó`   — | j                              ¦   «          |                      ¦   «          d S r�   r  )rG   r¶   s     rI   Úconnection_lostz#HTTPProxyConnection.connection_lost  r   rJ   r�   )r…   r'   ro   r   rM   rN   )r?   r@   )r³   r  r?   r@   )r  r  r?   r@   )r¶   r!  r?   r@   )	rd   re   rf   rC   r  r«   r  r  r#  rï   rJ   rI   r  r  Ê  s›   € € € € € ð
 )-ð	Gð Gð Gð Gð Gð*3ð 3ð 3ð 3ð$
ð 
ð 
ð 
ðð ð ð ðð ð ð ðð ð ð ð ð rJ   r  )rM   rM   úasyncio.Transportc             ‹  óþ   ‡ ‡‡K  —  t          j        ¦   «         j        ˆ ˆˆfd„‰ j        ‰ j        fi |¤Žƒ d {V —†\  }}	 |j        ƒ d {V —† n/# t           j        t          f$ r |                     ¦   «          ‚ w xY w|S )Nc                 ó&   •— t          ‰‰ ‰¦  «        S r�   )r  )ro   rM   r…   s   €€€rI   ú<lambda>z$connect_http_proxy.<locals>.<lambda>  s   ø€ Õ# F¨EÐ3DÑEÔE€ rJ   )	rX   rž   rt   r›   rœ   r`   rÐ   r·   rÑ   )ro   r…   rM   r   r³   r;   s   ```   rI   r¦   r¦     sØ   øøøè è € ð !M¥Ô 8Ñ :Ô :Ô LØEÐEÐEÐEÐEÐEØŒ
ØŒ
ð!ð !ð ð	!ð !ð ð ð ð ð ð Ñ€IˆxðàÔÐÐÐÐÐÐÐÐøÝÔ"¥IÐ.ð ð ð Ø�ŠÑÔÐØðøøøð Ðs   Á A Á,A:)NN)rð   rñ   ru   rN   r   r   r?   r+   )ro   r   r…   r'   r   r   r?   rø   )
ro   r   r…   r'   rM   rN   r   r   r?   r$  )TÚ
__future__r   rX   r‰   ÚosÚsocketr�   r¨   rß   Úurllib.parserÃ   Úcollections.abcr   r   r   Útypesr   Útypingr   r	   r
   r   Úclientr   r   r   Údatastructuresr   r   Ú
exceptionsr   r   r   r   r   Úextensions.baser   Úextensions.permessage_deflater   rS   r   Úhttp11r   r   r;   r   r   ro   r   r   r    r!   Ústreamsr"   r#   r$   r%   r&   ru   r'   r(   rƒ   r*   Ú__all__ÚintÚenvironr‡   rÎ   r-   r+   r,   Úpython_socksró   Úpython_socks.async_.asynciorú   ÚSOCKS5ÚSOCKS4rû   rþ   r£   r  ÚProtocolr  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€ðW)ð W)ð W)ð W)ð W)�zñ W)ô W)ð W)ðvrð rð rð rð rñ rô rð rðl !Øð<ð <ð <ð <ð <ð:2JØ&Ð&Ð&Ð&Ð&Ð&Ø?Ð?Ð?Ð?Ð?Ð?ð Ô#ØÔ"ØÔ#ØÔ"ð	ð Ðð ØØØð	ð ÐðJð Jð Jð Jð Jøð1 ð Tð Tð TðTð Tð Tð Tð Tð TðTøøøðb9ð 9ð 9ð 9ð 9˜'Ô*ñ 9ô 9ð 9ð@ %)ð	ð ð ð ð ð ð ð s   Ã8D+ Ä+	D7Ä6D7