403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.15.226.5
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/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/web_log.cpython-38.pyc
U

'�7`J�@s�ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZedd	�ZGd
d�de�ZdS)�N)�
namedtuple)�Any�Callable�Dict�Iterable�List�Tuple�)�AbstractAccessLogger)�BaseRequest)�StreamResponse�	KeyMethodz
key methodcs�eZdZdZdddddddd	d
ddd
�ZdZe�d�Ze�d�Z	iZ
efeje
dd��fdd�
Ze
ee
eefd�dd�Zee
eeee
d�dd��Zee
eeee
d�dd��Zeeeee
d�dd��Zeeeee
d�d d!��Zeeeee
d�d"d#��Zeeeee
d�d$d%��Zeeeeed�d&d'��Zeeeeed�d(d)��Zeeeee
d�d*d+��Z eeeee
d�d,d-��Z!eeeee
d�d.d/��Z"eeee#ee
e$eeege
ffd�d0d1�Z%eeedd�d2d3�Z&�Z'S)4�AccessLoggera�Helper object to log access.

    Usage:
        log = logging.getLogger("spam")
        log_format = "%a %{User-Agent}i"
        access_logger = AccessLogger(log, log_format)
        access_logger.log(request, response, time)

    Format:
        %%  The percent sign
        %a  Remote IP-address (IP-address of proxy if using reverse proxy)
        %t  Time when the request was started to process
        %P  The process ID of the child that serviced the request
        %r  First line of request
        %s  Response status code
        %b  Size of response in bytes, including HTTP headers
        %T  Time taken to serve the request, in seconds
        %Tf Time taken to serve the request, in seconds with floating fraction
            in .06f format
        %D  Time taken to serve the request, in microseconds
        %{FOO}i  request.headers['FOO']
        %{FOO}o  response.headers['FOO']
        %{FOO}e  os.environ['FOO']

    Zremote_addressZrequest_start_timeZ
process_idZfirst_request_lineZresponse_statusZ
response_sizeZrequest_timeZrequest_time_fracZrequest_time_microZrequest_headerZresponse_header)�a�t�P�r�s�b�TZTf�D�i�oz/%a %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"z.%(\{([A-Za-z0-9\-_]+)\}([ioe])|[atPrsbOD]|Tf?)z(%[^s])N)�logger�
log_format�returncsDt�j||d�tj�|�}|s4|�|�}|tj|<|\|_|_dS)z�Initialise the logger.

        logger is a logger object to be used for logging.
        log_format is a string with apache compatible log format description.

        )rN)�super�__init__r�
_FORMAT_CACHE�get�compile_format�_log_format�_methods)�selfrrZ_compiled_format��	__class__��B/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/web_log.pyr>s

zAccessLogger.__init__)rrcCs�t�}|j�|�D]�}|ddkrN|j|d}ttd|d�}t||�}n>|j|d|df}ttd|d�}t|t�||d��}|�	|�q|j�
d|�}|j�
d|�}||fS)a�Translate log_format into form usable by modulo formatting

        All known atoms will be replaced with %s
        Also methods for formatting of those atoms will be added to
        _methods in appropriate order

        For example we have log_format = "%a %t"
        This format will be translated to "%s %s"
        Also contents of _methods will be
        [self._format_a, self._format_t]
        These method will be called and results will be passed
        to translated string format.

        Each _format_* method receive 'args' which is list of arguments
        given to self.log

        Exceptions are _format_e, _format_i and _format_o methods which
        also receive key name (by functools.partial)

        r	�rz
_format_%s�z%sz%\1)�list�	FORMAT_RE�findall�LOG_FORMAT_MAP�getattrrr
�	functools�partial�append�sub�
CLEANUP_RE)r#r�methodsZatomZformat_key1�mZ
key_methodZformat_key2r&r&r'r NszAccessLogger.compile_format)�key�request�response�timercCs|dkrdS|j�|d�S)Nz(no headers)�-��headersr�r6r7r8r9r&r&r'�	_format_iwszAccessLogger._format_icCs|j�|d�S�Nr:r;r=r&r&r'�	_format_o�szAccessLogger._format_o)r7r8r9rcCs"|dkrdS|j}|dk	r|SdSr?)Zremote)r7r8r9Zipr&r&r'�	_format_a�szAccessLogger._format_acCs$tj��}|tj|d�}|�d�S)N)�secondsz[%d/%b/%Y:%H:%M:%S +0000])�datetime�utcnow�	timedelta�strftime)r7r8r9�nowZ
start_timer&r&r'�	_format_t�s
zAccessLogger._format_tcCsdt��S)Nz<%s>)�os�getpid�r7r8r9r&r&r'�	_format_P�szAccessLogger._format_PcCs(|dkrdSd�|j|j|jj|jj�S)Nr:z{} {} HTTP/{}.{})�format�methodZpath_qs�version�major�minorrKr&r&r'�	_format_r�s�zAccessLogger._format_rcCs|jS�N)�statusrKr&r&r'�	_format_s�szAccessLogger._format_scCs|jSrS)�body_lengthrKr&r&r'�	_format_b�szAccessLogger._format_bcCstt|��SrS��str�roundrKr&r&r'�	_format_T�szAccessLogger._format_TcCsd|S)Nz%06fr&rKr&r&r'�
_format_Tf�szAccessLogger._format_TfcCstt|d��S)Ni@BrXrKr&r&r'�	_format_D�szAccessLogger._format_Dcs���fdd�|jD�S)Ncs g|]\}}||����f�qSr&r&)�.0r6rNrKr&r'�
<listcomp>�sz-AccessLogger._format_line.<locals>.<listcomp>)r")r#r7r8r9r&rKr'�_format_line�szAccessLogger._format_linecCs�z�|�|||�}t�}t�}|D]J\}}|�|�|jtkrF|||<q |\}	}
|�|	i�}|||
<|||	<q |jj|j	t
|�|d�Wn tk
r�|j�d�YnXdS)N)�extrazError in logging)
r`r*�dictr1r%rYrr�infor!�tuple�	Exception�	exception)r#r7r8r9Zfmt_info�valuesrar6�valueZk1Zk2�dctr&r&r'�log�s



zAccessLogger.log)(�__name__�
__module__�__qualname__�__doc__r-Z
LOG_FORMAT�re�compiler+r3r�logging�LoggerrYrrrr
r �staticmethodrr�floatr>r@rArHrLrR�intrUrWr[r\r]rrr`rj�
__classcell__r&r&r$r'rsr�

)�	�
�r)rCr/rqrIro�collectionsr�typingrrrrrr�abcr
Zweb_requestrZweb_responserr
rr&r&r&r'�<module>s 


Youez - 2016 - github.com/yon3zu
LinuXploit