403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/tornado/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/tornado/__pycache__/httputil.cpython-311.pyc
�

���i}��
��dZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlZ
ddlZddlmZddlZddlZddlmZmZmZmZddlmZmZmZddlmZmZeddlZdd	lm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*ej+rdd
lm,Z,ddl-m.Z.ddl/Z/e	d��d
e0de0fd���Z1Gd�dej2j3��Z4Gd�de5��Z6Gd�de7��Z8Gd�de7��Z9Gd�de5��Z:Gd�de5��Z;Gd�de5��Z<de0de&de%e0e0fe"e e0e0fe e e0e0fd ffde0fd!�Z=Gd"�d#e��Z>d$e0de'e e'e?e'e?ffd%�Z@d&e'e?d'e'e?d(e?de0fd)�ZAd*e0de'e?fd+�ZB	dUd,e0d-eCd.e%e0e"eCfd/e%e0e"e>fd0e'e4ddfd1�ZDd2eCd3eCd.e%e0e"eCfd/e%e0e"e>fddf
d4�ZEd5e&e?eFeGejHejfde0fd6�ZIejJd7gd8���ZKejLd9��ZMd:e0deKfd;�ZNejJd<gd=���ZOejLd>��ZPd:e0deOfd?�ZQd@e0de)e0ddffdA�ZRd:e0de e0e%e0e0fffdB�ZSdCe0dDe%e0e0fde0fdE�ZTdFe&e0eCfdGe&e0eCfdeCfdH�ZUdI�ZVejLdJ��ZWdKe0de e0e'e?ffdL�ZXdMe%e0e"e*fde!e e0e*ffdN�ZYejLdO��jZZ[dPej\de0fdQ�Z]d@e0de0fdR�Z^dSe0de%e0e0ffdT�Z_dS)Vz�HTTP utility code shared by clients and servers.

This module also defines the `HTTPServerRequest` class which is exposed
via `tornado.web.RequestHandler.request`.
�N)�	lru_cache)�	responses)�SSLError)�	urlencode�urlparse�
urlunparse�	parse_qsl)�
native_str�parse_qs_bytes�utf8)�
ObjectDict�unicode_type)�Tuple�Iterable�List�Mapping�Iterator�Dict�Union�Optional�	Awaitable�	Generator�AnyStr)�Deque)�Futurei��name�returnc�f�d�d�|�d��D����S)ziMap a header name to Http-Header-Case.

    >>> _normalize_header("coNtent-TYPE")
    'Content-Type'
    �-c�6�g|]}|�����S�)�
capitalize)�.0�ws  �2/usr/lib/python3/dist-packages/tornado/httputil.py�
<listcomp>z%_normalize_header.<locals>.<listcomp>Hs ��=�=�=��Q�\�\�^�^�=�=�=�)�join�split)rs r%�_normalize_headerr*As/���8�8�=�=�T�Z�Z��_�_�=�=�=�>�>�>r'c�*�eZdZdZejdeeeefddfd���Z	ejdeeefddfd���Z	ejde
eefddfd���Z	ejd	eddfd
���Z	dejd	eddfd�Z	ded
eddfd�Zdedeefd�Z
dee
eeffd�Zdeddfd�Zededdfd���Zded
eddfd�Zdedefd�Zdedefd�Zdeddfd�Zdefd�Zdeejfd�Zdd�ZeZdefd�ZeZ dS)�HTTPHeadersa�A dictionary that maintains ``Http-Header-Case`` for all keys.

    Supports multiple values per key via a pair of new methods,
    `add()` and `get_list()`.  The regular dictionary interface
    returns a single value per key, with multiple values joined by a
    comma.

    >>> h = HTTPHeaders({"content-type": "text/html"})
    >>> list(h.keys())
    ['Content-Type']
    >>> h["Content-Type"]
    'text/html'

    >>> h.add("Set-Cookie", "A=B")
    >>> h.add("Set-Cookie", "C=D")
    >>> h["set-cookie"]
    'A=B,C=D'
    >>> h.get_list("set-cookie")
    ['A=B', 'C=D']

    >>> for (k,v) in sorted(h.get_all()):
    ...    print('%s: %s' % (k,v))
    ...
    Content-Type: text/html
    Set-Cookie: A=B
    Set-Cookie: C=D
    �_HTTPHeaders__argrNc��dS�Nr!��selfr-s  r%�__init__zHTTPHeaders.__init__h����r'c��dSr/r!r0s  r%r2zHTTPHeaders.__init__lr3r'�argsc��dSr/r!)r1r5s  r%r2zHTTPHeaders.__init__pr3r'�kwargsc��dSr/r!)r1r7s  r%r2zHTTPHeaders.__init__tr3r'c�<�i|_i|_d|_t|��dkrft|��dkrSt	|dt
��r8|d���D]\}}|�||���dS|j|i|��dS)N�r)	�_as_list�_combined_cache�	_last_key�len�
isinstancer,�get_all�add�update)r1r5r7�k�vs     r%r2zHTTPHeaders.__init__xs���/1��
�/1�������t�9�9��>�>�c�&�k�k�Q�.�.�:�d�1�g�{�3S�3S�.��Q����)�)�
�
���1�����A�����
�
�
�D�K��(��(�(�(�(�(r'r�valuec��t|��}||_||vr=|j�|d��|j|�|��dS|||<dS)z#Adds a new value for the given key.N)r*r=r<�popr;�append�r1rrE�	norm_names    r%rAzHTTPHeaders.add�sh��%�d�+�+�	�"�������� �$�$�Y��5�5�5��M�)�$�+�+�E�2�2�2�2�2�#�D��O�O�Or'c�V�t|��}|j�|g��S)z2Returns all values for the given header as a list.)r*r;�get�r1rrJs   r%�get_listzHTTPHeaders.get_list�s'��%�d�+�+�	��}� � ��B�/�/�/r'c#�^K�|j���D]\}}|D]}||fV��	�dS)z�Returns an iterable of all (name, value) pairs.

        If a header has multiple values, multiple pairs will be
        returned with the same name.
        N)r;�items)r1r�valuesrEs    r%r@zHTTPHeaders.get_all�sZ����!�M�/�/�1�1�	$�	$�L�D�&��
$�
$���U�m�#�#�#�#�
$�	$�	$r'�linec���|d���ro|j�td���d|���z}|j|jdxx|z
cc<|j�|jd��dS	|�dd��\}}n#t$rtd���wxYw|�	||�
����dS)	z�Updates the dictionary with a single header line.

        >>> h = HTTPHeaders()
        >>> h.parse_line("Content-Type: text/html")
        >>> h.get('content-type')
        'text/html'
        rNz.first header line cannot start with whitespace� ����:r:zno colon in header line)�isspacer=�HTTPInputError�lstripr;r<rGr)�
ValueErrorrA�strip)r1rR�new_partrrEs     r%�
parse_linezHTTPHeaders.parse_line�s�����7�?�?���	*��~�%�$�%U�V�V�V��T�[�[�]�]�*�H��M�$�.�)�"�-�-�-��9�-�-�-�� �$�$�T�^�T�:�:�:�:�:�
@�"�j�j��a�0�0���e�e���
@�
@�
@�$�%>�?�?�?�
@�����H�H�T�5�;�;�=�=�)�)�)�)�)s�B%�%B?�headersc��|��}|�d��D]8}|�d��r
|dd�}|r|�|���9|S)a�Returns a dictionary from HTTP header text.

        >>> h = HTTPHeaders.parse("Content-Type: text/html\r\nContent-Length: 42\r\n")
        >>> sorted(h.items())
        [('Content-Length', '42'), ('Content-Type', 'text/html')]

        .. versionchanged:: 5.1

           Raises `HTTPInputError` on malformed headers instead of a
           mix of `KeyError`, and `ValueError`.

        �
�
NrU)r)�endswithr])�clsr^�hrRs    r%�parsezHTTPHeaders.parse�sm��
�C�E�E���M�M�$�'�'�	#�	#�D��}�}�T�"�"�
!��C�R�C�y���
#����T�"�"�"���r'c�N�t|��}||j|<|g|j|<dSr/�r*r<r;rIs    r%�__setitem__zHTTPHeaders.__setitem__�s0��%�d�+�+�	�*/���Y�'�$)�7��
�i� � � r'c�`�t|t��sdSt|��}||jvS)NF)r?�strr*r;rMs   r%�__contains__zHTTPHeaders.__contains__�s5���$��$�$�	��5�%�d�+�+�	��D�M�)�)r'c��t|��}||jvr(d�|j|��|j|<|j|S)N�,)r*r<r(r;)r1r�headers   r%�__getitem__zHTTPHeaders.__getitem__�sK��"�4�(�(����-�-�-�+.�8�8�D�M�&�4I�+J�+J�D� ��(��#�F�+�+r'c�D�t|��}|j|=|j|=dSr/rgrMs   r%�__delitem__zHTTPHeaders.__delitem__�s*��%�d�+�+�	�� ��+��M�)�$�$�$r'c�*�t|j��Sr/)r>r;�r1s r%�__len__zHTTPHeaders.__len__�s���4�=�!�!�!r'c�*�t|j��Sr/)�iterr;rss r%�__iter__zHTTPHeaders.__iter__�s���D�M�"�"�"r'c� �t|��Sr/)r,rss r%�copyzHTTPHeaders.copy�s���4� � � r'c��g}|���D] \}}|�|�d|�d����!d�|��S)Nz: r`�)r@rHr()r1�linesrrEs    r%�__str__zHTTPHeaders.__str__�sT�����<�<�>�>�	5�	5�K�D�%��L�L�t�t�t�U�U�U�3�4�4�4�4��w�w�u�~�~�r')rr,)!�__name__�
__module__�__qualname__�__doc__�typing�overloadrrjrr2r�AnyrArNrr@r]�classmethodrerh�object�boolrkrorq�intrtrrwry�__copy__r}�__unicode__r!r'r%r,r,Ks���������8�_�
�g�c�4��9�n�5�
�$�
�
�
��_�
��_�
�g�c�3�h�/�
�D�
�
�
��_�
��_�
�e�C��H�o�
�$�
�
�
��_�
��_�
��
��
�
�
��_�
�)�f�j�)�C�)�D�)�)�)�)�($��$�C�$�D�$�$�$�$�0�S�0�T�#�Y�0�0�0�0�
$��%��S��/�2�$�$�$�$�*�s�*�t�*�*�*�*�,��C��M�����[��2+��+�C�+�D�+�+�+�+�
*��*�D�*�*�*�*�,��,��,�,�,�,�%��%��%�%�%�%�
"��"�"�"�"�#�(�6�:�.�#�#�#�#�!�!�!�!��H��������K�K�Kr'r,c��eZdZdZdZdZdZ										ddeedeededee	dee
d	eed
eeeedfded
deddee
ddfd�Zedeeejjffd���Zdefd�Zdefd�Z	ddededee
ffd�Zdd�Zdefd�ZdS)�HTTPServerRequesta7
A single HTTP request.

    All attributes are type `str` unless otherwise noted.

    .. attribute:: method

       HTTP request method, e.g. "GET" or "POST"

    .. attribute:: uri

       The requested uri.

    .. attribute:: path

       The path portion of `uri`

    .. attribute:: query

       The query portion of `uri`

    .. attribute:: version

       HTTP version specified in request, e.g. "HTTP/1.1"

    .. attribute:: headers

       `.HTTPHeaders` dictionary-like object for request headers.  Acts like
       a case-insensitive dictionary with additional methods for repeated
       headers.

    .. attribute:: body

       Request body, if present, as a byte string.

    .. attribute:: remote_ip

       Client's IP address as a string.  If ``HTTPServer.xheaders`` is set,
       will pass along the real IP address provided by a load balancer
       in the ``X-Real-Ip`` or ``X-Forwarded-For`` header.

    .. versionchanged:: 3.1
       The list format of ``X-Forwarded-For`` is now supported.

    .. attribute:: protocol

       The protocol used, either "http" or "https".  If ``HTTPServer.xheaders``
       is set, will pass along the protocol used by a load balancer if
       reported via an ``X-Scheme`` header.

    .. attribute:: host

       The requested hostname, usually taken from the ``Host`` header.

    .. attribute:: arguments

       GET/POST arguments are available in the arguments property, which
       maps arguments names to lists of values (to support multiple values
       for individual names). Names are of type `str`, while arguments
       are byte strings.  Note that this is different from
       `.RequestHandler.get_argument`, which returns argument values as
       unicode strings.

    .. attribute:: query_arguments

       Same format as ``arguments``, but contains only arguments extracted
       from the query string.

       .. versionadded:: 3.2

    .. attribute:: body_arguments

       Same format as ``arguments``, but contains only arguments extracted
       from the request body.

       .. versionadded:: 3.2

    .. attribute:: files

       File uploads are available in the files property, which maps file
       names to lists of `.HTTPFile`.

    .. attribute:: connection

       An HTTP request is attached to a single HTTP connection, which can
       be accessed through the "connection" attribute. Since connections
       are typically kept open in HTTP/1.1, multiple requests can be handled
       sequentially on a single connection.

    .. versionchanged:: 4.0
       Moved from ``tornado.httpserver.HTTPRequest``.
    N�HTTP/1.0�method�uri�versionr^�body�host�files�HTTPFile�
connection�HTTPConnection�
start_line�RequestStartLine�server_connectionrc���|	�|	\}}}||_||_||_|p
t��|_|pd|_t
|dd��}t
|dd��|_t
|dd��|_|p|j�	d��pd|_
t|j
�����d|_
|pi|_||_|
|_t#j��|_d|_|�#|�d	��\|_}|_t/|jd
���|_t3j|j��|_i|_dS)Nr'�context�	remote_ip�protocol�http�Hostz	127.0.0.1r�?T��keep_blank_values)r�r�r�r,r^r��getattrr�r�rLr��split_host_and_port�lower�	host_namer�r�r��time�_start_time�_finish_time�	partition�path�queryr�	argumentsry�deepcopy�query_arguments�body_arguments)
r1r�r�r�r^r�r�r�r�r�r�r��seps
             r%r2zHTTPServerRequest.__init__hsI���!�#-� �F�C������������/�+�-�-����K�C��	��*�i��6�6�� ��+�t�<�<������V�<�<��
��C�D�L�,�,�V�4�4�C���	�,�T�Y�_�_�->�->�?�?��B����[�b��
�$���!2����9�;�;��� ����?�),���s�);�);�&�D�I�s�D�J�'��
�d�K�K�K���#�}�T�^�<�<��� ����r'c�J�t|d��s�tj���|_d|jvra	t
|jd��}|���D] \}}	||j|<�#t$rY�wxYwn#t$rYnwxYw|jS)z0A dictionary of ``http.cookies.Morsel`` objects.�_cookies�Cookie)	�hasattrr��cookies�SimpleCookier�r^�parse_cookierP�	Exception)r1�parsedrCrDs    r%r�zHTTPServerRequest.cookies�s����t�Z�(�(�	!���)�)�+�+�
�M��4�<�'�'�!�)�$�,�x�*@�A�A�F�!'�����!�!���1�!�/0�D�M�!�,�,��(�!�!�!�!�D�	!����!��!�����D������}�s#�B�2
A=�=
B
�	B
�
B�Bc�6�|jdz|jz|jzS)z+Reconstructs the full URL for this request.z://)r�r�r�rss r%�full_urlzHTTPServerRequest.full_url�s���}�u�$�t�y�0�4�8�;�;r'c�d�|j�tj��|jz
S|j|jz
S)z?Returns the amount of time it took for this request to execute.)r�r�r�rss r%�request_timezHTTPServerRequest.request_time�s0����$��9�;�;��!1�1�1��$�t�'7�7�7r'F�binary_formc��	|j�dS|jjj�|���S#t$rYdSwxYw)a>Returns the client's SSL certificate, if any.

        To use client certificates, the HTTPServer's
        `ssl.SSLContext.verify_mode` field must be set, e.g.::

            ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
            ssl_ctx.load_cert_chain("foo.crt", "foo.key")
            ssl_ctx.load_verify_locations("cacerts.pem")
            ssl_ctx.verify_mode = ssl.CERT_REQUIRED
            server = HTTPServer(app, ssl_options=ssl_ctx)

        By default, the return value is a dictionary (or None, if no
        client certificate is present).  If ``binary_form`` is true, a
        DER-encoded form of the certificate is returned instead.  See
        SSLSocket.getpeercert() in the standard library for more
        details.
        http://docs.python.org/library/ssl.html#sslsocket-objects
        N)r�)r��stream�socket�getpeercertr)r1r�s  r%�get_ssl_certificatez%HTTPServerRequest.get_ssl_certificate�s`��*	���&��t��?�)�0�<�<�'�=���
���	�	�	��4�4�	���s�0�$0�
>�>c� �t|j�dd��|j|j|j|j��|j���D]3\}}|j�|g���	|���4dS)N�Content-Typer{)
�parse_body_argumentsr^rLr�r�r�rPr��
setdefault�extend)r1rCrDs   r%�_parse_bodyzHTTPServerRequest._parse_body�s�����L���^�R�0�0��I����J��L�	
�	
�	
��'�-�-�/�/�	7�	7�D�A�q��N�%�%�a��,�,�3�3�A�6�6�6�6�	7�	7r'c�n��d}d��fd�|D����}�jj�d|�d�S)N)r�r�r�r�r�r�z, c�:��g|]}|�dt�|������S)�=)r�)r#�nr1s  �r%r&z.HTTPServerRequest.__repr__.<locals>.<listcomp>�s/���I�I�I�a�Q�Q�Q���a�(8�(8�(8�9�I�I�Ir'�(�))r(�	__class__r~)r1�attrsr5s`  r%�__repr__zHTTPServerRequest.__repr__�sH���M���y�y�I�I�I�I�5�I�I�I�J�J���>�2�2�2�D�D�D�9�9r')
NNr�NNNNNNN)F�rN)r~rr�r�r�r��_body_futurerrjr,�bytesrrr�r2�propertyr�r��Morselr��floatr�r�rr�r�r�r!r'r%r�r�s�������Z�Z�x�D��E��L�!%�!�!�)-� $�"�7;�15�37�.2�&!�&!���
�&!��c�]�&!��	&!�
�+�&�&!��u�o�
&!��s�m�&!���S�$�z�"2�2�3�4�&!��-�.�&!��/�0�&!�$�F�+�&!�
�&!�&!�&!�&!�P���c�4�<�#6�6�7�����X��,<�#�<�<�<�<�8�e�8�8�8�8�#(�����	�t�T�5� �	!�����>
7�
7�
7�
7�:�#�:�:�:�:�:�:r'r�c��eZdZdZdS)rXzqException class for malformed HTTP requests or responses
    from remote sources.

    .. versionadded:: 4.0
    N�r~rr�r�r!r'r%rXrX�s��������	�Dr'rXc��eZdZdZdS)�HTTPOutputErrorzJException class for errors in HTTP output.

    .. versionadded:: 4.0
    Nr�r!r'r%r�r��s��������
	�Dr'r�c�6�eZdZdZdeddddfd�Zdeddfd	�ZdS)
�HTTPServerConnectionDelegatez_Implement this interface to handle requests from `.HTTPServer`.

    .. versionadded:: 4.0
    �server_conn�request_connr�r�HTTPMessageDelegatec��t���)ajThis method is called by the server when a new request has started.

        :arg server_conn: is an opaque object representing the long-lived
            (e.g. tcp-level) connection.
        :arg request_conn: is a `.HTTPConnection` object for a single
            request/response exchange.

        This method should return a `.HTTPMessageDelegate`.
        ��NotImplementedError)r1r�r�s   r%�
start_requestz*HTTPServerConnectionDelegate.start_request�s��"�#�#�#r'Nc��dS)z�This method is called when a connection has been closed.

        :arg server_conn: is a server connection that has previously been
            passed to ``start_request``.
        Nr!)r1r�s  r%�on_closez%HTTPServerConnectionDelegate.on_close
�	��	
�r')r~rr�r�r�r�r�r!r'r%r�r��sl��������
$�!�$�1A�$�	�$�$�$�$�
�F�
�t�
�
�
�
�
�
r'r�c��eZdZdZdeddedeedfd�Zde	deedfd	�Z
dd
�Zdd�ZdS)
r�z_Implement this interface to handle an HTTP request or response.

    .. versionadded:: 4.0
    r��r��ResponseStartLiner^rNc��dS)a�Called when the HTTP headers have been received and parsed.

        :arg start_line: a `.RequestStartLine` or `.ResponseStartLine`
            depending on whether this is a client or server message.
        :arg headers: a `.HTTPHeaders` instance.

        Some `.HTTPConnection` methods can only be called during
        ``headers_received``.

        May return a `.Future`; if it does the body will not be read
        until it is done.
        Nr!)r1r�r^s   r%�headers_receivedz$HTTPMessageDelegate.headers_receiveds	��"	
�r'�chunkc��dS)ziCalled when a chunk of data has been received.

        May return a `.Future` for flow control.
        Nr!�r1r�s  r%�
data_receivedz!HTTPMessageDelegate.data_received-s	��
	
�r'c��dS)z6Called after the last chunk of data has been received.Nr!rss r%�finishzHTTPMessageDelegate.finish4r3r'c��dS)z�Called if the connection is closed without finishing the request.

        If ``headers_received`` is called, either ``finish`` or
        ``on_connection_close`` will be called, but not both.
        Nr!rss r%�on_connection_closez'HTTPMessageDelegate.on_connection_close8r�r'r�)
r~rr�r�rr,rrr�r�r�r�r�r!r'r%r�r�s���������
��A�B�
��
�
�)�D�/�	"�	
�
�
�
�&
�5�
�X�i��o�-F�
�
�
�
�
�
�
�
�
�
�
�
�
�
r'r�c	�^�eZdZdZ	ddeddedeeddfd	�Zdeddfd
�Z	d
d�Z
dS)r�zYApplications use this interface to write their responses.

    .. versionadded:: 4.0
    Nr�r�r^r�rzFuture[None]c��t���)aWrite an HTTP header block.

        :arg start_line: a `.RequestStartLine` or `.ResponseStartLine`.
        :arg headers: a `.HTTPHeaders` instance.
        :arg chunk: the first (optional) chunk of data.  This is an optimization
            so that small responses can be written in the same call as their
            headers.

        The ``version`` field of ``start_line`` is ignored.

        Returns a future for flow control.

        .. versionchanged:: 6.0

           The ``callback`` argument was removed.
        r�)r1r�r^r�s    r%�
write_headerszHTTPConnection.write_headersGs��,"�#�#�#r'c��t���)z�Writes a chunk of body data.

        Returns a future for flow control.

        .. versionchanged:: 6.0

           The ``callback`` argument was removed.
        r�r�s  r%�writezHTTPConnection.write_s��"�#�#�#r'c��t���)z3Indicates that the last body data has been written.r�rss r%r�zHTTPConnection.finishjs��!�#�#�#r'r/r�)r~rr�r�rr,rr�r�r�r�r!r'r%r�r�As���������"&�	$�$��A�B�$��$����	$�

�$�$�$�$�0	$�5�	$�^�	$�	$�	$�	$�$�$�$�$�$�$r'r��urlr5.c	�d�|�|St|��}t|t��r>t|jd���}|�|�����n�t|t��st|t��r,t|jd���}|�|��n1d�	t|����}t|���t|��}t|d|d|d|d||d	f��}|S)
aConcatenate url and arguments regardless of whether
    url has existing query parameters.

    ``args`` may be either a dictionary or a list of key-value pairs
    (the latter allows for multiple values with the same key.

    >>> url_concat("http://example.com/foo", dict(c="d"))
    'http://example.com/foo?c=d'
    >>> url_concat("http://example.com/foo?a=b", dict(c="d"))
    'http://example.com/foo?a=b&c=d'
    >>> url_concat("http://example.com/foo?a=b", [("c", "d"), ("c", "d2")])
    'http://example.com/foo?a=b&c=d&c=d2'
    NTr�z7'args' parameter should be dict, list or tuple. Not {0}rr:���)rr?�dictr	r�r�rP�list�tuple�format�type�	TypeErrorrr)r�r5�
parsed_url�parsed_query�err�final_querys      r%�
url_concatros(��&�|��
��#���J��$����
� ��!1�T�J�J�J�����D�J�J�L�L�)�)�)�)�	�D�$�	�	��:�d�E�#:�#:�� ��!1�T�J�J�J�����D�!�!�!�!�G�N�N���J�J�
�
����n�n���L�)�)�K�
��q�M��q�M��q�M��q�M���q�M�
	
�	�	�C��Jr'c�2�eZdZUdZeed<eed<eed<dS)r�z�Represents a file uploaded via a form.

    For backwards compatibility, its instance attributes are also
    accessible as dictionary keys.

    * ``filename``
    * ``body``
    * ``content_type``
    �filenamer��content_typeN)r~rr�r�rj�__annotations__r�r!r'r%r�r��s<����������M�M�M�
�K�K�K������r'r��range_headerc�Z�|�d��\}}}|���|���}}|dkrdS|�d��\}}}	t|��}t|��}n#t$rYdSwxYw|�|�|dkr|}d}n|dz
}||fS)agParses a Range header.

    Returns either ``None`` or tuple ``(start, end)``.
    Note that while the HTTP headers use inclusive byte positions,
    this method returns indexes suitable for use in slices.

    >>> start, end = _parse_request_range("bytes=1-2")
    >>> start, end
    (1, 3)
    >>> [0, 1, 2, 3, 4][start:end]
    [1, 2]
    >>> _parse_request_range("bytes=6-")
    (6, None)
    >>> _parse_request_range("bytes=-6")
    (-6, None)
    >>> _parse_request_range("bytes=-0")
    (None, 0)
    >>> _parse_request_range("bytes=")
    (None, None)
    >>> _parse_request_range("foo=42")
    >>> _parse_request_range("bytes=1-2,6-10")

    Note: only supports one range (ex, ``bytes=1-2,6-10`` is not allowed).

    See [0] for the details of the range header.

    [0]: http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-range-latest.html#byte.ranges
    r�r�Nrrr:)r�r[�_int_or_nonerZ)r�unit�_rE�start_b�end_b�start�ends        r%�_parse_request_ranger�s���>"�+�+�C�0�0�N�D�!�U��*�*�,�,����
�
�%�D��w����t�����,�,��G�Q����W�%�%���5�!�!���������t�t�����
���=��a�x�x��������1�H�C��3�<�s�$B�
B�Brr�totalc�.�|pd}|p|dz
}d|�d|�d|��S)z�Returns a suitable Content-Range header:

    >>> print(_get_content_range(None, 1, 4))
    bytes 0-0/4
    >>> print(_get_content_range(1, 3, 4))
    bytes 1-2/4
    >>> print(_get_content_range(None, None, 4))
    bytes 0-3/4
    rr:zbytes r�/r!)rrrs   r%�_get_content_ranger�s4��
�J�Q�E��<�%�1�
�C�C�$�u�u�c�c�c�5�5�1�1r'�valc�X�|���}|dkrdSt|��S)Nr{)r[r�)rs r%rr�s(��

�)�)�+�+�C�
�b�y�y��t��s�8�8�Or'rr�r�r�r^c��|�d��r�|rd|vrtd|dz���	t|d���}n%#t$r}td|z��|�d}~wwxYw|���D]0\}}|r)|�|g���|���1dS|�d��r�|rd|vrtd|dz���	|�d	��}	|	D]W}
|
����	d
��\}}}
|dkr$|
r"tt|
��|||��dS�Xtd���#t$r}td
|z��|�d}~wwxYwdS)aFParses a form request body.

    Supports ``application/x-www-form-urlencoded`` and
    ``multipart/form-data``.  The ``content_type`` parameter should be
    a string and ``body`` should be a byte string.  The ``arguments``
    and ``files`` parameters are dictionaries that will be updated
    with the parsed contents.
    z!application/x-www-form-urlencodedzContent-Encodingz Unsupported Content-Encoding: %sTr�z&Invalid x-www-form-urlencoded body: %sNzmultipart/form-data�;r��boundaryzmultipart boundary not foundzInvalid multipart/form-data: %s)�
startswithrXrr�rPr�r�r)r[r��parse_multipart_form_datar)rr�r�r�r^�
uri_arguments�errQ�fields�fieldrCr�rDs              r%r�r��s�����B�C�C�O��	�)�W�4�4� �2�W�=O�5P�P���
�	�*�4�4�H�H�H�M�M���	�	�	� �!I�A�!M�N�N�TU�U�����	����*�/�/�1�1�	>�	>�L�D�&��
>��$�$�T�2�.�.�5�5�f�=�=�=��	>�	>�
�	 �	 �!6�	7�	7�O��	�)�W�4�4� �2�W�=O�5P�P���
�
	O�!�'�'��,�,�F��
E�
E��!�K�K�M�M�3�3�C�8�8�	��3���
�?�?�q�?�-�d�1�g�g�t�Y��N�N�N��E�E��$�%C�D�D�D���	O�	O�	O� �!B�Q�!F�G�G�Q�N�����	O����O�Os6�A�
A)�A$�$A)�'A,E%�E%�%
F�/F�Fr#�datac�&�|�d��r|�d��r
|dd�}|�d|zdz��}|dkrtd���|d|��d|zdz��}|D�]�}|s�|�d��}|dkrtd	���t�|d|��d
����}|�	dd��}	t|	��\}
}|
d
ks|�d��std���||dzd�}|�	d��std���|d}
|�	d��rW|�	dd��}|�|
g���t|d||�������\|�|
g���|�����dS)a]Parses a ``multipart/form-data`` body.

    The ``boundary`` and ``data`` parameters are both byte strings.
    The dictionaries given in the arguments and files parameters
    will be updated with the contents of the body.

    .. versionchanged:: 5.1

       Now recognizes non-ASCII filenames in RFC 2231/5987
       (``filename*=``) format.
    �"r:rUs--z4Invalid multipart/form-data: no final boundary foundNs
s

z#multipart/form-data missing headerszutf-8zContent-Dispositionr{z	form-datazInvalid multipart/form-data����rz multipart/form-data missing namerr�zapplication/unknown)rr�r)r$rb�rfindrXr)�findr,re�decoderL�
_parse_headerr�rHr�)r#r*r�r��final_boundary_index�parts�part�eohr^�disp_header�disposition�disp_paramsrEr�ctypes               r%r%r%&s>��,���4� � �"�X�%6�%6�t�%<�%<�"��A�b�D�>���:�:�e�h�&6��&>�?�?���r�!�!��S�T�T�T��&�&�&�'�-�-�e�h�.>��.H�I�I�E��9�9���	���i�i��$�$���"�9�9� �!F�G�G�G��#�#�D��#��J�$5�$5�g�$>�$>�?�?���k�k�"7��<�<��#0��#=�#=� ��[��+�%�%�T�]�]�7�-C�-C�%� �!>�?�?�?��S�1�W�r�\�"�����v�&�&�	E� �!C�D�D�D��6�"���?�?�:�&�&�	9��K�K��0E�F�F�E����T�2�&�&�-�-��(��4�5�u����
�
�
�
�
� � ��r�*�*�1�1�%�8�8�8�8�/9�9r'�tsc��t|ttf��r|}n�t|ttjf��rt
j|��}nSt|tj��r't
j|�	����}ntd|z���tj�
|d���S)aFormats a timestamp in the format used by HTTP.

    The argument may be a numeric timestamp as returned by `time.time`,
    a time tuple as returned by `time.gmtime`, or a `datetime.datetime`
    object.

    >>> format_timestamp(1359312200)
    'Sun, 27 Jan 2013 18:43:20 GMT'
    zunknown timestamp type: %rT)�usegmt)r?r�r�rr��struct_time�calendar�timegm�datetime�utctimetupler�email�utils�
formatdate)r;�time_nums  r%�format_timestamprG\s����"�s�E�l�#�#�;����	�B��� 0�1�	2�	2�;��?�2�&�&���	�B��)�	*�	*�;��?�2�?�?�#4�#4�5�5����4�r�9�:�:�:��;�!�!�(�4�!�8�8�8r'r�)r�r�r�z^HTTP/1\.[0-9]$rRc���	|�d��\}}}n#t$rtd���wxYwt�|��std|z���t|||��S)z�Returns a (method, path, version) tuple for an HTTP 1.x request line.

    The response is a `collections.namedtuple`.

    >>> parse_request_start_line("GET /foo HTTP/1.1")
    RequestStartLine(method='GET', path='/foo', version='HTTP/1.1')
    rTzMalformed HTTP request linez/Malformed HTTP version in HTTP Request-Line: %r)r)rZrX�_http_version_re�matchr�)rRr�r�r�s    r%�parse_request_start_linerK{s���<� $�
�
�3������g�g���<�<�<��:�;�;�;�<�����!�!�'�*�*�
��=��G�
�
�	
��F�D�'�2�2�2s��6r�)r��code�reasonz (HTTP/1.[0-9]) ([0-9]+) ([^\r]*)c�$�t|��}t�|��}|std���t	|�d��t
|�d����|�d����S)z�Returns a (version, code, reason) tuple for an HTTP 1.x response line.

    The response is a `collections.namedtuple`.

    >>> parse_response_start_line("HTTP/1.1 200 OK")
    ResponseStartLine(version='HTTP/1.1', code=200, reason='OK')
    z!Error parsing response start liner:r�r)r
�_http_response_line_rerJrXr��groupr�)rRrJs  r%�parse_response_start_linerQ�st���d���D�"�(�(��.�.�E��B��@�A�A�A��U�[�[��^�^�S����Q���-@�-@�%�+�+�a�.�.�Q�Q�Qr'�sc#��K�d}|�d|��|kr�|dz
}|�d|��}|d}}|dkr]||�d||��|�d||��z
z
}|dzdkrn!||�d|dz��}}|dk�]|dkrt|��}|||�}|���V�|}|�d|��|k��dSdS)Nrr"r:�"z\"r�)r0�countr>r[)rRrr�ind�diff�fs      r%�_parseparamrY�s����
�E�
�&�&��e�
�
��
%�
%�
��
���f�f�S�%� � ���1�T���A�g�g��A�G�G�C��c�*�*�Q�W�W�U�C��-E�-E�E�E�D��a�x�1�}�}���A�F�F�3��a��0�0��C�	�A�g�g�
��7�7��a�&�&�C�
�e�C�i�L���g�g�i�i�������&�&��e�
�
��
%�
%�
%�
%�
%�
%r'c��td|z��}t|��}dg}|D]�}|�d��}|dkrq|d|�������}||dzd����}|�|t
|��f����tj�	|��}|�
d��i}	|D]^\}}
tj�|
��}t|��dkr"|ddkr|d	dkr
|dd	�}||	|<�_||	fS)
aYParse a Content-type like header.

    Return the main content-type and a dictionary of options.

    >>> d = "form-data; foo=\"b\\\\a\\\"r\"; file*=utf-8''T%C3%A4st"
    >>> ct, d = _parse_header(d)
    >>> ct
    'form-data'
    >>> d['file'] == r'T\u00e4st'.encode('ascii').decode('unicode_escape')
    True
    >>> d['foo']
    'b\\a"r'
    r")�DummyrEr�rNr:r�rTrU)
rY�nextr0r[r�rHr
rCrD�
decode_paramsrG�collapse_rfc2231_valuer>)rRr4�key�params�p�irrE�decoded_params�pdict�
decoded_values           r%r2r2�sO��
��d�
�#�#�E�
�u�+�+�C� �
!�F�
�5�5��
�F�F�3�K�K����6�6��R�a�R�5�;�;�=�=�&�&�(�(�D��a�!�e�g�g�J�$�$�&�&�E��M�M�4��E�!2�!2�3�4�4�4���[�.�.�v�6�6�N����q�����E�-�����m���2�2�=�A�A���u�:�:��?�?�u�Q�x�3���5��9��3C�3C��!�B�$�K�E���d�����:�r'r_rdc���|s|S|g}t|�����D]7\}}|�|�|���|�|�d|�����8d�|��S)z�Inverse of _parse_header.

    >>> _encode_header('permessage-deflate',
    ...     {'client_max_window_bits': 15, 'client_no_context_takeover': None})
    'permessage-deflate; client_max_window_bits=15; client_no_context_takeover'
    Nr�z; )�sortedrPrHr()r_rd�outrCrDs     r%�_encode_headerri�s������
��%�C��u�{�{�}�}�%�%�)�)���1��9��J�J�q�M�M�M�M�
�J�J�!�!�!�Q�Q�'�(�(�(�(��9�9�S�>�>�r'�username�passwordc���t|t��rtjd|��}t|t��rtjd|��}t	|��dzt	|��zS)z�Encodes a username/password pair in the format used by HTTP auth.

    The return value is a byte string in the form ``username:password``.

    .. versionadded:: 5.1
    �NFC�:)r?r�unicodedata�	normalizer)rjrks  r%�encode_username_passwordrqsh���(�L�)�)�:��(���9�9���(�L�)�)�:��(���9�9����>�>�D� �4��>�>�1�1r'c�2�ddl}|���S)Nr)�doctest�DocTestSuite)rss r%�doctestsrus���N�N�N����!�!�!r'z^(.+):(\d+)$�netlocc��t�|��}|r8|�d��}t|�d����}n|}d}||fS)z�Returns ``(host, port)`` tuple from ``netloc``.

    Returned ``port`` will be ``None`` if not present.

    .. versionadded:: 4.1
    r:r�N)�
_netloc_rerJrPr�)rvrJr��ports    r%r�r�s[��
���V�$�$�E����{�{�1�~�~���5�;�;�q�>�>�"�"��������$�<�r'�qsc#�TK�|���D]\}}|D]}||fV��	�dS)zgGenerator converting a result of ``parse_qs`` back to name-value pairs.

    .. versionadded:: 5.0
    N)rP)rzrC�vsrDs    r%�	qs_to_qslr}-sP����
���������2��	�	�A��a�&�L�L�L�L�	��r'z\\(?:([0-3][0-7][0-7])|(.))�mc�h�|dr#tt|dd����S|dS)Nr:�r�)�chrr�)r~s r%�_unquote_replacer�:s1����t���3�q��t�Q�<�<� � � ���t�r'c��|�t|��dkr|S|ddks|ddkr|S|dd�}tt|��S)z�Handle double quotes and escaping in cookie values.

    This method is copied verbatim from the Python 3.13 standard
    library (http.cookies._unquote) so we don't have to depend on
    non-public interfaces.
    Nr�rrTrUr:)r>�_unquote_subr�)rRs r%�_unquote_cookier�As\��	�y�C��F�F�Q�J�J�����t�s�{�{�a��e�s�l�l���	
�!�B�$��A��(�!�,�,�,r'�cookiec�b�i}|�td����D]�}td��|vr'|�td��d��\}}ntd��|}}|���|���}}|s|rt|��||<��|S)a[Parse a ``Cookie`` HTTP header into a dict of name/value pairs.

    This function attempts to mimic browser cookie parsing behavior;
    it specifically does not follow any of the cookie-related RFCs
    (because browsers don't either).

    The algorithm used is identical to that used by Django version 1.9.10.

    .. versionadded:: 4.4.2
    r"r�r:r{)r)rjr[r�)r��
cookiedictr�r_rs     r%r�r�\s����J����c�#�h�h�'�'�
3�
3���s�8�8�u����{�{�3�s�8�8�Q�/�/�H�C����2�w�w���C��9�9�;�;��	�	���S���	3�#�	3�-�c�2�2�J�s�O���r'r/)`r�r?�collections.abc�collectionsryrA�email.utilsrC�	functoolsr�http.clientr�http.cookiesr��re�sslrr�ro�urllib.parserrrr	�tornado.escaper
rr�tornado.utilr
rr�rrrrrrrrrrr�
TYPE_CHECKINGr�asyncior�unittestrjr*�abc�MutableMappingr,r�r�r�rXr�r�r�r�rr�r�rrrr�r�r%r�rr>rG�
namedtupler��compilerIrKr�rOrQrYr2rirqrurxr�r}�subr��Matchr�r�r�r!r'r%�<module>r�s6�� ����������������������������!�!�!�!�!�!�����	�	�	�	���������������C�C�C�C�C�C�C�C�C�C�C�C�;�;�;�;�;�;�;�;�;�;�1�1�1�1�1�1�1�1�

�	�
�
�
�
���������������������������
����������������O�O�O���4���?�C�?�C�?�?�?���?�w�w�w�w�w�+�/�0�w�w�w�t[:�[:�[:�[:�[:��[:�[:�[:�|	�	�	�	�	�Y�	�	�	�	�	�	�	�	�i�	�	�	�
�
�
�
�
�6�
�
�
�:+
�+
�+
�+
�+
�&�+
�+
�+
�\+$�+$�+$�+$�+$�V�+$�+$�+$�\,�	�,�
��d�3��8�n�d�5��c��?�3�U�5��c��?�C�;O�5P�P��,�
	�,�,�,�,�^
�
�
�
�
�z�
�
�
� 0��0�
�e�H�S�M�8�C�=�0�1�2�0�0�0�0�f2�h�s�m�2�(�3�-�2��2�PS�2�2�2�2��c��h�s�m�����&*�,O�,O��,O�
�,O��C��e��$�%�,O���T�(�^�#�$�	,O�
�k�
"�,O�
�
,O�,O�,O�,O�^39��39�
�39��C��e��$�%�39���T�(�^�#�$�	39�

�39�39�39�39�l9�
�c�5�%��!1�8�3D�D�E�9��9�9�9�9�.*�;�)��5�5�5����
�2�:�0�1�1��3�3�3�+;�3�3�3�3�*+�K�*��6�6�6����
$���$G�H�H��R�C�R�,=�R�R�R�R�B�3��9�S�$��_�5�����$ �� ��c�4��S��>�&9� :� � � � �F���D��c��N��s�����(
2��C��J��
2�+0��e��+<�
2�
�
2�
2�
2�
2� "�"�"��R�Z��
(�
(�
�����c�8�C�=�.@�(A�����"�$�s�D��L�(�)��h�u�S�&�[�7I�.J������r�z�8�9�9�=������S�����-�s�-�s�-�-�-�-�6����c�3�h�������r'

Youez - 2016 - github.com/yon3zu
LinuXploit