PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  ]c@sdZddlmZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl mZmZmZddlmZddlmZdd lmZdd lmZdd lmZd d dfZdefdYZdefdYZdZdZ dZ!ej"r:e#nej$Z%de&fdYZ'dej(fdYZ)dej(fdYZ*dej(fdYZ+dej(fdYZ,d Z-d!Z.d"e&fd#YZ/d$Z0d%Z1dS(&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(tRequestDataTooBigtSuspiciousMultipartFormtTooManyFieldsSent(tSkipFiletStopFutureHandlerst StopUpload(tsix(tMultiValueDict(t force_text(tunquote(tunescape_entitiesuMultiPartParseruMultiPartParserErroruInputStreamExhaustedtMultiPartParserErrorcBseZRS((t__name__t __module__(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR stInputStreamExhaustedcBseZdZRS(u5 No more reads are allowed from this device. (RRt__doc__(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR"surawufileufieldtMultiPartParsercBs>eZdZddZdZdZdZdZRS(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|jdd}|jds4td|nt|jd\}}|jd}| sutj| rtd|nyt|jdd } Wntt fk rd } nX| d krtd | nt |t j r|jd}n||_ ||_g|D]} | jr | j^q } tdg| |_||_|pitj|_| |_||_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. u CONTENT_TYPEuu multipart/uInvalid Content-Type: %suasciiuboundaryu!Invalid boundary in multipart: %suCONTENT_LENGTHiuInvalid content length: %riiiNIi(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?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyt__init__7s.    %  c" CsWddlm}|j}|j}|jdkrJ|d|jtfSxS|D]K}|j|j|j|j|j |}|dk rQ|d|dfSqQW|dt |_ t|_ tt|j|j}d}dgt|}d} d} d} yxt||j D]\} } }|rH|j||d}ny"| dd}|dj}Wntttfk rqnX| jd }|dk r|dj}nt||d d }| tkr| d7} tjdk rtj| krtd ntjdk r/tj| } n|d kr|jd| }| t|7} yt j!|}Wqt"k r|}qXn"|jd| }| t|7} | t|d7} tjdk r| tjkrt#dn|j j$|t||d d q| t%kr|jd}|rct||d d }|j&t'|}n|soqn| jddif\}}|j}|jd}yt(| jdd}Wn tt)t*fk rd}nXdgt|}yxC|D];}y |j+||||||Wqt,k r?PqXqWxF|D]>}|d kr*dj-|j.}t|d}xL|dkr|jd|}|dj-|j.7}t|d}qWyt j!|}Wq*t/k r&}d|}t0j1t2t2|t3j4dq*Xnx\t5|D]N\}}t|} |j6|||}||c| 7<|dkr7Pq7q7WqKWWn%t7k r|j8t9|qX|}qt9|qWWn6t:k r}|j8|j;st9|jqnXt9|jx$|D]}|j<}!|!rPqqWt=|j _>|j |j fS(u Parse the POST data and break it into a FILES MultiValueDict and a POST MultiValueDict. Return a tuple containing the POST and FILES dictionary, respectively. i(t QueryDictiR,itmutableucontent-dispositionunameucontent-transfer-encodingterrorsureplaceuRThe number of GET/POST parameters exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS.ubase64tsizeiu;Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.ufilenameu content-typeuucharsetucontent-lengthtiu Could not decode base64 data: %rN(?t django.httpR5R%R'R&R thandle_raw_inputRR#RtNonetTruet_postt_filest LazyStreamt ChunkIterR"tlentParserthandle_file_completetstriptKeyErrort IndexErrortAttributeErrorRR tFIELDRtDATA_UPLOAD_MAX_NUMBER_FIELDSRtDATA_UPLOAD_MAX_MEMORY_SIZEtreadtbase64t b64decodet_BASE64_DECODE_ERRORRt appendlisttFILEt IE_sanitizeR RRRtnew_fileRtjointsplitt ExceptionRtreraiseR tsystexc_infot enumeratetreceive_data_chunkRt _close_filestexhaustRtconnection_resettupload_completetFalset_mutable("R(R5R,thandlersthandlertresulttstreamtold_field_nametcounterstnum_bytes_readt num_post_keyst read_sizet item_typet meta_datat field_streamt dispositiont field_namettransfer_encodingtraw_datatdatat file_nameR-tcontent_type_extratcharsetR1tchunktstripped_chunkt remainingt over_chunktetmsgtit chunk_lengthtretval((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pytparsejs      "        %          *           cCsfx_t|jD]N\}}|j||}|r|jjt||jdd|PqqWdS(uT Handle all the signaling that takes place when a file is complete. R7ureplaceN(RZR't file_completeR?RPR R%(R(RfRgR|Rctfile_obj((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRD's %cCs!|o ||jddjS(u3Cleanup filename from Internet Explorer full paths.u\i(trfindRE(R(tfilename((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRR2scCs7x0|jD]%}t|dr |jjq q WdS(Nufile(R'thasattrtfiletclose(R(Rc((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR\6sN( RRRR<R4RRDRRR\(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR0s  3 R@cBs\eZdZd dZdZd dZdZdZdZ dZ dZ RS( 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. R9iN(t _producerR`t_emptyt _leftovertlengthtpositiont _remainingt_unget_history(R(tproducerR((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR4Gs      cCs|jS(N(R(R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyttellVscs(fd}dj|}|S(Nc3sdkrjn}|dkr9djVdSx}|dkr|dks`tdyt}Wntk rdSX|| }j|||t|8}|Vq<WdS(NR9iu0remaining bytes to read should never go negative(R<RRTtAssertionErrortnextt StopIterationtungetRB(RxRvtemitting(R(R8(s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pytpartsZs   R9(RT(R(R8Rtout((R(R8s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRLYscCsO|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. R9(RRRRRRB(R(toutput((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyt__next__ts    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(R(R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRscCs|S(N((R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyt__iter__scCsQ|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. NR9(t_update_unget_historyRBRRTR(R(tbytes((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs cCsd|g|jd |_tg|jD]}||kr$|^q$}|dkr`tdndS(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(uThe 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(RRBR(R(t num_bytestcurrent_numbert number_equal((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs N( RRRR<R4RRLRRRRR(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR@?s      RAcBs,eZdZddZdZdZRS(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(RR ((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR4s cCsMy|jj|j}Wntk r5tnX|r@|StdS(N(RRLR RR(R(Rr((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs  cCs|S(N((R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRsi(RRRR4RR(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRAs  tInterBoundaryItercBs)eZdZdZdZdZRS(u7 A Producer that will iterate over boundaries. cCs||_||_dS(N(t_streamR(R(ReR0((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR4s cCs|S(N((R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRscCs>ytt|j|jSWntk r9tnXdS(N(R@t BoundaryIterRRRR(R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs (RRRR4RR(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs  RcBs5eZdZdZdZdZedZRS(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}|sRtn|jj|dS(Nii( RRR`t_doneRBt _rollbackRLRR(R(ReR0t unused_char((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR4s    cCs|S(N((R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRsc Cs1|jrtn|j}|j}d}g}xN|D]=}|t|7}|j|||krmPn|s:Pq:q:Wt|_|stndj|}|j|t||jk}|r|\}} |j || t|_|| S|| st|_|S|j || || SdS(NiR9( RRRRRBtappendR=RTt_find_boundaryR( R(Retrollbackt bytes_readtchunksRRvR0tendR((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs8         !    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 boundary 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(tfindRR<RBtmax(R(RrteoftindexRRtlast((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR%s    (RRRR4RRR`R(((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyRs     )cCsHyt|}Wn tk r2t|d}nXx|D]}q:WdS(uExhaust an iterator or stream.i@N(titerRRA(tstream_or_iterabletiteratort__((s?/usr/lib/python2.7/site-packages/django/http/multipartparser.pyR]?s   c Cs+|j|}|jd}d}|dkrM|j|ti|fS|| }|j||dt}i}x|jdD]v}y||\} \} } Wntk rqnX| dkrt}| jdrt}qn| | f|| s>    ua ; #