%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/web/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/web/__pycache__/_newclient.cpython-312.pyc

�

Ϫ�fN�����dZddlZddlmZddlmZmZmZmZm	Z	ddl
mZddlm
Z
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%ddl&m'Z'm(Z(m)Z)dZ*dZ+dZ,dZ-e�Z.Gd�de/�Z0Gd�de/�Z1Gd�de/�Z2Gd�de2�Z3Gd�de/�Z4Gd�d e4�Z5Gd!�d"e4�Z6Gd#�d$e/�Z7Gd%�d&e/�Z8Gd'�d(e/�Z9Gd)�d*e4�Z:Gd+�d,e:�Z;Gd-�d.e/�Z<d/�Z=Gd0�d1e�Z>Gd2�d3e>�Z?ej�d4eA�j�d5�fz�ZCd6�ZDej�d7�ZEd8�ZFee(�Gd9�d:��ZGGd;�d<�ZHd=�ZIee(�ZJee)�Gd>�d?��ZKee
�Gd@�dA��ZLee�GdB�dC��ZMGdD�dEe�ZNy)Fa�
An U{HTTP 1.1<http://www.w3.org/Protocols/rfc2616/rfc2616.html>} client.

The way to use the functionality provided by this module is to:

  - Connect a L{HTTP11ClientProtocol} to an HTTP server
  - Create a L{Request} with the appropriate data
  - Pass the request to L{HTTP11ClientProtocol.request}
  - The returned Deferred will fire with a L{Response} object
  - Create a L{IProtocol} provider which can handle the response body
  - Connect it to the response with L{Response.deliverBody}
  - When the protocol's C{connectionLost} method is called, the response is
    complete.  See L{Response.deliverBody} for details.

Various other classes in this module support this usage:

  - HTTPParser is the basic HTTP parser.  It can handle the parts of HTTP which
    are symmetric between requests and responses.

  - HTTPClientParser extends HTTPParser to handle response-specific parts of
    HTTP.  One instance is created for each request to parse the corresponding
    response.
�N)�implementer)�CancelledError�Deferred�fail�
maybeDeferred�succeed)�ConnectionDone)�	IConsumer�
IPushProducer)�Protocol)�Logger)�LineReceiver)�
networkString)�proxyForInterface)�Failure)�fullyQualifiedName)�
NO_CONTENT�NOT_MODIFIED�PotentialDataLoss�_ChunkedTransferDecoder�	_DataLoss�_IdentityTransferDecoder)�Headers)�UNKNOWN_LENGTH�IClientRequest�	IResponse�STATUS�HEADER�BODY�DONEc��eZdZdZy)�
BadHeadersz@
    Headers passed to L{Request} were in some way invalid.
    N��__name__�
__module__�__qualname__�__doc__���8/usr/lib/python3/dist-packages/twisted/web/_newclient.pyr"r"D���r)r"c��eZdZdZy)�ExcessWritezx
    The body L{IBodyProducer} for a request tried to write data after
    indicating it had finished writing data.
    Nr#r(r)r*r-r-Js��r)r-c��eZdZdZd�Zy)�
ParseErrorzh
    Some received data could not be parsed.

    @ivar data: The string which could not be parsed.
    c�@�tj|||�||_y�N)�	Exception�__init__�data)�self�reasonr4s   r*r3zParseError.__init__Xs�����4���.���	r)N�r$r%r&r'r3r(r)r*r/r/Qs���r)r/c��eZdZdZy)�BadResponseVersionz=
    The version string in a status line was unparsable.
    Nr#r(r)r*r9r9]r+r)r9c��eZdZdZd�Zy)�_WrapperExceptiona,
    L{_WrapperException} is the base exception type for exceptions which
    include one or more other exceptions as the low-level causes.

    @ivar reasons: A L{list} of one or more L{Failure} instances encountered
        during an HTTP request.  See subclass documentation for more details.
    c�>�tj||�||_yr1)r2r3�reasons)r5r=s  r*r3z_WrapperException.__init__ls�����4��)���r)Nr7r(r)r*r;r;cs���r)r;c��eZdZdZy)�RequestGenerationFailedz�
    There was an error while creating the bytes which make up a request.

    @ivar reasons: A C{list} of one or more L{Failure} instances giving the
        reasons the request generation was considered to have failed.
    Nr#r(r)r*r?r?q���r)r?c��eZdZdZy)�RequestTransmissionFailedz�
    There was an error while sending the bytes which make up a request.

    @ivar reasons: A C{list} of one or more L{Failure} instances giving the
        reasons the request transmission was considered to have failed.
    Nr#r(r)r*rBrBzr@r)rBc��eZdZdZy)�ConnectionAbortedzD
    The connection was explicitly aborted by application code.
    Nr#r(r)r*rDrD�r+r)rDc��eZdZdZy)�WrongBodyLengthz�
    An L{IBodyProducer} declared the number of bytes it was going to
    produce (via its C{length} attribute) and then produced a different number
    of bytes.
    Nr#r(r)r*rFrF����r)rFc��eZdZdZy)�ResponseDonez�
    L{ResponseDone} may be passed to L{IProtocol.connectionLost} on the
    protocol passed to L{Response.deliverBody} and indicates that the entire
    response has been delivered.
    Nr#r(r)r*rIrI�rGr)rIc��eZdZdZdd�Zy)�ResponseFaileda�
    L{ResponseFailed} indicates that all of the response to a request was not
    received for some reason.

    @ivar reasons: A C{list} of one or more L{Failure} instances giving the
        reasons the response was considered to have failed.

    @ivar response: If specified, the L{Response} received from the server (and
        in particular the status code and the headers).
    Nc�>�tj||�||_yr1)r;r3�response)r5r=rMs   r*r3zResponseFailed.__init__�s���"�"�4��1� ��
r)r1r7r(r)r*rKrK�s��	�!r)rKc��eZdZdZy)�ResponseNeverReceivedzU
    A L{ResponseFailed} that knows no response bytes at all have been received.
    Nr#r(r)r*rOrO�r+r)rOc��eZdZdZy)�RequestNotSentaF
    L{RequestNotSent} indicates that an attempt was made to issue a request but
    for reasons unrelated to the details of the request itself, the request
    could not be sent.  For example, this may indicate that an attempt was made
    to send a request using a protocol which is no longer connected to a
    server.
    Nr#r(r)r*rQrQ�s��r)rQc�r�	|�y#t$r#tjdt|���YywxYw)z�
    Call C{function}.  If it raises an exception, log it with a minimal
    description of the source.

    @return: L{None}
    z Unexpected exception from {name})�nameN)�
BaseException�
_moduleLog�failurer)�functions r*�_callAppFunctionrX�s9��
��
���
����.�5G��5Q�	�	
�
�s�
�)6�6c�L�eZdZdZdZhd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�
HTTPParsera
    L{HTTPParser} handles the parsing side of HTTP processing. With a suitable
    subclass, it can parse either the client side or the server side of the
    connection.

    @ivar headers: All of the non-connection control message headers yet
        received.

    @ivar state: State indicator for the response parsing state machine.  One
        of C{STATUS}, C{HEADER}, C{BODY}, C{DONE}.

    @ivar _partialHeader: L{None} or a C{list} of the lines of a multiline
        header while that header is being received.
    �
>�te�upgrade�trailers�
keep-alive�proxy-connection�
connection�content-length�transfer-encodingc�d�t�|_t�|_t|_d|_yr1)r�headers�connHeadersr�state�_partialHeader�r5s r*�connectionMadezHTTPParser.connectionMade�s$���y���"�9�����
�"��r)c��|jtk(rtd��||_t|_|j	�y)z�
        Switch to body parsing mode - interpret any more bytes delivered as
        part of the message body and deliver them to the given decoder.
        zalready in body modeN)rgr�RuntimeError�bodyDecoder�
setRawMode)r5�decoders  r*�switchToBodyModezHTTPParser.switchToBodyModes5��
�:�:����5�6�6�"�����
����r)c���|dddk(r|dd}|jtk(r|j|�t|_y|jtk(r�|r|ddvrz|j�Rdj|j�}|j
dd�\}}|j�}|j||�|s|j�y|g|_y|jj|�yy)	z2
        Handle one line from a response.
        ���N�
rs 	r)�:�)rgr�statusReceivedrrh�join�split�strip�headerReceived�allHeadersReceived�append)r5�line�headerrS�values     r*�lineReceivedzHTTPParser.lineReceived
s���
���9������9�D��:�:�������%��D�J�
�Z�Z�6�
!��4��7�&�0��&�&�2� �X�X�d�&9�&9�:�F�"(�,�,�t�Q�"7�K�D�%�!�K�K�M�E��'�'��e�4���+�+�-�,0�&�D�'��#�#�*�*�4�0�!"r)c�:�|jj|�y)zM
        Pass data from the message body to the body decoder object.
        N)rm�dataReceived�r5r4s  r*�rawDataReceivedzHTTPParser.rawDataReceived*s��	
���%�%�d�+r)c��||jvS)a�
        Return C{True} if the given lower-cased name is the name of a
        connection control header (rather than an entity header).

        According to RFC 2616, section 14.10, the tokens in the Connection
        header are probably relevant here.  However, I am not sure what the
        practical consequences of either implementing or ignoring that are.
        So I leave it unimplemented for the time being.
        )�CONNECTION_CONTROL_HEADERS�r5rSs  r*�isConnectionControlHeaderz$HTTPParser.isConnectionControlHeader0s���t�6�6�6�6r)c��y)a
        Callback invoked whenever the first line of a new message is received.
        Override this.

        @param status: The first line of an HTTP request or response message
            without trailing I{CR LF}.
        @type status: C{bytes}
        Nr()r5�statuss  r*rvzHTTPParser.statusReceived<��r)c��|j�}|j|�r
|j}n|j}|j	||�y)z<
        Store the given header in C{self.headers}.
        N)�lowerr�rfre�addRawHeader)r5rSrres    r*rzzHTTPParser.headerReceivedFsA���z�z�|���)�)�$�/��&�&�G��l�l�G����T�5�)r)c�&�|jd�y)z�
        Callback invoked after the last header is passed to C{headerReceived}.
        Override this to change to the C{BODY} or C{DONE} state.
        N)rpris r*r{zHTTPParser.allHeadersReceivedQs��
	
���d�#r)N)r$r%r&r'�	delimiterr�rjrpr�r�r�rvrzr{r(r)r*rZrZ�s?��
�H�I�	"��#�
�1�:,�
7��	*�$r)rZc�b�eZdZdZeehZdeiZdZ	e
�Zd�Zd�Z
d�Zd�Zd�Zd	�Zd
�Zd�Zy)�HTTPClientParseraL
    An HTTP parser which only handles HTTP responses.

    @ivar request: The request with which the expected response is associated.
    @type request: L{Request}

    @ivar NO_BODY_CODES: A C{set} of response codes which B{MUST NOT} have a
        body.

    @ivar finisher: A callable to invoke when this response is fully parsed.

    @ivar _responseDeferred: A L{Deferred} which will be called back with the
        response when all headers in the response have been received.
        Thereafter, L{None}.

    @ivar _everReceivedData: C{True} if any bytes have been received.
    schunkedNc�L�||_||_t�|_d|_y)NF)�request�finisherr�_responseDeferred�_everReceivedData)r5r�r�s   r*r3zHTTPClientParser.__init__us"����� ��
�!)����!&��r)c�>�d|_tj||�y)zM
        Override so that we know if any response has been received.
        TN)r�rZr�r�s  r*r�zHTTPClientParser.dataReceived{s��"&�������d�+r)c��	|jd�\}}|jd�\}}t|�t|�}}|dks|dkrtd|��|||fS#t$r}tt	|�|��d}~wwxYw)z�
        Parse version strings of the form Protocol '/' Major '.' Minor. E.g.
        b'HTTP/1.1'.  Returns (protocol, major, minor).  Will raise ValueError
        on bad syntax.
        �/�.Nrzversion may not be negative)rx�int�
ValueErrorr9�str)r5�
strversion�proto�	strnumber�major�minor�es       r*�parseVersionzHTTPClientParser.parseVersion�s���	9�)�/�/��5��E�9�$�?�?�4�0�L�E�5��u�:�s�5�z�5�E��1�9���	�$�%B�J�O�O��u�e�$�$��	�	9�$�S��V�Z�8�8��	9�s�>A�	A>�$A9�9A>c�x�|jdd�}t|�dk(r|\}}d}n!t|�dk(r|\}}}ntd|��	t|�}t
j
|j|�|||j|j|j�|_y#t$r
td|��wxYw)z�
        Parse the status line into its components and create a response object
        to keep track of this response's state.
        � �r)�zwrong number of partsznon-integer status codeN)rx�lenr/r�r��Response�
_constructr�re�	transportr�rM)r5r��parts�version�	codeBytes�phrase�
statusCodes       r*rvzHTTPClientParser.statusReceived�s���
���T�1�%���u�:��?�
"'��G�Y��F�
��Z�1�_�).�&�G�Y���4�f�=�=�	@��Y��J�!�+�+����g�&����L�L��N�N��L�L�

��
���	@��6��?�?�	@�s�B#�#B9c�<�t|_|j|�y)a�
        Called to indicate that an entire response has been received.  No more
        bytes will be interpreted by this L{HTTPClientParser}.  Extra bytes are
        passed up and the state of this L{HTTPClientParser} is set to I{DONE}.

        @param rest: A C{bytes} giving any extra bytes delivered to this
            L{HTTPClientParser} which are not part of the response being
            parsed.
        N)r rgr��r5�rests  r*�	_finishedzHTTPClientParser._finished�s����
��
�
�d�r)c�l�|jjdk(r|dk(rytj||�S)z�
        Content-Length in the response to a HEAD request is an entity header,
        not a connection control header.
        �HEADrbF)r��methodrZr�r�s  r*r�z*HTTPClientParser.isConnectionControlHeader�s4��
�<�<���'�)�d�6G�.G���3�3�D�$�?�?r)c���d|jjcxkrdkrGnnD|jjd|jj��|j	�|`y|jj|j
vs|jjdk(rLd|j_|j|j��|jj��n0|jjd�}|r!|j|dj�}n�|jjd	�}|�d�n9t!|�d
k(r t#|d���|j_nt%d���dk(r"|j|j��d}n�fd�}|�|jj�nP|j&j)�|j+||jj,|j��|j.j1|j�|`y)
zn
        Figure out how long the response body is going to be by examining
        headers and stuff.
        �d��z#Ignoring unexpected {code} response)�codeNr�rrcrbruz4Too many Content-Length headers; response is invalidc���t�||�Sr1)r)�x�y�
contentLengths  �r*�<lambda>z5HTTPClientParser.allHeadersReceived.<locals>.<lambda>s���3K�%�q�!�4�r))rMr��_log�inforj�
NO_BODY_CODESr�r��lengthr��clearLineBuffer�_bodyDataFinishedrf�
getRawHeaders�_transferDecodersr�r�r�r�r��pauseProducingrp�_bodyDataReceivedr��callback)r5�transferEncodingHeaders�transferDecoder�contentLengthHeadersr�s    @r*r{z#HTTPClientParser.allHeadersReceived�s����
�$�-�-�$�$�*�s�*�
�I�I�N�N�5�D�M�M�<N�<N�
�
�
���!��
���=�=����!3�!3�3�t�|�|�7J�7J�g�7U�#$�D�M�M� �
�N�N�4�/�/�1�2��M�M�+�+�-�&*�&6�&6�&D�&D�$�'�#�'�#'�"8�"8�+�A�.�4�4�6�#��(,�'7�'7�'E�'E�FW�'X�$�'�/�$(�M��-�.�!�3�$'�(<�Q�(?�$@�M�+8�D�M�M�(�%�Q���!�A�%��N�N�4�#7�#7�#9�:�&*�O�'�O��&��
�
�/�/�1����-�-�/��%�%�#�D�M�M�$C�$C�T�^�^�T��	
���'�'��
�
�6��"r)c
��|j�9		|jj�|jj�yyy|jtk7rG|jrt}nt}|jj!t||g���|`yy#t$r&|jjt��Y��t$rE|jjtt|t�g|j���Y��wxYw#t$r|jjd�YywxYw)N�)rm�
noMoreDatarMr�rrrrKrTr�rVrgr r�rOr��errback)r5r6�exceptionClasss   r*�connectionLostzHTTPClientParser.connectionLosts�����'�
&�	6��$�$�/�/�1��M�M�3�3�5�	�?��Z�Z�4�
��%�%�!/��!6���"�"�*�*�7�>�6�(�3K�+L�M��&�
 ��)�?��M�M�3�3�G�I�>� ���M�M�3�3�����	�/B�D�M�M� R�S����!�
&�
�	�	�!�!�"�%�
&�s;�B!�D�!,D�
D�A
D�D�D�D�$E�E)r$r%r&r'rrr�rr�rmr
r�r3r�r�rvr�r�r{r�r(r)r*r�r�Ys]���$ ��.�M�	�+����K��8�D�'�,�%� 
�@�@�T#�l'r)r�s	\A[%s]+\Z)�!�#�$�%�&�'�*�+�-r��^�_�`�|�~s0-9sA-Zsa-zc�L�tj|�r|Std|����)a

    An HTTP method is an HTTP token, which consists of any visible
    ASCII character that is not a delimiter (i.e. one of
    C{"(),/:;<=>?@[\]{}}.)

    @param method: the method to check
    @type method: L{bytes}

    @return: the method if it is valid
    @rtype: L{bytes}

    @raise ValueError: if the method is not valid

    @see: U{https://tools.ietf.org/html/rfc7230#section-3.1.1},
        U{https://tools.ietf.org/html/rfc7230#section-3.2.6},
        U{https://tools.ietf.org/html/rfc5234#appendix-B.1}
    zInvalid method )�
_VALID_METHOD�matchr�)r�s r*�_ensureValidMethodr�Ws)��$���6�"��
�
��v�j�1�
2�2r)s\A[\x21-\x7e]+\Zc�L�tj|�r|Std|����)a
    A valid URI cannot contain control characters (i.e., characters
    between 0-32, inclusive and 127) or non-ASCII characters (i.e.,
    characters with values between 128-255, inclusive).

    @param uri: the URI to check
    @type uri: L{bytes}

    @return: the URI if it is valid
    @rtype: L{bytes}

    @raise ValueError: if the URI is not valid

    @see: U{https://tools.ietf.org/html/rfc3986#section-3.3},
        U{https://tools.ietf.org/html/rfc3986#appendix-A},
        U{https://tools.ietf.org/html/rfc5234#appendix-B.1}
    zInvalid URI )�
_VALID_URIr�r�)�uris r*�_ensureValidURIr�qs)��$������
�
�|�C�7�+�
,�,r)c�n�eZdZdZe�Zdd�Ze	d
d��Ze	d��Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zy)�Requesta�
    A L{Request} instance describes an HTTP request to be sent to an HTTP
    server.

    @ivar method: See L{__init__}.
    @ivar uri: See L{__init__}.
    @ivar headers: See L{__init__}.
    @ivar bodyProducer: See L{__init__}.
    @ivar persistent: See L{__init__}.

    @ivar _parsedURI: Parsed I{URI} for the request, or L{None}.
    @type _parsedURI: L{twisted.web.client.URI} or L{None}
    c�|�t|�|_t|�|_||_||_||_d|_y)at
        @param method: The HTTP method for this request, ex: b'GET', b'HEAD',
            b'POST', etc.
        @type method: L{bytes}

        @param uri: The relative URI of the resource to request.  For example,
            C{b'/foo/bar?baz=quux'}.
        @type uri: L{bytes}

        @param headers: Headers to be sent to the server.  It is important to
            note that this object does not create any implicit headers.  So it
            is up to the HTTP Client to add required headers such as 'Host'.
        @type headers: L{twisted.web.http_headers.Headers}

        @param bodyProducer: L{None} or an L{IBodyProducer} provider which
            produces the content body to send to the remote HTTP server.

        @param persistent: Set to C{True} when you use HTTP persistent
            connection, defaults to C{False}.
        @type persistent: L{bool}
        N)r�r�r�r�re�bodyProducer�
persistent�
_parsedURI)r5r�r�rer�r�s      r*r3zRequest.__init__�s9��,)��0���"�3�'������(���$�����r)Nc�,�||||||�}||_|S)aS
        Private constructor.

        @param method: See L{__init__}.
        @param uri: See L{__init__}.
        @param headers: See L{__init__}.
        @param bodyProducer: See L{__init__}.
        @param persistent: See L{__init__}.
        @param parsedURI: See L{Request._parsedURI}.

        @return: L{Request} instance.
        )r�)�clsr�r�rer�r��	parsedURIr�s        r*r�zRequest._construct�s#�� �f�c�7�L�*�E��&����r)c�<�t|jdd���S)z{
        The absolute URI of the request as C{bytes}, or L{None} if the
        absolute URI cannot be determined.
        �toBytesc��yr1r(r(r)r*r�z%Request.absoluteURI.<locals>.<lambda>�r�r))�getattrr�ris r*�absoluteURIzRequest.absoluteURI�s��A�w�t���	�<�@�B�Br)c�F�|jjdd�}t|�dk7rtd��g}|j	djt
|j�t|j�dg��|js|j	d�|�|j	|�|jj�D]-\}}|j|D�cgc]
}|dz|zd	z��c}��/|j	d	�|j|�ycc}w)
Nshostr(ruz Exactly one Host header requiredr�s
HTTP/1.1
sConnection: close
s: �
)rer�r�r"r|rwr�r�r�r�r��getAllRawHeaders�extend�
writeSequence)r5r��TEorCL�hosts�requestLinesrS�values�vs        r*�
_writeHeaderszRequest._writeHeaders�s�����*�*�7�B�7���u�:��?��?�@�@�
������I�I�&�t�{�{�3�#�D�H�H�-�#��
�	
������� 8�9�������'� �L�L�9�9�;�	N�L�D�&����V� L������!1�G�!;� L�M�	N����G�$�����-��!Ms� D
c�����|j�d�t����j|jd�|jj	��}�fd�}��fd�}|j||�|S)z�
        Write this request to the given transport using chunked
        transfer-encoding to frame the body.

        @param transport: See L{writeTo}.
        @return: See L{writeTo}.
        sTransfer-Encoding: chunked
Tc�&���j�yr1��unregisterProducer)�ignored�encoders �r*�
cbProducedz7Request._writeToBodyProducerChunked.<locals>.cbProduced�s����&�&�(r)c�H���j��j�|Sr1)�_allowNoMoreWritesr	)�errrr�s ��r*�
ebProducedz7Request._writeToBodyProducerChunked.<locals>.ebProduced�s"����&�&�(�

�(�(�*��Jr))r�ChunkedEncoder�registerProducerr��startProducing�addCallbacks)r5r��drrrs `   @r*�_writeToBodyProducerChunkedz#Request._writeToBodyProducerChunked�sk���	
���9�&G�H� ��+��� � ��!2�!2�D�9����,�,�W�5��	)�	�	
���z�:�.��r)c�p������j�td�jjfz��t	�}t�j�|���j
�jd��jj������fd�}||��}�fd�}|j|�|S)z�
        Write this request to the given transport using content-length to frame
        the body.

        @param transport: See L{writeTo}.
        @return: See L{writeTo}.
        zContent-Length: %d
Tc������	fd�}t|��dg��
��fd�}���fd�}��
��fd�}|j|�|j||��S)Nc�&���j�yr1)�cancel)�ign�finishedProducings �r*�cancelConsumingzSRequest._writeToBodyProducerContentLength.<locals>.combine.<locals>.cancelConsuming+s���!�(�(�*r)c����dgk(rd�d<�j|�y�jjd|t���d��y)Nrurz>Buggy state machine in {request}/[{state}]: ebConsuming called)rVr�rg)r�r�rV�repr)rr5rg�ultimates ���r*�ebConsumingzORequest._writeToBodyProducerContentLength.<locals>.combine.<locals>.ebConsuming6sT����T�F�?� !�E�!�H��$�$�S�)��I�I�%�%�-� #� $�T�
�#�A�h�&�r)c����dgk(r(d�d<	�j��jd�yy#t$r�j�YywxYw)Nr�r)�_noMoreWritesExpectedr�rTr�)�resultrrgr s ���r*�cbProducingzORequest._writeToBodyProducerContentLength.<locals>.combine.<locals>.cbProducingMs\����T�F�?�
 !�E�!�H�0��5�5�7�!�)�)�$�/�#��)�+�!�(�(�*�+�s�1�A
�A
c����dgk(r'd�d<�j��j|�y�jjd|��y)Nr�rzProducer is buggy)rV)rr�r�rV)rrr5rgr s ����r*�ebProducingzORequest._writeToBodyProducerContentLength.<locals>.combine.<locals>.ebProducingbsK����T�F�?� !�E�!�H��.�.�0��$�$�S�)��I�I�%�%�&9�3�%�Gr))r�
addErrbackr)�	consuming�	producingrr!r%r'rgr rrr5s      @@���r*�combinez:Request._writeToBodyProducerContentLength.<locals>.combine'sR���
+� ��0�H��F�E�
�.
0�*
H�"
� � ��-��"�"�;��<��Or)c�(���j�|Sr1r)�passthroughr�s �r*�fz4Request._writeToBodyProducerContentLength.<locals>.fzs���
�(�(�*��r))	rrr�r�r�LengthEnforcingConsumerrr�addBoth)r5r��finishedConsumingr+rr.rrs``    @@r*�!_writeToBodyProducerContentLengthz)Request._writeToBodyProducerContentLength
s����	
�����2�d�6G�6G�6N�6N�5P�P�Q�	
�%�J��*����y�*;�
��	�"�"�4�#4�#4�d�;� �-�-�<�<�W�E��O	�b
�%�'8�9��	�	
�	�	�!���r)c�<�|j|d�td�S)z�
        Write this request to the given transport using content-length to frame
        the (empty) body.

        @param transport: See L{writeTo}.
        @return: See L{writeTo}.
        sContent-Length: 0
N)rr�r5r�s  r*�_writeToEmptyBodyContentLengthz&Request._writeToEmptyBodyContentLength�s��	
���9�&>�?��t�}�r)c��|j�3|jdvr|j|�y|j|d�y|jjt
ur|j
|�S|j|�S)a 
        Format this L{Request} as an HTTP/1.1 request and write it to the given
        transport.  If bodyProducer is not None, it will be associated with an
        L{IConsumer}.

        @param transport: The transport to which to write.
        @type transport: L{twisted.internet.interfaces.ITransport} provider

        @return: A L{Deferred} which fires with L{None} when the request has
            been completely written to the transport or with a L{Failure} if
            there is any problem generating the request bytes.
        N)sPUTsPOST)r�r�r5rr�rrr2r4s  r*�writeTozRequest.writeTo�ss�����$��{�{�/�/��3�3�I�>��"�"�9�d�3�
�
�
�
%�
%��
7��3�3�I�>�>��9�9�)�D�Dr)c�B�t|jj�y)aR
        Stop writing this request to the transport.  This can only be called
        after C{writeTo} and before the L{Deferred} returned by C{writeTo}
        fires.  It should cancel any asynchronous task started by C{writeTo}.
        The L{Deferred} returned by C{writeTo} need not be fired if this method
        is called.
        N)rXr��
stopProducingris r*�stopWritingzRequest.stopWriting�s��	��*�*�8�8�9r))F)FN)r$r%r&r'r
r�r3�classmethodr��propertyr�rrr2r5r7r:r(r)r*r�r��sc����8�D��:�MQ����&�C��C�.�6�8x�t	�E�4
:r)r�c�(�eZdZdZd�Zd�Zd�Zd�Zy)r/a�
    An L{IConsumer} proxy which enforces an exact length requirement on the
    total data written to it.

    @ivar _length: The number of bytes remaining to be written.

    @ivar _producer: The L{IBodyProducer} which is writing to this
        consumer.

    @ivar _consumer: The consumer to which at most C{_length} bytes will be
        forwarded.

    @ivar _finished: A L{Deferred} which will be fired with a L{Failure} if too
        many bytes are written to this consumer.
    c�P�|j|_||_||_||_yr1)r��_length�	_producer�	_consumerr�)r5�producer�consumer�finisheds    r*r3z LengthEnforcingConsumer.__init__�s"�������!���!���!��r)c��d|_y�z�
        Indicate that no additional writes are allowed.  Attempts to write
        after calling this method will be met with an exception.
        N)r�ris r*rz*LengthEnforcingConsumer._allowNoMoreWrites����
��r)c��|j�$|jj�t��t	|�|j
kr:|xj
t	|�zc_|jj|�yt|jj�|jjtd��|j�y)z�
        Write C{bytes} to the underlying consumer unless
        C{_noMoreWritesExpected} has been called or there are/have been too
        many bytes.
        Nztoo many bytes written)r�r@r9r-r�r?rA�writerXr�rFr�r5�bytess  r*rIzLengthEnforcingConsumer.write�s����>�>�!�
�N�N�(�(�*��-���u�:����%��L�L�C��J�&�L��N�N� � ��'�
�T�^�^�9�9�:��N�N�"�"�?�3K�#L�M��#�#�%r)c�l�|j�(|j�|jrtd��yy)z�
        Called to indicate no more bytes will be written to this consumer.
        Check to see that the correct number have been written.

        @raise WrongBodyLength: If not enough bytes have been written.
        Nztoo few bytes written)r�rr?rFris r*r#z-LengthEnforcingConsumer._noMoreWritesExpected�s7���>�>�%��#�#�%��|�|�%�&=�>�>��&r)N)r$r%r&r'r3rrIr#r(r)r*r/r/�s��� "��&�8
?r)r/c�4���fd�}|j|_|S)a}
    Given a I{dispatch} name and a function, return a function which can be
    used as a method and which, when called, will call another method defined
    on the instance and return the result.  The other method which is called is
    determined by the value of the C{_state} attribute of the instance.

    @param name: A string which is used to construct the name of the subsidiary
        method to invoke.  The subsidiary method is named like C{'_%s_%s' %
        (name, _state)}.

    @param template: A function object which is used to give the returned
        function a docstring.

    @return: The dispatcher function.
    c���t|d�zdz|jzd�}|�t|�d��d|j����||i|��S)N�_z has no z method in state )r��_staterl)r5�args�kwargs�funcrSs    �r*�
dispatcherz*makeStatefulDispatcher.<locals>.dispatchersY����t�S�4�Z�#�-����;�T�B���<��$���$��7H����
�V�W�W��T�$�V�$�$r))r')rS�templaterTs`  r*�makeStatefulDispatcherrV�s���"%�"�)�)�J���r)c���eZdZdZeZdZdZd�Ze	d��Z
d�Zd�Ze
de�Zd	�Zd
�Zd�Zd�Zd
�Ze
de�Zd�Zd�Zd�Zd�Zdd�Ze
de�Zdd�Zdd�Zd�Zd�Zy)r�a
    A L{Response} instance describes an HTTP response received from an HTTP
    server.

    L{Response} should not be subclassed or instantiated.

    @ivar _transport: See L{__init__}.

    @ivar _bodyProtocol: The L{IProtocol} provider to which the body is
        delivered.  L{None} before one has been registered with
        C{deliverBody}.

    @ivar _bodyBuffer: A C{list} of the strings passed to C{bodyDataReceived}
        before C{deliverBody} is called.  L{None} afterwards.

    @ivar _state: Indicates what state this L{Response} instance is in,
        particularly with respect to delivering bytes from the response body
        to an application-supplied protocol object.  This may be one of
        C{'INITIAL'}, C{'CONNECTED'}, C{'DEFERRED_CLOSE'}, or C{'FINISHED'},
        with the following meanings:

          - INITIAL: This is the state L{Response} objects start in.  No
            protocol has yet been provided and the underlying transport may
            still have bytes to deliver to it.

          - DEFERRED_CLOSE: If the underlying transport indicates all bytes
            have been delivered but no application-provided protocol is yet
            available, the L{Response} moves to this state.  Data is
            buffered and waiting for a protocol to be delivered to.

          - CONNECTED: If a protocol is provided when the state is INITIAL,
            the L{Response} moves to this state.  Any buffered data is
            delivered and any data which arrives from the transport
            subsequently is given directly to the protocol.

          - FINISHED: If a protocol is provided in the DEFERRED_CLOSE state,
            the L{Response} moves to this state after delivering all
            buffered data to the protocol.  Otherwise, if the L{Response} is
            in the CONNECTED state, if the transport indicates there is no
            more data, the L{Response} moves to this state.  Nothing else
            can happen once the L{Response} is in this state.
    @type _state: C{str}
    NFc��||_||_||_||_||_g|_d|_d|_d|_y)a�
        @param version: HTTP version components protocol, major, minor. E.g.
            C{(b'HTTP', 1, 1)} to mean C{b'HTTP/1.1'}.

        @param code: HTTP status code.
        @type code: L{int}

        @param phrase: HTTP reason phrase, intended to give a short description
            of the HTTP status code.

        @param headers: HTTP response headers.
        @type headers: L{twisted.web.http_headers.Headers}

        @param _transport: The transport which is delivering this response.
        �INITIALN)	r�r�r�re�
_transport�_bodyBufferrPr��previousResponse)r5r�r�r�rerZs      r*r3zResponse.__init__RsE�� �����	�������$������������ $��r)c�D�t|||||�}t|�|_|S)aM
        Private constructor.

        @param version: See L{__init__}.
        @param code: See L{__init__}.
        @param phrase: See L{__init__}.
        @param headers: See L{__init__}.
        @param _transport: See L{__init__}.
        @param request: See L{IResponse.request}.

        @return: L{Response} instance.
        )r��_ClientRequestProxyr�)r�r�r�r�rerZr�rMs        r*r�zResponse._constructls(���G�T�6�7�J�G��.�w�7����r)c��||_yr1)r\)r5r\s  r*�setPreviousResponsezResponse.setPreviousResponse~s
�� 0��r)c��y)zi
        Dispatch the given L{IProtocol} depending of the current state of the
        response.
        Nr(�r5�protocols  r*�deliverBodyzResponse.deliverBody�r�r)rdc���|j|j�||_|jD]}|jj	|��d|_d|_|jj
�y)z�
        Deliver any buffered data to C{protocol} and prepare to deliver any
        future data to it.  Move to the C{'CONNECTED'} state.
        N�	CONNECTED)�makeConnectionrZ�
_bodyProtocolr[r�rP�resumeProducing�r5rcr4s   r*�_deliverBody_INITIALzResponse._deliverBody_INITIAL�sh��
	������0�%����$�$�	2�D����+�+�D�1�	2����!���	
���'�'�)r)c�4�td|j�d���)z�
        It is invalid to attempt to deliver data to a protocol when it is
        already being delivered to another protocol.
        zResponse already has protocol z, cannot deliverBody again)rlrhrbs  r*�_deliverBody_CONNECTEDzResponse._deliverBody_CONNECTED�s��
��)�)�
,�
�	
r)c���|j|j�|jD]}|j|��d|_|j	|j
�d|_y)z�
        Deliver any buffered data to C{protocol} and then disconnect the
        protocol.  Move to the C{'FINISHED'} state.
        N�FINISHED)rgrZr[r�r��_reasonrPrjs   r*�_deliverBody_DEFERRED_CLOSEz$Response._deliverBody_DEFERRED_CLOSE�sZ��	������0��$�$�	(�D��!�!�$�'�	(����������-� ��r)c��td��)z�
        It is invalid to attempt to deliver data to a protocol after the
        response body has been delivered to another protocol.
        z2Response already finished, cannot deliverBody now.�rlrbs  r*�_deliverBody_FINISHEDzResponse._deliverBody_FINISHED�s��
�O�P�Pr)c��y)z�
        Called by HTTPClientParser with chunks of data from the response body.
        They will be buffered or delivered to the protocol passed to
        deliverBody.
        Nr(r�s  r*r�zResponse._bodyDataReceived�r�r)�bodyDataReceivedc�:�|jj|�y)a
        Buffer any data received for later delivery to a protocol passed to
        C{deliverBody}.

        Little or no data should be buffered by this method, since the
        transport has been paused and will not be resumed until a protocol
        is supplied.
        N)r[r|r�s  r*�_bodyDataReceived_INITIALz"Response._bodyDataReceived_INITIAL�s��	
������%r)c�:�|jj|�y)zk
        Deliver any data received to the protocol to which this L{Response}
        is connected.
        N)rhr�r�s  r*�_bodyDataReceived_CONNECTEDz$Response._bodyDataReceived_CONNECTED�s��
	
���'�'��-r)c��td��)z�
        It is invalid for data to be delivered after it has been indicated
        that the response body has been completely delivered.
        z0Cannot receive body data after _bodyDataFinishedrsr�s  r*� _bodyDataReceived_DEFERRED_CLOSEz)Response._bodyDataReceived_DEFERRED_CLOSE�s��
�M�N�Nr)c��td��)zz
        It is invalid for data to be delivered after the response body has
        been delivered to a protocol.
        z4Cannot receive body data after protocol disconnectedrsr�s  r*�_bodyDataReceived_FINISHEDz#Response._bodyDataReceived_FINISHED�s��
�T�U�Ur)c��y)z�
        Called by HTTPClientParser when no more body data is available.  If the
        optional reason is supplied, this indicates a problem or potential
        problem receiving all of the response body.
        Nr(�r5r6s  r*r�zResponse._bodyDataFinished�r�r)�bodyDataFinishedc�L�d|_|�ttd��}||_y)z}
        Move to the C{'DEFERRED_CLOSE'} state to wait for a protocol to
        which to deliver the response body.
        �DEFERRED_CLOSEN�Response body fully received)rPrrIrpr�s  r*�_bodyDataFinished_INITIALz"Response._bodyDataFinished_INITIAL�s'��
'����>��\�*H�I�J�F���r)c��|�ttd��}|jj|�d|_d|_y)zN
        Disconnect the protocol and move to the C{'FINISHED'} state.
        Nr�ro)rrIrhr�rPr�s  r*�_bodyDataFinished_CONNECTEDz$Response._bodyDataFinished_CONNECTED�s<���>��\�*H�I�J�F����)�)�&�1�!��� ��r)c��td��)��
        It is invalid to attempt to notify the L{Response} of the end of the
        response body data more than once.
        z&Cannot finish body data more than oncersris r*� _bodyDataFinished_DEFERRED_CLOSEz)Response._bodyDataFinished_DEFERRED_CLOSEs��
�C�D�Dr)c��td��)r�z3Cannot finish body data after protocol disconnectedrsris r*�_bodyDataFinished_FINISHEDz#Response._bodyDataFinished_FINISHED
s��
�S�T�Tr)r1)r$r%r&r'rr�rh�
_bodyFinishedr3r;r�r`rdrVrkrmrqrtr�rxrzr|r~r�r�r�r�r�r(r)r*r�r�s���*�X�F��M��M�%�4����"1��)���D�K�*�(
�!�$Q��/�/A�CT�U��	&�.�O�V��/�/A�CT�U���!�E�Ur)r�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)rz�
    Helper object which exposes L{IConsumer} on top of L{HTTP11ClientProtocol}
    for streaming request bodies to the server.
    c��||_yr1�r�r4s  r*r3zChunkedEncoder.__init__s	��"��r)c��d|_yrFr�ris r*rz!ChunkedEncoder._allowNoMoreWritesrGr)c�<�|jj||�y)zE
        Register the given producer with C{self.transport}.
        N)r�r)r5rB�	streamings   r*rzChunkedEncoder.registerProducer&s��	
���'�'��)�<r)c��|j�
t��|jjtdt	|�z�|df�y)z�
        Write the given request body bytes to the transport using chunked
        encoding.

        @type data: C{bytes}
        Nz%x
r�)r�r-r�rr�r�s  r*rIzChunkedEncoder.write,s@���>�>�!��-�����$�$�
�8�c�$�i�/�
0�$��@�	
r)c�z�|jd�|jj�|j�y)zT
        Indicate that the request body is complete and finish the request.
        r)N)rIr�r	rris r*r	z!ChunkedEncoder.unregisterProducer9s+��	
�
�
�3�����)�)�+����!r)N)	r$r%r&r'r3rrrIr	r(r)r*rrs ���
#��=�
�"r)rc�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�TransportProxyProducera'
    An L{twisted.internet.interfaces.IPushProducer} implementation which
    wraps another such thing and proxies calls to it until it is told to stop.

    @ivar _producer: The wrapped L{twisted.internet.interfaces.IPushProducer}
    provider or L{None} after this proxy has been stopped.
    Fc��||_yr1�r@)r5rBs  r*r3zTransportProxyProducer.__init__Ts	��!��r)c��d|_y)z�
        Stop forwarding calls of L{twisted.internet.interfaces.IPushProducer}
        methods to the underlying L{twisted.internet.interfaces.IPushProducer}
        provider.
        Nr�ris r*�stopProxyingz#TransportProxyProducer.stopProxyingWs����r)c�R�|j�|jj�yy)zl
        Proxy the stoppage to the underlying producer, unless this proxy has
        been stopped.
        N)r@r9ris r*r9z$TransportProxyProducer.stopProducing_s#��
�>�>�%��N�N�(�(�*�&r)c�R�|j�|jj�yy)zn
        Proxy the resumption to the underlying producer, unless this proxy has
        been stopped.
        N)r@riris r*riz&TransportProxyProducer.resumeProducinggs#��
�>�>�%��N�N�*�*�,�&r)c�R�|j�|jj�yy)zi
        Proxy the pause to the underlying producer, unless this proxy has been
        stopped.
        N)r@r�ris r*r�z%TransportProxyProducer.pauseProducingo�#��
�>�>�%��N�N�)�)�+�&r)c�R�|j�|jj�yy)z�
        Proxy the request to lose the connection to the underlying producer,
        unless this proxy has been stopped.
        N)r@�loseConnectionris r*r�z%TransportProxyProducer.loseConnectionwr�r)N)r$r%r&r'�
disconnectingr3r�r9rir�r�r(r)r*r�r�Bs,����M�"��+�-�,�,r)r�c���eZdZdZdZdZdZdZdZdZ	e
�Zd�fd�Ze
d��Zd�Zd�Zed	e�Zd
�ZeZd�Zd�Zd
�Zd�Zede�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�HTTP11ClientProtocola(
    L{HTTP11ClientProtocol} is an implementation of the HTTP 1.1 client
    protocol.  It supports as few features as possible.

    @ivar _parser: After a request is issued, the L{HTTPClientParser} to
        which received data making up the response to that request is
        delivered.

    @ivar _finishedRequest: After a request is issued, the L{Deferred} which
        will fire when a L{Response} object corresponding to that request is
        available.  This allows L{HTTP11ClientProtocol} to fail the request
        if there is a connection or parsing problem.

    @ivar _currentRequest: After a request is issued, the L{Request}
        instance used to make that request.  This allows
        L{HTTP11ClientProtocol} to stop request generation if necessary (for
        example, if the connection is lost).

    @ivar _transportProxy: After a request is issued, the
        L{TransportProxyProducer} to which C{_parser} is connected.  This
        allows C{_parser} to pause and resume the transport in a way which
        L{HTTP11ClientProtocol} can exert some control over.

    @ivar _responseDeferred: After a request is issued, the L{Deferred} from
        C{_parser} which will fire with a L{Response} when one has been
        received.  This is eventually chained with C{_finishedRequest}, but
        only in certain cases to avoid double firing that Deferred.

    @ivar _state: Indicates what state this L{HTTP11ClientProtocol} instance
        is in with respect to transmission of a request and reception of a
        response.  This may be one of the following strings:

          - QUIESCENT: This is the state L{HTTP11ClientProtocol} instances
            start in.  Nothing is happening: no request is being sent and no
            response is being received or expected.

          - TRANSMITTING: When a request is made (via L{request}), the
            instance moves to this state.  L{Request.writeTo} has been used
            to start to send a request but it has not yet finished.

          - TRANSMITTING_AFTER_RECEIVING_RESPONSE: The server has returned a
            complete response but the request has not yet been fully sent
            yet.  The instance will remain in this state until the request
            is fully sent.

          - GENERATION_FAILED: There was an error while the request.  The
            request was not fully sent to the network.

          - WAITING: The request was fully sent to the network.  The
            instance is now waiting for the response to be fully received.

          - ABORTING: Application code has requested that the HTTP connection
            be aborted.

          - CONNECTION_LOST: The connection has been lost.
    @type _state: C{str}

    @ivar _abortDeferreds: A list of C{Deferred} instances that will fire when
        the connection is lost.
    �	QUIESCENTNc��yr1r()�cs r*r�zHTTP11ClientProtocol.<lambda>�r�r)c� �||_g|_yr1)�_quiescentCallback�_abortDeferreds)r5�quiescentCallbacks  r*r3zHTTP11ClientProtocol.__init__�s��"3���!��r)c��|jSr1�rPris r*rgzHTTP11ClientProtocol.state�s���{�{�r)c�����jdk7rtt��Sd�_t|j�j
����fd�}t
|��_|�_t�j
��_
t|�j��_
�jj�j��jj�_�fd�}�fd�}�j!||��jS)a�
        Issue C{request} over C{self.transport} and return a L{Deferred} which
        will fire with a L{Response} instance or an error.

        @param request: The object defining the parameters of the request to
           issue.
        @type request: L{Request}

        @rtype: L{Deferred}
        @return: The deferred may errback with L{RequestGenerationFailed} if
            the request was not fully written to the transport due to a local
            error.  It may errback with L{RequestTransmissionFailed} if it was
            not fully written to the transport due to a network error.  It may
            errback with L{ResponseFailed} if the request was sent (not
            necessarily received) but some or all of the response was lost.  It
            may errback with L{RequestNotSent} if it is not possible to send
            any more requests using this L{HTTP11ClientProtocol}.
        r��TRANSMITTINGc����jdvr�j�y�jj��j	tt
���y)N)r��%TRANSMITTING_AFTER_RECEIVING_RESPONSE)rPrr��abortConnection�_disconnectParserrr)r�_requestDeferredr5s ��r*�
cancelRequestz3HTTP11ClientProtocol.request.<locals>.cancelRequest�sD����{�{�W�W� �'�'�)����.�.�0��&�&�w�~�/?�'@�Ar)c�~���jdk(r-d�_�jj�j�yy)Nr��WAITING)rPr��
chainDeferred�_finishedRequest)r
r5s �r*�cbRequestWrittenz6HTTP11ClientProtocol.request.<locals>.cbRequestWritten�s5����{�{�n�,�'����&�&�4�4�T�5J�5J�K�-r)c����jdk(rPd�_�jj��jj	tt
|g���y�jjd|�j��y)Nr��GENERATION_FAILEDzJError writing request, but not in valid state to finalize request: {state})rVrg)	rPr�r�r�r�rr?r�rV)rr5s �r*�ebRequestWritingz6HTTP11ClientProtocol.request.<locals>.ebRequestWritingsm����{�{�n�,�1������.�.�0��%�%�-�-�g�6M�s�e�6T�.U�V��	�	�!�!�3���+�+�	"�r))rPrrQrr7r�rr��_currentRequestr��_transportProxyr��_finishResponse�_parserrgr�r)r5r�r�r�r�r�s`    @r*r�zHTTP11ClientProtocol.request�s����&�;�;�+�%���(�)�)�$���(����$�.�.�I��	B�!)�� 7��� '���5�d�n�n�E���'���1E�1E�F������#�#�D�$8�$8�9�!%���!?�!?���	L�
	�	�%�%�&6�8H�I��$�$�$r)c��y)a!
        Called by an L{HTTPClientParser} to indicate that it has parsed a
        complete response.

        @param rest: A C{bytes} giving any trailing bytes which were given to
            the L{HTTPClientParser} which were not part of the response it
            was parsing.
        Nr(r�s  r*r�z$HTTP11ClientProtocol._finishResponser�r)�finishResponsec��|jdk(rd|_n,d|_|jj|j�|j�ytd�}|jjjdd�}d|vs%|jdk7s|jjs|jt|��y|jj�	|j|�|j'|�y#t$r8|j j#d�|jj%�Y�RwxYw)	Nr�r�r�z
synthetic!rar(scloser�)rPr�r�r�r�r	rfr�r�r��_giveUprr�rir�rTr�rVr�r�)r5r�r6rfs    r*�_finishResponse_WAITINGz,HTTP11ClientProtocol._finishResponse_WAITINGs
���;�;�)�#�%�D�K�B�D�K��"�"�0�0��1F�1F�G�
�<�<�����-���l�l�.�.�<�<�]�B�O��
��
$��{�{�k�)��'�'�2�2��L�L����)�
�N�N�*�*�,�
0��'�'��-�
�"�"�6�*��!�
0��	�	�!�!�"�%����-�-�/�	
0�s�!D�>E�Ec���|j�[|j}d|_d|_d|_d|_|jj�d|_|j
|�yy)z�
        If there is still a parser, call its C{connectionLost} method with the
        given reason.  If there is not, do nothing.

        @type reason: L{Failure}
        N)r�r�r�r�r�r�r�)r5r6�parsers   r*r�z&HTTP11ClientProtocol._disconnectParserLse���<�<�#��\�\�F��D�L�#'�D� �$(�D�!�%)�D�"�
� � �-�-�/�#'�D� ��!�!�&�)�$r)c�Z�|jj�|j|�y)z�
        Lose the underlying connection and disconnect the parser with the given
        L{Failure}.

        Use this method instead of calling the transport's loseConnection
        method directly otherwise random things will break.
        N)r�r�r�r�s  r*r�zHTTP11ClientProtocol._giveUpbs"��	
���%�%�'����v�&r)c��	|jj|�y#t$r|jt	��YywxYw)z4
        Handle some stuff from some place.
        N)r�r�rTr�rrJs  r*r�z!HTTP11ClientProtocol.dataReceivedms6��	$��L�L�%�%�e�,���	$��L�L���#�	$�s��"A�Ac��y)zh
        The underlying transport went away.  If appropriate, notify the parser
        object.
        Nr(r�s  r*r�z#HTTP11ClientProtocol.connectionLostvr�r)r�c��d|_y)z{
        Nothing is currently happening.  Move to the C{'CONNECTION_LOST'}
        state but otherwise do nothing.
        �CONNECTION_LOSTNr�r�s  r*�_connectionLost_QUIESCENTz.HTTP11ClientProtocol._connectionLost_QUIESCENT~���
(��r)c��d|_y)z�
        The connection was in an inconsistent state.  Move to the
        C{'CONNECTION_LOST'} state but otherwise do nothing.
        r�Nr�r�s  r*�!_connectionLost_GENERATION_FAILEDz6HTTP11ClientProtocol._connectionLost_GENERATION_FAILED�r�r)c��d|_|jjtt	|g���|`|j
j
�y)z�
        Fail the L{Deferred} for the current request, notify the request
        object that it does not need to continue transmitting itself, and
        move to the C{'CONNECTION_LOST'} state.
        r�N)rPr�r�rrBr�r:r�s  r*�_connectionLost_TRANSMITTINGz1HTTP11ClientProtocol._connectionLost_TRANSMITTING�sF��(������%�%�g�.G���.Q�&R�S��!�	
���(�(�*r)c��d|_y)z9
        Move to the C{'CONNECTION_LOST'} state.
        r�Nr�r�s  r*�5_connectionLost_TRANSMITTING_AFTER_RECEIVING_RESPONSEzJHTTP11ClientProtocol._connectionLost_TRANSMITTING_AFTER_RECEIVING_RESPONSE�s��(��r)c�4�|j|�d|_y)a
        Disconnect the response parser so that it can propagate the event as
        necessary (for example, to call an application protocol's
        C{connectionLost} method, or to fail a request L{Deferred}) and move
        to the C{'CONNECTION_LOST'} state.
        r�N)r�rPr�s  r*�_connectionLost_WAITINGz,HTTP11ClientProtocol._connectionLost_WAITING�s��	
���v�&�'��r)c��|jtt���d|_|jD]}|jd��g|_y)z�
        Disconnect the response parser with a L{ConnectionAborted} failure, and
        move to the C{'CONNECTION_LOST'} state.
        r�N)r�rrDrPr�r�)r5r6rs   r*�_connectionLost_ABORTINGz-HTTP11ClientProtocol._connectionLost_ABORTING�sK��
	
���w�'8�':�;�<�'����%�%�	�A�
�J�J�t��	�!��r)c���|jdk(rtd�S|jj�d|_t	�}|j
j
|�|S)zw
        Close the connection and cause all outstanding L{request} L{Deferred}s
        to fire with an error.
        r�N�ABORTING)rPrr�r�rr�r|)r5rs  r*�abortzHTTP11ClientProtocol.abort�sR��
�;�;�+�+��4�=� ����%�%�'� ����J�����#�#�A�&��r))r$r%r&r'rPr�r�r�r�r�r
r�r3r<rgr�r�rVr��_finishResponse_TRANSMITTINGr�r�r�r�r�r�r�r�r�r�r�r(r)r*r�r��s���;�z�F��G����O��O����8�D�)7�"�����A%�F�-�-=��O�O�++�Z$;� �*�,	'�$��,�,<�n�M�N�(�(�+�(�(�	"�r)r�)Or'�re�zope.interfacer�twisted.internet.deferrrrrr�twisted.internet.errorr	�twisted.internet.interfacesr
r�twisted.internet.protocolr�twisted.loggerr
�twisted.protocols.basicr�twisted.python.compatr�twisted.python.componentsr�twisted.python.failurer�twisted.python.reflectr�twisted.web.httprrrrrr�twisted.web.http_headersr�twisted.web.iwebrrrrrrr rUr2r"r-r/r9r;r?rBrDrFrIrKrOrQrXrZr��compilerKrwr�r�r�r�r�r/rVr^r�rr�r�r(r)r*�<module>r�s.��
�0
�&���2�@�.�!�0�/�7�*�5���-�F�F�
��	��
��
��
�X�
�����)��	��	�����	���/��� 1���	���i���9��!�&�!�"�N���Y��
�M$��M$�`^'�z�^'�B��
�
��
����
�	
����
�:3�.�R�Z�Z�,�
-�
�-�.
�^��j:�j:��j:�Z	D?�D?�N�>(��7��
�Y��rU�rU��rU�j
�Y��)"�)"��)"�X
�]��:,�:,��:,�z�8�r)

Zerion Mini Shell 1.0