File: //proc/1233/cwd/usr/lib/python3/dist-packages/websocket/__pycache__/_http.cpython-310.pyc
o
K�a�- � @ s d Z ddlZddlZddlZddlZddlT ddlT ddlT ddlT ddl T ddl
mZ g d�Z
zddlmZ ddlT ddlmZ d ZW n d
ZG dd� de�ZG d
d� de�ZG dd� de�ZY G dd� d�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Z dS )#a_
_http.py
websocket - WebSocket client library for Python
Copyright 2021 engn33r
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
� N� )�*)�encodebytes)�
proxy_info�connect�read_headers)�Proxy)� ProxyTypeTFc @ � e Zd ZdS )�
ProxyErrorN��__name__�
__module__�__qualname__� r r �1/usr/lib/python3/dist-packages/websocket/_http.pyr * � r c @ r
)�ProxyTimeoutErrorNr r r r r r - r r c @ r
)�ProxyConnectionErrorNr r r r r r 0 r r c @ s e Zd Zdd� ZdS )r c K s� |� dd �| _| jr8|� dd�| _|� dd �| _|� dd �| _|� dd�| _|� dd �| _| jd vr6td
��d S d| _d | _d | _d| _d S )N�http_proxy_host�http_proxy_portr �http_proxy_auth�
http_no_proxy�
proxy_type�http�timeout)r �socks4�socks4a�socks5�socks5hz7Only http, socks4, socks5 proxy protocols are supported)�get�
proxy_host�
proxy_port�auth�no_proxy�proxy_protocol�
proxy_timeoutr )�self�optionsr r r �__init__6 s
�
zproxy_info.__init__N)r
r r r) r r r r r 4 s r c C s� t std��t| �\}}}}|jdkrd}tj}|jdkr"d}tj}|jdkr,d}tj}|jdkr6d}tj}tj||j t
|j�|jrG|jd nd |jrP|jd nd |d
�} | j
|||jd�}
|rjtrjt|
|j|�}
n|rptd��|
|||ffS )
Nz>Python Socks is needed for SOCKS proxying but is not availabler Fr r Tr r r )r �host�port�username�password�rdns)r �SSL not available.)�HAVE_PYTHON_SOCKS�WebSocketException� parse_urlr% r �SOCKS5�SOCKS4r �creater! �intr"