Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
3 N”ªjÅ�ã@s˜dZdZddlmZmZmZddlmZddlZddl Z ddl Z ddl m Z ddlmZddlmZddlZddlZddlZd d d d d ddddddddddgZdadadd„Zdd„Zdd„Zdd „Zeadade jddd!fd"d „Zd6d#d „Z d7d$d „Z!d%d„Z"d&d'„Z#d(d„Z$Gd)d „d ƒZ%Gd*d „d ƒZ&e jfd+d„Z'd8d,d„Z(e jfd-d„Z)d.d„Z*d/d„Z+d0d„Z,d1d„Z-d9d2d„Z.d3d4„Z/e0d5k�r”e'ƒdS):z�Support module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python. z2.6é)ÚStringIOÚBytesIOÚ TextIOWrapper)ÚMappingN)Ú FeedParser)ÚMessage)ÚwarnÚMiniFieldStorageÚ FieldStorageÚparseÚparse_qsÚ parse_qslÚparse_multipartÚ parse_headerÚtestÚprint_exceptionÚ print_environÚ print_formÚprint_directoryÚprint_argumentsÚprint_environ_usageÚescapeÚc GsHtr.t r.yttdƒaWntk r,YnXts8tantat|ŽdS)a„Write a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message). ÚaN)ÚlogfileÚlogfpÚopenÚOSErrorÚnologÚlogÚdolog)Úallargs©r"ú/usr/lib64/python3.6/cgi.pyÚinitlog:s r$cGstj||dƒdS)z=Write a log message to the log file. See initlog() for docs.Ú N)rÚwrite)ZfmtÚargsr"r"r#r ]sr cGsdS)z9Dummy function, assigned to log when logging is disabled.Nr")r!r"r"r#rasrcCsdatrtjƒdatadS)zClose the log file.rN)rrÚcloser$rr"r"r"r#Úcloseloges r)ú&c CsZ|dkrtj}t|dƒr |j}nd}t|tƒr4|j}d|krDd|d<|ddk�rt|dƒ\}}|dkrtt||ƒS|d kr®t |d ƒ}t rœ|t krœt d ƒ‚|j |ƒj |ƒ} nd } d |krÔ| rÆ| d} | |d } n*tjdd…�rþ| rð| d} | tjd} | |d <nZd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Zd:d;„Z dS)?r aÉStore a sequence of fields, reading multipart/form-data. This class provides naming, typing, files stored on disk, and more. At the top level, it is accessible like a dictionary, whose keys are the field names. (Note: None can occur as a field name.) The items are either a Python list (if there's multiple values) or another FieldStorage or MiniFieldStorage object. If it's a single object, it has the following attributes: name: the field name, if specified; otherwise None filename: the filename, if specified; otherwise None; this is the client side filename, *not* the file name on which it is stored (that's a temporary file you don't deal with) value: the value as a *string*; for file uploads, this transparently reads the file every time you request the value and returns *bytes* file: the file(-like) object from which you can read the data *as bytes* ; None if the data is stored a simple string type: the content-type, or None if not specified type_options: dictionary of options specified on the content-type line disposition: content-disposition, or None if not specified disposition_options: dictionary of corresponding options headers: a dictionary(-like) object (sometimes email.message.Message or a subclass thereof) containing *all* headers The class is subclassable, mostly for the purpose of overriding the make_file() method, which is called internally to come up with a file open for reading and writing. This makes it possible to override the default choice of storing all files in a temporary directory and unlinking them as soon as they have been opened. NrJrzutf-8rlr*c  CsRd} ||_||_| |_| |_d|kr0|djƒ} d|_| dksF| dkržd|krX|d} ntjdd…rrtjd} nd} | jt j ƒdƒ} t | ƒ}|dkržd d i}|dkröi}| d krºd |d <d |krÎ|d |d <d|krà|d|_d |krô|d |d<nt |t tfƒ�stdƒ‚||_|dk�r*tjj|_nÚencodeÚlocaleÚgetpreferredencodingrr7rrÚ TypeErrorrZr5r8r@rr6r+ÚerrorsrXrzrtÚ outerboundaryÚ bytes_readÚlimitrr}r~rMrxÚ _binary_filer|Ú innerboundaryr9r;r:Úlengthryr{ÚdoneÚread_urlencodedÚ read_multiÚ read_single)rqr@rZr‰rArBrCr‹r+rˆr�r3ÚmethodrGZcdisprErDZclenr"r"r#rr™s®/                         zFieldStorage.__init__c Cs(y|jjƒWntk r"YnXdS)N)r{r(ÚAttributeError)rqr"r"r#Ú__del__=szFieldStorage.__del__cCs|S)Nr")rqr"r"r#Ú __enter__CszFieldStorage.__enter__cGs|jjƒdS)N)r{r()rqr'r"r"r#Ú__exit__FszFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rMrxrp)rqr"r"r#rsIszFieldStorage.__repr__cCs t|jƒƒS)N)ÚiterÚkeys)rqr"r"r#Ú__iter__NszFieldStorage.__iter__cCsT|dkrt|ƒ‚|jr:|jjdƒ|jjƒ}|jjdƒn|jdk rL|j}nd}|S)Nrpr)r”r{Úseekr<ry)rqrMrpr"r"r#Ú __getattr__Qs   zFieldStorage.__getattr__cCsb|jdkrtdƒ‚g}x"|jD]}|j|kr|j|ƒqW|sFt|ƒ‚t|ƒdkrZ|dS|SdS)zDictionary style indexing.Nz not indexabler2r)ryr‡rMrUÚKeyErrorrb)rqr]ÚfoundÚitemr"r"r#Ú __getitem__^s    zFieldStorage.__getitem__cCs8||kr0||}t|tƒr(dd„|DƒS|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|] }|j‘qSr")rp)Ú.0Úxr"r"r#ú qsz)FieldStorage.getvalue..N)r7ryrp)rqr]Údefaultrpr"r"r#Úgetvaluels  zFieldStorage.getvaluecCs4||kr,||}t|tƒr$|djS|jSn|SdS)z! Return the first value received.rN)r7ryrp)rqr]r¤rpr"r"r#Úgetfirstws   zFieldStorage.getfirstcCs:||kr2||}t|tƒr(dd„|DƒS|jgSngSdS)z Return list of received values.cSsg|] }|j‘qSr")rp)r¡r¢r"r"r#r£‡sz(FieldStorage.getlist..N)r7ryrp)rqr]rpr"r"r#Úgetlist‚s   zFieldStorage.getlistcCs*|jdkrtdƒ‚ttdd„|jDƒƒƒS)zDictionary style keys() method.Nz not indexablecss|] }|jVqdS)N)rM)r¡rŸr"r"r#ú ‘sz$FieldStorage.keys..)ryr‡Úset)rqr"r"r#r™�s zFieldStorage.keyscs*|jdkrtdƒ‚t‡fdd„|jDƒƒS)z%Dictionary style __contains__ method.Nz not indexablec3s|]}|jˆkVqdS)N)rM)r¡rŸ)r]r"r#r¨—sz,FieldStorage.__contains__..)ryr‡Úany)rqr]r")r]r#Ú __contains__“s zFieldStorage.__contains__cCs t|jƒƒS)z Dictionary style len(x) support.)rbr™)rqr"r"r#Ú__len__™szFieldStorage.__len__cCs|jdkrtdƒ‚t|jƒS)NzCannot be converted to bool.)ryr‡Úbool)rqr"r"r#Ú__bool__�s zFieldStorage.__bool__c Cs–|jj|jƒ}t|tƒs0td|jt|ƒjfƒ‚|j|j |j ƒ}|j rT|d|j 7}t j j||j|j|j |j |j|jd�}dd„|Dƒ|_|jƒdS)z+Internal: read data in query string format.z%s should return bytes, got %sr*)r+rˆr�r3cSsg|]\}}t||ƒ‘qSr")r )r¡r]rpr"r"r#r£¯sz0FieldStorage.read_urlencoded..N)r@r<rŽr7rXr;rzrtr=r+rˆrƒr?r r rBrCr�r3ryÚ skip_lines)rqrGÚqueryr"r"r#r�¢s  zFieldStorage.read_urlencodedc Cs@|j}t|ƒstd|fƒ‚g|_|jrftjj|j|j|j |j |j |j |j d�}|jjdd„|Dƒƒ|jpp|j}|jjƒ}t|tƒsžtd|jt|ƒjfƒ‚|jt|ƒ7_x6|jƒd|jkræ|ræ|jjƒ}|jt|ƒ7_q²W|j }|dk �r|t|jƒ8}�x*tƒ} d} x$|jjƒ} | | 7} | jƒ�sP�qW| �sBP|jt| ƒ7_| j| j|j |j ƒƒ| jƒ} d | k�r‚| d =||j| |||||j|j|j |j ||j ƒ } |dk �rè|d 8}| j�rÖ|t| jƒ8}|d k�rètd ƒ‚|j| j7_|jj| ƒ| j �s,|j|j!k�o$d kn�r P�q W|j"ƒdS) z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %r)r+rˆr�r3css|]\}}t||ƒVqdS)N)r )r¡r]rpr"r"r#r¨¿sz*FieldStorage.read_multi..z%s should return bytes, got %ss--NrJzcontent-lengthr2rzMax number of fields exceeded)#r�rPr;ryrƒr?r r rBrCr+rˆr�r3ÚextendÚFieldStorageClassÚ __class__r@rRr7rXrzrtrŠrbrcrZfeedr=r(r‹rUr�rŽr¯)rqrArBrCZibr°ÚklassZ first_liner�ÚparserZhdr_textrYrZÚpartr"r"r#r‘´sh             (zFieldStorage.read_multicCs4|jdkr|jƒ|jƒn|jƒ|jjdƒdS)zInternal: read an atomic part.rN)rŽÚ read_binaryr¯Ú read_linesr{r›)rqr"r"r#r’÷s   zFieldStorage.read_singleéicCs–|jƒ|_|j}|dkr’xx|dkr�|jjt||jƒƒ}t|tƒsXt d|jt |ƒj fƒ‚|j t |ƒ7_ |svd|_P|jj|ƒ|t |ƒ}qWdS)zInternal: read binary data.rz%s should return bytes, got %sr2NrN)Ú make_filer{rŽr@r<ÚminÚbufsizer7rXr;rzrtrŠrbr�r&)rqZtodorYr"r"r#r·s    zFieldStorage.read_binarycCs@|jrtƒ|_|_ntƒ|_|_|jr4|jƒn|jƒdS)z0Internal: read lines until EOF or outerboundary.N)rŒrr{Ú_FieldStorage__filerr‰Úread_lines_to_outerboundaryÚread_lines_to_eof)rqr"r"r#r¸s  zFieldStorage.read_linescCsv|jdk rF|jjƒt|ƒdkrF|jƒ|_|jjƒ}|jj|ƒd|_|jrZ|jj|ƒn|jj|j|j |j ƒƒdS)z line is always bytes, not stringNiè) r½Útellrbrºr{r¥r&rŒr=r+rˆ)rqr\rYr"r"r#Z__writes    zFieldStorage.__writecCs>x8|jjdƒ}|jt|ƒ7_|s,d|_P|j|ƒqWdS)zInternal: read lines until EOF.r2éNirN)r@rRrŠrbr�Ú_FieldStorage__write)rqr\r"r"r#r¿-s zFieldStorage.read_lines_to_eofc Cs,d|j}|d}d}d}d}�x||jkr.P|jjd ƒ}|jt|ƒ7_|t|ƒ7}|sdd|_P|dkrx||}d}|jdƒr¨|r¨|jƒ}||kr˜P||kr¨d|_P|}|j dƒrÌd}|d d…}d}nJ|j d ƒrìd }|d d…}d}n*|j dƒ�rd}|d d…}d }nd}d }|j ||ƒq"Wd S)zžInternal: read lines until outerboundary. Data is read as bytes: boundaries and line ends must be converted to bytes for comparisons. s--rJTrr2rÁó s NrHrLFirNrOrNrN) r‰r‹r@rRrŠrbr�rSrTÚendswithrÂ) rqÚ next_boundaryÚ last_boundaryZdelimÚlast_line_lfendZ_readr\Ú strippedlineZodelimr"r"r#r¾7sP          z(FieldStorage.read_lines_to_outerboundarycCs–|j s|jrdSd|j}|d}d}xh|jjdƒ}|jt|ƒ7_|sTd|_P|jdƒr„|r„|jƒ}||krtP||kr„d|_P|jdƒ}q*WdS) z5Internal: skip lines until outer boundary if defined.Ns--Tr2rÁrLirN)r‰r�r@rRrŠrbrÄrc)rqrÅrÆrÇr\rÈr"r"r#r¯hs&  zFieldStorage.skip_linescCs&|jrtjdƒStjd|jdd�SdS)a¯Overridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version opens a temporary file for reading and writing, and immediately deletes (unlinks) it. The trick (on Unix!) is that the file can still be used, but it can't be opened by another process, and it will automatically be deleted when it is closed or when the current process terminates. If you want a more permanent file, you derive a class which overrides this method. If you want a visible temporary file that is nevertheless automatically deleted when the script terminates, try defining a __del__ method in a derived class which unlinks the temporary files you have created. zwb+zw+r%)r+ÚnewlineN)rŒÚtempfileZ TemporaryFiler+)rqr"r"r#rº~s zFieldStorage.make_file)N)Ni )!rtrurvrwÚosrArrr•r–r—rsršrœr r¥r¦r§r™r«r¬r®r�r²r‘r’r¼r·r¸rÂr¿r¾r¯rºr"r"r"r#r ns@*"   C   1cCsÂtdƒtƒtjt_yNtƒ}tƒtƒt|ƒt|ƒt ƒdd„}|fdd„}tdƒ|ƒWnt ƒYnXtdƒda y&tƒ}tƒtƒt|ƒt|ƒWnt ƒYnXd S) z—Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. zContent-type: text/htmlcSs tdƒdS)Nz,testing print_exception() -- italics?)Úexecr"r"r"r#rf±sztest..fcSs |ƒdS)Nr")rfr"r"r#Úg³sztest..gz9

What follows is a test, not an actual exception:

z*

Second try with a small maxlen...

é2N) Úprintr4ÚstdoutÚstderrr rrrrrrr:)rAÚformrfrÍr"r"r#r s4    cCsx|dkrtjƒ\}}}ddl}tƒtdƒ|j||ƒ|j||ƒ}tdtjdj|dd…ƒƒtj|dƒfƒ~dS)Nrz+

Traceback (most recent call last):

z
%s%s
rr2rNrN) r4Úexc_infoÚ tracebackrÏÚ format_tbÚformat_exception_onlyÚhtmlrrV)rzrpÚtbr‹rÔryr"r"r#rÇs cCs`t|jƒƒ}tƒtdƒtdƒx*|D]"}tdtj|ƒdtj||ƒƒq(WtdƒtƒdS)z#Dump the shell environment as HTML.z

Shell Environment:

z
z
z
z
N)Úsortedr™rÏr×r)rAr™r]r"r"r#rÕs  "cCs¤t|jƒƒ}tƒtdƒ|s&tdƒtdƒxb|D]Z}tdtj|ƒddd�||}tdtjtt|ƒƒƒd ƒtd tjt|ƒƒƒq4Wtd ƒtƒd S) z$Dump the contents of a form as HTML.z

Form Contents:

z

No form fields.z

z
ú:ú )rezzz
z
N)rÙr™rÏr×rÚreprrz)rÒr™r]rpr"r"r#ràs  cCsjtƒtdƒy tjƒ}Wn6tk rP}ztdtjt|ƒƒƒWYdd}~XnXttj|ƒƒtƒdS)z#Dump the current directory as HTML.z#

Current Working Directory:

zOSError:N)rÏrËÚgetcwdrr×rÚstr)ÚpwdÚmsgr"r"r#rðs &cCs(tƒtdƒtƒttjƒtƒdS)Nz

Command Line Arguments:

)rÏr4r>r"r"r"r#rüs  cCs tdƒdS)z9Dump a list of environment variables used by CGI as HTML.aØ

These environment variables could have been set:

  • AUTH_TYPE
  • CONTENT_LENGTH
  • CONTENT_TYPE
  • DATE_GMT
  • DATE_LOCAL
  • DOCUMENT_NAME
  • DOCUMENT_ROOT
  • DOCUMENT_URI
  • GATEWAY_INTERFACE
  • LAST_MODIFIED
  • PATH
  • PATH_INFO
  • PATH_TRANSLATED
  • QUERY_STRING
  • REMOTE_ADDR
  • REMOTE_HOST
  • REMOTE_IDENT
  • REMOTE_USER
  • REQUEST_METHOD
  • SCRIPT_NAME
  • SERVER_NAME
  • SERVER_PORT
  • SERVER_PROTOCOL
  • SERVER_ROOT
  • SERVER_SOFTWARE
In addition, HTTP headers sent by the server may be passed in the environment as well. Here are some common variable names:
  • HTTP_ACCEPT
  • HTTP_CONNECTION
  • HTTP_HOST
  • HTTP_PRAGMA
  • HTTP_REFERER
  • HTTP_USER_AGENT
N)rÏr"r"r"r#rs'cCsFtdtdd�|jddƒ}|jddƒ}|jdd ƒ}|rB|jd d ƒ}|S) zDeprecated API.z1cgi.escape is deprecated, use html.escape insteadrH)Ú stacklevelr*z&úz>r_z")rrIrl)rdZquoter"r"r#r2s     cCs(ddl}t|tƒrd}nd}|j||ƒS)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)Úrer7rXÚmatch)rdräZ _vb_patternr"r"r#rP>s  rPÚ__main__)rr)rr)NNNN)N)1rwÚ __version__ÚiorrrÚ collectionsrr4rËZ urllib.parser?Z email.parserrZ email.messagerÚwarningsrr×r…rÊÚ__all__rrr$r rr)rr:rAr r r rrgrr r rrrrrrrrrPrtr"r"r"r#Úsb     # H  d 6'   /