� <��g���B�ddlmZddlZddlZddlZddlmZddlmZddgZ e ej � dd ����Z e ej � d d ����Zdd�Zejd��Zejd��Zdd�Zdd�Zdd�Zd d�ZdS)!�)� annotationsN�)�Headers)� SecurityError� read_request� read_response�WEBSOCKETS_MAX_NUM_HEADERS�128�WEBSOCKETS_MAX_LINE_LENGTH�8192�value�bytes�return�strc�.�|�d���S)zG Decode a bytestring for interpolating into an error message. �backslashreplace)�errors)�decode)r s �f/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/websockets/legacy/http.py�drs�� �<�<�1�<� 2� 2�2�s[-!#$%&\'*+.^_`|~0-9a-zA-Z]+s[\x09\x20-\x7e\x80-\xff]*�stream�asyncio.StreamReader�tuple[str, Headers]c���K� t|���d{V��}n"#t$r}td��|�d}~wwxYw |�dd��\}}}n.#t$r!tdt |������d�wxYw|dkrtdt |�������|dkrtd t |�������|�d d ��}t |���d{V��}||fS) a� Read an HTTP/1.1 GET request and return ``(path, headers)``. ``path`` isn't URL-decoded or validated in any way. ``path`` and ``headers`` are expected to contain only ASCII characters. Other characters are represented with surrogate escapes. :func:`read_request` doesn't attempt to read the request body because WebSocket handshake requests don't have one. If the request contains a body, it may be read from ``stream`` after this coroutine returns. Args: stream: Input to read the request from. Raises: EOFError: If the connection is closed without a full HTTP request. SecurityError: If the request exceeds a security limit. ValueError: If the request isn't well formatted. Nz1connection closed while reading HTTP request line� rzinvalid HTTP request line: sGETzunsupported HTTP method: �HTTP/1.1�unsupported HTTP version: �ascii�surrogateescape)� read_line�EOFError�split� ValueErrorrr� read_headers)r� request_line�exc�method�raw_path�version�path�headerss rrr-sS����8U�&�v�.�.�.�.�.�.�.�.� � �� �U�U�U��J�K�K�QT�T�����U����T�$0�$6�$6�t�Q�$?�$?�!���'�'�� �T�T�T��H�q����H�H�I�I�t�S�T���������@�Q�v�Y�Y�@�@�A�A�A��+����B�a��j�j�B�B�C�C�C� �?�?�7�$5� 6� 6�D� ��(�(�(�(�(�(�(�(�G� ��=�s�� 9�4�9�A�+B�tuple[int, str, Headers]c���K� t|���d{V��}n"#t$r}td��|�d}~wwxYw |�dd��\}}}n.#t$r!tdt |������d�wxYw|dkrtdt |������� t |��}n.#t$r!tdt |������d�wxYwd |cxkrd ks!ntd t |�������t �|��std t |�������|���}t|���d{V��}|||fS) a� Read an HTTP/1.1 response and return ``(status_code, reason, headers)``. ``reason`` and ``headers`` are expected to contain only ASCII characters. Other characters are represented with surrogate escapes. :func:`read_request` doesn't attempt to read the response body because WebSocket handshake responses don't have one. If the response contains a body, it may be read from ``stream`` after this coroutine returns. Args: stream: Input to read the response from. Raises: EOFError: If the connection is closed without a full HTTP response. SecurityError: If the response exceeds a security limit. ValueError: If the response isn't well formatted. Nz0connection closed while reading HTTP status linerrzinvalid HTTP status line: rrzinvalid HTTP status code: �di�zunsupported HTTP status code: zinvalid HTTP reason phrase: ) r!r"r#r$r�int� _value_re� fullmatchrr%) r� status_liner'r*�raw_status_code� raw_reason� status_code�reasonr,s rrr^s�����2T�%�f�-�-�-�-�-�-�-�-� � �� �T�T�T��I�J�J�PS�S�����T����R�/:�/@�/@��q�/I�/I�,���*�*�� �R�R�R��F�a� �n�n�F�F�G�G�T�Q�R�����+����B�a��j�j�B�B�C�C�C�V��/�*�*� � �� �V�V�V��J�a��6H�6H�J�J�K�K�QU�U�V���� �+� $� $� $� $�� $� $� $� $��N�!�O�:L�:L�N�N�O�O�O� � � �z� *� *�I��G��*� � �G�G�H�H�H� � � � � �F� ��(�(�(�(�(�(�(�(�G� ��� '�'s'�� 9�4�9�A�+B�,B<�<+C'rc��K�t��}ttdz��D�]E} t|���d{V��}n"#t$r}t d��|�d}~wwxYw|dkr�n |�dd��\}}n.#t $r!t dt|������d�wxYwt� |��st dt|�������|� d��}t� |��st d t|�������|� d ��}|� d d ��}|||<��Gtd ���|S) zo Read HTTP headers from ``stream``. Non-ASCII characters are represented with surrogate escapes. �Nz,connection closed while reading HTTP headersr�:zinvalid HTTP header line: zinvalid HTTP header name: s zinvalid HTTP header value: rr ztoo many HTTP headers)r�range�MAX_NUM_HEADERSr!r"r#r$r� _token_rer2�stripr1rr) rr,�_�liner'�raw_name� raw_value�namer s rr%r%�s������i�i�G� �?�Q�&� '� '�5�5�� T�"�6�*�*�*�*�*�*�*�*�D�D��� T� T� T��I�J�J�PS� S����� T���� �3�;�;� �E� O�"&�*�*�T�1�"5�"5� �H�i�i��� O� O� O��C�!�D�'�'�C�C�D�D�$� N� O�����"�"�8�,�,� I��G�!�H�+�+�G�G�H�H� H��O�O�F�+�+� ��"�"�9�-�-� K��I�1�Y�<�<�I�I�J�J� J����w�'�'��� � ��*;�<�<����� � ��3�4�4�4� �Ns#�A� A!� A�A!�.B�+B3c���K�|����d{V��}t|��tkrtd���|�d��st d���|dd�S)z[ Read a single line from ``stream``. CRLF is stripped from the return value. Nz line too longs zline without CRLF�����)�readline�len�MAX_LINE_LENGTHr�endswithr")rr@s rr!r!�sy�������"�"� "� "� "� "� "� "�D� �4�y�y�?�"�"��O�,�,�,� �=�=�� !� !�,��*�+�+�+� ����9�r)r rrr)rrrr)rrrr-)rrrr)rrrr)� __future__r�asyncio�os�re�datastructuresr� exceptionsr�__all__r0�environ�getr<rHr�compiler=r1rrr%r!�rr�<module>rUs;��"�"�"�"�"�"����� � � � � � � � �$�$�$�$�$�$�&�&�&�&�&�&� �?� +���#�b�j�n�n�%A�5�I�I�J�J���#�b�j�n�n�%A�6�J�J�K�K��3�3�3�3� �B�J�7� 8� 8� � �B�J�4� 5� 5� �.�.�.�.�b1(�1(�1(�1(�h%�%�%�%�P�����r
Memory