Your IP : 18.119.255.183


Current Path : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/cgi.cpython-36.pyc

3

� fҐ�@s�dZdZddlmZmZmZddlmZddlZddl	Z	ddl
Zddlm
Z
ddlmZddlmZddlZddlZddlZd	d
dd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�cGsHtr.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"�(/opt/alt/python36/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�td��|j|�j
|�}	nd}	d
|kr�|	r�|	d}	|	|d
}	n*tjdd��r�|	r�|	d}	|	tjd}	|	|d
<n<d
|k�r|d
}	n(tjdd��r8tjd}	nd}	|	|d
<tjj|	||||d�S)a�Parse a query in the environment or from a file (default stdin)

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        separator: str. The symbol to use for separating the query arguments.
            Defaults to &.
    N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-dataz!application/x-www-form-urlencoded�CONTENT_LENGTHzMaximum content length exceededr�QUERY_STRINGr*�)r+�	separator)�sys�stdin�hasattrr+�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibrr)
�fp�environ�keep_blank_values�strict_parsingr3r+�ctype�pdict�clength�qsr"r"r#rxsH





cCstdtd�tjj|||�S)z)Parse a query given as a string argument.z=cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead�)r�DeprecationWarningr?rr)rGrBrCr"r"r#r�scCstdtd�tjj|||�S)z)Parse a query given as a string argument.z?cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl insteadrH)rrIr?rr
)rGrBrCr"r"r#r
�scCs�ddl}d}d|kr|d}t|�s2td|f��d|}d|d}i}d}�x�||k�r�d}d}	|r�|jj|�}
|
jd�}|r�yt|�}Wntk
r�YnX|dkr�tr�|tkr�td	��|j|�}	nd}	g}xD|j	�}
|
s�|}P|
j
d��r|
j�}|||fk�rP|j|
�q�W|	dk�r&qR|dk�r�|�r�|d}
|
dd�dk�r^|
dd�}
n|
dd�dk�r||
dd�}
|
|d<dj
|�}	|
d
}
|
�s�qRt|
�\}}|dk�r�qRd|krR|d}nqR||k�r�||j|	�qR|	g||<qRW|S)a�Parse multipart input.

    Arguments:
    fp   : input file
    pdict: dictionary containing other parameters of content-type header

    Returns a dictionary just like parse_qs(): keys are the field names, each
    value is a list of values for that field.  This is easy to use but not
    much good if you are expecting megabytes to be uploaded -- in that case,
    use the FieldStorage class instead which is much more flexible.  Note
    that content-type is the raw, unparsed contents of the content-type
    header.

    XXX This does not parse nested multipart parts -- use FieldStorage for
    that.

    XXX This should really be subsumed by FieldStorage altogether -- no
    point in having two implementations of the same parsing algorithm.
    Also, FieldStorage protects itself better against certain DoS attacks
    by limiting the size of the data read in one chunk.  The API here
    does not support that kind of protection.  This also affects parse()
    since it can call parse_multipart().

    rN��boundaryz&Invalid boundary in multipart form: %rs--r2zcontent-lengthzMaximum content length exceededrHs
�
zcontent-dispositionz	form-data�name���rN���rOrNrNrN)Zhttp.client�valid_boundaryr;ZclientZ
parse_headers�getr9r:r<�readline�
startswith�rstrip�append�joinr)r@rEZhttprKZnextpartZlastpartZpartdict�
terminator�bytes�data�headersrF�lines�line�keyZparamsrMr"r"r#r�s|







ccs�x�|dd�dkr�|dd�}|jd�}x<|dkrd|jdd|�|jdd|�drd|jd|d�}q*W|dkrvt|�}|d|�}|j�V||d�}qWdS)Nr2�;r�"z\"rH)�find�count�len�strip)�s�end�fr"r"r#�_parseparam1s
*
rgcCs�td|�}|j�}i}x�|D]�}|jd�}|dkr|d|�j�j�}||dd�j�}t|�dkr�|d|dko�dknr�|dd�}|jdd	�jd
d�}|||<qW||fS)
zfParse a Content-type like header.

    Return the main content-type and a dictionary of options.

    r^�=rNr2rHr_z\\�\z\"rNrN)rg�__next__r`rc�lowerrb�replace)r\�partsr]rE�p�irM�valuer"r"r#r=s

,c@s@eZdZdZdZdZdZdZiZdZ	iZ
iZdd�Zdd�Z
dS)r	z=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.N)rMrp)�selfrMrpr"r"r#�__init__cszMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r))rMrp)rqr"r"r#�__repr__iszMiniFieldStorage.__repr__)�__name__�
__module__�__qualname__�__doc__�filename�list�type�file�type_options�disposition�disposition_optionsrZrrrsr"r"r"r#r	Usc@s�eZdZdZdddejdddddddfdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
d<dd�Zd=dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�ZdZd(d)�Zd*d+�Zd>Zd.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}|dkr�d
|d	<d|kr�|d|d	<d|kr�|d|_d
|kr�|d
|d<nt|t
tf��std��||_|dk�r*tjj|_n<t|t��r@|j|_n&t|d��oTt|d��s`td��||_||_|	|_t|t��s�tdt|�j��||_d|_||_di}}d|jk�r�t|jd�\}}||_||_ d|_!d|k�r�|d|_!d|_"d|k�r
|d|_"|j"dk	|_#d	|jk�r6t|jd	�\}}n(|j�sH|dk�rTdi}}n
d
i}}||_||_$d|k�r�|dj|j�|_%nd|_%d}d|jk�r�yt&|jd�}Wnt'k
�r�YnXt(�r�|t(k�r�t'd��||_)|jdk�r�|�r�||_d|_*|_+d|_,|d
k�r$|j-�n*|dd�dk�rF|j.|||�n|j/�dS)a$Constructor.  Read multipart/* until last part.

        Arguments, all optional:

        fp              : file pointer; default: sys.stdin.buffer
            (not used when the request method is GET)
            Can be :
            1. a TextIOWrapper object
            2. an object whose read() and readline() methods return bytes

        headers         : header dictionary-like object; default:
            taken from environ as per CGI spec

        outerboundary   : terminating multipart boundary
            (for internal use only)

        environ         : environment dictionary; default: os.environ

        keep_blank_values: flag indicating whether blank values in
            percent-encoded forms should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.

        limit : used internally to read parts of multipart/form-data forms,
            to exit from the reading loop when reached. It is the difference
            between the form content-length and the number of bytes already
            read

        encoding, errors : the encoding and error handler used to decode the
            binary stream to strings. Must be the same as the charset defined
            for the page sending the form (content-type : meta http-equiv or
            header)

        max_num_fields: int. If set, then __init__ throws a ValueError
            if there are more than n fields read by parse_qsl().

        r-r,NZHEADr1r2r�surrogateescapezcontent-typez!application/x-www-form-urlencodedr.r/r0zcontent-lengthz?headers must be mapping or an instance of email.message.Messager<rRzfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrMrxz
text/plainrKrJzMaximum content length exceeded�
z
multipart/rN)0rBrC�max_num_fieldsr3�upper�
qs_on_postr4r>�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__cCs(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#�
<listcomp>qsz)FieldStorage.getvalue.<locals>.<listcomp>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.<locals>.<listcomp>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#�	<genexpr>�sz$FieldStorage.keys.<locals>.<genexpr>)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__.<locals>.<genexpr>)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
�}|jrT|d|j7}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.<locals>.<listcomp>N)r@r<r�r7rXr;rzrtr=r+r�r�r?rr
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}|dk�r�td��|j|
j7_|jj|
�|
j �s,|j|j!k�o$dkn�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.<locals>.<genexpr>z%s should return bytes, got %ss--NrJzcontent-lengthr2rzMax number of fields exceeded)#r�rPr;ryr�r?rr
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
|�jf��|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�day&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() -- <I>italics?</I>)�execr"r"r"r#rf�sztest.<locals>.fcSs
|�dS)Nr")rfr"r"r#�g�sztest.<locals>.gz9<H3>What follows is a test, not an actual exception:</H3>z*<H1>Second try with a small maxlen...</H1>�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+<H3>Traceback (most recent call last):</H3>z<PRE>%s<B>%s</B></PRE>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<H3>Shell Environment:</H3>z<DL>z<DT>z<DD>z</DL>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<H3>Form Contents:</H3>z<P>No form fields.z<DL>z<DT>�:� )rez<i>z</i>z<DD>z</DL>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#<H3>Current Working Directory:</H3>zOSError:N)r�r��getcwdrr�r�str)�pwd�msgr"r"r#r�s&cCs(t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r4r>r"r"r"r#r�s

cCstd�dS)z9Dump a list of environment variables used by CGI as HTML.a�
<H3>These environment variables could have been set:</H3>
<UL>
<LI>AUTH_TYPE
<LI>CONTENT_LENGTH
<LI>CONTENT_TYPE
<LI>DATE_GMT
<LI>DATE_LOCAL
<LI>DOCUMENT_NAME
<LI>DOCUMENT_ROOT
<LI>DOCUMENT_URI
<LI>GATEWAY_INTERFACE
<LI>LAST_MODIFIED
<LI>PATH
<LI>PATH_INFO
<LI>PATH_TRANSLATED
<LI>QUERY_STRING
<LI>REMOTE_ADDR
<LI>REMOTE_HOST
<LI>REMOTE_IDENT
<LI>REMOTE_USER
<LI>REQUEST_METHOD
<LI>SCRIPT_NAME
<LI>SERVER_NAME
<LI>SERVER_PORT
<LI>SERVER_PROTOCOL
<LI>SERVER_ROOT
<LI>SERVER_SOFTWARE
</UL>
In addition, HTTP headers sent by the server may be passed in the
environment as well.  Here are some common variable names:
<UL>
<LI>HTTP_ACCEPT
<LI>HTTP_CONNECTION
<LI>HTTP_HOST
<LI>HTTP_PRAGMA
<LI>HTTP_REFERER
<LI>HTTP_USER_AGENT
</UL>
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&amp;�<z&lt;�>z&gt;r_z&quot;)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:rArrr
rrgrr	r
rrrrrrrrrPrtr"r"r"r#�<module>sb#	H

d6'
/



?>