%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/tornado/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/tornado/httputil.pyo

�
��L]c@�sEdZddlmZmZmZmZddlZddlZddlZddl	Z	ddl
ZddlZddl
Z
ddlZddlmZmZmZddlmZddlmZyddlZWn ek
r�ddljZnXyddlmZWn!ek
r.ddlmZnXeyddlmZWn!ek
rjddl mZnXydd	l!m"Z"Wn'ek
r�d
e#fd��YZ"nXe
j$d�Z%d
e&fd��YZ'e'd�Z(de&fd��YZ)de*fd��YZ+de#fd��YZ,de#fd��YZ-de*fd��YZ.de*fd��YZ/de*fd��YZ0d�Z1defd ��YZ2d!�Z3d"�Z4d#�Z5dd$�Z7d%�Z8d&�Z9ej:d'd(d)d*g�Z;d+�Z<ej:d,d*d-d.g�Z=d/�Z>d0�Z?d1�Z@d2�ZAd3�ZBd4�ZCdS(5s�HTTP utility code shared by clients and servers.

This module also defines the `HTTPServerRequest` class which is exposed
via `tornado.web.RequestHandler.request`.
i(tabsolute_importtdivisiontprint_functiontwith_statementN(t
native_strtparse_qs_bytestutf8(tgen_log(t
ObjectDict(t	responses(t	urlencode(tSSLErrorRcB�seZRS((t__name__t
__module__(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR<ss\r?\nt_NormalizedHeaderCachecB�s eZdZd�Zd�ZRS(sKDynamic cached mapping of header names to Http-Header-Case.

    Implemented as a dict subclass so that cache hits are as fast as a
    normal dict lookup, without the overhead of a python function
    call.

    >>> normalized_headers = _NormalizedHeaderCache(10)
    >>> normalized_headers["coNtent-TYPE"]
    'Content-Type'
    cC�s/tt|�j�||_tj�|_dS(N(tsuperRt__init__tsizetcollectionstdequetqueue(tselfR((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRPs	cC�s�djg|jd�D]}|j�^q�}|||<|jj|�t|j�|jkr||jj�}||=n|S(Nt-(tjointsplitt
capitalizeRtappendtlenRtpopleft(Rtkeytwt
normalizedtold_key((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt__missing__Us1

(RR
t__doc__RR!(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyREs
	i�tHTTPHeaderscB�s�eZdZd�Zd�Zd�Zd�Zd�Zed��Z	d�Z
d�Zd	�Zd
�Z
dd�Zd�Zd
�ZeZd�ZRS(s�A dictionary that maintains ``Http-Header-Case`` for all keys.

    Supports multiple values per key via a pair of new methods,
    `add()` and `get_list()`.  The regular dictionary interface
    returns a single value per key, with multiple values joined by a
    comma.

    >>> h = HTTPHeaders({"content-type": "text/html"})
    >>> list(h.keys())
    ['Content-Type']
    >>> h["Content-Type"]
    'text/html'

    >>> h.add("Set-Cookie", "A=B")
    >>> h.add("Set-Cookie", "C=D")
    >>> h["set-cookie"]
    'A=B,C=D'
    >>> h.get_list("set-cookie")
    ['A=B', 'C=D']

    >>> for (k,v) in sorted(h.get_all()):
    ...    print('%s: %s' % (k,v))
    ...
    Content-Type: text/html
    Set-Cookie: A=B
    Set-Cookie: C=D
    cO�s�tj|�i|_d|_t|�dkr�t|�dkr�t|dt�r�xA|dj�D]\}}|j	||�qgWn|j
||�dS(Nii(tdictRt_as_listtNonet	_last_keyRt
isinstanceR#tget_alltaddtupdate(Rtargstkwargstktv((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR�s
		$cC�sot|}||_||kratj||t||�dt|��|j|j|�n
|||<dS(s#Adds a new value for the given key.t,N(t_normalized_headersR'R$t__setitem__RR%R(Rtnametvaluet	norm_name((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR*�s
	cC�st|}|jj|g�S(s2Returns all values for the given header as a list.(R1R%tget(RR3R5((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytget_list�s
cc�s@x9|jj�D](\}}x|D]}||fVq#WqWdS(s�Returns an iterable of all (name, value) pairs.

        If a header has multiple values, multiple pairs will be
        returned with the same name.
        N(R%titems(RR3tvaluesR4((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR)�s
cC�s�|dj�r^d|j�}|j|jdc|7<tj||j||j|�n.|jdd�\}}|j||j��dS(s�Updates the dictionary with a single header line.

        >>> h = HTTPHeaders()
        >>> h.parse_line("Content-Type: text/html")
        >>> h.get('content-type')
        'text/html'
        it i����t:iN(	tisspacetlstripR%R'R$R2RR*tstrip(Rtlinetnew_partR3R4((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt
parse_line�scC�s=|�}x-tj|�D]}|r|j|�qqW|S(s�Returns a dictionary from HTTP header text.

        >>> h = HTTPHeaders.parse("Content-Type: text/html\r\nContent-Length: 42\r\n")
        >>> sorted(h.items())
        [('Content-Length', '42'), ('Content-Type', 'text/html')]
        (t_CRLF_RERRA(tclstheadersthR?((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytparse�s
	cC�s1t|}tj|||�|g|j|<dS(N(R1R$R2R%(RR3R4R5((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR2�s
cC�stj|t|�S(N(R$t__getitem__R1(RR3((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRG�scC�s(t|}tj||�|j|=dS(N(R1R$t__delitem__R%(RR3R5((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRH�s
cC�st|}tj||�S(N(R1R$t__contains__(RR3R5((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRI�s
cC�stj|t||�S(N(R$R6R1(RR3tdefault((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR6�scO�s4x-t||�j�D]\}}|||<qWdS(N(R$R8(RR,R-R.R/((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR+�s"cC�s
t|�S(N(R#(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytcopy�scC�s
|j�S(N(RK(Rt	memo_dict((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt__deepcopy__�sN(RR
R"RR*R7R)RAtclassmethodRFR2RGRHRIR&R6R+RKt__copy__RM(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR#ds 		
		
							tHTTPServerRequestc
B�s�eZdZdddddddddd�	Zd�Zed��Zdd�Zd�Z	d�Z
d�Zed	�Z
d
�Zd�ZRS(
s7
A single HTTP request.

    All attributes are type `str` unless otherwise noted.

    .. attribute:: method

       HTTP request method, e.g. "GET" or "POST"

    .. attribute:: uri

       The requested uri.

    .. attribute:: path

       The path portion of `uri`

    .. attribute:: query

       The query portion of `uri`

    .. attribute:: version

       HTTP version specified in request, e.g. "HTTP/1.1"

    .. attribute:: headers

       `.HTTPHeaders` dictionary-like object for request headers.  Acts like
       a case-insensitive dictionary with additional methods for repeated
       headers.

    .. attribute:: body

       Request body, if present, as a byte string.

    .. attribute:: remote_ip

       Client's IP address as a string.  If ``HTTPServer.xheaders`` is set,
       will pass along the real IP address provided by a load balancer
       in the ``X-Real-Ip`` or ``X-Forwarded-For`` header.

    .. versionchanged:: 3.1
       The list format of ``X-Forwarded-For`` is now supported.

    .. attribute:: protocol

       The protocol used, either "http" or "https".  If ``HTTPServer.xheaders``
       is set, will pass along the protocol used by a load balancer if
       reported via an ``X-Scheme`` header.

    .. attribute:: host

       The requested hostname, usually taken from the ``Host`` header.

    .. attribute:: arguments

       GET/POST arguments are available in the arguments property, which
       maps arguments names to lists of values (to support multiple values
       for individual names). Names are of type `str`, while arguments
       are byte strings.  Note that this is different from
       `.RequestHandler.get_argument`, which returns argument values as
       unicode strings.

    .. attribute:: query_arguments

       Same format as ``arguments``, but contains only arguments extracted
       from the query string.

       .. versionadded:: 3.2

    .. attribute:: body_arguments

       Same format as ``arguments``, but contains only arguments extracted
       from the request body.

       .. versionadded:: 3.2

    .. attribute:: files

       File uploads are available in the files property, which maps file
       names to lists of `.HTTPFile`.

    .. attribute:: connection

       An HTTP request is attached to a single HTTP connection, which can
       be accessed through the "connection" attribute. Since connections
       are typically kept open in HTTP/1.1, multiple requests can be handled
       sequentially on a single connection.

    .. versionchanged:: 4.0
       Moved from ``tornado.httpserver.HTTPRequest``.
    sHTTP/1.0c
	C�s?|	dk	r|	\}}}n||_||_||_|pEt�|_|pTd|_t|dd�}
t|
dd�|_t|
dd�|_	|p�|jj
d�p�d|_|p�i|_||_
tj�|_d|_|jd�\|_}|_t|jd	t�|_tj|j�|_i|_dS(
Nttcontextt	remote_iptprotocolthttptHosts	127.0.0.1t?tkeep_blank_values(R&tmethodturitversionR#RDtbodytgetattrRSRTR6thosttfilest
connectionttimet_start_timet_finish_timet	partitiontpathtqueryRtTruet	argumentsRKtdeepcopytquery_argumentstbody_arguments(RRYRZR[RDR\R^R_R`t
start_lineRRtsep((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRQs&			!		cC�s
|jdkS(s$Returns True if this request supports HTTP/1.1 semantics.

        .. deprecated:: 4.0
           Applications are less likely to need this information with the
           introduction of `.HTTPConnection`.  If you still need it, access
           the ``version`` attribute directly.
        sHTTP/1.1(R[(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytsupports_http_1_1lscC�sxt|d�sqtj�|_d|jkrqy!|jjt|jd��Wqntk
rji|_qnXqqn|jS(s&A dictionary of Cookie.Morsel objects.t_cookiestCookie(thasattrRptSimpleCookieRoRDtloadRt	Exception(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytcookiesvs	
cC�s|jj|d|�dS(s�Writes the given chunk to the response stream.

        .. deprecated:: 4.0
           Use ``request.connection`` and the `.HTTPConnection` methods
           to write the response.
        tcallbackN(R`twrite(RtchunkRv((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRw�s
cC�s |jj�tj�|_dS(s�Finishes this HTTP request on the open connection.

        .. deprecated:: 4.0
           Use ``request.connection`` and the `.HTTPConnection` methods
           to write the response.
        N(R`tfinishRaRc(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRy�s
cC�s|jd|j|jS(s+Reconstructs the full URL for this request.s://(RTR^RZ(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytfull_url�scC�s2|jdkr tj�|jS|j|jSdS(s?Returns the amount of time it took for this request to execute.N(RcR&RaRb(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytrequest_time�scC�s6y|jjjjd|�SWntk
r1dSXdS(s>Returns the client's SSL certificate, if any.

        To use client certificates, the HTTPServer's
        `ssl.SSLContext.verify_mode` field must be set, e.g.::

            ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
            ssl_ctx.load_cert_chain("foo.crt", "foo.key")
            ssl_ctx.load_verify_locations("cacerts.pem")
            ssl_ctx.verify_mode = ssl.CERT_REQUIRED
            server = HTTPServer(app, ssl_options=ssl_ctx)

        By default, the return value is a dictionary (or None, if no
        client certificate is present).  If ``binary_form`` is true, a
        DER-encoded form of the certificate is returned instead.  See
        SSLSocket.getpeercert() in the standard library for more
        details.
        http://docs.python.org/library/ssl.html#sslsocket-objects
        tbinary_formN(R`tstreamtsockettgetpeercertRR&(RR|((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytget_ssl_certificate�s

cC�sqt|jjdd�|j|j|j|j�x9|jj�D](\}}|jj|g�j	|�qAWdS(NsContent-TypeRQ(
tparse_body_argumentsRDR6R\RkR_R8Rht
setdefaulttextend(RR.R/((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt_parse_body�s
cC�s[d
}djg|D]}d|t||�f^q�}d	|jj|t|j�fS(NRTR^RYRZR[RSs, s%s=%rs%s(%s, headers=%s)(sprotocolshostsmethodsurisversions	remote_ip(RR]t	__class__RR$RD(RtattrstnR,((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt__repr__�s5N(RR
R"R&RRntpropertyRuRwRyRzR{tFalseR�R�R�(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRP�s[	

	
				tHTTPInputErrorcB�seZdZRS(sqException class for malformed HTTP requests or responses
    from remote sources.

    .. versionadded:: 4.0
    (RR
R"(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��stHTTPOutputErrorcB�seZdZRS(sJException class for errors in HTTP output.

    .. versionadded:: 4.0
    (RR
R"(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��stHTTPServerConnectionDelegatecB�s eZdZd�Zd�ZRS(s_Implement this interface to handle requests from `.HTTPServer`.

    .. versionadded:: 4.0
    cC�s
t��dS(sjThis method is called by the server when a new request has started.

        :arg server_conn: is an opaque object representing the long-lived
            (e.g. tcp-level) connection.
        :arg request_conn: is a `.HTTPConnection` object for a single
            request/response exchange.

        This method should return a `.HTTPMessageDelegate`.
        N(tNotImplementedError(Rtserver_conntrequest_conn((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt
start_request�s
cC�sdS(s�This method is called when a connection has been closed.

        :arg server_conn: is a server connection that has previously been
            passed to ``start_request``.
        N((RR�((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyton_close�s(RR
R"R�R�(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��s	tHTTPMessageDelegatecB�s2eZdZd�Zd�Zd�Zd�ZRS(s_Implement this interface to handle an HTTP request or response.

    .. versionadded:: 4.0
    cC�sdS(s�Called when the HTTP headers have been received and parsed.

        :arg start_line: a `.RequestStartLine` or `.ResponseStartLine`
            depending on whether this is a client or server message.
        :arg headers: a `.HTTPHeaders` instance.

        Some `.HTTPConnection` methods can only be called during
        ``headers_received``.

        May return a `.Future`; if it does the body will not be read
        until it is done.
        N((RRlRD((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytheaders_received�s
cC�sdS(siCalled when a chunk of data has been received.

        May return a `.Future` for flow control.
        N((RRx((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt
data_receivedscC�sdS(s6Called after the last chunk of data has been received.N((R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRyscC�sdS(s�Called if the connection is closed without finishing the request.

        If ``headers_received`` is called, either ``finish`` or
        ``on_connection_close`` will be called, but not both.
        N((R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyton_connection_closes(RR
R"R�R�RyR�(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��s
			tHTTPConnectioncB�s2eZdZddd�Zdd�Zd�ZRS(sYApplications use this interface to write their responses.

    .. versionadded:: 4.0
    cC�s
t��dS(sWrite an HTTP header block.

        :arg start_line: a `.RequestStartLine` or `.ResponseStartLine`.
        :arg headers: a `.HTTPHeaders` instance.
        :arg chunk: the first (optional) chunk of data.  This is an optimization
            so that small responses can be written in the same call as their
            headers.
        :arg callback: a callback to be run when the write is complete.

        The ``version`` field of ``start_line`` is ignored.

        Returns a `.Future` if no callback is given.
        N(R�(RRlRDRxRv((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt
write_headers%scC�s
t��dS(s�Writes a chunk of body data.

        The callback will be run when the write is complete.  If no callback
        is given, returns a Future.
        N(R�(RRxRv((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRw5scC�s
t��dS(s<Indicates that the last body data has been written.
        N(R�(R((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyRy=sN(RR
R"R&R�RwRy(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR� scC�sG|s
|S|ddkr9|d|kr/dnd7}n|t|�S(sConcatenate url and arguments regardless of whether
    url has existing query parameters.

    ``args`` may be either a dictionary or a list of key-value pairs
    (the latter allows for multiple values with the same key.

    >>> url_concat("http://example.com/foo", dict(c="d"))
    'http://example.com/foo?c=d'
    >>> url_concat("http://example.com/foo?a=b", dict(c="d"))
    'http://example.com/foo?a=b&c=d'
    >>> url_concat("http://example.com/foo?a=b", [("c", "d"), ("c", "d2")])
    'http://example.com/foo?a=b&c=d&c=d2'
    i����RWt&(RWR�(R
(turlR,((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt
url_concatCs
tHTTPFilecB�seZdZRS(s�Represents a file uploaded via a form.

    For backwards compatibility, its instance attributes are also
    accessible as dictionary keys.

    * ``filename``
    * ``body``
    * ``content_type``
    (RR
R"(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR�Xs	cC�s�|jd�\}}}|j�|j�}}|dkrAdS|jd�\}}}yt|�}t|�}Wntk
r�dSX|dk	r�|dkr�|dkr�|}d}q�q�|d7}n||fS(sgParses a Range header.

    Returns either ``None`` or tuple ``(start, end)``.
    Note that while the HTTP headers use inclusive byte positions,
    this method returns indexes suitable for use in slices.

    >>> start, end = _parse_request_range("bytes=1-2")
    >>> start, end
    (1, 3)
    >>> [0, 1, 2, 3, 4][start:end]
    [1, 2]
    >>> _parse_request_range("bytes=6-")
    (6, None)
    >>> _parse_request_range("bytes=-6")
    (-6, None)
    >>> _parse_request_range("bytes=-0")
    (None, 0)
    >>> _parse_request_range("bytes=")
    (None, None)
    >>> _parse_request_range("foo=42")
    >>> _parse_request_range("bytes=1-2,6-10")

    Note: only supports one range (ex, ``bytes=1-2,6-10`` is not allowed).

    See [0] for the details of the range header.

    [0]: http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p5-range-latest.html#byte.ranges
    t=tbytesRiiN(RdR>R&t_int_or_nonet
ValueError(trange_headertunitt_R4tstart_btend_btstarttend((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt_parse_request_rangees"

cC�s-|p	d}|p|d}d|||fS(s�Returns a suitable Content-Range header:

    >>> print(_get_content_range(None, 1, 4))
    bytes 0-0/4
    >>> print(_get_content_range(1, 3, 4))
    bytes 1-2/4
    >>> print(_get_content_range(None, None, 4))
    bytes 0-3/4
    iisbytes %s-%s/%s((R�R�ttotal((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt_get_content_range�s
cC�s&|j�}|dkrdSt|�S(NRQ(R>R&tint(tval((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��scC�s||r*d|kr*tjd|d�dS|jd�r�ytt|�dt�}Wn)tk
r�}tjd|�i}nXx�|j�D].\}}|r�|j|g�j	|�q�q�Wn�|jd�rxy}|j
d�}	xg|	D]S}
|
j�jd	�\}}}
|d
kr�|
r�t
t|
�|||�Pq�q�Wtd��Wqxtk
rt}tjd|�qxXndS(
sFParses a form request body.

    Supports ``application/x-www-form-urlencoded`` and
    ``multipart/form-data``.  The ``content_type`` parameter should be
    a string and ``body`` should be a byte string.  The ``arguments``
    and ``files`` parameters are dictionaries that will be updated
    with the parsed contents.
    sContent-Encodings Unsupported Content-Encoding: %sNs!application/x-www-form-urlencodedRXs&Invalid x-www-form-urlencoded body: %ssmultipart/form-datat;R�tboundarysmultipart boundary not foundsInvalid multipart/form-data: %s(Rtwarningt
startswithRRRgRtR8R�R�RR>Rdtparse_multipart_form_dataRR�(tcontent_typeR\RhR_RDt
uri_argumentsteR3R9tfieldstfieldR.RmR/((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��s0		
#
cC�s�|jd�r.|jd�r.|dd!}n|jd|d�}|dkrbtjd�dS|| jd|d�}xc|D][}|s�q�n|jd�}|dkr�tjd	�q�ntj|| j	d
��}|j
dd�}	t|	�\}
}|
d
ks |jd�r3tjd�q�n||dd!}|j
d�sftjd�q�n|d}
|j
d�r�|j
dd�}|j|
g�j
td|dd|d|��q�|j|
g�j
|�q�WdS(s�Parses a ``multipart/form-data`` body.

    The ``boundary`` and ``data`` parameters are both byte strings.
    The dictionaries given in the arguments and files parameters
    will be updated with the contents of the body.
    t"ii����s--s.Invalid multipart/form-data: no final boundaryNs
s

s#multipart/form-data missing headerssutf-8sContent-DispositionRQs	form-datasInvalid multipart/form-dataii����R3s&multipart/form-data value missing nametfilenamesContent-Typesapplication/unknownR\R�(R�tendswithtrfindRR�RtfindR#RFtdecodeR6t
_parse_headerR�RR�(R�tdataRhR_tfinal_boundary_indextpartstpartteohRDtdisp_headertdispositiontdisp_paramsR4R3tctype((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR��s>






cC�s�t|tj�rndt|ttjf�r?tj|�}n:t|tj�ritj|j	��}nt
d|��tjj
|dt�S(sFormats a timestamp in the format used by HTTP.

    The argument may be a numeric timestamp as returned by `time.time`,
    a time tuple as returned by `time.gmtime`, or a `datetime.datetime`
    object.

    >>> format_timestamp(1359312200)
    'Sun, 27 Jan 2013 18:43:20 GMT'
    sunknown timestamp type: %rtusegmt(R(tnumberstRealttupleRatstruct_timetcalendarttimegmtdatetimetutctimetuplet	TypeErrortemailtutilst
formatdateRg(tts((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytformat_timestamp�s
tRequestStartLineRYReR[cC�sqy|jd�\}}}Wntk
r;td��nXtjd|�satd|��nt|||�S(s�Returns a (method, path, version) tuple for an HTTP 1.x request line.

    The response is a `collections.namedtuple`.

    >>> parse_request_start_line("GET /foo HTTP/1.1")
    RequestStartLine(method='GET', path='/foo', version='HTTP/1.1')
    R:sMalformed HTTP request lines^HTTP/1\.[0-9]$s/Malformed HTTP version in HTTP Request-Line: %r(RR�R�tretmatchR�(R?RYReR[((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytparse_request_start_lines
tResponseStartLinetcodetreasoncC�sdt|�}tjd|�}|s3td��nt|jd�t|jd��|jd��S(s�Returns a (version, code, reason) tuple for an HTTP 1.x response line.

    The response is a `collections.namedtuple`.

    >>> parse_response_start_line("HTTP/1.1 200 OK")
    ResponseStartLine(version='HTTP/1.1', code=200, reason='OK')
    s(HTTP/1.[0-9]) ([0-9]+) ([^
]*)s!Error parsing response start lineiii(RR�R�R�R�tgroupR�(R?R�((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytparse_response_start_line-s!cc�s�x�|d dkr�|d}|jd�}xR|dkr�|jdd|�|jdd|�dr�|jd|d�}q/W|dkr�t|�}n|| }|j�V||}qWdS(NiR�iR�s\"i(R�tcountRR>(tsR�tf((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt_parseparamCs
;
cC�s�td|�}t|�}i}x�|D]�}|jd�}|dkr�|| j�j�}||dj�}t|�dkr�|d|dko�dknr�|dd!}|jdd	�jd
d�}n|||<q)d||<q)W||fS(sfParse a Content-type like header.

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

    R�R�iiii����R�s\\s\s\"N(R�tnextR�R>tlowerRtreplaceR&(R?R�RtpdicttptiR3R4((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyR�Ps
6
!
cC�sv|s
|S|g}xSt|j��D]?\}}|dkrN|j|�q&|jd||f�q&Wdj|�S(s�Inverse of _parse_header.

    >>> _encode_header('permessage-deflate',
    ...     {'client_max_window_bits': 15, 'client_no_context_takeover': None})
    'permessage-deflate; client_max_window_bits=15; client_no_context_takeover'
    s%s=%ss; N(tsortedR8R&RR(RR�toutR.R/((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt_encode_headergs	cC�sddl}|j�S(Ni(tdoctesttDocTestSuite(R�((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytdoctests{scC�sUtjd|�}|r?|jd�}t|jd��}n|}d}||fS(s�Returns ``(host, port)`` tuple from ``netloc``.

    Returned ``port`` will be ``None`` if not present.

    .. versionadded:: 4.1
    s^(.+):(\d+)$iiN(R�R�R�R�R&(tnetlocR�R^tport((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pytsplit_host_and_port�s(DR"t
__future__RRRRR�RRKR�temail.utilsR�R�R�Rattornado.escapeRRRttornado.logRttornado.utilRRptImportErrorthttp.cookiesRuthttplibR	thttp.clientturllibR
turllib.parsetsslRRttcompileRBR$RR1R#tobjectRPR�R�R�R�R�R�R�R�R�R�R&R�R�R�t
namedtupleR�R�R�R�R�R�R�R�R�(((s6/usr/lib64/python2.7/site-packages/tornado/httputil.pyt<module>st"



��	(#	
	1		$	.				
			

Zerion Mini Shell 1.0