AlkantarClanX12

Your IP : 18.191.93.18


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/cgi.cpython-35.opt-1.pyc



��YfΌ�@sOdZdZddlmZmZmZddlmZddlZddl	Z	ddl
Zddlm
Z
ddlmZddlmZddlZddlZddlZd	d
ddd
dddddddddgZdadadd�Zdd�Zdd�Zdd�Zeadade	jddd d�Zddd!d�Z ddd"d
�Z!d#d�Z"d$d%�Z#d&d�Z$Gd'd	�d	�Z%Gd(d
�d
�Z&e	jd)d*�Z'ddddd+d�Z(e	jd,d�Z)d-d�Z*d.d�Z+d/d�Z,d0d�Z-dd1d�Z.d2d3�Z/e0d4krKe'�dS)5z�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�print_exception�
print_environ�
print_form�print_directory�print_arguments�print_environ_usage�escape�cGsXtr5tr5yttd�aWntk
r4YnXtsDtantat|�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/python35/lib64/python3.5/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]srcGsdS)z9Dummy function, assigned to log when logging is disabled.Nr!)r r!r!r"rasrcCs&datrtj�datadS)zClose the log file.rN)rr�closer#rr!r!r!r"�closeloges

r(c	Cs�|dkrtj}t|d�r0|j}nd}t|t�rN|j}d|krdd|d<|ddkrlt|d�\}}|dkr�t||�S|d	kr�t	|d
�}t
r�|t
kr�td��|j|�j
|�}nd}d
|kr+|r|d}||d
}n4tjdd�r_|rN|d}|tjd}||d
<nLd
|kr�|d
}n3tjdd�r�tjd}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.
    N�encodingzlatin-1�REQUEST_METHOD�GET�POST�CONTENT_TYPEzmultipart/form-dataz!application/x-www-form-urlencoded�CONTENT_LENGTHzMaximum content length exceededr�QUERY_STRING�&�)�sys�stdin�hasattrr)�
isinstancer�bufferrr�int�maxlen�
ValueError�read�decode�argv�urllibrr)	�fp�environ�keep_blank_values�strict_parsingr)�ctype�pdict�clength�qsr!r!r"rxsH		






cCs&tdtd�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)rEr@rAr!r!r"r�s
cCs&tdtd�tjj|||�S)z)Parse a query given as a string argument.z?cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl insteadrF)rrGr=rr
)rEr@rAr!r!r"r
�s
cCs�ddl}d}d|kr(|d}t|�sGtd|f��d|}d|d}i}d}x!||kr�d}d}	|r|jj|�}
|
jd�}|r�yt|�}Wntk
r�YnX|dkrtr|tkrtd	��|j|�}	nd}	g}xX|j	�}
|
s<|}P|
j
d�rj|
j�}|||fkrjP|j|
�q#W|	dkr�qn|dkr|r|d}
|
dd�dkr�|
dd�}
n&|
dd�dkr�|
dd�}
|
|d<dj
|�}	|
d
}
|
s!qnt|
�\}}|dkrBqnd|krn|d}nqn||kr~||j|	�qn|	g||<qnW|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--r1zcontent-lengthzMaximum content length exceededrFs
s
zcontent-dispositionz	form-data�name���rK���rLrKrKrK)Zhttp.client�valid_boundaryr9ZclientZ
parse_headers�getr7r8r:�readline�
startswith�rstrip�append�joinr)r>rCZhttprIZnextpartZlastpartZpartdict�
terminator�bytes�data�headersrD�lines�line�keyZparamsrJr!r!r"r�s|







ccs�x�|dd�dkr�|dd�}|jd�}xR|dkr�|jdd|�|jdd|�dr�|jd|d�}q;W|dkr�t|�}|d|�}|j�V||d�}qWdS)Nr1�;r�"z\"rF)�find�count�len�strip)�s�end�fr!r!r"�_parseparam-s;rdcCs�td|�}|j�}i}x�|D]�}|jd�}|dkr)|d|�j�j�}||dd�j�}t|�dkr�|d|dko�dknr�|dd�}|jdd	�jd
d�}|||<q)W||fS)
zfParse a Content-type like header.

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

    r[�=rNr1rFr\z\\�\z\"rKrK)rd�__next__r]r`�lowerr_�replace)rY�partsrZrC�p�irJ�valuer!r!r"r9s
6c@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)rJrm)�selfrJrmr!r!r"�__init___s	zMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r))rJrm)rnr!r!r"�__repr__eszMiniFieldStorage.__repr__)�__name__�
__module__�__qualname__�__doc__�filename�list�type�file�type_options�disposition�disposition_optionsrWrorpr!r!r!r"r	Qsc@sreZdZdZdddejddddddd�	Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�Zddd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�ZdZd'd(�Zd)d*�Zd;Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�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.

    NrHrzutf-8ric
Cshd}
||_||_d|kr4|dj�}
d|_|
dksU|
dkr�d|krn|d}n)tjdd�r�tjd}nd}|jtj�d�}t	|�}|dkr�d	d
i}|dkrKi}|
dkr�d
|d	<d|kr|d|d	<d|kr.|d|_d
|krl|d
|d<n!t
|ttf�slt
d��||_|dkr�tjj|_nQt
|t�r�|j|_n3t|d�o�t|d�s�t
d��||_||_|	|_t
|t�st
dt|�j��||_d|_||_di}}
d|jkrnt|jd�\}}
||_|
|_d|_d|
kr�|
d|_d|_ d|
kr�|
d|_ |j dk	|_!d	|jkrt|jd	�\}}
n2|js|
dkr&di}}
n
d
i}}
||_|
|_"d|
krm|
dj|j�|_#n	d|_#d}d|jkr�yt$|jd�}Wnt%k
r�YnXt&r�|t&kr�t%d��||_'|jdkr�|r�||_d|_(|_)d|_*|d
kr.|j+�n6|dd�dkrZ|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)

        r+r*NZHEADr/r1r�surrogateescapezcontent-typez!application/x-www-form-urlencodedr,r-r.zcontent-lengthz?headers must be mapping or an instance of email.message.Messager:rOzfp must be file pointerz#outerboundary must be bytes, not %srzcontent-dispositionrJruz
text/plainrIrHzMaximum content length exceeded�
z
multipart/rK).r@rA�upper�
qs_on_postr2r<�encode�locale�getpreferredencodingrr5rr�	TypeErrorrWr3r6r>rr4r)�errorsrUrwrq�
outerboundary�
bytes_read�limitrrzr{rJru�_binary_filery�
innerboundaryr7r9r8�lengthrvrx�done�read_urlencoded�
read_multi�read_single)rnr>rWr�r?r@rAr�r)r��methodrEZcdisprCrBZclenr!r!r"ro�s�+			
	

							
			
	

			
			
zFieldStorage.__init__cCs*y|jj�Wntk
r%YnXdS)N)rxr'�AttributeError)rnr!r!r"�__del__3s
zFieldStorage.__del__cCs|S)Nr!)rnr!r!r"�	__enter__9szFieldStorage.__enter__cGs|jj�dS)N)rxr')rnr&r!r!r"�__exit__<szFieldStorage.__exit__cCsd|j|j|jfS)z"Return a printable representation.zFieldStorage(%r, %r, %r))rJrurm)rnr!r!r"rp?szFieldStorage.__repr__cCst|j��S)N)�iter�keys)rnr!r!r"�__iter__DszFieldStorage.__iter__cCsx|dkrt|��|jrS|jjd�|jj�}|jjd�n!|jdk	rn|j}nd}|S)Nrmr)r�rx�seekr:rv)rnrJrmr!r!r"�__getattr__Gs	zFieldStorage.__getattr__cCs�|jdkrtd��g}x-|jD]"}|j|kr+|j|�q+W|sct|��t|�dkr}|dS|SdS)zDictionary style indexing.Nz
not indexabler1r)rvr�rJrR�KeyErrorr_)rnrZ�found�itemr!r!r"�__getitem__TszFieldStorage.__getitem__cCsH||kr@||}t|t�r6dd�|D�S|jSn|SdS)z8Dictionary style get() method, including 'value' lookup.cSsg|]}|j�qSr!)rm)�.0�xr!r!r"�
<listcomp>gs	z)FieldStorage.getvalue.<locals>.<listcomp>N)r5rvrm)rnrZ�defaultrmr!r!r"�getvaluebs

zFieldStorage.getvaluecCsB||kr:||}t|t�r0|djS|jSn|SdS)z! Return the first value received.rN)r5rvrm)rnrZr�rmr!r!r"�getfirstms

zFieldStorage.getfirstcCsK||krC||}t|t�r6dd�|D�S|jgSngSdS)z  Return list of received values.cSsg|]}|j�qSr!)rm)r�r�r!r!r"r�}s	z(FieldStorage.getlist.<locals>.<listcomp>N)r5rvrm)rnrZrmr!r!r"�getlistxs

zFieldStorage.getlistcCs;|jdkrtd��ttdd�|jD���S)zDictionary style keys() method.Nz
not indexablecss|]}|jVqdS)N)rJ)r�r�r!r!r"�	<genexpr>�sz$FieldStorage.keys.<locals>.<genexpr>)rvr��set)rnr!r!r"r��szFieldStorage.keyscs;|jdkrtd��t�fdd�|jD��S)z%Dictionary style __contains__ method.Nz
not indexablec3s|]}|j�kVqdS)N)rJ)r�r�)rZr!r"r��sz,FieldStorage.__contains__.<locals>.<genexpr>)rvr��any)rnrZr!)rZr"�__contains__�szFieldStorage.__contains__cCst|j��S)z Dictionary style len(x) support.)r_r�)rnr!r!r"�__len__�szFieldStorage.__len__cCs(|jdkrtd��t|j�S)NzCannot be converted to bool.)rvr��bool)rnr!r!r"�__bool__�szFieldStorage.__bool__cCs�|jj|j�}t|t�sFtd|jt|�jf��|j|j	|j
�}|jrx|d|j7}g|_t
jj||j|jd|j	d|j
�}x-|D]%\}}|jjt||��q�W|j�dS)z+Internal: read data in query string format.z%s should return bytes, got %sr0r)r�N)r>r:r�r5rUr9rwrqr;r)r�rrvr=rr
r@rArRr	�
skip_lines)rnrE�queryrZrmr!r!r"r��s			zFieldStorage.read_urlencodedc
Cs~|j}t|�s(td|f��g|_|jr�tjj|j|j|j	d|j
d|j�}x-|D]%\}}|jjt
||��qtW|jp�|j}|jj�}	t|	t�s�td|jt|	�jf��|jt|	�7_xG|	j�d|jkrM|	rM|jj�}	|jt|	�7_qWxt�}
d}x*|jj�}||7}|j�scPqcW|s�P|jt|�7_|
j|j|j
|j��|
j�}
d|
kr�|
d=||j|
|||||j|j|j
|j�	}|j|j7_|jj|�|jsk|j|jkofdknrQPqQW|j �d	S)
z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %rr)r�z%s should return bytes, got %ss--rHzcontent-lengthrN)!r�rMr9rvrr=rr
r@rAr)r�rRr	�FieldStorageClass�	__class__r>rOr5rUrwrqr�r_r`rZfeedr;r'r�r�r�r�)rnr?r@rAZibr�rZrm�klassZ
first_line�parserZhdr_textrVrW�partr!r!r"r��sV					
+zFieldStorage.read_multicCsD|jdkr&|j�|j�n
|j�|jjd�dS)zInternal: read an atomic part.rN)r��read_binaryr��
read_linesrxr�)rnr!r!r"r��s



zFieldStorage.read_single�icCs�|j�|_|j}|dkr�x�|dkr�|jjt||j��}t|t�s�t	d|jt
|�jf��|jt
|�7_|s�d|_P|jj|�|t
|�}q'WdS)zInternal: read binary data.rz%s should return bytes, got %sr1NrK)�	make_filerxr�r>r:�min�bufsizer5rUr9rwrqr�r_r�r%)rnZtodorVr!r!r"r��s		zFieldStorage.read_binarycCsV|jrt�|_|_nt�|_|_|jrH|j�n
|j�dS)z0Internal: read lines until EOF or outerboundary.N)r�rrx�_FieldStorage__filerr��read_lines_to_outerboundary�read_lines_to_eof)rnr!r!r"r��s		
zFieldStorage.read_linescCs�|jdk	re|jj�t|�dkre|j�|_|jj�}|jj|�d|_|jr�|jj|�n"|jj|j|j	|j
��dS)z line is always bytes, not stringNi�)r��tellr_r�rxr�r%r�r;r)r�)rnrYrVr!r!r"Z__writes		zFieldStorage.__writecCsOxH|jjd�}|jt|�7_|s:d|_P|j|�qWdS)zInternal: read lines until EOF.r1�NirK)r>rOr�r_r��_FieldStorage__write)rnrYr!r!r"r�s	zFieldStorage.read_lines_to_eofc	Cs�d|j}|d}d}d}d}xh||jkr<P|jjd
�}|jt|�7_|t|�7}|s�d|_P|dkr�||}d}|jd�r�|r�|j�}||kr�P||kr�d|_P|}|j	d�rd}|d	d�}d}nh|j	d�rEd}|d	d�}d}n:|j	d�rsd}|d	d�}d}nd}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--rHTrr1r�s
s
NrFs
FirKrLrKrK)r�r�r>rOr�r_r�rPrQ�endswithr�)	rn�
next_boundary�
last_boundaryZdelim�last_line_lfendZ_readrY�strippedlineZodelimr!r!r"r�!sP

	
				z(FieldStorage.read_lines_to_outerboundarycCs�|js|jrdSd|j}|d}d}x�|jjd�}|jt|�7_|snd|_P|jd�r�|r�|j�}||kr�P||kr�d|_P|jd�}q7WdS)	z5Internal: skip lines until outer boundary if defined.Ns--Tr1r�s
irK)r�r�r>rOr�r_r�r`)rnr�r�r�rYr�r!r!r"r�Rs&

		zFieldStorage.skip_linescCs6|jrtjd�Stjdd|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)�newliner$N)r��tempfileZ
TemporaryFiler))rnr!r!r"r�hs	
zFieldStorage.make_filei )!rqrrrsrt�osr?ror�r�r�rpr�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
js<*	�
6	
1cCs�td�t�tjt_ybt�}t�t�t|�t|�t	�dd�}|dd�}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/htmlcSstd�dS)Nz,testing print_exception() -- <I>italics?</I>)�execr!r!r!r"rc�sztest.<locals>.fcSs|�dS)Nr!)rcr!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)�printr2�stdout�stderrr
rrrrrrr8)r?�formrcr�r!r!r"�test�s4
	



	
r�cCs�|dkr!tj�\}}}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>rr1rKrK)	r2�exc_info�	tracebackr��	format_tb�format_exception_only�htmlrrS)rwrm�tbr�r�rvr!r!r"r�s
cCs|t|j��}t�td�td�x7|D]/}tdtj|�dtj||��q4Wtd�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)r?r�rZr!r!r"r�s


-
cCs�t|j��}t�td�|s3td�td�x}|D]u}tdtj|�ddd�||}tdtjtt|���d	�td
tjt|���qDWtd�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>�:rb� z<i>z</i>z<DD>z</DL>N)r�r�r�r�r�reprrw)r�r�rZrmr!r!r"r�s



!
'!
cCs�t�td�ytj�}WnAtk
rd}z!tdtjt|���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
/cCs0t�td�t�ttj�t�dS)Nz <H3>Command Line Arguments:</H3>)r�r2r<r!r!r!r"r�s


cCstd�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"r�s'cCsetdtdd�|jdd�}|jdd�}|jdd	�}|ra|jd
d�}|S)zDeprecated API.z1cgi.escape is deprecated, use html.escape instead�
stacklevelrFr0z&amp;�<z&lt;�>z&gt;r\z&quot;)rrGri)raZquoter!r!r"rs
cCs:ddl}t|t�r$d}nd}|j||�S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)�rer5rU�match)rar�Z_vb_patternr!r!r"rM(s
	rM�__main__)1rt�__version__�iorrr�collectionsrr2r�Zurllib.parser=Zemail.parserrZ
email.messager�warningsrr�r�r��__all__rrr#rrr(rr8r?rrr
rrdrr	r
r�rrrrrrrrMrqr!r!r!r"�<module>s\		#	Ed��"'/