HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/websockets/__pycache__/uri.cpython-310.pyc
o

�hJ�@s�ddlmZddlZddlZddlZddlmZmZddgZ	dZ
ejGdd�d��Zddd�Z
ejGd
d�d��Zddd�Zddd�ZdS)�)�annotationsN�)�InvalidProxy�
InvalidURI�	parse_uri�WebSocketURIz:/?#[]@!$&'()*+,;=c@sneZdZUdZded<ded<ded<ded<ded	<d
Zded<d
Zded
<eddd��Zeddd��Z	d
S)ra
    WebSocket URI.

    Attributes:
        secure: :obj:`True` for a ``wss`` URI, :obj:`False` for a ``ws`` URI.
        host: Normalized to lower case.
        port: Always set even if it's the default.
        path: May be empty.
        query: May be empty if the URI doesn't include a query component.
        username: Available when the URI contains `User Information`_.
        password: Available when the URI contains `User Information`_.

    .. _User Information: https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1

    �bool�secure�str�host�int�port�path�queryN�
str | None�username�password�returncCs*|jr|j}nd}|jr|d|j7}|S)N�/�?)rr)�self�
resource_name�r�A/usr/local/CyberCP/lib/python3.10/site-packages/websockets/uri.pyr+szWebSocketURI.resource_name�tuple[str, str] | NonecC�(|jdurdS|jdusJ�|j|jfS�N�rr�rrrr�	user_info5�
zWebSocketURI.user_info)rr
�rr)
�__name__�
__module__�__qualname__�__doc__�__annotations__rr�propertyrrrrrrrs
	�urir
rc	Cs4tj�|�}|jdvrt|d��|jdurt|d��|jdkr$t|d��|jdk}|j}|jp4|r3dnd	}|j}|j	}|j
}|j}|durN|durNt|d
��z|�d�Wn:t
y�|�d���}tjj|td
�}tjj|td
�}|dur�|dus}J�tjj|td
�}tjj|td
�}Ynwt|||||||�S)z�
    Parse and validate a WebSocket URI.

    Args:
        uri: WebSocket URI.

    Returns:
        Parsed WebSocket URI.

    Raises:
        InvalidURI: If ``uri`` isn't a valid WebSocket URI.

    )�ws�wsszscheme isn't ws or wssN�hostname isn't provided�z"fragment identifier is meaninglessr*��P�"username provided without password�ascii�idna��safe)�urllib�parse�urlparse�schemer�hostname�fragmentr
rrrr�encode�UnicodeEncodeError�decode�quote�DELIMSr)	r(�parsedr	rr
rrrrrrrr=s:







��c@sPeZdZUdZded<ded<ded<dZded	<dZded
<edd
d��ZdS)�Proxya�
    Proxy.

    Attributes:
        scheme: ``"socks5h"``, ``"socks5"``, ``"socks4a"``, ``"socks4"``,
            ``"https"``, or ``"http"``.
        host: Normalized to lower case.
        port: Always set even if it's the default.
        username: Available when the proxy address contains `User Information`_.
        password: Available when the proxy address contains `User Information`_.

    .. _User Information: https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1

    r
r7rrr
NrrrrrcCrrrrrrrr�r zProxy.user_infor!)	r"r#r$r%r&rrr'rrrrrr@os
r@�proxycCs8tj�|�}|jdvrt|d|j�d���|jdurt|d��|jdvr)t|d��|jdkr3t|d	��|jdkr=t|d
��|j}|j}|j	pN|jdkrMdnd
}|j
}|j}|durb|durbt|d��z|�d�Wn*t
y�|�d���}|dur�|dus�J�tjj|td�}tjj|td�}Ynwt|||||�S)z�
    Parse and validate a proxy.

    Args:
        proxy: proxy.

    Returns:
        Parsed proxy.

    Raises:
        InvalidProxy: If ``proxy`` isn't a valid proxy.

    )�socks5h�socks5�socks4a�socks4�https�httpzscheme z isn't supportedNr+)r,rzpath is meaninglessr,zquery is meaninglesszfragment is meaninglessrFr-r.r/r0r1r2)r4r5r6r7rr8rrr9r
rrr:r;r<r=r>r@)rAr?r7rr
rrrrr�parse_proxy�s:









��	rHrcCs�tj�|j�d|j���rdStj��}|jrgd�}ngd�}|D] }|�|�}|durB|dkr>|�d�r>d|dd�}|Sq"dS)	zU
    Return the proxy to use for connecting to the given WebSocket URI, if any.

    �:N)r*�socksrF)r)rJrFrGrJzhttp://z
socks5h://�)	r4�request�proxy_bypassrr
�
getproxiesr	�get�
startswith)r(�proxies�schemesr7rArrr�	get_proxy�s


�rS)r(r
rr)rAr
rr@)r(rrr)�
__future__r�dataclasses�urllib.parser4�urllib.request�
exceptionsrr�__all__r>�	dataclassrrr@rHrSrrrr�<module>s
+2
2