Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
_http.cpython-313.pyc109 linesDownload Raw Back to __pycache__
1�

2q�jT9���SrSSKrSSKrSSKrSSKJr SSKJrJ	r	J3r4 SSKJrJ
r
Jr SSKJrJrJr SSKJrJr SS	KJrJr /S5QrSSKJrJrJr SSKJr SS
K J!r! Sr""SS5r$S\%S\&4Sjr'S\%4Sjr(S\)S\*S\&4Sjr+Sr,S \RS!\-4S"jr.S \RS#\-4S$jr/S \RS\)S\R4S%jr0S \RS\&4S&jr1g! Sr""SS\#5r"SS\#5r"SS\#5rN�=f)'a_6_http.py7websocket - WebSocket client library for Python8 9Copyright 2025 engn33r10 11Licensed under the Apache License, Version 2.0 (the "License");12you may not use this file except in compliance with the License.13You may obtain a copy of the License at14 15    http://www.apache.org/licenses/LICENSE-2.016 17Unless required by applicable law or agreed to in writing, software18distributed under the License is distributed on an "AS IS" BASIS,19WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.20See the License for the specific language governing permissions and21limitations under the License.22�N)�encodebytes�)�WebSocketAddressException�WebSocketException�WebSocketProxyException)�debug�dump�trace)�DEFAULT_SOCKET_OPTION�	recv_line�send)�HAVE_SSL�ssl)�get_proxy_info�	parse_url)�23proxy_info�connect�read_headers)�ProxyConnectionError�24ProxyError�ProxyTimeoutError)�	ProxyType)�ProxyTFc��\rSrSrSrg)r�.�N��__name__�25__module__�__qualname__�__firstlineno__�__static_attributes__r��UD:\code\apps\devtools\python\user_packages\Python313\site-packages\websocket/_http.pyrr.���r#rc��\rSrSrSrg)r�1rNrrr#r$rr1r%r#rc��\rSrSrSrg)r�4rNrrr#r$rr4r%r#rc��\rSrSrSrSrg)r�8c��URSS5UlUR(a�URSS5UlURSS5UlURSS5UlURSS5UlURSS5UlUR26S	;a[S275egSUlSUlSUlSUlg)N�http_proxy_host�http_proxy_portr�http_proxy_auth�
http_no_proxy�28proxy_type�http�http_proxy_timeout)r2�socks4�socks4a�socks5�socks5hz7Only http, socks4, socks5 proxy protocols are supported)�get�29proxy_host�30proxy_port�auth�no_proxy�proxy_protocol�
proxy_timeoutr)�self�optionss  r$�__init__�proxy_info.__init__9s���!�+�+�&7��>����?�?�%�k�k�*;�Q�?�D�O����$5�t�<�D�I�#�K�K���>�D�M�")�+�+�l�F�"C�D��!(���-A�4�!H�D���"�"�+��!�M���� �D�O��D�I� �D�M�"(�D�r#)r;r<r9r:r=r>N)rrr r!rAr"rr#r$rr8s��)r#r�url�returnc	���[(d[S5e[U5up4pVURS:XaSn[R31nOhURS:XaSn[R32nOEURS:XaSn[RnO"URS:XaSn[Rn[R"WUR[UR5UR(aURSOSUR(aURS	OSWS339n	U	RX4URS9n34U(a-[(a[!X�R"U5n35O[S5eX�XE44$)
Nz>Python Socks is needed for SOCKS proxying but is not availabler4Fr5Tr6r7rr)r1�host�port�username�password�rdns)�timeout�SSL not available.)�HAVE_PYTHON_SOCKSrrr=r�SOCKS4�SOCKS5r�creater9�intr:r;rr>r�_ssl_socket�sslopt)rCr@�proxy�hostnamerG�resource�	is_securerJr1�ws_proxy�socks           r$�_start_proxied_socketrZSs@���� �L�36�	37�+4�C�.�'�H�H����x�'����%�%�38�	�	�	��	*����%�%�39�	�	�	��	)����%�%�40�	�	�	��	*����%�%�41��|�|��
�
�
�
��!�!�
"�"'�*�*����A��$�"'�*�*����A��$�
�
�H����H�E�4G�4G��H�D���8��t�^�^�X�>�D�$�%9�:�:��D�+�+�+r#c��UR(a#U(dURS:wa[XU5$[U5upEpgU(aX4XV44$[	XEXr5up�n42U(d[SUSU35eSn[
X�RUR5nU	(a[X�XZ5nU(a-[(a[X�RU5nO[S5eX�XV44$! U(aUR5 e=f)Nr2zHost not found.: �:rL)r9r=rZr�_get_addrinfo_listr�_open_socket�sockoptrK�_tunnelrrRrS�close)rCr@rT�socketrU�
port_from_urlrVrW�
addrinfo_list�need_tunnelr;rYs            r$rr~s���
����5�+?�+?�6�+I�$�S�5�9�9�3<�S�>�0�H�X�
��-�:�:�:�'9���(�$�M��� �#4�X�J�a�
��!O�P�P��D���M�?�?�G�O�O�L����4�=�?�D���x�"�4����B��(�)=�>�>��
�8�8�8�����J�J�L�
�s
�9A+C%�%C?rGrWc���[UUURURURUR5upEnU(d:[43R"XS[44R[45R5nUSS4$U=(a U=(d Sn[46R"XES[47R[48R5nUSU4$![49Ran[U5eSnAff=f)NrF�PT)rr9r:r;r<rb�getaddrinfo�SOCK_STREAM�SOL_TCP�gaierrorr)	rUrGrWrT�phost�pport�pauthrd�es	         r$r]r]�s���(���
���
���
�50�51�
���
��E�%�+��"�.�.���6�#5�#5�v�~�~��M�!�%��-�-��O�e�)�r�E�52#�.�.��a��!3�!3�V�^�^��M�!�$��-�-���?�?�+�'��*�*��+�s�AC�>A
C�C0� C+�+C0c��SnUH�nUSSupVn[R"XVU5nURU5 [Hn	UR"U	6 M UHn	UR"U	6 M USn53SnU(dUR	U545 OM� U$ U(aUeW$![R55a�nUR
5 [U56S5Ul[R[R[R4nO0![a# [R[R4nOf=fURU;aUeUnSnAM�SnAff=f)N��r)rb�57settimeoutr�58setsockoptr�errorra�str�	remote_ip�errno�ECONNREFUSED�WSAECONNREFUSED�ENETUNREACH�AttributeError)
rdr_rK�err�addrinfo�family�socktype�protorY�opts�addressru�eConnRefuseds
             r$r^r^�sH��59�C�!��"*�2�A�,���%��}�}�V�u�5������ �)�D��O�O�T�"�*��D��O�O�T�"���1�+�����
����W�%�"��
�60�K�M"�F��I��K��1�<�<�
��61�62��"%�g�a�j�/���K��*�*��-�-��)�)�$�L��63&�K�$)�$6�$6��8I�8I�#J�L�K���;�;�l�2��K�����
�s<�;B�E�3#E�/D�E�*D4�1E�3D4�4E�ErYrSc�64�URSS5nU(Gd�[R"URS[R55n[R65RS5nUbXTlURS[R5[R:wa~URSS5nURSS5nU(dU(aURXgS9 O;[US	5(a*UR[RR 5 URSS5(a7UR#USURSS5URS
S55 URS[R5[R:Xa4URSS5(dSUl[RUlO<URSS5UlURS[R(5UlSU;aUR+US5 SU;aRUSn	[-U	[.[045(a[3U	5S:wa[S5eU	up�nUR#X�U5 SU;aUR5US5 UR7UURSS5URSS5US9$![[R[4an[SU35eSnAff=f![Ran[S66U35eSnAff=f![[4an[SU35eSnAf[Ran[SU35eSnAff=f![Ran[SU35eSnAff=f![a e[[R4an[SU35eSnAff=f![an[SU35eSnAff=f)N�context�ssl_version�
SSLKEYLOGFILE�	cert_reqs�ca_certs�ca_cert_path)�cafile�capathz#SSL CA certificate loading failed: �load_default_certsz(SSL default certificate loading failed: �certfile�keyfilerIz'SSL client certificate loading failed: �check_hostnameFT�ciphersz!SSL cipher configuration failed: �67cert_chainrqz@cert_chain must be a tuple/list of (certfile, keyfile, password)z-SSL client certificate configuration failed: �68ecdh_curvez%SSL ECDH curve configuration failed: �do_handshake_on_connect�suppress_ragged_eofs)r�r��server_hostname)r8r�69SSLContext�PROTOCOL_TLS_CLIENT�os�environ�keylog_filename�	CERT_NONE�load_verify_locations�FileNotFoundError�SSLError�70ValueErrorr�hasattrr��Purpose�SERVER_AUTH�load_cert_chainr��verify_mode�
CERT_REQUIRED�set_ciphers�71isinstance�tuple�list�len�set_ecdh_curve�wrap_socket)
rYrSrUr�r��keylog_filer�r�ror�r�r�rIs
             r$�_wrap_sni_socketr��s����j�j��D�)�G���.�.����M�3�;R�;R�!S�T��72�j�j�n�n�_�5���"�&1�#��:�:�k�3�=�=�1�S�]�]�B��Z�Z�73�D�1�F��Z�Z���5�F���X��1�1��1�O���"6�7�7���.�.�s�{�{�/F�/F�G�74�:�:�j�$�'�'�	
X��'�'��:�&��J�J�y�$�/��J�J�z�4�0���:�:�k�3�=�=�1�S�]�]�B�6�:�:��e�L75�L76�&+�G�"�"%�-�-�G��%+�Z�Z�0@�$�%G�G�"�"(�*�*�[�#�:K�:K�"L�G�����
R��#�#�F�9�$5�6��6�!�

�#�L�1�77�!�*�u�d�m�<�<��J��ST�@T�$�Z���/9�+��8��'�'��8�D��6�!�
V��&�&�v�l�';�<����� &�78�79�+D�d� K�#�Z�Z�(>��E� �	����w*�3�<�<��D�X�,�/R�ST�RU�-V�W�W��X��80�|�|��,�B�1�#�F������&�z�2�
X�(�+R�ST�RU�)V�W�W���<�<�
X�(�+R�ST�RU�)V�W�W��
X��$�<�<�
R�(�+L�Q�C�)P�Q�Q��
R���
��%�s�|�|�4�
�(�C�A�3�G����
���
V�(�+P�QR�PS�)T�U�U��
V�s��K�>)L�?6L6�N�9AN+�O%�L	�6L�L	�L3� L.�.L3�6M>�M�M>�+M9�9M>�N(�N#�#N(�+$O"�O�O"�%81P�/O=�=P�user_ssloptc��S[R0nURU5 [RRS5nU(a<[RRU5(aURSS5cXCS'OBU(a;[RRU5(aURSS5cXCS'URSS5(aUSnURSS5n[XX%5nU$)Nr��WEBSOCKET_CLIENT_CA_BUNDLEr�r�r�r�T)82rr��updater�r�r8�path�isfile�isdirr�)rYr�rUrS�	cert_pathr�s      r$rRrRCs�����!2�!2�3�F�83�M�M�+���84�85���;�<�I���G�G�N�N�9�%�%��O�O�J��-�5�&�z����G�G�M�M�)�$�$��O�O�N�D�1�9�!*�~��
�z�z�#�T�*�*��+�,���Z�Z� 0�$�7�N��D�(�C�D��Kr#c�$�[S5 SUSUS3nUSUSUS3-
nU(arUS(ahUSnUS(aUSUS3-
n[UR55R5R	5RS	S865nUSUS3-
nUS-
n[
SU5 [X5 [U5un nUS
:wa[SU35eU$![R[4an	[[U	55eSn	A	ff=f)NzConnecting proxy...zCONNECT r\z HTTP/1.1
87zHost: z
88rr�89�zProxy-Authorization: Basic zrequest header��z!failed CONNECT via proxy status: )r�base64encode�encode�strip�decode�replacer	r
rrbrurrrv)90rYrFrGr;�connect_header�auth_str�encoded_str�status�_ros91          r$r`r`^s*��	�92� ���v�Q�t�f�M�:�N���t�f�A�d�V�4�0�0�N���Q����7����7��!�D��G�9�
�%�H�"�8�?�?�#4�5�;�;�=�D�D�F�N�N�t�UW�X���7��}�D�I�I���f��N��	�>�*����.�#�D�)����1���}�%�(I�&��&R�S�S��K��

�L�L�,�-�.�%�c�!�f�-�-��.�s�7C�D�6D93�94Dc��SnSn0n[S5 [U5nURS5R5nU(dGO[U5 U(d5UR	SS5n[US5n[
U5S:�aUSnO�UR	SS5n[
U5S:wa[S5eUupxUR5S:XaXURS5(aBURS5n	U	bU	S	-UR5-US'O4UR5US'O UR5X7R5'GM9[S955 XU4$)Nz--- response header ---zutf-8� �rr\zInvalid headerz96set-cookiez; z-----------------------)97r98rr�r��splitrQr�r�lowerr8)99rYr��status_message�headers�line�status_info�kv�key�value�existing_cookies100          r$rrzs9��
�F��N��G�	�101#�$�102������{�{�7�#�)�)�+����
�d����*�*�S�!�,�K���Q��(�F��;��!�#�!,�Q�������C��#�B��2�w�!�|�(�)9�:�:��J�C��y�y�{�l�*�w�{�{�<�/H�/H�")�+�+�l�";��"�.�,;�d�,B�U�[�[�]�,R�G�L�)�,1�K�K�M�G�L�)�',�{�{�}��	�	��$�/�2103�104#�$��N�*�*r#)2�__doc__rxr�rb�base64rr��_exceptionsrrr�_loggingrr	r105�_socketrrr
�_ssl_compatrr�_urlrr�__all__�python_socks._errorsrrr�python_socks._typesr�python_socks.syncrrM�	Exceptionrrvr�rZrrQ�boolr]r^�dictr�rRr`rrr#r$�<module>r�s;���&
�	�
�.���106)�(�;�;�&�+�1073��
�X�X�-�'���)�)�6(,�s�(,�u�(,�V"��"�J+�s�+�t�+�u�+�@(�VR�6�=�=�R�$�R�j�f�m�m��$��6�&�-�-��S��6�=�=��8!+�v�}�}�!+��!+��_108 109
���
�Y�
�
�I�
�
�y�
�s�C!�!%D
codekingpro/portable-devtools · Team Ai