§
    ÉtºfÊ· ã                   ó†  — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZ ddlmZmZ ddlmZmZ ddlmZ dd	lmZmZmZmZ dd
lmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZCmDZD ddlEmFZFmGZG  G d„ deH¦  «        ZI G d„ deH¦  «        ZJ eAddgi¦  «        ZKd„ ZLd„ ZMd„ ZNd„ ZOd„ ZP G d„ d e ¦  «        ZQ G d!„ d"¦  «        ZR G d#„ d$eRe ¦  «        ZS G d%„ d&eRe ¦  «        ZT G d'„ d(e ¦  «        ZU G d)„ d*¦  «        ZV G d+„ d,¦  «        ZW G d-„ d.e ¦  «        ZX eeC¦  «         G d/„ d0¦  «        ¦   «         ZY G d1„ d2e ¦  «        ZZ G d3„ d4e ¦  «        Z[ G d5„ d6e ¦  «        Z\ G d7„ d8e ¦  «        Z] G d9„ d:e ¦  «        Z^d;S )<z&
Tests for L{twisted.web._newclient}.
é    )ÚOptional)Úimplementer)ÚverifyObject)ÚCancelledErrorÚDeferredÚfailÚsucceed)ÚConnectionDoneÚConnectionLost)Ú	IConsumerÚIPushProducer)ÚProtocol)ÚAccumulatingProtocolÚEventLoggingObserverÚStringTransportÚ StringTransportWithDisconnection)ÚglobalLogPublisher)ÚLineReceiver)ÚFailure)ÚTestCase)ÚBODYÚDONEÚHEADERÚSTATUSÚUNKNOWN_LENGTHÚ
BadHeadersÚBadResponseVersionÚChunkedEncoderÚConnectionAbortedÚExcessWriteÚHTTPClientParserÚ
HTTPParserÚLengthEnforcingConsumerÚ
ParseErrorÚRequestNotSentÚTransportProxyProducerÚWrongBodyLengthÚmakeStatefulDispatcher)	ÚHTTP11ClientProtocolÚPotentialDataLossÚRequestÚRequestGenerationFailedÚRequestTransmissionFailedÚResponseÚResponseDoneÚResponseFailedÚResponseNeverReceived)Ú	_DataLoss)ÚHeaders)ÚIBodyProducerÚ	IResponse)ÚbytesLinearWhitespaceComponentsÚsanitizedBytesc                   ó   — e Zd ZdZdS )ÚArbitraryExceptionze
    A unique, arbitrary exception type which L{twisted.web._newclient} knows
    nothing about.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú^/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/web/test/test_newclient.pyr9   r9   C   s   € € € € € ðð ð ð r@   r9   c                   ó   — e Zd ZdZdS )ÚAnotherArbitraryExceptionzI
    Similar to L{ArbitraryException} but with a different identity.
    Nr:   r?   r@   rA   rC   rC   J   s   € € € € € ðð ð ð r@   rC   ó   hostó   example.comc                 ól   ‡ ‡— ˆˆ fd„}‰                       ||¦  «        }|                     |¦  «         |S )a•  
    Assert that the given L{Deferred} fails with the exception given by
    C{mainType} and that the exceptions wrapped by the instance of C{mainType}
    it fails with match the list of exception types given by C{reasonTypes}.

    This is a helper for testing failures of exceptions which subclass
    L{_newclient._WrapperException}.

    @param self: A L{TestCase} instance which will be used to make the
        assertions.

    @param deferred: The L{Deferred} which is expected to fail with
        C{mainType}.

    @param mainType: A L{_newclient._WrapperException} subclass which will be
        trapped on C{deferred}.

    @param reasonTypes: A sequence of exception types which will be trapped on
        the resulting C{mainType} exception instance's C{reasons} sequence.

    @return: A L{Deferred} which fires with the C{mainType} instance
        C{deferred} fails with, or which fails somehow.
    c           	      óì   •— t          | j        ‰¦  «        D ]\  }}|                     |¦  «         Œ‰                     t	          | j        ¦  «        t	          ‰¦  «        d| j        › d‰› d�¦  «         | S )Nzlen(z	) != len(ú))ÚzipÚreasonsÚtrapÚassertEqualÚlen)ÚerrÚreasonÚtypeÚreasonTypesÚselfs      €€rA   ÚcbFailedz-assertWrapperExceptionTypes.<locals>.cbFailedn   s†   ø€ Ý ¤¨[Ñ9Ô9ð 	ð 	‰LˆF�DØ�KŠK˜ÑÔÐÐØ×ÒÝ�”ÑÔÝ�ÑÔØ7�3”;Ð7Ð7¨Ð7Ð7Ð7ñ	
ô 	
ð 	
ð
 ˆ
r@   )ÚassertFailureÚaddCallback)rR   ÚdeferredÚmainTyperQ   rS   Úds   `  `  rA   ÚassertWrapperExceptionTypesrY   U   sP   øø€ ð2ð ð ð ð ð ð 	×Ò˜8 XÑ.Ô.€AØ‡M‚M�(ÑÔÐØ€Hr@   c                 ó0   — t          | |t          |¦  «        S )zo
    A simple helper to invoke L{assertWrapperExceptionTypes} with a C{mainType}
    of L{ResponseFailed}.
    )rY   r0   ©rR   rV   rQ   s      rA   ÚassertResponseFailedr\   }   s   € õ
 ' t¨Xµ~À{ÑSÔSÐSr@   c                 ó0   — t          | |t          |¦  «        S )zx
    A simple helper to invoke L{assertWrapperExceptionTypes} with a C{mainType}
    of L{RequestGenerationFailed}.
    )rY   r,   r[   s      rA   ÚassertRequestGenerationFailedr^   …   s    € õ
 'ØˆhÕ/°ñô ð r@   c                 ó0   — t          | |t          |¦  «        S )zz
    A simple helper to invoke L{assertWrapperExceptionTypes} with a C{mainType}
    of L{RequestTransmissionFailed}.
    )rY   r-   r[   s      rA   ÚassertRequestTransmissionFailedr`   �   s    € õ
 'ØˆhÕ1°;ñô ð r@   c                 ó2   — t          dddt          | ¦  «        S )zî
    Helper function for creating a Response which uses the given transport.
    All of the other parameters to L{Response.__init__} are filled with
    arbitrary values.  Only use this method if you don't care about any of
    them.
    ©s   HTTPé   rc   éÈ   ó   OK)r.   Ú_boringHeaders)Ú	transports    rA   ÚjustTransportResponserh   ™   s   € õ �O S¨%µÀÑKÔKÐKr@   c                   ó   — e Zd ZdZd„ ZdS )ÚMakeStatefulDispatcherTestsz.
    Tests for L{makeStatefulDispatcher}.
    c                 ó0  —  G d„ d¦  «        } |¦   «         }|                       |                     ¦   «         d¦  «         d|_        |                       |                     ¦   «         d¦  «         d|_        |                      t          |j        ¦  «         dS )z‹
        A method defined with L{makeStatefulDispatcher} invokes a second
        method based on the current state of the object.
        c                   ó<   — e Zd ZdZd„ Z ede¦  «        Zd„ Zd„ ZdS )úCMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.FooÚAc                 ó   — d S ©Nr?   ©rR   s    rA   ÚbarzGMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Foo.bar±   s   € Ø�r@   Úquuxc                 ó   — dS )NÚar?   rq   s    rA   Ú_quux_AzKMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Foo._quux_A¶   ó   € Ø�sr@   c                 ó   — dS )NÚbr?   rq   s    rA   Ú_quux_BzKMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Foo._quux_B¹   rw   r@   N)r;   r<   r=   Ú_staterr   r(   rv   rz   r?   r@   rA   ÚFoorm   ®   sZ   € € € € € ØˆFðð ð ð )Ð(¨°Ñ5Ô5ˆCðð ð ðð ð ð ð r@   r|   ru   ÚBry   ÚCN)rL   rr   r{   ÚassertRaisesÚRuntimeError)rR   r|   Ústatefuls      rA   Útest_functionCalledByStatez6MakeStatefulDispatcherTests.test_functionCalledByState¨   sŸ   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð �3‘5”5ˆØ×Ò˜Ÿš™œ¨Ñ-Ô-Ð-ØˆŒØ×Ò˜Ÿš™œ¨Ñ-Ô-Ð-ØˆŒØ×Ò�,¨¬Ñ5Ô5Ð5Ð5Ð5r@   N)r;   r<   r=   r>   r‚   r?   r@   rA   rj   rj   £   s-   € € € € € ðð ð6ð 6ð 6ð 6ð 6r@   rj   c                   ój   — e Zd ZU dZdZee         ed<   d„ Zd„ Z	d„ Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ ZdS )Ú_HTTPParserTestszt
    Base test class for L{HTTPParser} which is responsible for the bulk of
    the task of parsing HTTP bytes.
    NÚsepc                 óh  — g }t          ¦   «         }|j        |_        |                     t	          ¦   «         ¦  «         |                      |j        t          ¦  «         |                     d| j	        z   ¦  «         |                      |dg¦  «         |                      |j        t          ¦  «         dS )zj
        L{HTTPParser} calls its C{statusReceived} method when it receives a
        status line.
        ó   HTTP/1.1 200 OKN)r"   ÚappendÚstatusReceivedÚmakeConnectionr   rL   Ústater   ÚdataReceivedr…   r   )rR   ÚstatusÚprotocols      rA   Útest_statusCallbackz$_HTTPParserTests.test_statusCallbackÌ   s¢   € ð
 ˆÝ‘<”<ˆØ"(¤-ˆÔØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Ò˜œ­Ñ0Ô0Ð0Ø×ÒÐ0°4´8Ñ;Ñ<Ô<Ð<Ø×Ò˜Ð"4Ð!5Ñ6Ô6Ð6Ø×Ò˜œ­Ñ0Ô0Ð0Ð0Ð0r@   c                 ó¾   — i }t          ¦   «         }|j        |_        |                     t	          ¦   «         ¦  «         |                     d| j        z   ¦  «         ||fS )Nr‡   )r"   Ú__setitem__ÚheaderReceivedrŠ   r   rŒ   r…   ©rR   ÚheaderrŽ   s      rA   Ú_headerTestSetupz!_HTTPParserTests._headerTestSetupÚ   s\   € ØˆÝ‘<”<ˆØ"(Ô"4ˆÔØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ0°4´8Ñ;Ñ<Ô<Ð<Ø�xÐÐr@   c                 ó  — |                       ¦   «         \  }}|                     d| j        z   ¦  «         |                     | j        ¦  «         |                      |ddi¦  «         |                      |j        t
          ¦  «         dS )ze
        L{HTTPParser} calls its C{headerReceived} method when it receives a
        header.
        s	   X-Foo:baró   X-Fooó   barN©r•   rŒ   r…   rL   r‹   r   r“   s      rA   Útest_headerCallbackz$_HTTPParserTests.test_headerCallbackâ   s†   € ð
  ×0Ò0Ñ2Ô2Ñˆ�Ø×Ò˜l¨T¬XÑ5Ñ6Ô6Ð6ð 	×Ò˜dœhÑ'Ô'Ð'Ø×Ò˜ (¨FÐ!3Ñ4Ô4Ð4Ø×Ò˜œ­Ñ.Ô.Ð.Ð.Ð.r@   c                 ó†  — |                       ¦   «         \  }}|                     d| j        z   ¦  «         |                     d| j        z   ¦  «         |                     d| j        z   ¦  «         |                     | j        ¦  «         |                      |ddi¦  «         |                      |j        t
          ¦  «         dS )z”
        If a header is split over multiple lines, L{HTTPParser} calls
        C{headerReceived} with the entire value once it is received.
        ó
   X-Foo: bars    bazs   	quuxr—   s   bar baz	quuxNr™   r“   s      rA   Útest_continuedHeaderCallbackz-_HTTPParserTests.test_continuedHeaderCallbackï   s»   € ð
  ×0Ò0Ñ2Ô2Ñˆ�Ø×Ò˜m¨d¬hÑ6Ñ7Ô7Ð7Ø×Ò˜g¨¬Ñ0Ñ1Ô1Ð1Ø×Ò˜i¨$¬(Ñ2Ñ3Ô3Ð3Ø×Ò˜dœhÑ'Ô'Ð'Ø×Ò˜ (Ð,<Ð!=Ñ>Ô>Ð>Ø×Ò˜œ­Ñ.Ô.Ð.Ð.Ð.r@   c                 ó2  — |                       ¦   «         \  }}| j                             g d¢¦  «        }|                     d|z   ¦  «         |                     d|z   ¦  «         |                     | j        ¦  «         |                      |dddœ¦  «         dS )zŒ
        Leading and trailing linear whitespace is stripped from the header
        value passed to the C{headerReceived} callback.
        )s    	 s    bar 	s    	r@   s   X-Bar:s   X-Foo:r˜   )r—   s   X-BarN)r•   r…   ÚjoinrŒ   rL   )rR   r”   rŽ   Úvalues       rA   Útest_fieldContentWhitespacez,_HTTPParserTests.test_fieldContentWhitespaceü   s    € ð
  ×0Ò0Ñ2Ô2Ñˆ�Ø”—’Ð@Ð@Ð@ÑAÔAˆØ×Ò˜i¨%Ñ/Ñ0Ô0Ð0Ø×Ò˜i¨%Ñ/Ñ0Ô0Ð0Ø×Ò˜dœhÑ'Ô'Ð'Ø×Ò˜¨F¸fÐ!EÐ!EÑFÔFÐFÐFÐFr@   c                 ó  ‡‡— g Š|                       ¦   «         \  }Šˆˆfd„}|‰_        ‰                     | j        ¦  «         |                      ‰t
          g¦  «         |                      ‰j        t          ¦  «         dS )zg
        After the last header is received, L{HTTPParser} calls
        C{allHeadersReceived}.
        c                  óT   •— ‰                       ‰j        ¦  «         t          ‰_        d S rp   )rˆ   r‹   r   )ÚcalledrŽ   s   €€rA   ÚallHeadersReceivedzD_HTTPParserTests.test_allHeadersCallback.<locals>.allHeadersReceived  s"   ø€ Ø�MŠM˜(œ.Ñ)Ô)Ð)Ý#ˆHŒNˆNˆNr@   N)r•   r¥   rŒ   r…   rL   r   r‹   r   )rR   r”   r¥   r¤   rŽ   s      @@rA   Útest_allHeadersCallbackz(_HTTPParserTests.test_allHeadersCallback  s•   øø€ ð
 ˆØ×0Ò0Ñ2Ô2Ñˆ�ð	$ð 	$ð 	$ð 	$ð 	$ð 	$ð '9ˆÔ#Ø×Ò˜dœhÑ'Ô'Ð'Ø×Ò˜¥& Ñ*Ô*Ð*Ø×Ò˜œ­Ñ0Ô0Ð0Ð0Ð0r@   c                 óÔ   — |                       ¦   «         \  }}|                     | j        ¦  «         |                      |i ¦  «         |                      |j        t
          ¦  «         dS )zp
        If there are no headers in the message, L{HTTPParser} does not call
        C{headerReceived}.
        Nr™   r“   s      rA   Útest_noHeaderCallbackz&_HTTPParserTests.test_noHeaderCallback  sd   € ð
  ×0Ò0Ñ2Ô2Ñˆ�Ø×Ò˜dœhÑ'Ô'Ð'Ø×Ò˜ Ñ$Ô$Ð$Ø×Ò˜œ­Ñ.Ô.Ð.Ð.Ð.r@   c                 óÈ  — t          ¦   «         }|                     t          ¦   «         ¦  «         |                     d| j        z   ¦  «         |                     d| j        z   ¦  «         |                     d| j        z   ¦  «         |                     | j        ¦  «         dddgfg}|                      |t          |j                             ¦   «         ¦  «        ¦  «         dS )zc
        All headers received by L{HTTPParser} are added to
        L{HTTPParser.headers}.
        r‡   rœ   ó
   X-Foo: bazr—   r˜   ó   bazN)	r"   rŠ   r   rŒ   r…   rL   ÚlistÚheadersÚgetAllRawHeaders)rR   rŽ   Úexpecteds      rA   Útest_headersSavedOnResponsez,_HTTPParserTests.test_headersSavedOnResponse#  sÔ   € õ
 ‘<”<ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ0°4´8Ñ;Ñ<Ô<Ð<Ø×Ò˜m¨d¬hÑ6Ñ7Ô7Ð7Ø×Ò˜m¨d¬hÑ6Ñ7Ô7Ð7Ø×Ò˜dœhÑ'Ô'Ð'Ø ¨Ð/Ð0Ð1ˆØ×Ò˜¥4¨Ô(8×(IÒ(IÑ(KÔ(KÑ#LÔ#LÑMÔMÐMÐMÐMr@   c                 óà   — t          ¦   «         }g d¢}|D ]/}|                      |                     |¦  «        d|›d�¦  «         Œ0|                      |                     d¦  «        d¦  «         dS )zð
        L{HTTPParser.isConnectionControlHeader} returns C{True} for headers
        which are always connection control headers (similar to "hop-by-hop"
        headers from RFC 2616 section 13.5.1) and C{False} for other headers.
        )ó   content-lengthó
   connections
   keep-alives   tes   trailerss   transfer-encodings   upgrades   proxy-connectionz
Expecting z. to be a connection control header, but wasn'ts   datez`Expecting the arbitrarily selected 'date' header to not be a connection control header, but was.N)r"   Ú
assertTrueÚisConnectionControlHeaderÚassertFalse)rR   rŽ   ÚconnHeaderNamesr”   s       rA   Útest_connectionControlHeadersz._HTTPParserTests.test_connectionControlHeaders1  s¤   € õ ‘<”<ˆð	
ð 	
ð 	
ˆð &ð 	ð 	ˆFØ�OŠOØ×2Ò2°6Ñ:Ô:Ð:à"˜F˜Fð%ñô ð ð ð
 	×ÒØ×.Ò.¨wÑ7Ô7ð4ñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 ó   — t          ¦   «         }|                     t          ¦   «         ¦  «         |                     t	          ¦   «         ¦  «         |                      t          |j        t	          ¦   «         ¦  «         dS )zi
        L{HTTPParser.switchToBodyMode} raises L{RuntimeError} if called more
        than once.
        N)r"   rŠ   r   ÚswitchToBodyModeÚobjectr   r€   ©rR   rŽ   s     rA   Útest_switchToBodyModez&_HTTPParserTests.test_switchToBodyModeO  sd   € õ
 ‘<”<ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×!Ò!¥&¡(¤(Ñ+Ô+Ð+Ø×Ò�,¨Ô(AÅ6Á8Ä8ÑLÔLÐLÐLÐLr@   )r;   r<   r=   r>   r…   r   ÚbytesÚ__annotations__r�   r•   rš   r�   r¡   r¦   r¨   r°   r¸   r½   r?   r@   rA   r„   r„   Ä   s×   € € € € € € ðð ð
  €Cˆ�%ŒÐÐÑð1ð 1ð 1ð ð  ð  ð/ð /ð /ð/ð /ð /ð
Gð 
Gð 
Gð1ð 1ð 1ð"/ð /ð /ðNð Nð Nð
ð 
ð 
ð<Mð Mð Mð Mð Mr@   r„   c                   ó   — e Zd ZdZdZdS )Ú$HTTPParserRFCComplaintDelimeterTestsz<
    L{_HTTPParserTests} using standard CR LF newlines.
    ó   
N©r;   r<   r=   r>   r…   r?   r@   rA   rÁ   rÁ   Z  s   € € € € € ðð ð €C€C€Cr@   rÁ   c                   ó   — e Zd ZdZdZdS )Ú'HTTPParserNonRFCComplaintDelimeterTestsz5
    L{_HTTPParserTests} using bare LF newlines.
    ó   
NrÃ   r?   r@   rA   rÅ   rÅ   b  s   € € € € € ðð ð €C€C€Cr@   rÅ   c                   óÞ   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d „ Z"d!„ Z#d"„ Z$d#„ Z%d$S )%ÚHTTPClientParserTestszd
    Tests for L{HTTPClientParser} which is responsible for parsing HTTP
    response messages.
    c                 óx   — t          dd¦  «        }|                      |                     d¦  «        d¦  «         dS )zj
        L{HTTPClientParser.parseVersion} parses a status line into its three
        components.
        Ns	   CANDY/7.2)s   CANDYé   é   )r!   rL   ÚparseVersionr¼   s     rA   Útest_parseVersionz'HTTPClientParserTests.test_parseVersionp  s>   € õ
 $ D¨$Ñ/Ô/ˆØ×Ò˜×.Ò.¨|Ñ<Ô<Ð>NÑOÔOÐOÐOÐOr@   c                 óÚ   ‡ ‡‡— t          dd¦  «        }t          Š|j        Šˆˆˆ fd„} |d¦  «          |d¦  «          |d¦  «          |d¦  «          |d¦  «          |d¦  «         dS )	zr
        L{HTTPClientParser.parseVersion} raises L{ValueError} when passed an
        unparsable version.
        Nc                 ól   •— ‰                      ‰‰| ¦  «        }‰                     |j        | ¦  «         d S rp   )r   rL   Údata)ÚsÚexcÚeÚfrR   s     €€€rA   ÚcheckParsingz@HTTPClientParserTests.test_parseBadVersion.<locals>.checkParsing�  s8   ø€ Ø×#Ò# A q¨!Ñ,Ô,ˆCØ×Ò˜SœX qÑ)Ô)Ð)Ð)Ð)r@   ó   foos   foo/bar/bazs   foo/s   foo/..s   foo/a.bs	   foo/-1.-1)r!   r   rÌ   )rR   rŽ   rÕ   rÓ   rÔ   s   `  @@rA   Útest_parseBadVersionz*HTTPClientParserTests.test_parseBadVersionx  s®   øøø€ õ
 $ D¨$Ñ/Ô/ˆÝˆØÔ!ˆð	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	ˆ�VÑÔÐØˆ�^Ñ$Ô$Ð$àˆ�WÑÔÐØˆ�YÑÔÐàˆ�ZÑ Ô Ð Øˆ�\Ñ"Ô"Ð"Ð"Ð"r@   c                 ó€  — t          ddt          d¦  «        }t          |d¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                      |j        j        d¦  «         |                      |j        j	        d¦  «         |                      |j        j
        d¦  «         dS )zž
        L{HTTPClientParser.statusReceived} parses the version, code, and phrase
        from the status line and stores them on the response object.
        ó   GETó   /Nó   HTTP/1.1 200 OK
rb   rd   re   ©r+   rf   r!   rŠ   r   rŒ   rL   ÚresponseÚversionÚcodeÚphrase©rR   ÚrequestrŽ   s      rA   Útest_responseStatusParsingz0HTTPClientParserTests.test_responseStatusParsingŽ  s¯   € õ
 ˜& $­¸Ñ=Ô=ˆÝ# G¨TÑ2Ô2ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×Ò˜Ô*Ô2°OÑDÔDÐDØ×Ò˜Ô*Ô/°Ñ5Ô5Ð5Ø×Ò˜Ô*Ô1°5Ñ9Ô9Ð9Ð9Ð9r@   c                 ó€  — t          ddt          d¦  «        }t          |d¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                      |j        j        d¦  «         |                      |j        j	        d¦  «         |                      |j        j
        d¦  «         dS )zß
        L{HTTPClientParser.statusReceived} can parse a status line without a
        phrase (though such lines are a violation of RFC 7230, section 3.1.2;
        nevertheless some broken servers omit the phrase).
        rÙ   rÚ   Ns   HTTP/1.1 200
rb   rd   r@   rÜ   rá   s      rA   Ú test_responseStatusWithoutPhrasez6HTTPClientParserTests.test_responseStatusWithoutPhrase›  s¯   € õ ˜& $­¸Ñ=Ô=ˆÝ# G¨TÑ2Ô2ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ1Ñ2Ô2Ð2Ø×Ò˜Ô*Ô2°OÑDÔDÐDØ×Ò˜Ô*Ô/°Ñ5Ô5Ð5Ø×Ò˜Ô*Ô1°3Ñ7Ô7Ð7Ð7Ð7r@   c                 ób   ‡ ‡— t          dd¦  «        Šˆˆ fd„} |d¦  «          |d¦  «         dS )zŒ
        L{HTTPClientParser.statusReceived} raises L{ParseError} if it is called
        with a status line which cannot be parsed.
        Nc                 ó€   •— ‰                      t          ‰j        | ¦  «        }‰                     |j        | ¦  «         d S rp   )r   r$   r‰   rL   rÐ   )rÑ   rÒ   rŽ   rR   s     €€rA   rÕ   zBHTTPClientParserTests.test_badResponseStatus.<locals>.checkParsing°  s;   ø€ Ø×#Ò#¥J°Ô0GÈÑKÔKˆCØ×Ò˜SœX qÑ)Ô)Ð)Ð)Ð)r@   rÖ   s   HTTP/1.1 bar OK)r!   )rR   rÕ   rŽ   s   ` @rA   Útest_badResponseStatusz,HTTPClientParserTests.test_badResponseStatus©  s^   øø€ õ
 $ D¨$Ñ/Ô/ˆð	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	ˆ�VÑÔÐð 	ˆÐ'Ñ(Ô(Ð(Ð(Ð(r@   c                 ór  ‡	— i }g }g }g Š	t          ||j        ¦  «        }|j        |_        t	          ¦   «         }|                     |¦  «         |                     |¦  «         |j        |j        _        ˆ	fd„|j        _	        |                     |¦  «         |  
                    |j        d¦  «         |  
                    |j        t          ¦  «         |  
                    |g ¦  «         |  
                    |dg¦  «         |  
                    ‰	dg¦  «         |  
                    |j        j        d¦  «         |S )a0  
        Assert that L{HTTPClientParser} parses the given C{response} to
        C{request}, resulting in a response with no body and no extra bytes and
        leaving the transport in the producing state.

        @param request: A L{Request} instance which might have caused a server
            to return the given response.
        @param status: A string giving the status line of the response to be
            parsed.
        @param response: A string giving the response to be parsed.

        @return: A C{dict} of headers from the response.
        c                  ó.   •— ‰                       d¦  «        S ©NT©rˆ   )ÚbodyDataFinisheds   €rA   ú<lambda>z3HTTPClientParserTests._noBodyTest.<locals>.<lambda>Ö  s   ø€ Ð6F×6MÒ6MÈdÑ6SÔ6S€ r@   Ú	producingr@   Tr   )r!   rˆ   r‘   r’   r   rŠ   rŒ   rÝ   Ú_bodyDataReceivedÚ_bodyDataFinishedrL   ÚproducerStater‹   r   Úlength)
rR   râ   r�   rÝ   r”   ÚfinishedÚbodyrŽ   rg   rí   s
            @rA   Ú_noBodyTestz!HTTPClientParserTests._noBodyTest¼  s9  ø€ ð ˆØˆØˆØÐÝ# G¨X¬_Ñ=Ô=ˆØ"(Ô"4ˆÔÝ#Ñ%Ô%ˆ	Ø×Ò 	Ñ*Ô*Ð*ð 	×Ò˜fÑ%Ô%Ð%Ø.2¬kˆÔÔ+Ø.SÐ.SÐ.SÐ.SˆÔÔ+Ø×Ò˜hÑ'Ô'Ð'Ø×Ò˜Ô0°+Ñ>Ô>Ð>Ø×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜˜rÑ"Ô"Ð"Ø×Ò˜ C 5Ñ)Ô)Ð)Ø×ÒÐ)¨D¨6Ñ2Ô2Ð2Ø×Ò˜Ô*Ô1°1Ñ5Ô5Ð5Øˆr@   c                 óš   — t          ddt          d¦  «        }d}d}|                      |||¦  «        }|                      |ddi¦  «         dS )zÁ
        If the response is to a HEAD request, no body is expected, the body
        callback is not invoked, and the I{Content-Length} header is passed to
        the header callback.
        ó   HEADrÚ   NrÛ   s   Content-Length: 10

s   Content-Lengths   10)r+   rf   rö   rL   )rR   râ   r�   rÝ   r”   s        rA   Útest_headResponsez'HTTPClientParserTests.test_headResponseà  sZ   € õ ˜' 4­¸Ñ>Ô>ˆØ'ˆØ4ˆØ×!Ò! '¨6°8Ñ<Ô<ˆØ×Ò˜Ð"3°UÐ!;Ñ<Ô<Ð<Ð<Ð<r@   c                 ój   — t          ddt          d¦  «        }d}d}|                      |||¦  «         dS )z€
        If the response code is I{NO CONTENT} (204), no body is expected and
        the body callback is not invoked.
        rÙ   rÚ   Ns   HTTP/1.1 204 NO CONTENT
rÂ   ©r+   rf   rö   ©rR   râ   r�   rÝ   s       rA   Útest_noContentResponsez,HTTPClientParserTests.test_noContentResponseì  s?   € õ
 ˜& $­¸Ñ=Ô=ˆØ/ˆØˆØ×Ò˜ &¨(Ñ3Ô3Ð3Ð3Ð3r@   c                 ój   — t          ddt          d¦  «        }d}d}|                      |||¦  «         dS )z‚
        If the response code is I{NOT MODIFIED} (304), no body is expected and
        the body callback is not invoked.
        rÙ   rÚ   Ns   HTTP/1.1 304 NOT MODIFIED
rÂ   rû   rü   s       rA   Útest_notModifiedResponsez.HTTPClientParserTests.test_notModifiedResponseö  s?   € õ
 ˜& $­¸Ñ=Ô=ˆØ1ˆØˆØ×Ò˜ &¨(Ñ3Ô3Ð3Ð3Ð3r@   c                 ó  — t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                      |j        t          i ¦  «        ¦  «         |                      |j	        j
        t          dd	gi¦  «        ¦  «         |                      |j	        j        t          ¦  «         dS )
zq
        The response headers are added to the response object's C{headers}
        L{Headers} instance.
        rÙ   rÚ   Nc                 ó   — d S rp   r?   ©Úrests    rA   rî   z<HTTPClientParserTests.test_responseHeaders.<locals>.<lambda>  ó   € Àd€ r@   rÛ   s   X-Foo: bar
rÂ   ó   x-foor˜   ©r!   r+   rf   rŠ   r   rŒ   rL   ÚconnHeadersr3   rÝ   r­   ÚassertIdenticalró   r   r¼   s     rA   Útest_responseHeadersz*HTTPClientParserTests.test_responseHeaders   sð   € õ
 $Ý�F˜D¥.°$Ñ7Ô7Ð9JÐ9Jñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×ÒÐ/Ñ0Ô0Ð0Ø×Ò˜gÑ&Ô&Ð&Ø×Ò˜Ô-­w°r©{¬{Ñ;Ô;Ð;Ø×Ò˜Ô*Ô2µG¸XÈÀxÐ<PÑ4QÔ4QÑRÔRÐRØ×Ò˜XÔ.Ô5µ~ÑFÔFÐFÐFÐFr@   c                 ó6  — t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                      |j        t          i ¦  «        ¦  «         |                      |j	        j
        t          d	d
gi¦  «        ¦  «         |                      |j	        j        t          ¦  «         dS )z‡
        The multi-line response headers are folded and added to the response
        object's C{headers} L{Headers} instance.
        rÙ   rÚ   Nc                 ó   — d S rp   r?   r  s    rA   rî   zEHTTPClientParserTests.test_responseHeadersMultiline.<locals>.<lambda>  r  r@   rÛ   s   X-Multiline: a
s       b
rÂ   s   x-multilines   a    br  r¼   s     rA   Útest_responseHeadersMultilinez3HTTPClientParserTests.test_responseHeadersMultiline  s  € õ
 $Ý�F˜D¥.°$Ñ7Ô7Ð9JÐ9Jñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×ÒÐ3Ñ4Ô4Ð4Ø×Ò˜lÑ+Ô+Ð+Ø×Ò˜gÑ&Ô&Ð&Ø×Ò˜Ô-­w°r©{¬{Ñ;Ô;Ð;Ø×ÒØÔÔ%¥w°ÀÀÐ/LÑ'MÔ'Mñ	
ô 	
ð 	
ð 	×Ò˜XÔ.Ô5µ~ÑFÔFÐFÐFÐFr@   c                 ó0  — t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                      |j        j        t          i ¦  «        ¦  «         |                      |j
        t          d	gd
gdœ¦  «        ¦  «         |                      |j        j        d¦  «         dS )zv
        The connection control headers are added to the parser's C{connHeaders}
        L{Headers} instance.
        rÙ   rÚ   Nc                 ó   — d S rp   r?   r  s    rA   rî   z>HTTPClientParserTests.test_connectionHeaders.<locals>.<lambda>)  r  r@   rÛ   ó   Content-Length: 123
s   Connection: close
rÂ   ó   123s   close)r²   r³   é{   ©r!   r+   rf   rŠ   r   rŒ   rL   rÝ   r­   r3   r  ró   r¼   s     rA   Útest_connectionHeadersz,HTTPClientParserTests.test_connectionHeaders#  s  € õ
 $Ý�F˜D¥.°$Ñ7Ô7Ð9JÐ9Jñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×ÒÐ8Ñ9Ô9Ð9Ø×ÒÐ6Ñ7Ô7Ð7Ø×Ò˜gÑ&Ô&Ð&Ø×Ò˜Ô*Ô2µG¸B±K´KÑ@Ô@Ð@Ø×ÒØÔ Ý¨¨À(ÀÐLÐLÑMÔMñ	
ô 	
ð 	
ð 	×Ò˜Ô*Ô1°3Ñ7Ô7Ð7Ð7Ð7r@   c                 ó  — t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                      |j        j        t          dd	gi¦  «        ¦  «         |                      |j
        t          i ¦  «        ¦  «         |                      |j        j        d
¦  «         dS )z§
        If a HEAD request is made, the I{Content-Length} header in the response
        is added to the response headers, not the connection control headers.
        rø   rÚ   Nc                 ó   — d S rp   r?   r  s    rA   rî   zRHTTPClientParserTests.test_headResponseContentLengthEntityHeader.<locals>.<lambda>=  s   € Àt€ r@   rÛ   r  rÂ   r²   r  r   r  r¼   s     rA   Ú*test_headResponseContentLengthEntityHeaderz@HTTPClientParserTests.test_headResponseContentLengthEntityHeader7  sú   € õ
 $Ý�G˜T¥>°4Ñ8Ô8Ð:KÐ:Kñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×ÒÐ8Ñ9Ô9Ð9Ø×Ò˜gÑ&Ô&Ð&Ø×ÒØÔÔ%¥wÐ0AÀFÀ8Ð/LÑ'MÔ'Mñ	
ô 	
ð 	
ð 	×Ò˜Ô-­w°r©{¬{Ñ;Ô;Ð;Ø×Ò˜Ô*Ô1°1Ñ5Ô5Ð5Ð5Ð5r@   c                 ó  — g }t          t          ddt          d¦  «        |j        ¦  «        }t	          ¦   «         }|                     |¦  «         |                     d¦  «         g }|j        |j        _        |                     d¦  «         |                     d¦  «         |  	                    |j
        d¦  «         |  	                    |j        t          ¦  «         |                     d¦  «         |  	                    |dg¦  «         |  	                    |j        t          ¦  «         |                     d	¦  «         |  	                    |dd	g¦  «         |  	                    |j        t          ¦  «         |  	                    |d
g¦  «         dS )zÛ
        If a response includes a body with a length given by the
        I{Content-Length} header, the bytes which make up the body are passed
        to the C{_bodyDataReceived} callback on the L{HTTPParser}.
        rÙ   rÚ   NrÛ   s   Content-Length: 10
rÂ   Úpauseds   xxxxxxs   yyyyr@   )r!   r+   rf   rˆ   r   rŠ   rŒ   rÝ   rð   rL   rò   r‹   r   r   ©rR   rô   rŽ   rg   rõ   s        rA   Útest_contentLengthz(HTTPClientParserTests.test_contentLengthI  sz  € ð ˆÝ#Ý�F˜D¥.°$Ñ7Ô7¸¼ñ
ô 
ˆõ $Ñ%Ô%ˆ	Ø×Ò 	Ñ*Ô*Ð*Ø×ÒÐ4Ñ5Ô5Ð5ØˆØ.2¬kˆÔÔ+Ø×ÒÐ7Ñ8Ô8Ð8Ø×Ò˜gÑ&Ô&Ð&ð 	×Ò˜Ô0°(Ñ;Ô;Ð;à×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜hÑ'Ô'Ð'Ø×Ò˜ ˜zÑ*Ô*Ð*Ø×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜hÑ'Ô'Ð'Ø×Ò˜ ¨(Ð3Ñ4Ô4Ð4Ø×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜ C 5Ñ)Ô)Ð)Ð)Ð)r@   c                 ó  — g }t          t          ddt          d¦  «        |j        ¦  «        }|                     t          ¦   «         ¦  «         |                     d¦  «         g }|j        |j        _        |                     d¦  «         |                     d¦  «         |  	                    |j
        t          ¦  «         |  	                    |g ¦  «         |  	                    |dg¦  «         |  	                    |j        j        d¦  «         dS )	zÛ
        If a response includes a I{Content-Length} header indicating zero bytes
        in the response, L{Response.length} is set accordingly and no data is
        delivered to L{Response._bodyDataReceived}.
        rÙ   rÚ   NrÛ   ó   Content-Length: 0
rÂ   r@   r   )r!   r+   rf   rˆ   rŠ   r   rŒ   rÝ   rð   rL   r‹   r   ró   ©rR   rô   rŽ   rõ   s       rA   Útest_zeroContentLengthz,HTTPClientParserTests.test_zeroContentLengthh  s  € ð ˆÝ#Ý�F˜D¥.°$Ñ7Ô7¸¼ñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5àˆØ.2¬kˆÔÔ+à×ÒÐ6Ñ7Ô7Ð7Ø×Ò˜gÑ&Ô&Ð&à×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜˜rÑ"Ô"Ð"Ø×Ò˜ C 5Ñ)Ô)Ð)Ø×Ò˜Ô*Ô1°1Ñ5Ô5Ð5Ð5Ð5r@   c                 óÔ   — t          t          ddt          d¦  «        d¦  «        }|                     t	          ¦   «         ¦  «         |                      t          |j        d¦  «         dS )zè
        If a response includes multiple, distinct I{Content-Length} headers,
        L{HTTPClientParser.dataReceived} raises L{ValueError} to indicate that
        the response is invalid and the transport is now unusable.
        rÙ   rÚ   Ns9   HTTP/1.1 200 OK
Content-Length: 1
Content-Length: 2

©r!   r+   rf   rŠ   r   r   Ú
ValueErrorrŒ   r¼   s     rA   Ú)test_multipleDistinctContentLengthHeadersz?HTTPClientParserTests.test_multipleDistinctContentLengthHeaders�  sl   € õ $¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÝØÔ!ðñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 ó<  — t          t          ddt          d¦  «        d¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                      |j        j        d¦  «         |                      |j	        t          ¦  «         dS )zË
        If a response includes multiple, yet equal, I{Content-Length} headers,
        L{HTTPClientParser.dataReceived} successfully handles and passes single
        length for body processing
        rÙ   rÚ   Ns9   HTTP/1.1 200 OK
Content-Length: 1
Content-Length: 1

rc   ©r!   r+   rf   rŠ   r   rŒ   rL   rÝ   ró   r‹   r   r¼   s     rA   Ú&test_multipleEqualContentLengthHeadersz<HTTPClientParserTests.test_multipleEqualContentLengthHeaders“  s•   € õ $¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Òðñ	
ô 	
ð 	
ð 	×Ò˜Ô*Ô1°1Ñ5Ô5Ð5Ø×Ò˜œ­Ñ.Ô.Ð.Ð.Ð.r@   c                 óÔ   — t          t          ddt          d¦  «        d¦  «        }|                     t	          ¦   «         ¦  «         |                      t          |j        d¦  «         dS )zô
        If a response includes multiple, distinct I{Content-Length} header
        field-values, L{HTTPClientParser.dataReceived} raises L{ValueError} to
        indicate that the response is invalid and the transport is now unusable.
        rÙ   rÚ   Ns)   HTTP/1.1 200 OK
Content-Length: 1, 2

r   r¼   s     rA   Ú3test_multipleDistinctContentLengthHeaderFieldValueszIHTTPClientParserTests.test_multipleDistinctContentLengthHeaderFieldValues¥  sj   € õ $¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÝØÔ!ØFñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 ó<  — t          t          ddt          d¦  «        d¦  «        }|                     t	          ¦   «         ¦  «         |                     d¦  «         |                      |j        j        d¦  «         |                      |j	        t          ¦  «         dS )a%  
        If a response includes multiple, equal I{Content-Length} header
        field-values, L{HTTPClientParser.dataReceived} successfully handles and
        passes single content-length header for body processing. Field-values
        are considered equal by parsed decimal value.
        rÙ   rÚ   Ns+   HTTP/1.1 200 OK
Content-Length: 1, 001

rc   r$  r¼   s     rA   Ú0test_multipleEqualContentLengthHeaderFieldValueszFHTTPClientParserTests.test_multipleEqualContentLengthHeaderFieldValues´  s“   € õ $¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒØHñ	
ô 	
ð 	
ð 	×Ò˜Ô*Ô1°1Ñ5Ô5Ð5Ø×Ò˜œ­Ñ.Ô.Ð.Ð.Ð.r@   c                 óÔ   — t          t          ddt          d¦  «        d¦  «        }|                     t	          ¦   «         ¦  «         |                      t          |j        d¦  «         dS )zç
        If the I{Content-Length} header contains anything other than digits
        L{HTTPClientParser.dataReceived} raises L{ValueError} to
        indicate that the response is invalid and the transport is now unusable.
        rÙ   rÚ   Ns'   HTTP/1.1 200 OK
Content-Length: +1

r   r¼   s     rA   Útest_contentLengthTooPositivez3HTTPClientParserTests.test_contentLengthTooPositiveÄ  ój   € õ $¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÝØÔ!Ø<ñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 óÔ   — t          t          ddt          d¦  «        d¦  «        }|                     t	          ¦   «         ¦  «         |                      t          |j        d¦  «         dS )zØ
        If the I{Content-Length} header has a negative value
        L{HTTPClientParser.dataReceived} raises L{ValueError} to
        indicate that the response is invalid and the transport is now unusable.
        rÙ   rÚ   Ns'   HTTP/1.1 200 OK
Content-Length: -1

r   r¼   s     rA   Útest_contentLengthNegativez0HTTPClientParserTests.test_contentLengthNegativeÓ  r,  r@   c                 óŒ  — g }t          t          ddt          d¦  «        |j        ¦  «        }|                     t          ¦   «         ¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                      |j        t          ¦  «         |                      |dg¦  «         dS )zy
        If extra bytes are received past the end of a response, they are passed
        to the finish callback.
        rÙ   rÚ   NrÛ   r  ó   
Here is another thing!ó   Here is another thing!©
r!   r+   rf   rˆ   rŠ   r   rŒ   rL   r‹   r   ©rR   rô   rŽ   s      rA   Útest_extraBytesPassedBackz/HTTPClientParserTests.test_extraBytesPassedBackâ  sÀ   € ð
 ˆÝ#Ý�F˜D¥.°$Ñ7Ô7¸¼ñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×ÒÐ6Ñ7Ô7Ð7Ø×ÒÐ;Ñ<Ô<Ð<Ø×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜Ð$=Ð#>Ñ?Ô?Ð?Ð?Ð?r@   c                 óŒ  — g }t          t          ddt          d¦  «        |j        ¦  «        }|                     t          ¦   «         ¦  «         |                     d¦  «         |                     d¦  «         |                     d¦  «         |                      |j        t          ¦  «         |                      |dg¦  «         dS )zš
        If extra bytes are received past the end of the headers of a response
        to a HEAD request, they are passed to the finish callback.
        rø   rÚ   NrÛ   s   Content-Length: 12
r0  r1  r2  r3  s      rA   Útest_extraBytesPassedBackHEADz3HTTPClientParserTests.test_extraBytesPassedBackHEADó  sÀ   € ð
 ˆÝ#Ý�G˜T¥>°4Ñ8Ô8¸(¼/ñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5Ø×ÒÐ7Ñ8Ô8Ð8Ø×ÒÐ;Ñ<Ô<Ð<Ø×Ò˜œ­Ñ.Ô.Ð.Ø×Ò˜Ð$=Ð#>Ñ?Ô?Ð?Ð?Ð?r@   c                 óÄ  — g }t          t          ddt          d¦  «        |j        ¦  «        }|                     t          ¦   «         ¦  «         |                     d¦  «         g }|j        |j        _        |                     d¦  «         |                     d¦  «         |  	                    |g ¦  «         |  
                    |j        j        t          ¦  «         |                     d¦  «         |  	                    |dg¦  «         |                     d	¦  «         |  	                    |dd
g¦  «         |                     d¦  «         |  	                    |dg¦  «         dS )zô
        If the response headers indicate the response body is encoded with the
        I{chunked} transfer encoding, the body is decoded according to that
        transfer encoding before being passed to L{Response._bodyDataReceived}.
        rÙ   rÚ   NrÛ   s   Transfer-Encoding: chunked
rÂ   s   3
aó   as   bc
s   bcs
   0

extras   extra)r!   r+   rf   rˆ   rŠ   r   rŒ   rÝ   rð   rL   r  ró   r   r  s       rA   Útest_chunkedResponseBodyz.HTTPClientParserTests.test_chunkedResponseBody  s`  € ð ˆÝ#Ý�F˜D¥.°$Ñ7Ô7¸¼ñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ4Ñ5Ô5Ð5àˆØ.2¬kˆÔÔ+à×ÒÐ?Ñ@Ô@Ð@Ø×Ò˜gÑ&Ô&Ð&ð 	×Ò˜˜rÑ"Ô"Ð"ð 	×Ò˜XÔ.Ô5µ~ÑFÔFÐFð 	×Ò˜iÑ(Ô(Ð(Ø×Ò˜ ˜vÑ&Ô&Ð&Ø×Ò˜iÑ(Ô(Ð(Ø×Ò˜  e˜}Ñ-Ô-Ð-ð
 	×ÒÐ/Ñ0Ô0Ð0Ø×Ò˜ H :Ñ.Ô.Ð.Ð.Ð.r@   c                 ó  — g }t          t          ddt          d¦  «        |j        ¦  «        }t	          ¦   «         }|                     |¦  «         |                     d¦  «         g }|j        |j        _        |                     d¦  «         |                     d¦  «         |                     d¦  «         |  	                    |ddg¦  «         | 
                    t          d¦  «        ¦  «         |  	                    |d	g¦  «         dS )
zµ
        If a response does not include a I{Transfer-Encoding} or a
        I{Content-Length}, the end of response body is indicated by the
        connection being closed.
        rÙ   rÚ   NrÛ   rÂ   rÖ   r˜   zsimulated end of connectionr@   )r!   r+   rf   rˆ   r   rŠ   rŒ   rÝ   rð   rL   ÚconnectionLostr
   r  s        rA   Útest_unknownContentLengthz/HTTPClientParserTests.test_unknownContentLength)  s  € ð ˆÝ#Ý�F˜D¥.°$Ñ7Ô7¸¼ñ
ô 
ˆõ $Ñ%Ô%ˆ	Ø×Ò 	Ñ*Ô*Ð*Ø×ÒÐ4Ñ5Ô5Ð5àˆØ.2¬kˆÔÔ+à×Ò˜gÑ&Ô&Ð&Ø×Ò˜fÑ%Ô%Ð%Ø×Ò˜fÑ%Ô%Ð%Ø×Ò˜ ¨Ð/Ñ0Ô0Ð0Ø×Ò¥Ð/LÑ MÔ MÑNÔNÐNØ×Ò˜ C 5Ñ)Ô)Ð)Ð)Ð)r@   c                 óz  — g }t          t          ddt          d¦  «        |j        ¦  «        }t	          ¦   «         }|                     |¦  «         |                     d¦  «         g }|j        |j        _        |                     d¦  «         |  	                    |dg¦  «         |  	                    |dg¦  «         dS )z´
        According to RFC 2616, section 4.4, point 3, if I{Content-Length} and
        I{Transfer-Encoding: chunked} are present, I{Content-Length} MUST be
        ignored
        rÙ   rÚ   NrÛ   s@   Content-Length: 102
Transfer-Encoding: chunked

3
abc
0

ó   abcr@   )
r!   r+   rf   rˆ   r   rŠ   rŒ   rÝ   rð   rL   r  s        rA   Ú%test_contentLengthAndTransferEncodingz;HTTPClientParserTests.test_contentLengthAndTransferEncodingA  sÊ   € ð ˆÝ#Ý�F˜D¥.°$Ñ7Ô7¸¼ñ
ô 
ˆõ $Ñ%Ô%ˆ	Ø×Ò 	Ñ*Ô*Ð*Ø×ÒÐ4Ñ5Ô5Ð5àˆØ.2¬kˆÔÔ+à×Òðñ	
ô 	
ð 	
ð 	×Ò˜ ˜xÑ(Ô(Ð(Ø×Ò˜ C 5Ñ)Ô)Ð)Ð)Ð)r@   c                 ó*  — t          ¦   «         }t          t          ddt          d¦  «        d¦  «        }|                     |¦  «         |j        }|                     t          t          ¦   «         ¦  «        ¦  «         t          | |t          g¦  «        S )zÅ
        If L{HTTPClientParser.connectionLost} is called before the headers are
        finished, the C{_responseDeferred} is fired with the L{Failure} passed
        to C{connectionLost}.
        rÙ   rÚ   N)
r   r!   r+   rf   rŠ   Ú_responseDeferredr;  r   r9   r\   )rR   rg   rŽ   ÚresponseDeferreds       rA   Útest_connectionLostBeforeBodyz3HTTPClientParserTests.test_connectionLostBeforeBody_  s„   € õ $Ñ%Ô%ˆ	Ý#¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆØ×Ò 	Ñ*Ô*Ð*à#Ô5ÐØ×Ò¥Õ(:Ñ(<Ô(<Ñ =Ô =Ñ>Ô>Ð>å# DÐ*:Õ=OÐ<PÑQÔQÐQr@   c                 ó`  — t          j        | t          ¦  «        }t          ¦   «         }t	          t          ddt          d¦  «        d¦  «        }|                     |¦  «         g }|j         	                    |j
        ¦  «         |                     d¦  «         |d         }d	d„}||_        |                     d¦  «         |                      dt          |¦  «        ¦  «         |d         }|d         }|                      |j        t$          ¦  «         |                      t$          ¦  «         dS )
z°
        If one of the L{Response} methods called by
        L{HTTPClientParser.connectionLost} raises an exception, the exception
        is logged and not re-raised.
        rÙ   rÚ   Nó&   HTTP/1.1 200 OK
Content-Length: 1

r   c                 ó   — t          ¦   «         ‚rp   ©r9   )rN   s    rA   ÚfakeBodyDataFinishedzPHTTPClientParserTests.test_connectionLostWithError.<locals>.fakeBodyDataFinished  s   € Ý$Ñ&Ô&Ð&r@   rc   Úlog_failurerp   )r   ÚcreateWithCleanupr   r   r!   r+   rf   rŠ   rA  rU   rˆ   rŒ   rñ   r;  ÚassertEqualsrM   ÚassertIsInstancer    r9   ÚflushLoggedErrors)rR   ÚlogObserverrg   rŽ   rÝ   rH  ÚeventrÔ   s           rA   Útest_connectionLostWithErrorz2HTTPClientParserTests.test_connectionLostWithErrorn  s'  € õ +Ô<¸TÕCUÑVÔVˆÝ#Ñ%Ô%ˆ	Ý#¥G¨F°D½.È$Ñ$OÔ$OÐQUÑVÔVˆØ×Ò 	Ñ*Ô*Ð*àˆØÔ"×.Ò.¨x¬Ñ?Ô?Ð?Ø×ÒÐUÑVÔVÐVØ˜A”;ˆð	'ð 	'ð 	'ð 	'ð &:ˆÔ"à×Ò Ñ%Ô%Ð%Ø×Ò˜!�S Ñ-Ô-Ñ.Ô.Ð.Ø˜A”ˆØ�-Ô ˆØ×Ò˜aœgÕ'9Ñ:Ô:Ð:Ø×ÒÕ1Ñ2Ô2Ð2Ð2Ð2r@   c                 ó  — t          t          ddt          d¦  «        d„ ¦  «        }|j        }|                     t          ¦   «         ¦  «         |                     t          ¦   «         ¦  «         |                      |t          ¦  «        S )z‰
        If no response at all was received and the connection is lost, the
        resulting error is L{ResponseNeverReceived}.
        rø   rÚ   Nc                 ó   — d S rp   r?   ©Úigns    rA   rî   z<HTTPClientParserTests.test_noResponseAtAll.<locals>.<lambda>‘  r  r@   )
r!   r+   rf   rA  rŠ   r   r;  r   rT   r1   ©rR   rŽ   rX   s      rA   Útest_noResponseAtAllz*HTTPClientParserTests.test_noResponseAtAll‹  s   € õ
 $Ý�G˜T¥>°4Ñ8Ô8Ð:JÐ:Jñ
ô 
ˆð Ô&ˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Ò¥Ñ 0Ô 0Ñ1Ô1Ð1Ø×!Ò! !Õ%:Ñ;Ô;Ð;r@   c                 ó|  — t          t          ddt          d¦  «        d„ ¦  «        }|j        }|                     t          ¦   «         ¦  «         |                     d¦  «         |                     t          ¦   «         ¦  «         |  	                    |t          ¦  «                             | j        t          ¦  «        S )z¬
        If a partial response was received and the connection is lost, the
        resulting error is L{ResponseFailed}, but not
        L{ResponseNeverReceived}.
        rø   rÚ   Nc                 ó   — d S rp   r?   rS  s    rA   rî   zBHTTPClientParserTests.test_someResponseButNotAll.<locals>.<lambda>   r  r@   ó   2)r!   r+   rf   rA  rŠ   r   rŒ   r;  r   rT   r0   rU   rL  rU  s      rA   Útest_someResponseButNotAllz0HTTPClientParserTests.test_someResponseButNotAll™  s¬   € õ $Ý�G˜T¥>°4Ñ8Ô8Ð:JÐ:Jñ
ô 
ˆð Ô&ˆà×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Ò˜dÑ#Ô#Ð#Ø×Ò¥Ñ 0Ô 0Ñ1Ô1Ð1Ø×!Ò! !¥^Ñ4Ô4×@Ò@ØÔ!¥>ñ
ô 
ð 	
r@   c                 óž  — d}t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     |¦  «         |                      t          |dd¦  «        du ¦  «         |                      |j	        t          ¦  «         |                      t          t          |j                             ¦   «         ¦  «        ¦  «        d¦  «         |                      t          t          |j                             ¦   «         ¦  «        ¦  «        d¦  «         |                      |j        ¦  «         dS )zy
        If a response in the 1XX range is received it just gets swallowed and
        the parser resets itself.
        óœ   HTTP/1.1 103 Early Hints
Server: socketserver/1.0.0
Link: </other/styles.css>; rel=preload; as=style
Link: </other/action.js>; rel=preload; as=script

rÙ   rÚ   Nc                 ó   — d S rp   r?   rS  s    rA   rî   zCHTTPClientParserTests.test_1XXResponseIsSwallowed.<locals>.<lambda>¹  ó   € ÀT€ r@   rÝ   r   )r!   r+   rf   rŠ   r   rŒ   r´   ÚgetattrrL   r‹   r   rM   r¬   r­   r®   r  Ú_everReceivedData)rR   Úsample103ResponserŽ   s      rA   Útest_1XXResponseIsSwallowedz1HTTPClientParserTests.test_1XXResponseIsSwallowed«  s'  € ðð 	õ $Ý�F˜D¥.°$Ñ7Ô7Ð9IÐ9Iñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ/Ñ0Ô0Ð0ð 	�Š� ¨*°dÑ;Ô;¸tÐCÑDÔDÐDØ×Ò˜œ­Ñ0Ô0Ð0Ø×Ò��T (Ô"2×"CÒ"CÑ"EÔ"EÑFÔFÑGÔGÈÑKÔKÐKØ×Ò��T (Ô"6×"GÒ"GÑ"IÔ"IÑJÔJÑKÔKÈQÑOÔOÐOØ�Š˜Ô2Ñ3Ô3Ð3Ð3Ð3r@   c                 óü  — d}d}t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     ||z   ¦  «         |                      |j        j        d¦  «         |                      |j        j	        t          i ¦  «        ¦  «         |                      |j        t          dd	gi¦  «        ¦  «         |                      |j        j        d
¦  «         dS )z‘
        When a 1XX response is swallowed, the final response that follows it is
        the only one that gets sent to the application.
        r\  ó(   HTTP/1.1 200 OK
Content-Length: 123

rÙ   rÚ   Nc                 ó   — d S rp   r?   rS  s    rA   rî   zUHTTPClientParserTests.test_1XXFollowedByFinalResponseOnlyEmitsFinal.<locals>.<lambda>Ô  r^  r@   rd   r²   r  r  ©r!   r+   rf   rŠ   r   rŒ   rL   rÝ   rß   r­   r3   r  ró   ©rR   ra  Úfollowing200ResponserŽ   s       rA   Ú-test_1XXFollowedByFinalResponseOnlyEmitsFinalzCHTTPClientParserTests.test_1XXFollowedByFinalResponseOnlyEmitsFinalÅ  sû   € ðð 	ð  YÐå#Ý�F˜D¥.°$Ñ7Ô7Ð9IÐ9Iñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ/Ð2FÑFÑGÔGÐGà×Ò˜Ô*Ô/°Ñ5Ô5Ð5Ø×Ò˜Ô*Ô2µG¸B±K´KÑ@Ô@Ð@Ø×Ò˜Ô-­wÐ8IÈFÈ8Ð7TÑ/UÔ/UÑVÔVÐVØ×Ò˜Ô*Ô1°3Ñ7Ô7Ð7Ð7Ð7r@   c                 ó  — d}d}t          t          ddt          d¦  «        d„ ¦  «        }|                     t	          ¦   «         ¦  «         |                     ||z   |z   |z   ¦  «         |                      |j        j        d¦  «         |                      |j        j	        t          i ¦  «        ¦  «         |                      |j        t          dd	gi¦  «        ¦  «         |                      |j        j        d
¦  «         dS )zp
        It is acceptable for multiple 1XX responses to come through, all of
        which get ignored.
        r\  rd  rÙ   rÚ   Nc                 ó   — d S rp   r?   rS  s    rA   rî   zKHTTPClientParserTests.test_multiple1XXResponsesAreIgnored.<locals>.<lambda>í  r^  r@   rd   r²   r  r  rf  rg  s       rA   Ú#test_multiple1XXResponsesAreIgnoredz9HTTPClientParserTests.test_multiple1XXResponsesAreIgnoredÞ  s  € ðð 	ð  YÐå#Ý�F˜D¥.°$Ñ7Ô7Ð9IÐ9Iñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒØØñ àñ ð #ñ#ñ	
ô 	
ð 	
ð 	×Ò˜Ô*Ô/°Ñ5Ô5Ð5Ø×Ò˜Ô*Ô2µG¸B±K´KÑ@Ô@Ð@Ø×Ò˜Ô-­wÐ8IÈFÈ8Ð7TÑ/UÔ/UÑVÔVÐVØ×Ò˜Ô*Ô1°3Ñ7Ô7Ð7Ð7Ð7r@   c                 ó¼  — t          j        | t          ¦  «        }d}t          t	          ddt
          d¦  «        d„ ¦  «        }|                     t          ¦   «         ¦  «         |                     |¦  «         |  	                    dt          |¦  «        ¦  «         |d         }|  	                    |d         d	¦  «         |  	                    |d
         d¦  «         dS )zF
        When a 1XX response is ignored, Twisted emits a log.
        r\  rÙ   rÚ   Nc                 ó   — d S rp   r?   rS  s    rA   rî   zHHTTPClientParserTests.test_ignored1XXResponseCausesLog.<locals>.<lambda>
  r^  r@   rc   r   Ú
log_formatz#Ignoring unexpected {code} responserß   ég   )r   rJ  r   r!   r+   rf   rŠ   r   rŒ   rK  rM   )rR   rN  ra  rŽ   rO  s        rA   Ú test_ignored1XXResponseCausesLogz6HTTPClientParserTests.test_ignored1XXResponseCausesLogü  sÝ   € õ +Ô<¸TÕCUÑVÔVˆðð 	õ $Ý�F˜D¥.°$Ñ7Ô7Ð9IÐ9Iñ
ô 
ˆð 	×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×ÒÐ/Ñ0Ô0Ð0à×Ò˜!�S Ñ-Ô-Ñ.Ô.Ð.Ø˜A”ˆØ×Ò˜% Ô-Ð/TÑUÔUÐUØ×Ò˜% œ-¨Ñ-Ô-Ð-Ð-Ð-r@   N)&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.  r4  r6  r9  r<  r?  rC  rP  rV  rZ  rb  ri  rl  rq  r?   r@   rA   rÈ   rÈ   j  s0  € € € € € ðð ð
Pð Pð Pð#ð #ð #ð,:ð :ð :ð8ð 8ð 8ð)ð )ð )ð&"ð "ð "ðH
=ð 
=ð 
=ð4ð 4ð 4ð4ð 4ð 4ðGð Gð Gð Gð Gð Gð&8ð 8ð 8ð(6ð 6ð 6ð$*ð *ð *ð>6ð 6ð 6ð2
ð 
ð 
ð$/ð /ð /ð$
ð 
ð 
ð/ð /ð /ð 
ð 
ð 
ð
ð 
ð 
ð@ð @ð @ð"@ð @ð @ð"#/ð #/ð #/ðJ*ð *ð *ð0*ð *ð *ð<Rð Rð Rð3ð 3ð 3ð:<ð <ð <ð
ð 
ð 
ð$4ð 4ð 4ð48ð 8ð 8ð28ð 8ð 8ð<.ð .ð .ð .ð .r@   rÈ   c                   ó*   — e Zd ZdZdZdZdZd„ Zd„ ZdS )ÚSlowRequesta„  
    L{SlowRequest} is a fake implementation of L{Request} which is easily
    controlled externally (for example, by code in a test method).

    @ivar stopped: A flag indicating whether C{stopWriting} has been called.

    @ivar finished: After C{writeTo} is called, a L{Deferred} which was
        returned by that method.  L{SlowRequest} will never fire this
        L{Deferred}.
    rÙ   Fc                 ó6   — t          ¦   «         | _        | j        S rp   )r   rô   ©rR   rg   s     rA   ÚwriteTozSlowRequest.writeTo%  s   € Ý ™
œ
ˆŒØŒ}Ðr@   c                 ó   — d| _         d S rë   ©Ústoppedrq   s    rA   ÚstopWritingzSlowRequest.stopWriting)  ó   € ØˆŒˆˆr@   N)	r;   r<   r=   r>   Úmethodry  Ú
persistentrv  rz  r?   r@   rA   rs  rs    sM   € € € € € ð	ð 	ð €FØ€GØ€Jðð ð ðð ð ð ð r@   rs  c                   ó   — e Zd ZdZdZd„ ZdS )ÚSimpleRequesta  
    L{SimpleRequest} is a fake implementation of L{Request} which writes a
    short, fixed string to the transport passed to its C{writeTo} method and
    returns a succeeded L{Deferred}.  This vaguely emulates the behavior of a
    L{Request} with no body producer.
    Fc                 óJ   — |                      d¦  «         t          d ¦  «        S )Nó
   SOME BYTES)Úwriter	   ru  s     rA   rv  zSimpleRequest.writeTo7  s    € Ø�Š˜Ñ&Ô&Ð&Ý�t‰}Œ}Ðr@   N)r;   r<   r=   r>   r}  rv  r?   r@   rA   r  r  -  s4   € € € € € ðð ð €Jðð ð ð ð r@   r  c                   óæ   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d&d	„Z
d
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d „ Z!d!„ Z"d"„ Z#d#„ Z$d$„ Z%d%„ Z&dS )'ÚHTTP11ClientProtocolTestsz]
    Tests for the HTTP 1.1 client protocol implementation,
    L{HTTP11ClientProtocol}.
    c                 ó�   — t          ¦   «         | _        t          ¦   «         | _        | j                             | j        ¦  «         dS )zR
        Create an L{HTTP11ClientProtocol} connected to a fake transport.
        N)r   rg   r)   rŽ   rŠ   rq   s    rA   ÚsetUpzHTTP11ClientProtocolTests.setUpB  s<   € õ )Ñ*Ô*ˆŒÝ,Ñ.Ô.ˆŒØŒ×$Ò$ T¤^Ñ4Ô4Ð4Ð4Ð4r@   c                 ó¬   — | j                              t          ¦   «         ¦  «         |                      | j                             ¦   «         d¦  «         dS )z†
        L{HTTP11ClientProtocol.request} accepts a L{Request} and calls its
        C{writeTo} method with its own transport.
        r�  N)rŽ   râ   r  rL   rg   r    rq   s    rA   Útest_requestz&HTTP11ClientProtocolTests.test_requestJ  sH   € ð
 	Œ×Ò�m™oœoÑ.Ô.Ð.Ø×Ò˜œ×-Ò-Ñ/Ô/°Ñ?Ô?Ð?Ð?Ð?r@   c                 ó  ‡ — ‰ j                              t          ¦   «         ¦  «         ˆ fd„}‰                      ‰ j                              t	          ¦   «         ¦  «        t
          ¦  «        }|                     |¦  «         |S )zÇ
        The second time L{HTTP11ClientProtocol.request} is called, it returns a
        L{Deferred} which immediately fires with a L{Failure} wrapping a
        L{RequestNotSent} exception.
        c                 ób   •— ‰                      ‰j                             ¦   «         d¦  «         d S ©Nr@   ©rL   rg   r    ©ÚignoredrR   s    €rA   Ú	cbNotSentz?HTTP11ClientProtocolTests.test_secondRequest.<locals>.cbNotSentZ  ó-   ø€ Ø×Ò˜Tœ^×1Ò1Ñ3Ô3°SÑ9Ô9Ð9Ð9Ð9r@   )rŽ   râ   rs  rT   r  r%   rU   ©rR   r�  rX   s   `  rA   Útest_secondRequestz,HTTP11ClientProtocolTests.test_secondRequestR  sz   ø€ ð 	Œ×Ò�k™mœmÑ,Ô,Ð,ð	:ð 	:ð 	:ð 	:ð 	:ð ×Ò˜tœ}×4Ò4µ]±_´_ÑEÔEÅ~ÑVÔVˆØ	�Š�iÑ Ô Ð Øˆr@   c                 ó"  ‡ — ‰ j                              t          t          d¦  «        ¦  «        ¦  «         ˆ fd„}‰                      ‰ j                              t          ¦   «         ¦  «        t          ¦  «        }|                     |¦  «         |S )zÒ
        L{HTTP11ClientProtocol.request} returns a L{Deferred} which immediately
        fires with a L{Failure} wrapping a L{RequestNotSent} if called after
        the protocol has been disconnected.
        zsad transportc                 ób   •— ‰                      ‰j                             ¦   «         d¦  «         d S r‹  rŒ  r�  s    €rA   r�  zLHTTP11ClientProtocolTests.test_requestAfterConnectionLost.<locals>.cbNotSenti  r�  r@   )	rŽ   r;  r   r
   rT   râ   r  r%   rU   r‘  s   `  rA   Útest_requestAfterConnectionLostz9HTTP11ClientProtocolTests.test_requestAfterConnectionLosta  s†   ø€ ð 	Œ×$Ò$¥W­^¸OÑ-LÔ-LÑ%MÔ%MÑNÔNÐNð	:ð 	:ð 	:ð 	:ð 	:ð ×Ò˜tœ}×4Ò4µ]±_´_ÑEÔEÅ~ÑVÔVˆØ	�Š�iÑ Ô Ð Øˆr@   c                 óÈ   ‡ —  G d„ d¦  «        }‰ j                               |¦   «         ¦  «        }ˆ fd„}t          ‰ |t          g¦  «        }|                     |¦  «         |S )a%  
        If the L{Deferred} returned by L{Request.writeTo} fires with a
        L{Failure}, L{HTTP11ClientProtocol.request} disconnects its transport
        and returns a L{Deferred} which fires with a L{Failure} of
        L{RequestGenerationFailed} wrapping the underlying failure.
        c                   ó   — e Zd ZdZd„ ZdS )úCHTTP11ClientProtocolTests.test_failedWriteTo.<locals>.BrokenRequestFc                 ó8   — t          t          ¦   «         ¦  «        S rp   )r   r9   ru  s     rA   rv  zKHTTP11ClientProtocolTests.test_failedWriteTo.<locals>.BrokenRequest.writeTo{  s   € ÝÕ.Ñ0Ô0Ñ1Ô1Ð1r@   N©r;   r<   r=   r}  rv  r?   r@   rA   ÚBrokenRequestr˜  x  s(   € € € € € ØˆJð2ð 2ð 2ð 2ð 2r@   r›  c                 ó®   •— ‰                      ‰j        j        ¦  «         ‰j                             t          t          d¦  «        ¦  «        ¦  «         d S )Nzyou asked for it)r´   rg   ÚdisconnectingrŽ   r;  r   r
   r�  s    €rA   rS   z>HTTP11ClientProtocolTests.test_failedWriteTo.<locals>.cbFailed€  sI   ø€ Ø�OŠO˜DœNÔ8Ñ9Ô9Ð9ð ŒM×(Ò(­µÐ@RÑ1SÔ1SÑ)TÔ)TÑUÔUÐUÐUÐUr@   )rŽ   râ   r^   r9   rU   )rR   r›  rX   rS   s   `   rA   Útest_failedWriteToz,HTTP11ClientProtocolTests.test_failedWriteTop  s”   ø€ ð	2ð 	2ð 	2ð 	2ð 	2ñ 	2ô 	2ð 	2ð ŒM×!Ò! - -¡/¤/Ñ2Ô2ˆð	Vð 	Vð 	Vð 	Vð 	Võ *¨$°Õ4FÐ3GÑHÔHˆØ	�Š�hÑÔÐØˆr@   c                 óŽ   —  G d„ d¦  «        }| j                               |¦   «         ¦  «        }t          | |t          g¦  «        S )z×
        If L{Request.writeTo} raises an exception,
        L{HTTP11ClientProtocol.request} returns a L{Deferred} which fires with
        a L{Failure} of L{RequestGenerationFailed} wrapping that exception.
        c                   ó   — e Zd ZdZd„ ZdS )úMHTTP11ClientProtocolTests.test_synchronousWriteToError.<locals>.BrokenRequestFc                 ó   — t          ¦   «         ‚rp   rG  ru  s     rA   rv  zUHTTP11ClientProtocolTests.test_synchronousWriteToError.<locals>.BrokenRequest.writeTo”  s   € Ý(Ñ*Ô*Ð*r@   Nrš  r?   r@   rA   r›  r¡  ‘  s(   € € € € € ØˆJð+ð +ð +ð +ð +r@   r›  )rŽ   râ   r^   r9   )rR   r›  rX   s      rA   Útest_synchronousWriteToErrorz6HTTP11ClientProtocolTests.test_synchronousWriteToErrorŠ  s]   € ð	+ð 	+ð 	+ð 	+ð 	+ñ 	+ô 	+ð 	+ð ŒM×!Ò! - -¡/¤/Ñ2Ô2ˆÝ,¨T°1Õ7IÐ6JÑKÔKÐKr@   Nc                 ó„  — t          ¦   «         }| j                             |¦  «        }t          | |t          g¦  «        }|                      |j        ¦  «         | j                             t          t	          ¦   «         ¦  «        ¦  «         |  	                    |j        ¦  «         |dk    r|j
                             d¦  «         nx|dk    rq|j
                             t          t          ¦   «         ¦  «        ¦  «         |                      t          ¦  «        }|                      t!          |¦  «        d¦  «         n	 |S )a2  
        If L{HTTP11ClientProtocol}'s transport is disconnected before the
        L{Deferred} returned by L{Request.writeTo} fires, the L{Deferred}
        returned by L{HTTP11ClientProtocol.request} fires with a L{Failure} of
        L{RequestTransmissionFailed} wrapping the underlying failure.
        ÚcallbackNÚerrbackrc   )rs  rŽ   râ   r`   r9   r¶   ry  r;  r   r´   rô   r¥  r¦  rC   rM  rL   rM   )rR   Úmoderâ   rX   Úerrorss        rA   Ú*test_connectionLostDuringRequestGenerationzDHTTP11ClientProtocolTests.test_connectionLostDuringRequestGenerationš  s  € õ ‘-”-ˆØŒM×!Ò! 'Ñ*Ô*ˆÝ+¨D°!Õ6HÐ5IÑJÔJˆð 	×Ò˜œÑ)Ô)Ð)àŒ×$Ò$¥WÕ-?Ñ-AÔ-AÑ%BÔ%BÑCÔCÐCð 	�Š˜œÑ(Ô(Ð(à�:ÒÐØÔ×%Ò% dÑ+Ô+Ð+Ð+Ø�YÒÐØÔ×$Ò$¥WÕ-FÑ-HÔ-HÑ%IÔ%IÑJÔJÐJØ×+Ò+Õ,EÑFÔFˆFØ×Ò�S ™[œ[¨!Ñ,Ô,Ð,Ð,ð Øˆr@   c                 ó,   — |                       d¦  «        S )zÂ
        If the request passed to L{HTTP11ClientProtocol} finishes generation
        successfully after the L{HTTP11ClientProtocol}'s connection has been
        lost, nothing happens.
        r¥  ©r©  rq   s    rA   Ú+test_connectionLostBeforeGenerationFinishedzEHTTP11ClientProtocolTests.test_connectionLostBeforeGenerationFinishedº  s   € ð ×>Ò>¸zÑJÔJÐJr@   c                 ó,   — |                       d¦  «        S )zÃ
        If the request passed to L{HTTP11ClientProtocol} finished generation
        with an error after the L{HTTP11ClientProtocol}'s connection has been
        lost, nothing happens.
        r¦  r«  rq   s    rA   Ú)test_connectionLostBeforeGenerationFailedzCHTTP11ClientProtocolTests.test_connectionLostBeforeGenerationFailedÂ  s   € ð ×>Ò>¸yÑIÔIÐIr@   c                 ó–   ‡ ‡— t          j        ‰ t          ¦  «        Šˆˆ fd„}‰                      d¦  «                             |¦  «        S )a	  
        If the request passed to L{HTTP11ClientProtocol} finished generation
        with an error after the L{HTTP11ClientProtocol}'s connection has been
        lost, an error is logged that gives a non-confusing hint to user on what
        went wrong.
        c                 óú   •— ‰                      dt          ‰¦  «        ¦  «         ‰d         }‰                     d|¦  «         ‰                     |d         d¦  «         ‰                     |d         d¦  «         d S )Nrc   r   rI  ro  zJError writing request, but not in valid state to finalize request: {state}r‹   ÚCONNECTION_LOST)rK  rM   ÚassertInrL   )ÚignorerO  rN  rR   s     €€rA   ÚcheckznHTTP11ClientProtocolTests.test_errorMessageOnConnectionLostBeforeGenerationFailedDoesNotConfuse.<locals>.checkÓ  s†   ø€ Ø×Ò˜a¥ [Ñ!1Ô!1Ñ2Ô2Ð2Ø ”NˆEØ�MŠM˜-¨Ñ/Ô/Ð/Ø×ÒØ�lÔ#ð/ñô ð ð
 ×Ò˜U 7œ^Ð->Ñ?Ô?Ð?Ð?Ð?r@   r¦  )r   rJ  r   r©  rU   )rR   r´  rN  s   ` @rA   ÚEtest_errorMessageOnConnectionLostBeforeGenerationFailedDoesNotConfusez_HTTP11ClientProtocolTests.test_errorMessageOnConnectionLostBeforeGenerationFailedDoesNotConfuseÊ  sh   øø€ õ +Ô<¸TÕCUÑVÔVˆð		@ð 		@ð 		@ð 		@ð 		@ð 		@ð ×>Ò>¸yÑIÔI×UÒUØñ
ô 
ð 	
r@   c                 óÎ   ‡ — ‰ j                              t          ddt          d¦  «        ¦  «        }ˆ fd„}|                     |¦  «         ‰ j                              d¦  «         |S )zà
        When a response is delivered to L{HTTP11ClientProtocol}, the
        L{Deferred} previously returned by the C{request} method is called back
        with a L{Response} instance and the connection is closed.
        rÙ   rÚ   Nc                 ó
  •— ‰                      | j        d¦  «         ‰                      | j        t          ¦   «         ¦  «         ‰                     ‰j        j        ¦  «         ‰                      ‰j        j        d¦  «         d S )Nrd   Ú	QUIESCENT)	rL   rß   r­   r3   r´   rg   r�  rŽ   r‹   )rÝ   rR   s    €rA   Ú	cbRequestzIHTTP11ClientProtocolTests.test_receiveSimplestResponse.<locals>.cbRequestê  sp   ø€ Ø×Ò˜Xœ]¨CÑ0Ô0Ð0Ø×Ò˜XÔ-­w©y¬yÑ9Ô9Ð9Ø�OŠO˜DœNÔ8Ñ9Ô9Ð9Ø×Ò˜Tœ]Ô0°+Ñ>Ô>Ð>Ð>Ð>r@   s9   HTTP/1.1 200 OK
Content-Length: 0
Connection: close

©rŽ   râ   r+   rf   rU   rŒ   ©rR   rX   r¹  s   `  rA   Útest_receiveSimplestResponsez6HTTP11ClientProtocolTests.test_receiveSimplestResponseâ  s{   ø€ ð ŒM×!Ò!¥'¨&°$½ÈÑ"MÔ"MÑNÔNˆð	?ð 	?ð 	?ð 	?ð 	?ð 	
�Š�iÑ Ô Ð ØŒ×"Ò"ðñ	
ô 	
ð 	
ð ˆr@   c                 óÎ   ‡ — ‰ j                              t          ddt          d¦  «        ¦  «        }ˆ fd„}|                     |¦  «         ‰ j                              d¦  «         |S )zÌ
        The headers included in a response delivered to L{HTTP11ClientProtocol}
        are included on the L{Response} instance passed to the callback
        returned by the C{request} method.
        rÙ   rÚ   Nc                 ód   •— t          dddgi¦  «        }‰                     | j        |¦  «         d S )Nr  r˜   r«   )r3   rL   r­   )rÝ   r¯   rR   s     €rA   r¹  zHHTTP11ClientProtocolTests.test_receiveResponseHeaders.<locals>.cbRequest  s9   ø€ Ý ¨6°6Ð*:Ð;Ñ<Ô<ˆHØ×Ò˜XÔ-¨xÑ8Ô8Ð8Ð8Ð8r@   s+   HTTP/1.1 200 OK
X-Foo: bar
X-Foo: baz

rº  r»  s   `  rA   Útest_receiveResponseHeadersz5HTTP11ClientProtocolTests.test_receiveResponseHeadersù  sy   ø€ ð ŒM×!Ò!¥'¨&°$½ÈÑ"MÔ"MÑNÔNˆð	9ð 	9ð 	9ð 	9ð 	9ð 	
�Š�iÑ Ô Ð ØŒ×"Ò"ØNñ	
ô 	
ð 	
ð ˆr@   c                 ób  ‡ ‡‡‡‡— g Št          ¦   «         Št          ‰j        ¦  «        Š‰                     ‰¦  «         t	          ¦   «         Š‰                     ‰¦  «        }‰                     d¦  «         ˆˆˆ ˆfd„}|                     |¦  «         ˆˆ fd„}|                     |¦  «         |S )a[  
        If response bytes are delivered to L{HTTP11ClientProtocol} before the
        L{Deferred} returned by L{Request.writeTo} fires, those response bytes
        are parsed as part of the response.

        The connection is also closed, because we're in a confusing state, and
        therefore the C{quiescentCallback} isn't called.
        s8   HTTP/1.1 200 OK
X-Foo: bar
Content-Length: 6

foobarc                 ó@  •‡ ‡— t          ¦   «         Št          ¦   «         x}‰_        ‰                      ‰¦  «         ‰                     ‰j        d¦  «         ‰                     ‰j        ¦  «         ‰                     ‰g ¦  «         |                     ˆˆ fd„¦  «        S )NÚ%TRANSMITTING_AFTER_RECEIVING_RESPONSEc                 ó   •— ‰‰j         fS rp   ©rÐ   ©rT  ÚprÝ   s    €€rA   rî   zoHTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone.<locals>.cbResponse.<locals>.<lambda>*  ó   ø€ ¸À1Ä6Ð8J€ r@   )	r   r   ÚclosedDeferredÚdeliverBodyrL   r‹   r´   r�  rU   )rÝ   ÚwhenFinishedrÆ  rŽ   ÚquiescentResultrR   rg   s   ` @€€€€rA   Ú
cbResponsez]HTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone.<locals>.cbResponse#  sš   øøø€ Ý$Ñ&Ô&ˆAÝ.6©j¬jÐ8ˆL˜1Ô+Ø× Ò  Ñ#Ô#Ð#Ø×Ò˜Xœ^Ð-TÑUÔUÐUØ�OŠO˜IÔ3Ñ4Ô4Ð4Ø×Ò˜_¨bÑ1Ô1Ð1Ø×+Ò+Ð,JÐ,JÐ,JÐ,JÐ,JÑKÔKÐKr@   c                 ój  •— | \  }}‰                      |j        d¦  «         ‰                      |j        d¦  «         ‰                      |j        d¦  «         ‰                      |j        t          ddgi¦  «        ¦  «         ‰                      |d¦  «         ‰j                             d ¦  «         d S )Nrb   rd   re   r  r˜   ó   foobar)rL   rÞ   rß   rà   r­   r3   rô   r¥  )ÚresultrÝ   rõ   râ   rR   s      €€rA   ÚcbAllResponsez`HTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone.<locals>.cbAllResponse.  s²   ø€ Ø#‰NˆH�dØ×Ò˜XÔ-¨Ñ?Ô?Ð?Ø×Ò˜Xœ]¨CÑ0Ô0Ð0Ø×Ò˜Xœ_¨eÑ4Ô4Ð4Ø×Ò˜XÔ-­w¸À6À(Ð7KÑ/LÔ/LÑMÔMÐMØ×Ò˜T 9Ñ-Ô-Ð-ð Ô×%Ò% dÑ+Ô+Ð+Ð+Ð+r@   )r   r)   rˆ   rŠ   rs  râ   rŒ   rU   )rR   rX   rÌ  rÐ  rŽ   rË  râ   rg   s   `   @@@@rA   Ú/test_receiveResponseBeforeRequestGenerationDonezIHTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone  sñ   øøøøø€ ð ˆÝ#Ñ%Ô%ˆ	Ý'¨Ô(>Ñ?Ô?ˆØ×Ò 	Ñ*Ô*Ð*å‘-”-ˆØ×Ò˜WÑ%Ô%ˆØ×Òðñ	
ô 	
ð 	
ð	Lð 	Lð 	Lð 	Lð 	Lð 	Lð 	Lð 	Lð 	
�Š�jÑ!Ô!Ð!ð
	,ð 
	,ð 
	,ð 
	,ð 
	,ð 
	,ð 	
�Š�mÑ$Ô$Ð$Øˆr@   c                 óH  — t          ¦   «         }t          ¦   «         }||_        |                     |¦  «         dt          j        z  }|                     t          ddt          d¦  «        ¦  «        }| 	                    d|z   dz   ¦  «         t          | |t          g¦  «        S )zy
        The connection is closed when the server respond with a header which
        is above the maximum line.
        r8  rÙ   rÚ   Ns   HTTP/1.1 200 OK
X-Foo: s   
X-Ignored: ignored

)r   r)   rŽ   rŠ   r   Ú
MAX_LENGTHrâ   r+   rf   rŒ   r\   r
   )rR   rg   rŽ   ÚlongLinerX   s        rA   Ú"test_receiveResponseHeadersTooLongz<HTTP11ClientProtocolTests.test_receiveResponseHeadersTooLong=  sª   € õ
 5Ñ6Ô6ˆ	Ý'Ñ)Ô)ˆØ%ˆ	ÔØ×Ò 	Ñ*Ô*Ð*à�,Ô1Ñ1ˆØ×Ò�W V¨Tµ>À4ÑHÔHÑIÔIˆà×ÒðØ!ñ"ð%ññ	
ô 	
ð 	
õ $ D¨!­nÐ-=Ñ>Ô>Ð>r@   c                 óô   ‡ ‡— t          ¦   «         Š‰ j                             ‰¦  «        }‰ j                             d¦  «         d„ }|                     |¦  «         ˆˆ fd„}|                     |¦  «         |S )zç
        If response bytes are delivered to L{HTTP11ClientProtocol} before the
        request completes, calling C{connectionLost} on the protocol will
        result in protocol being moved to C{'CONNECTION_LOST'} state.
        s8   HTTP/1.1 400 BAD REQUEST
Content-Length: 9

tisk tiskc                 ó¨   ‡ ‡— t          ¦   «         Št          ¦   «         x}‰_        ‰                      ‰¦  «         |                     ˆˆ fd„¦  «        S )Nc                 ó   •— ‰‰j         fS rp   rÄ  rÅ  s    €€rA   rî   z„HTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDone.<locals>.cbResponse.<locals>.<lambda>j  rÇ  r@   )r   r   rÈ  rÉ  rU   )rÝ   rÊ  rÆ  s   ` @rA   rÌ  zrHTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDone.<locals>.cbResponsef  sU   øø€ Ý$Ñ&Ô&ˆAÝ.6©j¬jÐ8ˆL˜1Ô+Ø× Ò  Ñ#Ô#Ð#Ø×+Ò+Ð,JÐ,JÐ,JÐ,JÐ,JÑKÔKÐKr@   c                 óâ   •— ‰j                              d ¦  «         ‰j                             t	          t          ¦   «         ¦  «        ¦  «         ‰                     ‰j        j        d¦  «         d S )Nr±  )rô   r¥  rŽ   r;  r   r9   rL   r{   )r³  râ   rR   s    €€rA   rÐ  zuHTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDone.<locals>.cbAllResponsen  sa   ø€ ØÔ×%Ò% dÑ+Ô+Ð+àŒM×(Ò(­Õ1CÑ1EÔ1EÑ)FÔ)FÑGÔGÐGØ×Ò˜Tœ]Ô1Ð3DÑEÔEÐEÐEÐEr@   )rs  rŽ   râ   rŒ   rU   )rR   rX   rÌ  rÐ  râ   s   `   @rA   ÚDtest_connectionLostAfterReceivingResponseBeforeRequestGenerationDonez^HTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDoneW  s¦   øø€ õ ‘-”-ˆØŒM×!Ò! 'Ñ*Ô*ˆØŒ×"Ò"ðñ	
ô 	
ð 	
ð	Lð 	Lð 	Lð 	
�Š�jÑ!Ô!Ð!ð	Fð 	Fð 	Fð 	Fð 	Fð 	Fð 	
�Š�mÑ$Ô$Ð$Øˆr@   c                 óR  ‡ ‡— t          ¦   «         Št          ¦   «         x}‰_        ‰ j                             t          ddt          d¦  «        ¦  «        }‰ j                             d¦  «         g }|                     |j	        ¦  «         ‰  
                    |g ¦  «         ‰ j                             d¦  «         |d         }|                     ‰¦  «         ‰ j                             d¦  «         ‰ j                             d¦  «         ˆˆ fd	„}|                     |¦  «         |S )
zÌ
        The C{deliverBody} method of the response object with which the
        L{Deferred} returned by L{HTTP11ClientProtocol.request} fires can be
        used to get the body of the response.
        rÙ   rÚ   Ns%   HTTP/1.1 200 OK
Content-Length: 6
rÆ   r   rÖ   r˜   c                 ó|   •— ‰                      ‰j        d¦  «         ‰j                             t          ¦  «         d S )NrÎ  )rL   rÐ   ÚclosedReasonrK   r/   )rŽ  rŽ   rR   s    €€rA   rÐ  zIHTTP11ClientProtocolTests.test_receiveResponseBody.<locals>.cbAllResponse™  s8   ø€ Ø×Ò˜Xœ]¨IÑ6Ô6Ð6ØÔ!×&Ò&¥|Ñ4Ô4Ð4Ð4Ð4r@   )r   r   rÈ  rŽ   râ   r+   rf   rŒ   rU   rˆ   rL   rÉ  )rR   rÊ  ÚrequestDeferredrÏ  rÝ   rÐ  rŽ   s   `     @rA   Útest_receiveResponseBodyz2HTTP11ClientProtocolTests.test_receiveResponseBodyw  s7  øø€ õ (Ñ)Ô)ˆÝ19±´Ð;ˆ�xÔ.Øœ-×/Ò/Ý�F˜D¥.°$Ñ7Ô7ñ
ô 
ˆð 	Œ×"Ò"ØAñ	
ô 	
ð 	
ð ˆØ×#Ò# F¤MÑ2Ô2Ð2à×Ò˜ Ñ$Ô$Ð$ð 	Œ×"Ò" 5Ñ)Ô)Ð)Ø˜!”9ˆà×Ò˜XÑ&Ô&Ð&àŒ×"Ò" 6Ñ*Ô*Ð*ØŒ×"Ò" 6Ñ*Ô*Ð*ð	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	× Ò  Ñ/Ô/Ð/ØÐr@   c                 ój  — | j                              t          ddt          d¦  «        ¦  «        }| j                              d¦  «         g }|                     |j        ¦  «         |d         }t          ¦   «         }|                     |¦  «         | j                              d¦  «         | j                              d¦  «         |  	                    |j
        d¦  «         | j                              t          t          d	¦  «        ¦  «        ¦  «         |j                             t           ¦  «         dS )
zù
        If the length of the response body is unknown, the protocol passed to
        the response's C{deliverBody} method has its C{connectionLost}
        method called with a L{Failure} wrapping a L{PotentialDataLoss}
        exception.
        rÙ   rÚ   Ns   HTTP/1.1 200 OK

r   rÖ   r˜   rÎ  z low-level transport disconnected)rŽ   râ   r+   rf   rŒ   rU   rˆ   r   rÉ  rL   rÐ   r;  r   r
   rÝ  rK   r*   ©rR   rÞ  rÏ  rÝ   rŽ   s        rA   ÚEtest_responseBodyFinishedWhenConnectionLostWhenContentLengthIsUnknownz_HTTP11ClientProtocolTests.test_responseBodyFinishedWhenConnectionLostWhenContentLengthIsUnknown   s  € ð œ-×/Ò/Ý�F˜D¥.°$Ñ7Ô7ñ
ô 
ˆð 	Œ×"Ò"Ð#AÑBÔBÐBàˆØ×#Ò# F¤MÑ2Ô2Ð2Ø˜!”9ˆå'Ñ)Ô)ˆØ×Ò˜XÑ&Ô&Ð&àŒ×"Ò" 6Ñ*Ô*Ð*ØŒ×"Ò" 6Ñ*Ô*Ð*à×Ò˜œ¨	Ñ2Ô2Ð2ØŒ×$Ò$Ý•NÐ#EÑFÔFÑGÔGñ	
ô 	
ð 	
ð 	Ô×"Ò"Õ#4Ñ5Ô5Ð5Ð5Ð5r@   c                 ó„  — | j                              t          ddt          d¦  «        ¦  «        }| j                              d¦  «         g }|                     |j        ¦  «         |d         }t          ¦   «         }|                     |¦  «         | j                              d¦  «         | j                              d¦  «         |  	                    |j
        d¦  «         | j                              t          t          ¦   «         ¦  «        ¦  «         t          | t          |j        ¦  «        t          t"          g¦  «        S )	a  
        If the final chunk has not been received when the connection is lost
        (for any reason), the protocol passed to C{deliverBody} has its
        C{connectionLost} method called with a L{Failure} wrapping the
        exception for that reason.
        rÙ   rÚ   Ns/   HTTP/1.1 200 OK
Transfer-Encoding: chunked

r   ó   3
foo
s   3
bar
rÎ  )rŽ   râ   r+   rf   rŒ   rU   rˆ   r   rÉ  rL   rÐ   r;  r   r9   r\   r   rÝ  r2   rá  s        rA   Ú4test_chunkedResponseBodyUnfinishedWhenConnectionLostzNHTTP11ClientProtocolTests.test_chunkedResponseBodyUnfinishedWhenConnectionLost½  s#  € ð œ-×/Ò/Ý�F˜D¥.°$Ñ7Ô7ñ
ô 
ˆð 	Œ×"Ò"ØLñ	
ô 	
ð 	
ð ˆØ×#Ò# F¤MÑ2Ô2Ð2Ø˜!”9ˆå'Ñ)Ô)ˆØ×Ò˜XÑ&Ô&Ð&àŒ×"Ò" ?Ñ3Ô3Ð3ØŒ×"Ò" ?Ñ3Ô3Ð3à×Ò˜œ¨	Ñ2Ô2Ð2àŒ×$Ò$¥WÕ-?Ñ-AÔ-AÑ%BÔ%BÑCÔCÐCå#Ø•$�xÔ,Ñ-Ô-Õ0BÅIÐ/Nñ
ô 
ð 	
r@   c                 óü   ‡ — ‰ j                              t          ddt          d¦  «        ¦  «        }‰ j                              d¦  «         t          ‰ |t          g¦  «        }ˆ fd„}|                     |¦  «         |S )a!  
        If the parser L{HTTP11ClientProtocol} delivers bytes to in
        C{dataReceived} raises an exception, the exception is wrapped in a
        L{Failure} and passed to the parser's C{connectionLost} and then the
        L{HTTP11ClientProtocol}'s transport is disconnected.
        rÙ   rÚ   Ns   unparseable garbage goes here
c                 ó  •— ‰                      ‰j        j        ¦  «         ‰                     | j        d         j        j        d¦  «         ‰j                             t          t          d¦  «        ¦  «        ¦  «         d S )Nr   s   unparseable garbage goes herez
it is done)r´   rg   r�  rL   rJ   r    rÐ   rŽ   r;  r   r
   )rÒ   rR   s    €rA   rS   zLHTTP11ClientProtocolTests.test_parserDataReceivedException.<locals>.cbFailedê  sr   ø€ Ø�OŠO˜DœNÔ8Ñ9Ô9Ð9Ø×ÒØ”˜A”Ô$Ô)Ð+Kñô ð ð ŒM×(Ò(­µÀÑ1MÔ1MÑ)NÔ)NÑOÔOÐOÐOÐOr@   )rŽ   râ   r+   rf   rŒ   r\   r$   rU   )rR   rÞ  rX   rS   s   `   rA   Ú test_parserDataReceivedExceptionz:HTTP11ClientProtocolTests.test_parserDataReceivedExceptionÝ  s�   ø€ ð œ-×/Ò/Ý�F˜D¥.°$Ñ7Ô7ñ
ô 
ˆð 	Œ×"Ò"Ð#GÑHÔHÐHÝ   ½¸ÑEÔEˆð
	Pð 
	Pð 
	Pð 
	Pð 
	Pð 	
�Š�hÑÔÐØˆr@   c                 óŽ  — | j                              t          ddt          d¦  «        ¦  «        }| j         j        j        }|                      |j        | j        ¦  «         | j                              t          t          d¦  «        ¦  «        ¦  «         |                      |j        d¦  «         t          | |t          g¦  «        S )z£
        When the HTTP response parser is disconnected, the
        L{TransportProxyProducer} which was connected to it as a transport is
        stopped.
        rÙ   rÚ   Nzconnection done)rŽ   râ   r+   rf   Ú_parserrg   r  Ú	_producerÚ_disconnectParserr   r
   r\   )rR   rÞ  rg   s      rA   Útest_proxyStoppedz+HTTP11ClientProtocolTests.test_proxyStoppedù  s«   € ð œ-×/Ò/Ý�F˜D¥.°$Ñ7Ô7ñ
ô 
ˆð ”MÔ)Ô3ˆ	Ø×Ò˜YÔ0°$´.ÑAÔAÐAØŒ×'Ò'­µÐ?PÑ0QÔ0QÑ(RÔ(RÑSÔSÐSØ×Ò˜YÔ0°$Ñ7Ô7Ð7Ý# D¨/½NÐ;KÑLÔLÐLr@   c                 ó@  — t          ¦   «         }t          ¦   «         }|                     |¦  «         g }g }|                     ¦   «                              |j        ¦  «         |                     ¦   «                              |j        ¦  «         |                      ||fg g f¦  «         |                      |j        ¦  «         | 	                    t          t          ¦   «         ¦  «        ¦  «         |                      |dg¦  «         |                      |dg¦  «         dS )zÅ
        L{HTTP11ClientProtocol.abort} will tell the transport to close its
        connection when it is invoked, and returns a C{Deferred} that fires
        when the connection is lost.
        N)r   r)   rŠ   ÚabortrU   rˆ   rL   r´   r�  r;  r   r
   )rR   rg   rŽ   Úr1Úr2s        rA   Útest_abortClosesConnectionz4HTTP11ClientProtocolTests.test_abortClosesConnection  s  € õ $Ñ%Ô%ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*ØˆØˆØ�ŠÑÔ×$Ò$ R¤YÑ/Ô/Ð/Ø�ŠÑÔ×$Ò$ R¤YÑ/Ô/Ð/Ø×Ò˜"˜b˜ B¨ 8Ñ,Ô,Ð,Ø�Š˜	Ô/Ñ0Ô0Ð0ð 	×Ò¥­Ñ(8Ô(8Ñ 9Ô 9Ñ:Ô:Ð:Ø×Ò˜˜d˜VÑ$Ô$Ð$Ø×Ò˜˜d˜VÑ$Ô$Ð$Ð$Ð$r@   c                 ó„  — t          ¦   «         }t          ¦   «         }|                     |¦  «         |                     t	          t          ¦   «         ¦  «        ¦  «         g }|                     ¦   «                              |j        ¦  «         |  	                    |dg¦  «         |  	                    |j
        d¦  «         dS )z‰
        L{HTTP11ClientProtocol.abort} called after the connection is lost
        returns a C{Deferred} that fires immediately.
        Nr±  )r   r)   rŠ   r;  r   r
   rï  rU   rˆ   rL   r{   ©rR   rg   rŽ   rÏ  s       rA   Útest_abortAfterConnectionLostz7HTTP11ClientProtocolTests.test_abortAfterConnectionLost  s¬   € õ
 $Ñ%Ô%ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø×Ò¥­Ñ(8Ô(8Ñ 9Ô 9Ñ:Ô:Ð:àˆØ�ŠÑÔ×$Ò$ V¤]Ñ3Ô3Ð3Ø×Ò˜ $ Ñ(Ô(Ð(Ø×Ò˜œÐ*;Ñ<Ô<Ð<Ð<Ð<r@   c                 óž  — t          ¦   «         }t          ¦   «         }|                     |¦  «         |                     t	          ddt
          d¦  «        ¦  «        }|                     ¦   «          |                      |j        ¦  «         | 	                    t          t          ¦   «         ¦  «        ¦  «         t          | |t          g¦  «        S )a  
        The Deferred returned by L{HTTP11ClientProtocol.request} will fire
        with a L{ResponseFailed} failure containing a L{ConnectionAborted}
        exception, if the connection was aborted before all response headers
        have been received.
        rÙ   rÚ   N)r   r)   rŠ   râ   r+   rf   rï  r´   r�  r;  r   r
   r\   r   rô  s       rA   Útest_abortBeforeResponseBodyz6HTTP11ClientProtocolTests.test_abortBeforeResponseBody,  s¬   € õ $Ñ%Ô%ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø×!Ò!¥'¨&°$½ÈÑ"MÔ"MÑNÔNˆØ�ŠÑÔÐØ�Š˜	Ô/Ñ0Ô0Ð0Ø×Ò¥­Ñ(8Ô(8Ñ 9Ô 9Ñ:Ô:Ð:Ý# D¨&Õ3DÐ2EÑFÔFÐFr@   c                 óà  ‡ ‡‡‡‡— t          d¬¦  «        Št          ¦   «         Š‰                     ‰¦  «         ‰                     t	          ddt
          d¦  «        ¦  «        }‰                     d¦  «         t          ¦   «         Š G ˆˆfd„dt          ¦  «        Šˆˆˆ ˆfd	„}ˆ fd
„}| 	                    |¦  «         t          ‰ ‰t          t          g¦  «        }| 	                    |¦  «        S )aS  
        When the connection is aborted after the response headers have
        been received and the L{Response} has been made available to
        application code, the response body protocol's C{connectionLost}
        method will be invoked with a L{ResponseFailed} failure containing a
        L{ConnectionAborted} exception.
        T)ÚlenientrÙ   rÚ   NrE  c                   ó(   •— e Zd ZdZˆ fd„Zˆfd„ZdS )úQHTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.BodyDestinationzl
            A body response protocol which immediately aborts the HTTP
            connection.
            c                 ó0   •— ‰                      ¦   «          dS )z<
                Abort the HTTP connection.
                N)rï  r¼   s    €rA   ÚconnectionMadez`HTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.BodyDestination.connectionMadeV  s   ø€ ð —’Ñ Ô Ð Ð Ð r@   c                 ó2   •— ‰                      |¦  «         dS )z�
                Make the reason for the losing of the connection available to
                the unit test via C{testResult}.
                N)r¦  )rR   rO   Ú
testResults     €rA   r;  z`HTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.BodyDestination.connectionLost\  s   ø€ ð
 ×"Ò" 6Ñ*Ô*Ð*Ð*Ð*r@   N)r;   r<   r=   r>   rý  r;  )rŽ   rÿ  s   €€rA   ÚBodyDestinationrû  P  sQ   ø€ € € € € ðð ð
!ð !ð !ð !ð !ð+ð +ð +ð +ð +ð +ð +r@   r   c                 óÒ   •— |                        ‰¦   «         ¦  «         ‰                     ‰j        ¦  «         ‰                     t	          t          ¦   «         ¦  «        ¦  «         dS )zÔ
            Connect the L{BodyDestination} response body protocol to the
            response, and then simulate connection loss after ensuring that
            the HTTP connection has been aborted.
            N)rÉ  r´   r�  r;  r   r
   )rÝ   r   rŽ   rR   rg   s    €€€€rA   rÉ  zMHTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.deliverBodyc  s^   ø€ ð × Ò   Ñ!2Ô!2Ñ3Ô3Ð3Ø�OŠO˜IÔ3Ñ4Ô4Ð4Ø×#Ò#¥G­NÑ,<Ô,<Ñ$=Ô$=Ñ>Ô>Ð>Ð>Ð>r@   c                 óH   •— ‰                      | j        t          ¦  «         d S rp   )rL  rÝ   r.   )ÚerrorrR   s    €rA   Ú
checkErrorzLHTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.checkErrorm  s!   ø€ Ø×!Ò! %¤.µ(Ñ;Ô;Ð;Ð;Ð;r@   )r   r)   rŠ   râ   r+   rf   rŒ   r   r   rU   r\   r   r2   )	rR   rÏ  rÉ  r  rV   r   rŽ   rÿ  rg   s	   `    @@@@rA   Útest_abortAfterResponseHeadersz8HTTP11ClientProtocolTests.test_abortAfterResponseHeaders<  s9  øøøøø€ õ $¨DÐ1Ñ1Ô1ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø×!Ò!¥'¨&°$½ÈÑ"MÔ"MÑNÔNˆà×ÒÐUÑVÔVÐVå‘Z”Zˆ
ð	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+�hñ 	+ô 	+ð 	+ð&	?ð 	?ð 	?ð 	?ð 	?ð 	?ð 	?ð 	?ð	<ð 	<ð 	<ð 	<ð 	<ð 	×Ò˜;Ñ'Ô'Ð'Ý'Ø�*Õ0µ)Ð<ñ
ô 
ˆð ×#Ò# JÑ/Ô/Ð/r@   c           	      óÄ  ‡ ‡‡— g Šˆˆˆ fd„}t          ¦   «         }t          |¦  «        Š‰                     |¦  «         ‰                     t	          ddt
          dd¬¦  «        ¦  «        }‰                     d¦  «         ‰                      ‰g ¦  «         g }|                     |j	        ¦  «         |d         }t          ¦   «         }t          ¦   «         |_        |j                             ˆfd	„¦  «         |                     |¦  «         ‰                     d
¦  «         |j                             t           ¦  «         ‰                      ‰‰dg¦  «         ‰                      ‰j        d¦  «         ‰                      ‰j        d¦  «         ‰                      ‰j        d¦  «         ‰                      ‰j        d¦  «         ‰                      ‰j        d¦  «         dS )a  
        If after a response is done the {HTTP11ClientProtocol} stays open and
        returns to QUIESCENT state, all per-request state is reset and the
        C{quiescentCallback} is called with the protocol instance.

        This is useful for implementing a persistent connection pool.

        The C{quiescentCallback} is called *before* the response-receiving
        protocol's C{connectionLost}, so that new requests triggered by end of
        first request can re-use a persistent connection.
        c                 ó”   •— ‰                      | ‰¦  «         ‰                      | j        d¦  «         ‰                     | ¦  «         d S ©Nr¸  ©rL   r‹   rˆ   ©rÆ  rŽ   rË  rR   s    €€€rA   r¥  zHHTTP11ClientProtocolTests.test_quiescentCallbackCalled.<locals>.callback„  óK   ø€ Ø×Ò˜Q Ñ)Ô)Ð)Ø×Ò˜QœW kÑ2Ô2Ð2Ø×"Ò" 1Ñ%Ô%Ð%Ð%Ð%r@   rÙ   rÚ   NT©r}  s&   HTTP/1.1 200 OK
Content-length: 3

r   c                 ó.   •— ‰                      d¦  «        S )Núresponse donerì   )rT  rË  s    €rA   rî   zHHTTP11ClientProtocolTests.test_quiescentCallbackCalled.<locals>.<lambda>ž  s   ø€ ˜×.Ò.¨Ñ?Ô?€ r@   r>  r  )r   r)   rŠ   râ   r+   rf   rŒ   rL   rU   rˆ   r   r   rÈ  rÉ  rÝ  rK   r/   rê  Ú_finishedRequestÚ_currentRequestÚ_transportProxyrA  )	rR   r¥  rg   rÞ  rÏ  rÝ   ÚbodyProtocolrŽ   rË  s	   `      @@rA   Útest_quiescentCallbackCalledz6HTTP11ClientProtocolTests.test_quiescentCallbackCalledv  sþ  øøø€ ð ˆð	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&õ
 $Ñ%Ô%ˆ	Ý'¨Ñ1Ô1ˆØ×Ò 	Ñ*Ô*Ð*à"×*Ò*Ý�F˜D¥.°$À4ÐHÑHÔHñ
ô 
ˆð 	×ÒÐUÑVÔVÐVð 	×Ò˜¨"Ñ-Ô-Ð-àˆØ×#Ò# F¤MÑ2Ô2Ð2Ø˜!”9ˆõ ,Ñ-Ô-ˆÝ&.¡j¤jˆÔ#ØÔ#×/Ò/Ø?Ð?Ð?Ð?ñ	
ô 	
ð 	
ð 	×Ò˜\Ñ*Ô*Ð*Ø×Ò˜fÑ%Ô%Ð%ØÔ!×&Ò&¥|Ñ4Ô4Ð4ð 	×Ò˜¨8°_Ð*EÑFÔFÐFð 	×Ò˜Ô)¨4Ñ0Ô0Ð0Ø×Ò˜Ô2°DÑ9Ô9Ð9Ø×Ò˜Ô1°4Ñ8Ô8Ð8Ø×Ò˜Ô1°4Ñ8Ô8Ð8Ø×Ò˜Ô3°TÑ:Ô:Ð:Ð:Ð:r@   c           	      óà  ‡ ‡‡— g Šˆˆˆ fd„}t          ¦   «         }t          |¦  «        Š‰                     |¦  «         ‰                     t	          ddt
          dd¬¦  «        ¦  «        }‰                     d¦  «         ‰                      |¦  «        }‰                      |j	        d¦  «         ‰                      t          ‰¦  «        d	¦  «         ‰                      |j        d
¦  «         dS )aÜ  
        The C{quiescentCallback} passed to L{HTTP11ClientProtocol} will only be
        invoked once that protocol is in a state similar to its initial state.
        One of the aspects of this initial state is the producer-state of its
        transport; an L{HTTP11ClientProtocol} begins with a transport that is
        producing, i.e. not C{pauseProducing}'d.

        Therefore, when C{quiescentCallback} is invoked the protocol will still
        be producing.
        c                 ó”   •— ‰                      | ‰¦  «         ‰                      | j        d¦  «         ‰                     | ¦  «         d S r  r	  r
  s    €€€rA   r¥  z]HTTP11ClientProtocolTests.test_transportProducingWhenQuiescentAfterFullBody.<locals>.callback¼  r  r@   rÙ   rÚ   NTr  s)   HTTP/1.1 200 OK
Content-length: 3

BBBÚDEFERRED_CLOSErc   rï   )r   r)   rŠ   râ   r+   rf   rŒ   ÚsuccessResultOfrL   r{   rM   rò   )rR   r¥  rg   rÞ  rÝ   rŽ   rË  s   `    @@rA   Ú1test_transportProducingWhenQuiescentAfterFullBodyzKHTTP11ClientProtocolTests.test_transportProducingWhenQuiescentAfterFullBody¯  s  øøø€ ð ˆð	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&õ
 $Ñ%Ô%ˆ	Ý'¨Ñ1Ô1ˆØ×Ò 	Ñ*Ô*Ð*Ø"×*Ò*Ý�F˜D¥.°$À4ÐHÑHÔHñ
ô 
ˆð 	×Òðñ	
ô 	
ð 	
ð ×'Ò'¨Ñ8Ô8ˆð 	×Ò˜œÐ*:Ñ;Ô;Ð;ð
 	×Ò�˜_Ñ-Ô-¨qÑ1Ô1Ð1ð
 	×Ò˜Ô0°+Ñ>Ô>Ð>Ð>Ð>r@   c           	      óø  ‡ ‡‡— g Šˆˆˆ fd„}t          ¦   «         }t          |¦  «        Š‰                     |¦  «         ‰                     t	          ddt
          dd¬¦  «        ¦  «        }|                     ‰j        ¦  «         ‰                     d¦  «         ‰  	                    t          ‰¦  «        d¦  «         ‰                      ‰d	         ‰¦  «         ‰                      ‰d
         t          ¦  «         dS )zˆ
        The quiescentCallback is called before the request C{Deferred} fires,
        in cases where the response has no body.
        c                 ó”   •— ‰                      | ‰¦  «         ‰                      | j        d¦  «         ‰                     | ¦  «         d S r  r	  r
  s    €€€rA   r¥  zUHTTP11ClientProtocolTests.test_quiescentCallbackCalledEmptyResponse.<locals>.callbackä  r  r@   rÙ   rÚ   NTr  ó&   HTTP/1.1 200 OK
Content-length: 0

rË   r   rc   )r   r)   rŠ   râ   r+   rf   rU   rˆ   rŒ   rL   rM   r  rL  r.   )rR   r¥  rg   rÞ  rŽ   rË  s   `   @@rA   Ú)test_quiescentCallbackCalledEmptyResponsezCHTTP11ClientProtocolTests.test_quiescentCallbackCalledEmptyResponseÝ  s  øøø€ ð
 ˆð	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&õ
 $Ñ%Ô%ˆ	Ý'¨Ñ1Ô1ˆØ×Ò 	Ñ*Ô*Ð*à"×*Ò*Ý�F˜D¥.°$À4ÐHÑHÔHñ
ô 
ˆð 	×#Ò# OÔ$:Ñ;Ô;Ð;Ø×ÒÐUÑVÔVÐVà×Ò�˜_Ñ-Ô-¨qÑ1Ô1Ð1Ø×Ò˜_¨QÔ/°Ñ:Ô:Ð:Ø×Ò˜o¨aÔ0µ(Ñ;Ô;Ð;Ð;Ð;r@   c           	      ó&  — g }t          ¦   «         }t          |j        ¦  «        }|                     |¦  «         |                     t          ddt          dd¬¦  «        ¦  «        }|                     d¦  «         g }|                     |j        ¦  «         |d         }t          ¦   «         }| 
                    |¦  «         |j                             t          ¦  «         |                      |g ¦  «         |                      |j        ¦  «         dS )zÒ
        If after a response is done the {HTTP11ClientProtocol} returns a
        C{Connection: close} header in the response, the C{quiescentCallback}
        is not called and the connection is lost.
        rÙ   rÚ   NTr  s9   HTTP/1.1 200 OK
Content-length: 0
Connection: close

r   ©r   r)   rˆ   rŠ   râ   r+   rf   rŒ   rU   r   rÉ  rÝ  rK   r/   rL   r´   r�  ©rR   rË  rg   rŽ   rÞ  rÏ  rÝ   r  s           rA   Útest_quiescentCallbackNotCalledz9HTTP11ClientProtocolTests.test_quiescentCallbackNotCalled÷  s  € ð ˆÝ#Ñ%Ô%ˆ	Ý'¨Ô(>Ñ?Ô?ˆØ×Ò 	Ñ*Ô*Ð*à"×*Ò*Ý�F˜D¥.°$À4ÐHÑHÔHñ
ô 
ˆð 	×Òðñ	
ô 	
ð 	
ð ˆØ×#Ò# F¤MÑ2Ô2Ð2Ø˜!”9ˆå+Ñ-Ô-ˆØ×Ò˜\Ñ*Ô*Ð*ØÔ!×&Ò&¥|Ñ4Ô4Ð4Ø×Ò˜¨"Ñ-Ô-Ð-Ø�Š˜	Ô/Ñ0Ô0Ð0Ð0Ð0r@   c           	      ó&  — g }t          ¦   «         }t          |j        ¦  «        }|                     |¦  «         |                     t          ddt          dd¬¦  «        ¦  «        }|                     d¦  «         g }|                     |j        ¦  «         |d         }t          ¦   «         }| 
                    |¦  «         |j                             t          ¦  «         |                      |g ¦  «         |                      |j        ¦  «         dS )z 
        If the request was non-persistent (i.e. sent C{Connection: close}),
        the C{quiescentCallback} is not called and the connection is lost.
        rÙ   rÚ   NFr  r  r   r  r  s           rA   Ú1test_quiescentCallbackNotCalledNonPersistentQueryzKHTTP11ClientProtocolTests.test_quiescentCallbackNotCalledNonPersistentQuery  s  € ð
 ˆÝ#Ñ%Ô%ˆ	Ý'¨Ô(>Ñ?Ô?ˆØ×Ò 	Ñ*Ô*Ð*à"×*Ò*Ý�F˜D¥.°$À5ÐIÑIÔIñ
ô 
ˆð 	×ÒÐUÑVÔVÐVàˆØ×#Ò# F¤MÑ2Ô2Ð2Ø˜!”9ˆå+Ñ-Ô-ˆØ×Ò˜\Ñ*Ô*Ð*ØÔ!×&Ò&¥|Ñ4Ô4Ð4Ø×Ò˜¨"Ñ-Ô-Ð-Ø�Š˜	Ô/Ñ0Ô0Ð0Ð0Ð0r@   c           	      ó   — d„ }t          j        | t          ¦  «        }t          ¦   «         }t	          |¦  «        }|                     |¦  «         |                     t          ddt          dd¬¦  «        ¦  «        }| 	                    d¦  «         g }| 
                    |j        ¦  «         |d         }t          ¦   «         }|                     |¦  «         |j                             t           ¦  «         |                      d	t%          |¦  «        ¦  «         |d         }	|	d
         }
|                      |
j        t*          ¦  «         |                      t*          ¦  «         |                      |j        ¦  «         dS )zx
        If C{quiescentCallback} throws an exception, the error is logged and
        protocol is disconnected.
        c                 ó   — t          ¦   «         ‚rp   )ÚZeroDivisionError)rÆ  s    rA   r¥  zHHTTP11ClientProtocolTests.test_quiescentCallbackThrows.<locals>.callback5  s   € Ý#Ñ%Ô%Ð%r@   rÙ   rÚ   NTr  r  r   rc   rI  )r   rJ  r   r   r)   rŠ   râ   r+   rf   rŒ   rU   rˆ   r   rÉ  rÝ  rK   r/   rK  rM   rL  r    r%  rM  r´   r�  )rR   r¥  rN  rg   rŽ   rÞ  rÏ  rÝ   r  rO  rÔ   s              rA   Útest_quiescentCallbackThrowsz6HTTP11ClientProtocolTests.test_quiescentCallbackThrows/  sh  € ð	&ð 	&ð 	&õ +Ô<¸TÕCUÑVÔVˆå#Ñ%Ô%ˆ	Ý'¨Ñ1Ô1ˆØ×Ò 	Ñ*Ô*Ð*à"×*Ò*Ý�F˜D¥.°$À4ÐHÑHÔHñ
ô 
ˆð 	×ÒÐUÑVÔVÐVàˆØ×#Ò# F¤MÑ2Ô2Ð2Ø˜!”9ˆÝ+Ñ-Ô-ˆØ×Ò˜\Ñ*Ô*Ð*ØÔ!×&Ò&¥|Ñ4Ô4Ð4à×Ò˜!�S Ñ-Ô-Ñ.Ô.Ð.Ø˜A”ˆØ�-Ô ˆØ×Ò˜aœgÕ'8Ñ9Ô9Ð9à×ÒÕ0Ñ1Ô1Ð1Ø�Š˜	Ô/Ñ0Ô0Ð0Ð0Ð0r@   c                 óN  — t          ¦   «         }t          ¦   «         }|                     |¦  «         |                     t	          ddt
          d¦  «        ¦  «        }|                     ¦   «          |                      |j        ¦  «         t          | |t          t          g¦  «        S )a  
        The L{Deferred} returned by L{HTTP11ClientProtocol.request} will fire
        with a L{ResponseNeverReceived} failure containing a L{CancelledError}
        exception if the request was cancelled before any response headers were
        received.
        rÙ   rÚ   N)r   r)   rŠ   râ   r+   rf   Úcancelr´   ÚdisconnectedrY   r1   r   rô  s       rA   Útest_cancelBeforeResponsez3HTTP11ClientProtocolTests.test_cancelBeforeResponseR  s�   € õ $Ñ%Ô%ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø×!Ò!¥'¨&°$½ÈÑ"MÔ"MÑNÔNˆØ�Š‰ŒˆØ�Š˜	Ô.Ñ/Ô/Ð/Ý*Ø�&Õ/µ.Ð1Añ
ô 
ð 	
r@   c                 ól  — t          ¦   «         }t          ¦   «         }|                     |¦  «         |                     t	          ddt
          d¦  «        ¦  «        }|                     d¦  «         |                     ¦   «          |                      |j	        ¦  «         t          | |t          g¦  «        S )a  
        The L{Deferred} returned by L{HTTP11ClientProtocol.request} will fire
        with a L{ResponseFailed} failure containing a L{CancelledError}
        exception if the request was cancelled before all response headers were
        received.
        rÙ   rÚ   NrÛ   )r   r)   rŠ   râ   r+   rf   rŒ   r(  r´   r)  r\   r   rô  s       rA   Útest_cancelDuringResponsez3HTTP11ClientProtocolTests.test_cancelDuringResponsec  s›   € õ $Ñ%Ô%ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø×!Ò!¥'¨&°$½ÈÑ"MÔ"MÑNÔNˆØ×ÒÐ4Ñ5Ô5Ð5Ø�Š‰ŒˆØ�Š˜	Ô.Ñ/Ô/Ð/Ý# D¨&µ>Ð2BÑCÔCÐCr@   c                 óü  ‡‡‡— t          ¦   «         }t          ¦   «         }|                     |¦  «         t          |¦  «        ŠddiŠˆfd„Šˆˆfd„}|‰_        |                     t          ddt          ‰¦  «        ¦  «        }‰j         	                    d¦  «         | 
                    ¦   «          |                      |j        ¦  «         |                      ‰d         ¦  «         t          | |t          g¦  «        S )a  
        The L{Deferred} returned by L{HTTP11ClientProtocol.request} will fire
        with a L{RequestGenerationFailed} failure containing a
        L{CancelledError} exception if the request was cancelled before a
        C{bodyProducer} has finished producing.
        Ú	cancelledFc                 ó   •— d‰d<   d S )NTr.  r?   )rT  ÚnonLocals    €rA   r(  zJHTTP11ClientProtocolTests.assertCancelDuringBodyProduction.<locals>.cancel�  s   ø€ Ø$(ˆH�[Ñ!Ð!Ð!r@   c                 óH   •— | ‰_         t          ‰¦  «        ‰_        ‰j        S rp   ©Úconsumerr   rô   )r3  r(  Úproducers    €€rA   ÚstartProducingzRHTTP11ClientProtocolTests.assertCancelDuringBodyProduction.<locals>.startProducing„  s$   ø€ Ø (ˆHÔÝ (¨Ñ 0Ô 0ˆHÔØÔ$Ð$r@   ó   POSTó   /bars   xxxxx)r   r)   rŠ   ÚStringProducerr5  râ   r+   rf   r3  r‚  r(  r´   r)  r^   r   )	rR   ÚproducerLengthrg   rŽ   r5  rÏ  r(  r0  r4  s	         @@@rA   Ú assertCancelDuringBodyProductionz:HTTP11ClientProtocolTests.assertCancelDuringBodyProductions  s  øøø€ õ $Ñ%Ô%ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ý! .Ñ1Ô1ˆà Ð'ˆð	)ð 	)ð 	)ð 	)ð 	)ð	%ð 	%ð 	%ð 	%ð 	%ð 	%ð
 #1ˆÔà×!Ò!¥'¨'°7½NÈHÑ"UÔ"UÑVÔVˆØÔ×Ò Ñ)Ô)Ð)Ø�Š‰ŒˆØ�Š˜	Ô.Ñ/Ô/Ð/Ø�Š˜ Ô-Ñ.Ô.Ð.Ý,¨T°6½NÐ;KÑLÔLÐLr@   c                 ó,   — |                       d¦  «        S )a(  
        The L{Deferred} returned by L{HTTP11ClientProtocol.request} will fire
        with a L{RequestGenerationFailed} failure containing a
        L{CancelledError} exception if the request was cancelled before a
        C{bodyProducer} with an explicit length has finished producing.
        é
   )r:  rq   s    rA   Útest_cancelDuringBodyProductionz9HTTP11ClientProtocolTests.test_cancelDuringBodyProduction’  s   € ð ×4Ò4°RÑ8Ô8Ð8r@   c                 ó6   — |                       t          ¦  «        S )a'  
        The L{Deferred} returned by L{HTTP11ClientProtocol.request} will fire
        with a L{RequestGenerationFailed} failure containing a
        L{CancelledError} exception if the request was cancelled before a
        C{bodyProducer} with C{UNKNOWN_LENGTH} has finished producing.
        )r:  r   rq   s    rA   Ú&test_cancelDuringChunkedBodyProductionz@HTTP11ClientProtocolTests.test_cancelDuringChunkedBodyProduction›  s   € ð ×4Ò4µ^ÑDÔDÐDr@   rp   )'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õ  r÷  r  r  r  r  r   r"  r&  r*  r,  r:  r=  r?  r?   r@   rA   r„  r„  <  sV  € € € € € ðð ð
5ð 5ð 5ð@ð @ð @ðð ð ðð ð ðð ð ð4Lð Lð Lð ð ð ð ð@Kð Kð KðJð Jð Jð
ð 
ð 
ð0ð ð ð.ð ð ð$0ð 0ð 0ðd?ð ?ð ?ð4ð ð ð@'ð 'ð 'ðR6ð 6ð 6ð:
ð 
ð 
ð@ð ð ð8Mð Mð Mð%ð %ð %ð*=ð =ð =ðGð Gð Gð 80ð 80ð 80ðt7;ð 7;ð 7;ðr,?ð ,?ð ,?ð\<ð <ð <ð41ð 1ð 1ð>1ð 1ð 1ð2!1ð !1ð !1ðF
ð 
ð 
ð"Dð Dð Dð Mð Mð Mð>9ð 9ð 9ðEð Eð Eð Eð Er@   r„  c                   ó4   — e Zd ZdZdZd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	r8  a»  
    L{StringProducer} is a dummy body producer.

    @ivar stopped: A flag which indicates whether or not C{stopProducing} has
        been called.
    @ivar consumer: After C{startProducing} is called, the value of the
        C{consumer} argument to that method.
    @ivar finished: After C{startProducing} is called, a L{Deferred} which was
        returned by that method.  L{StringProducer} will never fire this
        L{Deferred}.
    Fc                 ó   — || _         d S rp   )ró   )rR   ró   s     rA   Ú__init__zStringProducer.__init__µ  s   € ØˆŒˆˆr@   c                 óD   — || _         t          ¦   «         | _        | j        S rp   r2  )rR   r3  s     rA   r5  zStringProducer.startProducing¸  s   € Ø ˆŒÝ ™
œ
ˆŒØŒ}Ðr@   c                 ó   — d| _         d S rë   rx  rq   s    rA   ÚstopProducingzStringProducer.stopProducing½  r{  r@   c                 ó   — d S rp   r?   rq   s    rA   ÚpauseProducingzStringProducer.pauseProducingÀ  ó   € àˆr@   c                 ó   — d S rp   r?   rq   s    rA   ÚresumeProducingzStringProducer.resumeProducingÄ  rH  r@   N)
r;   r<   r=   r>   ry  rB  r5  rE  rG  rJ  r?   r@   rA   r8  r8  ¥  sp   € € € € € ð
ð 
ð €Gðð ð ðð ð ð
ð ð ðð ð ðð ð ð ð r@   r8  c                   óª   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚRequestTestsz
    Tests for L{Request}.
    c                 ó,   — t          ¦   «         | _        d S rp   )r   rg   rq   s    rA   r†  zRequestTests.setUpÎ  s   € Ý(Ñ*Ô*ˆŒˆˆr@   c                 ó¾   — t          ddt          d¦  «                             | j        ¦  «         |                      | j                             ¦   «         d¦  «         dS )zk
        L{Request.writeTo} formats the request data and writes it to the given
        transport.
        rÙ   rÚ   Ns8   GET / HTTP/1.1
Connection: close
Host: example.com

©r+   rf   rv  rg   rL   r    rq   s    rA   Útest_sendSimplestRequestz%RequestTests.test_sendSimplestRequestÑ  s`   € õ
 	�˜�n¨dÑ3Ô3×;Ò;¸D¼NÑKÔKÐKØ×ÒØŒN× Ò Ñ"Ô"ðñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 óÆ   — t          ddt          dd¬¦  «        }|                     | j        ¦  «         |                      | j                             ¦   «         d¦  «         dS )zO
        A pesistent request does not send 'Connection: close' header.
        rÙ   rÚ   NTr  s%   GET / HTTP/1.1
Host: example.com

rO  )rR   Úreqs     rA   Ú"test_sendSimplestPersistentRequestz/RequestTests.test_sendSimplestPersistentRequestß  sf   € õ �f˜d¥N°DÀTÐJÑJÔJˆØ�Š�D”NÑ#Ô#Ð#Ø×ÒØŒN× Ò Ñ"Ô"ØBñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 ó¼  — t          ddgdgdœ¦  «        }t          dd|d¦  «                             | j        ¦  «         | j                             ¦   «                              d¦  «        }|                      |d	         d
¦  «         |                      |dd…         ddg¦  «         |d	= |dd…= |                     ¦   «          |                      |g d¢¦  «         dS )zf
        L{Request.writeTo} formats header data and writes it to the given
        transport.
        r˜   r«   rE   )r  rD   rÙ   ó   /fooNrÂ   r   ó   GET /foo HTTP/1.1éþÿÿÿr@   )ó   Connection: closes   Host: example.comrœ   rª   )r3   r+   rv  rg   r    ÚsplitrL   Úsort)rR   r­   Úliness      rA   Útest_sendRequestHeadersz$RequestTests.test_sendRequestHeadersê  sï   € õ
  f¨fÐ%5ÀÐ@PÐQÐQÑRÔRˆÝ�˜ ¨$Ñ/Ô/×7Ò7¸¼ÑGÔGÐGØ”×$Ò$Ñ&Ô&×,Ò,¨WÑ5Ô5ˆØ×Ò˜˜qœÐ#7Ñ8Ô8Ð8Ø×Ò˜˜r˜s˜sœ c¨3 ZÑ0Ô0Ð0Ø�!ˆH�e˜B˜C˜C�jØ�
Š
‰ŒˆØ×ÒØØVÐVÐVñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 óH  — t           D �]}t          ||gddgi¦  «        }t          ¦   «         }t          dd|d¦  «                             |¦  «         |                     ¦   «                              d¦  «        }|                      |d         d¦  «         |                      |d	d…         d
d
g¦  «         |d= |d	d…= |                     d¦  «         |                     d¦  «         d 	                    t          t          g¦  «        }|                      ||g¦  «         �ŒdS )z_
        Linear whitespace in request headers is replaced with a single
        space.
        rD   s   example.invalidrÙ   rU  NrÂ   r   rV  rW  r@   rX  s   Host: example.invalids   : )r6   r3   r   r+   rv  r    rY  rL   ÚremoverŸ   r7   )rR   Ú	componentr­   rg   r[  ÚsanitizedHeaderLines         rA   Ú-test_sanitizeLinearWhitespaceInRequestHeadersz:RequestTests.test_sanitizeLinearWhitespaceInRequestHeadersû  s+  € õ
 9ð 	;ñ 	;ˆIÝ˜y¨9¨+°wÐASÐ@TÐUÑVÔVˆGÝ'Ñ)Ô)ˆIÝ�F˜G W¨dÑ3Ô3×;Ò;¸IÑFÔFÐFØ—O’OÑ%Ô%×+Ò+¨GÑ4Ô4ˆEØ×Ò˜U 1œXÐ';Ñ<Ô<Ð<Ø×Ò˜U 2 3 3œZ¨#¨s¨Ñ4Ô4Ð4Ø�a�˜%   ˜*Ø�LŠLÐ-Ñ.Ô.Ð.Ø�LŠLÐ1Ñ2Ô2Ð2Ø"'§*¢*­n½nÐ-MÑ"NÔ"NÐØ×Ò˜UÐ%8Ð$9Ñ:Ô:Ð:Ñ:ð	;ð 	;r@   c                 ó  — t          t          ¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «         |                      |j        d¦  «         |                      | j        j	        |¦  «         |  
                    | j        j        ¦  «         |                      | j                             ¦   «         d¦  «         | j                             ¦   «          |j                             d¦  «         |j                             d¦  «         |j                             d¦  «         |                      | j        j	        d¦  «         |                      | j                             ¦   «         d¦  «         dS )zË
        L{Request.writeTo} uses chunked encoding to write data from the request
        body producer to the given transport.  It registers the request body
        producer with the transport.
        r6  r7  NsX   POST /bar HTTP/1.1
Connection: close
Transfer-Encoding: chunked
Host: example.com

s   xxxs   yyyyyyyyyyyyyyys!   3
xxx
f
yyyyyyyyyyyyyyy
0

)r8  r   r+   rf   rv  rg   ÚassertNotIdenticalr3  r  r4  r´   Ú	streamingrL   r    Úclearr‚  rô   r¥  ©rR   r4  râ   s      rA   Útest_sendChunkedRequestBodyz(RequestTests.test_sendChunkedRequestBody  s]  € õ "¥.Ñ1Ô1ˆÝ˜' 7­N¸HÑEÔEˆØ�Š˜œÑ'Ô'Ð'à×Ò Ô 1°4Ñ8Ô8Ð8Ø×Ò˜Tœ^Ô4°hÑ?Ô?Ð?Ø�Š˜œÔ0Ñ1Ô1Ð1à×ÒØŒN× Ò Ñ"Ô"ðñ	
ô 	
ð 	
ð 	Œ×ÒÑÔÐàÔ×Ò Ñ)Ô)Ð)ØÔ×Ò 	Ñ*Ô*Ð*ØÔ×"Ò" 4Ñ(Ô(Ð(Ø×Ò˜Tœ^Ô4°dÑ;Ô;Ð;Ø×ÒØŒN× Ò Ñ"Ô"ØPñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 óz  ‡ — t          t          ¦  «        }t          ddt          |¦  «        }|                     ‰ j        ¦  «        }‰ j                             ¦   «          |j                             t          ¦   «         ¦  «         ˆ fd„}‰  
                    |t          ¦  «        }|                     |¦  «         |S )aš  
        If L{Request} is created with a C{bodyProducer} without a known length
        and the L{Deferred} returned from its C{startProducing} method fires
        with a L{Failure}, the L{Deferred} returned by L{Request.writeTo} fires
        with that L{Failure} and the body producer is unregistered from the
        transport.  The final zero-length chunk is not written to the
        transport.
        r6  r7  c                 ó¢   •— ‰                      ‰j                             ¦   «         d¦  «         ‰                     ‰j        j        d ¦  «         d S r‹  )rL   rg   r    r  r4  r�  s    €rA   rS   zCRequestTests.test_sendChunkedRequestBodyWithError.<locals>.cbFailed=  sH   ø€ Ø×Ò˜Tœ^×1Ò1Ñ3Ô3°SÑ9Ô9Ð9Ø× Ò  ¤Ô!8¸$Ñ?Ô?Ð?Ð?Ð?r@   )r8  r   r+   rf   rv  rg   re  rô   r¦  r9   rT   rU   )rR   r4  râ   ÚwriteDeferredrS   rX   s   `     rA   Ú$test_sendChunkedRequestBodyWithErrorz1RequestTests.test_sendChunkedRequestBodyWithError.  s·   ø€ õ "¥.Ñ1Ô1ˆÝ˜' 7­N¸HÑEÔEˆØŸš¨¬Ñ7Ô7ˆØŒ×ÒÑÔÐØÔ×!Ò!Õ"4Ñ"6Ô"6Ñ7Ô7Ð7ð	@ð 	@ð 	@ð 	@ð 	@ð ×Ò˜}Õ.@ÑAÔAˆØ	�Š�hÑÔÐØˆr@   c                 óÈ  — t          d¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «         |                      |j        d¦  «         |                      | j        j        |¦  «         |  	                    | j        j
        ¦  «         |                      | j                             ¦   «         d¦  «         | j                             ¦   «          |j                             d¦  «         |j                             d¦  «         |                      | j        j        d¦  «         |                      | j                             ¦   «         d¦  «         dS )zÊ
        If L{Request} is created with a C{bodyProducer} with a known length,
        that length is sent as the value for the I{Content-Length} header and
        chunked encoding is not used.
        é   r6  r7  NsO   POST /bar HTTP/1.1
Connection: close
Content-Length: 3
Host: example.com

r>  )r8  r+   rf   rv  rg   rc  r3  r  r4  r´   rd  rL   r    re  r‚  rô   r¥  rf  s      rA   Útest_sendRequestBodyWithLengthz+RequestTests.test_sendRequestBodyWithLengthE  s:  € õ " !Ñ$Ô$ˆÝ˜' 7­N¸HÑEÔEˆØ�Š˜œÑ'Ô'Ð'à×Ò Ô 1°4Ñ8Ô8Ð8Ø×Ò˜Tœ^Ô4°hÑ?Ô?Ð?Ø�Š˜œÔ0Ñ1Ô1Ð1à×ÒØŒN× Ò Ñ"Ô"ðñ	
ô 	
ð 	
ð 	Œ×ÒÑÔÐàÔ×Ò Ñ'Ô'Ð'ØÔ×"Ò" 4Ñ(Ô(Ð(Ø×Ò˜Tœ^Ô4°dÑ;Ô;Ð;Ø×Ò˜œ×-Ò-Ñ/Ô/°Ñ8Ô8Ð8Ð8Ð8r@   c                 óÈ   — t          |dt          d¦  «        }|                     | j        ¦  «         |                      | j                             ¦   «         |dz   ¦  «         dS )a"  
        Verify that the message generated by a L{Request} initialized with
        the given method and C{None} as the C{bodyProducer} includes
        I{Content-Length: 0} in the header.

        @param method: The HTTP method issue in the request.
        @type method: L{bytes}
        rU  NsK    /foo HTTP/1.1
Connection: close
Content-Length: 0
Host: example.com

rO  )rR   r|  râ   s      rA   Ú_sendRequestEmptyBodyWithLengthz,RequestTests._sendRequestEmptyBodyWithLengthb  sk   € õ ˜& '­>¸4Ñ@Ô@ˆØ�Š˜œÑ'Ô'Ð'à×ÒØŒN× Ò Ñ"Ô"Øð ñ ñ	
ô 	
ð 	
ð 	
ð 	
r@   c                 ó0   — |                       d¦  «         dS )z­
        If I{PUT} L{Request} is created without a C{bodyProducer},
        I{Content-Length: 0} is included in the header and chunked
        encoding is not used.
        s   PUTN©rp  rq   s    rA   Útest_sendPUTRequestEmptyBodyz)RequestTests.test_sendPUTRequestEmptyBodyw  s   € ð 	×,Ò,¨VÑ4Ô4Ð4Ð4Ð4r@   c                 ó0   — |                       d¦  «         dS )z®
        If I{POST} L{Request} is created without a C{bodyProducer},
        I{Content-Length: 0} is included in the header and chunked
        encoding is not used.
        r6  Nrr  rq   s    rA   Útest_sendPOSTRequestEmptyBodyz*RequestTests.test_sendPOSTRequestEmptyBody  s   € ð 	×,Ò,¨WÑ5Ô5Ð5Ð5Ð5r@   c                 ó`  — t          d¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «        }|j                             d¦  «         |j                             d¦  «         |  	                    | j        j
        d¦  «         |                      |t          ¦  «        S )a  
        If L{Request} is created with a C{bodyProducer} with a known length and
        the producer does not produce that many bytes, the L{Deferred} returned
        by L{Request.writeTo} fires with a L{Failure} wrapping a
        L{WrongBodyLength} exception.
        rm  r6  r7  ó   abN)r8  r+   rf   rv  rg   r3  r‚  rô   r¥  r  r4  rT   r'   ©rR   r4  râ   rj  s       rA   Ú#test_sendRequestBodyWithTooFewBytesz0RequestTests.test_sendRequestBodyWithTooFewBytes‡  s–   € õ " !Ñ$Ô$ˆÝ˜' 7­N¸HÑEÔEˆØŸš¨¬Ñ7Ô7ˆØÔ×Ò Ñ&Ô&Ð&ØÔ×"Ò" 4Ñ(Ô(Ð(Ø×Ò˜Tœ^Ô4°dÑ;Ô;Ð;Ø×!Ò! -µÑAÔAÐAr@   c                 ó
  ‡ ‡‡— t          d¦  «        Št          ddt          ‰¦  «        }|                     ‰ j        ¦  «        }‰j                             d¦  «         ‰                      ‰j        ¦  «         ‰j                             d¦  «         ‰  	                    ‰j        ¦  «         ‰  
                    ‰ j        j        d¦  «         ˆˆˆ fd„}‰                      |t          ¦  «        }|                     |¦  «         |S )a7  
        Verify that when too many bytes have been written by a body producer
        and then the body producer's C{startProducing} L{Deferred} fires that
        the producer is unregistered from the transport and that the
        L{Deferred} returned from L{Request.writeTo} is fired with a L{Failure}
        wrapping a L{WrongBodyLength}.

        @param finisher: A callable which will be invoked with the body
            producer after too many bytes have been written to the transport.
            It should fire the startProducing Deferred somehow.
        rm  r6  r7  rw  ó   cdNc                 óP  •— ‰                      ‰j                             ¦   «         d¦  «         ‰j                             ¦   «          ‰                     t
          ‰j        j        d¦  «          ‰‰¦  «         ‰                      ‰j                             ¦   «         d¦  «         d S )NsQ   POST /bar HTTP/1.1
Connection: close
Content-Length: 3
Host: example.com

abs   efr@   )rL   rg   r    re  r   r    r3  r‚  )rÒ   Úfinisherr4  rR   s    €€€rA   rS   zCRequestTests._sendRequestBodyWithTooManyBytesTest.<locals>.cbFailed¶  s§   ø€ ð ×ÒØ”×$Ò$Ñ&Ô&ðñô ð ð ŒN× Ò Ñ"Ô"Ð"ð ×Ò�k¨8Ô+<Ô+BÀEÑJÔJÐJð
 ˆH�XÑÔÐð ×Ò˜Tœ^×1Ò1Ñ3Ô3°SÑ9Ô9Ð9Ð9Ð9r@   )r8  r+   rf   rv  rg   r3  r‚  r¶   ry  r´   r  r4  rT   r'   rU   )rR   r}  râ   rj  rS   rX   r4  s   ``    @rA   Ú$_sendRequestBodyWithTooManyBytesTestz1RequestTests._sendRequestBodyWithTooManyBytesTest–  s  øøø€ õ " !Ñ$Ô$ˆÝ˜' 7­N¸HÑEÔEˆØŸš¨¬Ñ7Ô7ˆàÔ×Ò Ñ&Ô&Ð&ð 	×Ò˜Ô)Ñ*Ô*Ð*àÔ×Ò Ñ&Ô&Ð&ð 	�Š˜Ô(Ñ)Ô)Ð)ð 	×Ò˜Tœ^Ô4°dÑ;Ô;Ð;ð	:ð 	:ð 	:ð 	:ð 	:ð 	:ð 	:ð: ×Ò˜}­oÑ>Ô>ˆØ	�Š�hÑÔÐØˆr@   c                 ó2   — d„ }|                       |¦  «        S )á  
        If L{Request} is created with a C{bodyProducer} with a known length and
        the producer tries to produce more than than many bytes, the
        L{Deferred} returned by L{Request.writeTo} fires with a L{Failure}
        wrapping a L{WrongBodyLength} exception.
        c                 ó:   — | j                              d ¦  «         d S rp   ©rô   r¥  ©r4  s    rA   r}  zCRequestTests.test_sendRequestBodyWithTooManyBytes.<locals>.finisherß  ó   € ØÔ×&Ò& tÑ,Ô,Ð,Ð,Ð,r@   )r~  ©rR   r}  s     rA   Ú$test_sendRequestBodyWithTooManyBytesz1RequestTests.test_sendRequestBodyWithTooManyBytes×  s'   € ð	-ð 	-ð 	-ð ×8Ò8¸ÑBÔBÐBr@   c                 óp   ‡ ‡— t          j        ‰ t          ¦  «        Šˆˆ fd„}‰                      |¦  «        S )r€  c                 óZ  •— | j                              t          ¦   «         ¦  «         ‰d         }‰                     d|¦  «         |d         }‰                     |j        t          ¦  «         ‰                     t          ¦  «        }‰                     t          |¦  «        d¦  «         d S )Nr   rI  rc   )	rô   r¦  r9   r²  rL  r    rM  rL   rM   )r4  rO  rÔ   r¨  rN  rR   s       €€rA   r}  zHRequestTests.test_sendRequestBodyErrorWithTooManyBytes.<locals>.finisherí  s—   ø€ ØÔ×%Ò%Õ&8Ñ&:Ô&:Ñ;Ô;Ð;Ø ”NˆEØ�MŠM˜-¨Ñ/Ô/Ð/Ø�mÔ$ˆAØ×!Ò! !¤'Õ+=Ñ>Ô>Ð>Ø×+Ò+Õ,>Ñ?Ô?ˆFØ×Ò�S ™[œ[¨!Ñ,Ô,Ð,Ð,Ð,r@   )r   rJ  r   r~  )rR   r}  rN  s   ` @rA   Ú)test_sendRequestBodyErrorWithTooManyBytesz6RequestTests.test_sendRequestBodyErrorWithTooManyBytesä  sM   øø€ õ +Ô<¸TÕCUÑVÔVˆð	-ð 	-ð 	-ð 	-ð 	-ð 	-ð ×8Ò8¸ÑBÔBÐBr@   c                 ó~  — t          j        | t          ¦  «        }t          d¦  «        }t	          ddt
          |¦  «        }|                     | j        ¦  «         |j        j	        }|j         
                    d¦  «         |j                             d¦  «         |                     t          ¦   «         ¦  «         |d         }|                      d|¦  «         |d         }|                      |j        t          ¦  «         |                      t'          |                      t          ¦  «        ¦  «        d¦  «         dS )	a’  
        Though there should be no way for the internal C{finishedConsuming}
        L{Deferred} in L{Request._writeToBodyProducerContentLength} to fire a
        L{Failure} after the C{finishedProducing} L{Deferred} has fired, in
        case this does happen, the error should be logged with a message about
        how there's probably a bug in L{Request}.

        This is a whitebox test.
        rm  r6  r7  r>  Nr   rI  rc   )r   rJ  r   r8  r+   rf   rv  rg   r3  Ú	_finishedr‚  rô   r¥  r¦  r9   r²  rL  r    rL   rM   rM  )rR   rN  r4  râ   ÚfinishedConsumingrO  rÔ   s          rA   Ú*test_sendRequestBodyErrorWithConsumerErrorz7RequestTests.test_sendRequestBodyErrorWithConsumerErrorø  s  € õ +Ô<¸TÕCUÑVÔVˆÝ! !Ñ$Ô$ˆÝ˜' 7­N¸HÑEÔEˆØ�Š˜œÑ'Ô'Ð'à$Ô-Ô7ÐàÔ×Ò Ñ'Ô'Ð'ØÔ×"Ò" 4Ñ(Ô(Ð(à×!Ò!Õ"4Ñ"6Ô"6Ñ7Ô7Ð7Ø˜A”ˆØ�Š�m UÑ+Ô+Ð+Ø�-Ô ˆØ×Ò˜aœgÕ'9Ñ:Ô:Ð:Ø×Ò�˜T×3Ò3Õ4FÑGÔGÑHÔHÈ!ÑLÔLÐLÐLÐLr@   c                 óè  — t          d¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «        }|j                             d¦  «          ||¦  «         |                      | j        j        d¦  «         | j         	                    ¦   «          |  
                    t          |j        j        d¦  «         |                      | j                             ¦   «         d¦  «         |S )a  
        Verify that if the body producer fires its Deferred and then keeps
        writing to the consumer that the extra writes are ignored and the
        L{Deferred} returned by L{Request.writeTo} fires with a L{Failure}
        wrapping the most appropriate exception type.
        rm  r6  r7  rw  Nr{  r@   )r8  r+   rf   rv  rg   r3  r‚  r  r4  re  r   r    rL   r    )rR   r}  r4  râ   rj  s        rA   Ú-_sendRequestBodyFinishedEarlyThenTooManyBytesz:RequestTests._sendRequestBodyFinishedEarlyThenTooManyBytes	  sÕ   € õ " !Ñ$Ô$ˆÝ˜' 7­N¸HÑEÔEˆØŸš¨¬Ñ7Ô7ˆàÔ×Ò Ñ&Ô&Ð&Øˆ�ÑÔÐØ×Ò˜Tœ^Ô4°dÑ;Ô;Ð;ØŒ×ÒÑÔÐØ×Ò�+ xÔ'8Ô'>ÀÑFÔFÐFØ×Ò˜œ×-Ò-Ñ/Ô/°Ñ5Ô5Ð5ØÐr@   c                 ód   — d„ }|                       |                      |¦  «        t          ¦  «        S )a-  
        If the request body producer indicates it is done by firing the
        L{Deferred} returned from its C{startProducing} method but then goes on
        to write too many bytes, the L{Deferred} returned by {Request.writeTo}
        fires with a L{Failure} wrapping L{WrongBodyLength}.
        c                 ó:   — | j                              d ¦  «         d S rp   r‚  rƒ  s    rA   r}  zPRequestTests.test_sendRequestBodyFinishedEarlyThenTooManyBytes.<locals>.finisher.	  r„  r@   )rT   r�  r'   r…  s     rA   Ú1test_sendRequestBodyFinishedEarlyThenTooManyBytesz>RequestTests.test_sendRequestBodyFinishedEarlyThenTooManyBytes&	  s?   € ð	-ð 	-ð 	-ð ×!Ò!Ø×>Ò>¸xÑHÔHÝñ
ô 
ð 	
r@   c                 ód   — d„ }|                       |                      |¦  «        t          ¦  «        S )a3  
        If the request body producer indicates an error by firing the
        L{Deferred} returned from its C{startProducing} method but then goes on
        to write too many bytes, the L{Deferred} returned by {Request.writeTo}
        fires with that L{Failure} and L{WrongBodyLength} is logged.
        c                 óR   — | j                              t          ¦   «         ¦  «         d S rp   )rô   r¦  r9   rƒ  s    rA   r}  zORequestTests.test_sendRequestBodyErroredEarlyThenTooManyBytes.<locals>.finisher>	  s&   € ØÔ×%Ò%Õ&8Ñ&:Ô&:Ñ;Ô;Ð;Ð;Ð;r@   )rT   r�  r9   r…  s     rA   Ú0test_sendRequestBodyErroredEarlyThenTooManyBytesz=RequestTests.test_sendRequestBodyErroredEarlyThenTooManyBytes6	  s?   € ð	<ð 	<ð 	<ð ×!Ò!Ø×>Ò>¸xÑHÔHÝñ
ô 
ð 	
r@   Nc                 óœ  — t          t          ¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «        }|j                             |¦  «         | j                             ¦   «          |  	                    t          |j        j        d¦  «         |                      | j                             ¦   «         d¦  «         |S )a  
        If the request body producer with an unknown length tries to write
        after firing the L{Deferred} returned by its C{startProducing} method,
        the C{write} call raises an exception and does not write anything to
        the underlying transport.
        r6  r7  rÖ   r@   )r8  r   r+   rf   rv  rg   rô   r¥  re  r   r    r3  r‚  rL   r    )rR   Ú_withr4  râ   rj  s        rA   Ú0test_sendChunkedRequestBodyFinishedThenWriteMorez=RequestTests.test_sendChunkedRequestBodyFinishedThenWriteMoreF	  sª   € õ "¥.Ñ1Ô1ˆÝ˜' 7­N¸HÑEÔEˆØŸš¨¬Ñ7Ô7ˆØÔ×"Ò" 5Ñ)Ô)Ð)ØŒ×ÒÑÔÐà×Ò�+ xÔ'8Ô'>ÀÑGÔGÐGØ×Ò˜œ×-Ò-Ñ/Ô/°Ñ5Ô5Ð5ØÐr@   c                 ó”   — |                       t          t          ¦   «         ¦  «        ¦  «        }|                      |t          ¦  «        S )a$  
        If the request body producer with an unknown length tries to write
        after firing the L{Deferred} returned by its C{startProducing} method
        with a L{Failure}, the C{write} call raises an exception and does not
        write anything to the underlying transport.
        )r˜  r   r9   rT   )rR   rX   s     rA   Ú9test_sendChunkedRequestBodyFinishedWithErrorThenWriteMorezFRequestTests.test_sendChunkedRequestBodyFinishedWithErrorThenWriteMoreW	  sD   € ð ×AÒAÝÕ&Ñ(Ô(Ñ)Ô)ñ
ô 
ˆð ×!Ò! !Õ%7Ñ8Ô8Ð8r@   c                 óæ  — t          d¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «        }|                      | j        j        |¦  «         |                      | j        j        ¦  «         |j	         
                    d¦  «         |                      | j                             ¦   «         d¦  «         |                      | j        j        ¦  «         |j                             t#          t%          ¦   «         ¦  «        ¦  «         |                      | j        j        ¦  «         |                      | j        j        d¦  «         |                      |t$          ¦  «        S )zú
        If the L{Deferred} returned from the C{startProducing} method of the
        L{IBodyProducer} passed to L{Request} fires with a L{Failure}, the
        L{Deferred} returned from L{Request.writeTo} fails with that
        L{Failure}.
        é   r6  r7  rw  sQ   POST /bar HTTP/1.1
Connection: close
Content-Length: 5
Host: example.com

abN)r8  r+   rf   rv  rg   r  r4  r´   rd  r3  r‚  rL   r    r¶   r�  rô   r¦  r   r9   rT   rx  s       rA   Útest_sendRequestBodyWithErrorz*RequestTests.test_sendRequestBodyWithErrorc	  s@  € õ " !Ñ$Ô$ˆÝ˜' 7­N¸HÑEÔEˆØŸš¨¬Ñ7Ô7ˆð 	×Ò˜Tœ^Ô4°hÑ?Ô?Ð?Ø�Š˜œÔ0Ñ1Ô1Ð1àÔ×Ò Ñ&Ô&Ð&Ø×ÒØŒN× Ò Ñ"Ô"ðñ	
ô 	
ð 	
ð 	×Ò˜œÔ5Ñ6Ô6Ð6ØÔ×!Ò!¥'Õ*<Ñ*>Ô*>Ñ"?Ô"?Ñ@Ô@Ð@ð 	×Ò˜œÔ5Ñ6Ô6Ð6ð 	×Ò˜Tœ^Ô4°dÑ;Ô;Ð;à×!Ò! -Õ1CÑDÔDÐDr@   c           	      óÖ  — t          ddt          i ¦  «        d¦  «        }|                      t          |j        | j        ¦  «         |                      | j                             ¦   «         d¦  «         t          ddt          dddgi¦  «        d¦  «        }|                      t          |j        | j        ¦  «         |                      | j                             ¦   «         d¦  «         dS )z—
        L{Request.writeTo} raises L{BadHeaders} if there is not exactly one
        I{Host} header and writes nothing to the given transport.
        rÙ   rÚ   Nr@   s   HostrE   s   example.org)r+   r3   r   r   rv  rg   rL   r    )rR   râ   s     rA   Útest_hostHeaderRequiredz$RequestTests.test_hostHeaderRequiredŠ	  sÐ   € õ
 ˜& $­°©¬°TÑ:Ô:ˆØ×Ò�* g¤o°t´~ÑFÔFÐFØ×Ò˜œ×-Ò-Ñ/Ô/°Ñ5Ô5Ð5åØ�D�' 7¨^¸^Ð,LÐ"MÑNÔNÐPTñ
ô 
ˆð 	×Ò�* g¤o°t´~ÑFÔFÐFØ×Ò˜œ×-Ò-Ñ/Ô/°Ñ5Ô5Ð5Ð5Ð5r@   c                 ó  — t          d¦  «        }t          ddt          |¦  «        }|                     | j        ¦  «         |                      |j        ¦  «         |                     ¦   «          |                      |j        ¦  «         dS )zc
        L{Request.stopWriting} calls its body producer's C{stopProducing}
        method.
        rm  rÙ   rÚ   N)	r8  r+   rf   rv  rg   r¶   ry  rz  r´   rf  s      rA   Útest_stopWritingzRequestTests.test_stopWriting™	  s|   € õ
 " !Ñ$Ô$ˆÝ˜& $­¸ÑAÔAˆØ�Š˜œÑ'Ô'Ð'Ø×Ò˜Ô)Ñ*Ô*Ð*Ø×ÒÑÔÐØ�Š˜Ô(Ñ)Ô)Ð)Ð)Ð)r@   c                 ó>  — t          j        | t          ¦  «        }t          d¦  «        }d„ }||_        t          ddt          |¦  «        }|                     | j        ¦  «         | 	                    ¦   «          |  
                    t          |                      t          ¦  «        ¦  «        d¦  «         |                      dt          |¦  «        ¦  «         |d         }|                      d|¦  «         |d         }|                      |j        t          ¦  «         dS )	z–
        If the body producer's C{stopProducing} method raises an exception,
        L{Request.stopWriting} logs it and does not re-raise it.
        rm  c                  ó    — t          d¦  «        ‚©NzstopProducing is bustedrG  r?   r@   rA   ÚbrokenStopProducingzBRequestTests.test_brokenStopProducing.<locals>.brokenStopProducing­	  s   € Ý$Ð%>Ñ?Ô?Ð?r@   rÙ   rÚ   rc   r   rI  N)r   rJ  r   r8  rE  r+   rf   rv  rg   rz  rL   rM   rM  r9   rK  r²  rL  r    )rR   rN  r4  r¥  râ   rO  rÔ   s          rA   Útest_brokenStopProducingz%RequestTests.test_brokenStopProducing¥	  s
  € õ
 +Ô<¸TÕCUÑVÔVˆÝ! !Ñ$Ô$ˆð	@ð 	@ð 	@ð "5ˆÔå˜& $­¸ÑAÔAˆØ�Š˜œÑ'Ô'Ð'Ø×ÒÑÔÐØ×Ò�˜T×3Ò3Õ4FÑGÔGÑHÔHÈ!ÑLÔLÐLØ×Ò˜!�S Ñ-Ô-Ñ.Ô.Ð.Ø˜A”ˆØ�Š�m UÑ+Ô+Ð+Ø�-Ô ˆØ×Ò˜aœgÕ'9Ñ:Ô:Ð:Ð:Ð:r@   rp   )r;   r<   r=   r>   r†  rP  rS  r\  ra  rg  rk  rn  rp  rs  ru  ry  r~  r†  r‰  r�  r�  r’  r•  r˜  rš  r�  rŸ  r¡  r¦  r?   r@   rA   rL  rL  É  s¬  € € € € € ðð ð+ð +ð +ð
ð 
ð 
ð	
ð 	
ð 	
ð
ð 
ð 
ð";ð ;ð ;ð$
ð 
ð 
ðBð ð ð.9ð 9ð 9ð:
ð 
ð 
ð*5ð 5ð 5ð6ð 6ð 6ðBð Bð Bð?ð ?ð ?ðBCð Cð CðCð Cð Cð(Mð Mð Mð6ð ð ð&
ð 
ð 
ð 
ð 
ð 
ð ð ð ð ð"
9ð 
9ð 
9ð%Eð %Eð %EðN6ð 6ð 6ð
*ð 
*ð 
*ð;ð ;ð ;ð ;ð ;r@   rL  c                   óD   — e Zd ZdZd„ Zd„ Zd„ Zdd„Zd„ Zd„ Z	d	„ Z
d
„ ZdS )ÚLengthEnforcingConsumerTestsz/
    Tests for L{LengthEnforcingConsumer}.
    c                 óÄ   — t          ¦   «         | _        t          d¦  «        | _        t	          ¦   «         | _        t          | j        | j        | j        ¦  «        | _        d S )Nr<  )r   rÏ  r8  r4  r   rg   r#   Úenforcerrq   s    rA   r†  z"LengthEnforcingConsumerTests.setUpÂ	  sK   € Ý‘j”jˆŒÝ& rÑ*Ô*ˆŒÝ(Ñ*Ô*ˆŒÝ/ØŒM˜4œ>¨4¬;ñ
ô 
ˆŒˆˆr@   c                 óT  — | j                              d¦  «         |                      | j                             ¦   «         d¦  «         | j                             ¦   «          | j                              d¦  «         |                      | j                             ¦   «         d¦  «         dS )zì
        L{LengthEnforcingConsumer.write} calls the wrapped consumer's C{write}
        method with the bytes it is passed as long as there are fewer of them
        than the C{length} attribute indicates remain to be received.
        r>  s   defN)rª  r‚  rL   rg   r    re  rq   s    rA   Ú
test_writez'LengthEnforcingConsumerTests.test_writeÊ	  s’   € ð 	Œ×Ò˜FÑ#Ô#Ð#Ø×Ò˜œ×-Ò-Ñ/Ô/°Ñ8Ô8Ð8ØŒ×ÒÑÔÐØŒ×Ò˜FÑ#Ô#Ð#Ø×Ò˜œ×-Ò-Ñ/Ô/°Ñ8Ô8Ð8Ð8Ð8r@   c                 ó„   — | j                              d¦  «         |                      t          | j         j        ¦  «         dS )z´
        L{LengthEnforcingConsumer._noMoreWritesExpected} raises
        L{WrongBodyLength} if it is called before the indicated number of bytes
        have been written.
        s	   xxxxxxxxxN)rª  r‚  r   r'   Ú_noMoreWritesExpectedrq   s    rA   Útest_finishedEarlyz/LengthEnforcingConsumerTests.test_finishedEarlyÖ	  s;   € ð 	Œ×Ò˜HÑ%Ô%Ð%Ø×Ò�/¨4¬=Ô+NÑOÔOÐOÐOÐOr@   Fc                 ó\  — | j                              d¦  «         |                      | j        j        ¦  «         | j                              d¦  «         |                      | j        j        ¦  «         |r| j                              ¦   «          |                      | j        t          ¦  «        S )aN  
        If it is called with a total number of bytes exceeding the indicated
        limit passed to L{LengthEnforcingConsumer.__init__},
        L{LengthEnforcingConsumer.write} fires the L{Deferred} with a
        L{Failure} wrapping a L{WrongBodyLength} and also calls the
        C{stopProducing} method of the producer.
        ó
   xxxxxxxxxxó   x)
rª  r‚  r¶   r4  ry  r´   r®  rT   rÏ  r'   )rR   Ú_unregisterAfters     rA   Útest_writeTooManyz.LengthEnforcingConsumerTests.test_writeTooManyß	  s”   € ð 	Œ×Ò˜IÑ&Ô&Ð&Ø×Ò˜œÔ.Ñ/Ô/Ð/ØŒ×Ò˜DÑ!Ô!Ð!Ø�Š˜œÔ-Ñ.Ô.Ð.Øð 	2ØŒM×/Ò/Ñ1Ô1Ð1Ø×!Ò! $¤+­Ñ?Ô?Ð?r@   c                 ó4  — | j                              d¦  «         | j                              ¦   «          |                      | j        j        ¦  «         |                      t          | j         j        d¦  «         |                      | j        j        ¦  «         dS )zÒ
        If L{LengthEnforcingConsumer.write} is called after
        L{LengthEnforcingConsumer._noMoreWritesExpected}, it calls the
        producer's C{stopProducing} method and raises L{ExcessWrite}.
        r±  r²  N)	rª  r‚  r®  r¶   r4  ry  r   r    r´   rq   s    rA   Útest_writeAfterNoMoreExpectedz:LengthEnforcingConsumerTests.test_writeAfterNoMoreExpectedï	  s�   € ð 	Œ×Ò˜IÑ&Ô&Ð&ØŒ×+Ò+Ñ-Ô-Ð-Ø×Ò˜œÔ.Ñ/Ô/Ð/Ø×Ò�+ t¤}Ô':¸DÑAÔAÐAØ�Š˜œÔ-Ñ.Ô.Ð.Ð.Ð.r@   c                 ó,   — |                       d¦  «        S )zÍ
        L{LengthEnforcingConsumer._noMoreWritesExpected} does nothing (in
        particular, it does not raise any exception) if called after too many
        bytes have been passed to C{write}.
        T)r´  rq   s    rA   Útest_finishedLatez.LengthEnforcingConsumerTests.test_finishedLateû	  s   € ð ×%Ò% dÑ+Ô+Ð+r@   c                 ó”   — | j                              d¦  «         |                      | j                              ¦   «         d¦  «         dS )zŸ
        If L{LengthEnforcingConsumer._noMoreWritesExpected} is called after
        the correct number of bytes have been written it returns L{None}.
        r±  N)rª  r‚  r  r®  rq   s    rA   Útest_finishedz*LengthEnforcingConsumerTests.test_finished
  sD   € ð
 	Œ×Ò˜IÑ&Ô&Ð&Ø×Ò˜Tœ]×@Ò@ÑBÔBÀDÑIÔIÐIÐIÐIr@   c                 ó†   ‡ — ˆ fd„}|‰ j         _        ˆ fd„}‰                      ¦   «         }|                     |¦  «         |S )a8  
        If L{LengthEnforcingConsumer.write} calls the producer's
        C{stopProducing} because too many bytes were written and the
        C{stopProducing} method raises an exception, the exception is logged
        and the L{LengthEnforcingConsumer} still errbacks the finished
        L{Deferred}.
        c                  ó`   •— t                                ‰ j        ¦  «         t          d¦  «        ‚r¤  )r8  rE  r4  r9   rq   s   €rA   r¥  zRLengthEnforcingConsumerTests.test_stopProducingRaises.<locals>.brokenStopProducing
  s(   ø€ Ý×(Ò(¨¬Ñ7Ô7Ð7Ý$Ð%>Ñ?Ô?Ð?r@   c                 ó~   •— ‰                      t          ‰                     t          ¦  «        ¦  «        d¦  «         d S )Nrc   )rL   rM   rM  r9   r�  s    €rA   Ú
cbFinishedzILengthEnforcingConsumerTests.test_stopProducingRaises.<locals>.cbFinished
  s6   ø€ Ø×Ò�S ×!7Ò!7Õ8JÑ!KÔ!KÑLÔLÈaÑPÔPÐPÐPÐPr@   )r4  rE  r´  rU   )rR   r¥  r¾  rX   s   `   rA   Útest_stopProducingRaisesz5LengthEnforcingConsumerTests.test_stopProducingRaises
  su   ø€ ð	@ð 	@ð 	@ð 	@ð 	@ð ':ˆŒÔ#ð	Qð 	Qð 	Qð 	Qð 	Qð ×"Ò"Ñ$Ô$ˆØ	�Š�jÑ!Ô!Ð!Øˆr@   N)F)r;   r<   r=   r>   r†  r¬  r¯  r´  r¶  r¸  rº  r¿  r?   r@   rA   r¨  r¨  ½	  s¥   € € € € € ðð ð
ð 
ð 
ð
9ð 
9ð 
9ðPð Pð Pð@ð @ð @ð @ð 
/ð 
/ð 
/ð,ð ,ð ,ðJð Jð Jðð ð ð ð r@   r¨  c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )ÚRequestBodyConsumerTestsz¤
    Tests for L{ChunkedEncoder} which sits between an L{ITransport} and a
    request/response body producer and chunked encodes everything written to
    it.
    c           	      óˆ   — |                       t          t          t          t	          ¦   «         ¦  «        ¦  «        ¦  «         dS )zC
        L{ChunkedEncoder} instances provide L{IConsumer}.
        N)r´   r   r   r   r   rq   s    rA   Útest_interfacez'RequestBodyConsumerTests.test_interface)
  s4   € ð 	�Š�¥Yµ½Ñ?PÔ?PÑ0QÔ0QÑRÔRÑSÔSÐSÐSÐSr@   c                 ó\  — t          ¦   «         }t          |¦  «        }|                     d¦  «         |                      |                     ¦   «         d¦  «         |                     ¦   «          |                     d¦  «         |                      |                     ¦   «         d¦  «         dS )z}
        L{ChunkedEncoder.write} writes to the transport the chunked encoded
        form of the bytes passed to it.
        rÖ   rä  s   xxxxxxxxxxxxxxxxs   10
xxxxxxxxxxxxxxxx
N)r   r   r‚  rL   r    re  )rR   rg   Úencoders      rA   r¬  z#RequestBodyConsumerTests.test_write/
  s—   € õ
 $Ñ%Ô%ˆ	Ý  Ñ+Ô+ˆØ�Š�fÑÔÐØ×Ò˜ŸšÑ*Ô*¨OÑ<Ô<Ð<Ø�ŠÑÔÐØ�Š�iÑ Ô Ð Ø×Ò˜ŸšÑ*Ô*Ð,KÑLÔLÐLÐLÐLr@   c                 ó   — t          ¦   «         }t          ¦   «         }t          |¦  «        }|                     |d¦  «         |                      |j        |¦  «         |                      |j        ¦  «         |                     ¦   «          |                      |j        d¦  «         |  	                    | 
                    ¦   «         d¦  «         dS )a  
        L{ChunkedEncoder.registerProducer} registers the given streaming
        producer with its transport and L{ChunkedEncoder.unregisterProducer}
        writes a zero-length chunk to its transport and unregisters the
        transport's producer.
        TNs   0

)r   r»   r   ÚregisterProducerr  r4  r´   rd  ÚunregisterProducerrL   r    )rR   rg   r4  rÅ  s       rA   Útest_producerRegistrationz2RequestBodyConsumerTests.test_producerRegistration<
  sº   € õ $Ñ%Ô%ˆ	Ý‘8”8ˆÝ  Ñ+Ô+ˆØ× Ò  ¨4Ñ0Ô0Ð0Ø×Ò˜YÔ/°Ñ:Ô:Ð:Ø�Š˜	Ô+Ñ,Ô,Ð,Ø×"Ò"Ñ$Ô$Ð$Ø×Ò˜YÔ/°Ñ6Ô6Ð6Ø×Ò˜ŸšÑ*Ô*¨LÑ9Ô9Ð9Ð9Ð9r@   N)r;   r<   r=   r>   rÃ  r¬  rÉ  r?   r@   rA   rÁ  rÁ  "
  sQ   € € € € € ðð ðTð Tð TðMð Mð Mð:ð :ð :ð :ð :r@   rÁ  c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚTransportProxyProducerTestszn
    Tests for L{TransportProxyProducer} which proxies the L{IPushProducer}
    interface of a transport.
    c                 óp   — |                       t          t          t          d¦  «        ¦  «        ¦  «         dS )zO
        L{TransportProxyProducer} instances provide L{IPushProducer}.
        N)r´   r   r   r&   rq   s    rA   rÃ  z*TransportProxyProducerTests.test_interfaceT
  s/   € ð 	�Š�¥]Õ4JÈ4Ñ4PÔ4PÑQÔQÑRÔRÐRÐRÐRr@   c                 óÔ   — t          ¦   «         }t          |¦  «        }|                      |j        |¦  «         |                     ¦   «          |                      |j        d¦  «         dS )z~
        L{TransportProxyProducer.stopProxying} drops the reference to the
        wrapped L{IPushProducer} provider.
        N)r   r&   r  rë  ÚstopProxying©rR   rg   Úproxys      rA   Ú%test_stopProxyingUnreferencesProducerzATransportProxyProducerTests.test_stopProxyingUnreferencesProducerZ
  sd   € õ
 $Ñ%Ô%ˆ	Ý& yÑ1Ô1ˆØ×Ò˜Uœ_¨iÑ8Ô8Ð8Ø×ÒÑÔÐØ×Ò˜Uœ_¨dÑ3Ô3Ð3Ð3Ð3r@   c                 óª  — t          ¦   «         }|                     ¦   «          t          |¦  «        }|                      |j        d¦  «         |                     ¦   «          |                      |j        d¦  «         |                     ¦   «          |                     ¦   «          |                     ¦   «          |                      |j        d¦  «         dS )z™
        L{TransportProxyProducer.resumeProducing} calls the wrapped
        transport's C{resumeProducing} method unless told to stop proxying.
        r  rï   N)r   rG  r&   rL   rò   rJ  rÎ  rÏ  s      rA   Útest_resumeProducingz0TransportProxyProducerTests.test_resumeProducinge
  sÉ   € õ
 $Ñ%Ô%ˆ	Ø× Ò Ñ"Ô"Ð"å& yÑ1Ô1ˆà×Ò˜Ô0°(Ñ;Ô;Ð;Ø×ÒÑÔÐà×Ò˜Ô0°+Ñ>Ô>Ð>à× Ò Ñ"Ô"Ð"Ø×ÒÑÔÐð 	×ÒÑÔÐØ×Ò˜Ô0°(Ñ;Ô;Ð;Ð;Ð;r@   c                 ó‚  — t          ¦   «         }t          |¦  «        }|                      |j        d¦  «         |                     ¦   «          |                      |j        d¦  «         |                     ¦   «          |                     ¦   «          |                     ¦   «          |                      |j        d¦  «         dS )z—
        L{TransportProxyProducer.pauseProducing} calls the wrapped transport's
        C{pauseProducing} method unless told to stop proxying.
        rï   r  N)r   r&   rL   rò   rG  rJ  rÎ  rÏ  s      rA   Útest_pauseProducingz/TransportProxyProducerTests.test_pauseProducing{
  s·   € õ
 $Ñ%Ô%ˆ	å& yÑ1Ô1ˆà×Ò˜Ô0°+Ñ>Ô>Ð>Ø×ÒÑÔÐà×Ò˜Ô0°(Ñ;Ô;Ð;à×!Ò!Ñ#Ô#Ð#Ø×ÒÑÔÐð 	×ÒÑÔÐØ×Ò˜Ô0°+Ñ>Ô>Ð>Ð>Ð>r@   c                 ó”  — t          ¦   «         }t          |¦  «        }|                      |j        d¦  «         |                     ¦   «          |                      |j        d¦  «         t          ¦   «         }t          |¦  «        }|                     ¦   «          |                     ¦   «          |                      |j        d¦  «         dS )z•
        L{TransportProxyProducer.stopProducing} calls the wrapped transport's
        C{stopProducing} method unless told to stop proxying.
        rï   ry  N)r   r&   rL   rò   rE  rÎ  rÏ  s      rA   Útest_stopProducingz.TransportProxyProducerTests.test_stopProducing�
  s»   € õ
 $Ñ%Ô%ˆ	Ý& yÑ1Ô1ˆà×Ò˜Ô0°+Ñ>Ô>Ð>Ø×ÒÑÔÐà×Ò˜Ô0°)Ñ<Ô<Ð<å#Ñ%Ô%ˆ	Ý& yÑ1Ô1ˆØ×ÒÑÔÐØ×ÒÑÔÐà×Ò˜Ô0°+Ñ>Ô>Ð>Ð>Ð>r@   c                 ó�  — t          ¦   «         }t          ¦   «         }|                     |¦  «         ||_        t	          |¦  «        }|                      |j        ¦  «         |                      |j        d¦  «         | 	                    ¦   «          |                      |j        d¦  «         |  
                    |j        ¦  «         dS )zs
        L{TransportProxyProducer.loseConnection} calls the wrapped transport's
        C{loseConnection}.
        rï   N)r   r   rŠ   rŽ   r&   r´   Ú	connectedrL   rò   ÚloseConnectionr¶   ©rR   rg   rŽ   rÐ  s       rA   Ú test_loseConnectionWhileProxyingz<TransportProxyProducerTests.test_loseConnectionWhileProxying¤
  s»   € õ
 5Ñ6Ô6ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø%ˆ	ÔÝ& yÑ1Ô1ˆà�Š˜	Ô+Ñ,Ô,Ð,Ø×Ò˜Ô0°+Ñ>Ô>Ð>à×ÒÑÔÐð 	×Ò˜Ô0°+Ñ>Ô>Ð>Ø×Ò˜Ô,Ñ-Ô-Ð-Ð-Ð-r@   c                 óL  — t          ¦   «         }t          ¦   «         }|                     |¦  «         ||_        t	          |¦  «        }|                     ¦   «          |                      |j        ¦  «         |                     ¦   «          |                      |j        ¦  «         dS )zm
        L{TransportProxyProducer.loseConnection} does nothing when the
        proxy is not active.
        N)	r   r   rŠ   rŽ   r&   rÎ  r´   rÙ  rÚ  rÛ  s       rA   Útest_loseConnectionNotProxyingz:TransportProxyProducerTests.test_loseConnectionNotProxying¹
  s™   € õ
 5Ñ6Ô6ˆ	Ý'Ñ)Ô)ˆØ×Ò 	Ñ*Ô*Ð*Ø%ˆ	ÔÝ& yÑ1Ô1ˆØ×ÒÑÔÐØ�Š˜	Ô+Ñ,Ô,Ð,à×ÒÑÔÐð 	�Š˜	Ô+Ñ,Ô,Ð,Ð,Ð,r@   N)r;   r<   r=   r>   rÃ  rÑ  rÓ  rÕ  r×  rÜ  rÞ  r?   r@   rA   rË  rË  N
  sŠ   € € € € € ðð ð
Sð Sð Sð	4ð 	4ð 	4ð<ð <ð <ð,?ð ?ð ?ð*?ð ?ð ?ð(.ð .ð .ð*-ð -ð -ð -ð -r@   rË  c                   ól   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚResponseTestsz 
    Tests for L{Response}.
    c                 óŒ   — t          t          ¦   «         ¦  «        }|                      t          t          |¦  «        ¦  «         dS )z=
        L{Response} instances provide L{IResponse}.
        N)rh   r   r´   r   r5   ©rR   rÝ   s     rA   Útest_verifyInterfacez"ResponseTests.test_verifyInterfaceÑ
  s9   € õ )­Ñ):Ô):Ñ;Ô;ˆØ�Š�¥Y°Ñ9Ô9Ñ:Ô:Ð:Ð:Ð:r@   c                 ór  ‡— g Št          ¦   «         } G ˆfd„dt          ¦  «        } |¦   «         }t          |¦  «        }|                     |¦  «         ‰\  }|                     ¦   «          |                      |j        d¦  «         |                     ¦   «          |                      |j        d¦  «         dS )zÑ
        The L{IProtocol} provider passed to L{Response.deliverBody} has its
        C{makeConnection} method called with an L{IPushProducer} provider
        hooked up to the response as an argument.
        c                   ó   •— e Zd Zˆ fd„ZdS )ú7ResponseTests.test_makeConnection.<locals>.SomeProtocolc                 ó2   •— ‰                      |¦  «         d S rp   rì   )rR   r4  Ú	producerss     €rA   rŠ   zFResponseTests.test_makeConnection.<locals>.SomeProtocol.makeConnectionâ
  s   ø€ Ø× Ò  Ñ*Ô*Ð*Ð*Ð*r@   N©r;   r<   r=   rŠ   )rè  s   €rA   ÚSomeProtocolræ  á
  s.   ø€ € € € € ð+ð +ð +ð +ð +ð +ð +r@   rê  r  rï   N)r   r   rh   rÉ  rG  rL   rò   rJ  )rR   rg   rê  r3  rÝ   ÚtheProducerrè  s         @rA   Útest_makeConnectionz!ResponseTests.test_makeConnectionØ
  sÚ   ø€ ð ˆ	Ý#Ñ%Ô%ˆ	ð	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+�8ñ 	+ô 	+ð 	+ð  �<‘>”>ˆÝ(¨Ñ3Ô3ˆØ×Ò˜XÑ&Ô&Ð&Ø!‰ˆØ×"Ò"Ñ$Ô$Ð$Ø×Ò˜Ô0°(Ñ;Ô;Ð;Ø×#Ò#Ñ%Ô%Ð%Ø×Ò˜Ô0°+Ñ>Ô>Ð>Ð>Ð>r@   c                 ó  ‡— g Š G ˆfd„dt           ¦  «        } |¦   «         }t          t          ¦   «         ¦  «        }|                     |¦  «         |                     d¦  «         |                      ‰dg¦  «         dS )zµ
        The L{IProtocol} provider passed to L{Response.deliverBody} has its
        C{dataReceived} method called with bytes received as part of the
        response body.
        c                   ó   •— e Zd Zˆ fd„ZdS )ú5ResponseTests.test_dataReceived.<locals>.ListConsumerc                 ó2   •— ‰                      |¦  «         d S rp   rì   ©rR   rÐ   r¾   s     €rA   rŒ   zBResponseTests.test_dataReceived.<locals>.ListConsumer.dataReceived÷
  ó   ø€ Ø—’˜TÑ"Ô"Ð"Ð"Ð"r@   N©r;   r<   r=   rŒ   ©r¾   s   €rA   ÚListConsumerrï  ö
  ó.   ø€ € € € € ð#ð #ð #ð #ð #ð #ð #r@   rõ  rÖ   N)r   rh   r   rÉ  rð   rL   )rR   rõ  r3  rÝ   r¾   s       @rA   Útest_dataReceivedzResponseTests.test_dataReceivedî
  s¤   ø€ ð ˆð	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#�8ñ 	#ô 	#ð 	#ð  �<‘>”>ˆÝ(­Ñ):Ô):Ñ;Ô;ˆØ×Ò˜XÑ&Ô&Ð&à×"Ò" 6Ñ*Ô*Ð*Ø×Ò˜  Ñ)Ô)Ð)Ð)Ð)r@   c                 óŽ  ‡— g Š G ˆfd„dt           ¦  «        } |¦   «         }t          t          ¦   «         ¦  «        }|                     |¦  «         |                     ¦   «          ‰d                              t          ¦  «         |                      t          ‰¦  «        d¦  «         |  	                    |j
        d¦  «         dS )zó
        The L{IProtocol} provider passed to L{Response.deliverBody} has its
        C{connectionLost} method called with a L{Failure} wrapping
        L{ResponseDone} when the response's C{_bodyDataFinished} method is
        called.
        c                   ó   •— e Zd Zˆ fd„ZdS )ú7ResponseTests.test_connectionLost.<locals>.ListConsumerc                 ó2   •— ‰                      |¦  «         d S rp   rì   )rR   rO   Úlosts     €rA   r;  zFResponseTests.test_connectionLost.<locals>.ListConsumer.connectionLost  s   ø€ Ø—’˜FÑ#Ô#Ð#Ð#Ð#r@   N)r;   r<   r=   r;  )rü  s   €rA   rõ  rú  
  s.   ø€ € € € € ð$ð $ð $ð $ð $ð $ð $r@   rõ  r   rc   N)r   rh   r   rÉ  rñ   rK   r/   rL   rM   r  Ú_bodyProtocol)rR   rõ  r3  rÝ   rü  s       @rA   Útest_connectionLostz!ResponseTests.test_connectionLost  s×   ø€ ð ˆð	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$�8ñ 	$ô 	$ð 	$ð  �<‘>”>ˆÝ(­Ñ):Ô):Ñ;Ô;ˆØ×Ò˜XÑ&Ô&Ð&à×"Ò"Ñ$Ô$Ð$ØˆQŒ�Š•\Ñ"Ô"Ð"Ø×Ò�˜T™œ AÑ&Ô&Ð&ð 	×Ò˜XÔ3°TÑ:Ô:Ð:Ð:Ð:r@   c                 óŽ  ‡— g Š G ˆfd„dt           ¦  «        } |¦   «         }t          t          ¦   «         ¦  «        }|                     d¦  «         |                     d¦  «         |                     |¦  «         |                     d¦  «         |                      ‰g d¢¦  «         |                      |j        d¦  «         dS )zÌ
        If data is delivered to the L{Response} before a protocol is registered
        with C{deliverBody}, that data is buffered until the protocol is
        registered and then is delivered.
        c                   ó   •— e Zd Zˆ fd„ZdS )ú8ResponseTests.test_bufferEarlyData.<locals>.ListConsumerc                 ó2   •— ‰                      |¦  «         d S rp   rì   rñ  s     €rA   rŒ   zEResponseTests.test_bufferEarlyData.<locals>.ListConsumer.dataReceived#  rò  r@   Nró  rô  s   €rA   rõ  r  "  rö  r@   rõ  rÖ   r˜   r«   )rÖ   r˜   r«   N)r   rh   r   rð   rÉ  rL   r  Ú_bodyBuffer)rR   rõ  rŽ   rÝ   r¾   s       @rA   Útest_bufferEarlyDataz"ResponseTests.test_bufferEarlyData  sì   ø€ ð ˆð	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#�8ñ 	#ô 	#ð 	#ð  �<‘>”>ˆÝ(­Ñ):Ô):Ñ;Ô;ˆØ×"Ò" 6Ñ*Ô*Ð*Ø×"Ò" 6Ñ*Ô*Ð*Ø×Ò˜XÑ&Ô&Ð&Ø×"Ò" 6Ñ*Ô*Ð*Ø×Ò˜Ð 8Ð 8Ð 8Ñ9Ô9Ð9ð 	×Ò˜XÔ1°4Ñ8Ô8Ð8Ð8Ð8r@   c                 óØ   — t          t          ¦   «         ¦  «        }|                     t          ¦   «         ¦  «         |                      t
          |j        t          ¦   «         ¦  «         dS )zb
        L{Response.deliverBody} raises L{RuntimeError} if called more than
        once.
        N)rh   r   rÉ  r   r   r€   râ  s     rA   Ú test_multipleStartProducingFailsz.ResponseTests.test_multipleStartProducingFails1  sT   € õ
 )­Ñ):Ô):Ñ;Ô;ˆØ×Ò�X™ZœZÑ(Ô(Ð(Ø×Ò�,¨Ô(<½h¹j¼jÑIÔIÐIÐIÐIr@   c                 ó   — t          t          ¦   «         ¦  «        }|                     t          ¦   «         ¦  «         |                     ¦   «          |                      t          |j        t          ¦   «         ¦  «         dS )zw
        L{Response.deliverBody} raises L{RuntimeError} if called after
        L{Response._bodyDataFinished}.
        N)rh   r   rÉ  r   rñ   r   r€   râ  s     rA   Ú%test_startProducingAfterFinishedFailsz3ResponseTests.test_startProducingAfterFinishedFails:  sf   € õ
 )­Ñ):Ô):Ñ;Ô;ˆØ×Ò�X™ZœZÑ(Ô(Ð(Ø×"Ò"Ñ$Ô$Ð$Ø×Ò�,¨Ô(<½h¹j¼jÑIÔIÐIÐIÐIr@   c                 ó¦   — t          t          ¦   «         ¦  «        }|                     ¦   «          |                      t          |j        d¦  «         dS )z 
        L{Response._bodyDataReceived} raises L{RuntimeError} if called after
        L{Response._bodyDataFinished} but before L{Response.deliverBody}.
        rÖ   N)rh   r   rñ   r   r€   rð   râ  s     rA   Ú'test_bodyDataReceivedAfterFinishedFailsz5ResponseTests.test_bodyDataReceivedAfterFinishedFailsD  sJ   € õ
 )­Ñ):Ô):Ñ;Ô;ˆØ×"Ò"Ñ$Ô$Ð$Ø×Ò�,¨Ô(BÀFÑKÔKÐKÐKÐKr@   c                 óè   — t          t          ¦   «         ¦  «        }|                     ¦   «          |                     t	          ¦   «         ¦  «         |                      t          |j        d¦  «         dS )zŸ
        L{Response._bodyDataReceived} raises L{RuntimeError} if called after
        L{Response._bodyDataFinished} and after L{Response.deliverBody}.
        rÖ   N)rh   r   rñ   rÉ  r   r   r€   rð   râ  s     rA   Ú'test_bodyDataReceivedAfterDeliveryFailsz5ResponseTests.test_bodyDataReceivedAfterDeliveryFailsM  sb   € õ
 )­Ñ):Ô):Ñ;Ô;ˆØ×"Ò"Ñ$Ô$Ð$Ø×Ò�X™ZœZÑ(Ô(Ð(Ø×Ò�,¨Ô(BÀFÑKÔKÐKÐKÐKr@   c                 ó¤   — t          t          ¦   «         ¦  «        }|                     ¦   «          |                      t          |j        ¦  «         dS )zh
        L{Response._bodyDataFinished} raises L{RuntimeError} if called more
        than once.
        N)rh   r   rñ   r   r€   râ  s     rA   Ú'test_bodyDataFinishedAfterFinishedFailsz5ResponseTests.test_bodyDataFinishedAfterFinishedFailsW  sH   € õ
 )­Ñ):Ô):Ñ;Ô;ˆØ×"Ò"Ñ$Ô$Ð$Ø×Ò�,¨Ô(BÑCÔCÐCÐCÐCr@   c                 óæ   — t          t          ¦   «         ¦  «        }|                     ¦   «          |                     t	          ¦   «         ¦  «         |                      t          |j        ¦  «         dS )z{
        L{Response._bodyDataFinished} raises L{RuntimeError} if called after
        the body has been delivered.
        N)rh   r   rñ   rÉ  r   r   r€   râ  s     rA   Ú'test_bodyDataFinishedAfterDeliveryFailsz5ResponseTests.test_bodyDataFinishedAfterDeliveryFails`  s`   € õ
 )­Ñ):Ô):Ñ;Ô;ˆØ×"Ò"Ñ$Ô$Ð$Ø×Ò�X™ZœZÑ(Ô(Ð(Ø×Ò�,¨Ô(BÑCÔCÐCÐCÐCr@   c                 óp  ‡— g Š G ˆfd„dt           ¦  «        }t          ¦   «         }|                     ¦   «           |¦   «         }t          |¦  «        }|                      |j        d¦  «         |                     |¦  «         |                      ‰dg¦  «         |                      |j        d¦  «         dS )z–
        L{Response.deliverBody} resumes the HTTP connection's transport
        after passing it to the consumer's C{makeConnection} method.
        c                   ó   •— e Zd Zˆ fd„ZdS )ú9ResponseTests.test_transportResumed.<locals>.ListConsumerc                 ó<   •— ‰                      |j        ¦  «         d S rp   )rˆ   rò   )rR   rg   ÚtransportStates     €rA   rŠ   zHResponseTests.test_transportResumed.<locals>.ListConsumer.makeConnectionr  s    ø€ Ø×%Ò% iÔ&=Ñ>Ô>Ð>Ð>Ð>r@   Nré  )r  s   €rA   rõ  r  q  s.   ø€ € € € € ð?ð ?ð ?ð ?ð ?ð ?ð ?r@   rõ  r  rï   N)r   r   rG  rh   rL   rò   rÉ  )rR   rõ  rg   rŽ   rÝ   r  s        @rA   Útest_transportResumedz#ResponseTests.test_transportResumedj  sÙ   ø€ ð
 ˆð	?ð 	?ð 	?ð 	?ð 	?ð 	?ð 	?�8ñ 	?ô 	?ð 	?õ $Ñ%Ô%ˆ	Ø× Ò Ñ"Ô"Ð"Ø�<‘>”>ˆÝ(¨Ñ3Ô3ˆØ×Ò˜Ô0°(Ñ;Ô;Ð;Ø×Ò˜XÑ&Ô&Ð&Ø×Ò˜¨(¨Ñ4Ô4Ð4Ø×Ò˜Ô0°+Ñ>Ô>Ð>Ð>Ð>r@   c                 óv  — t          ¦   «         }t          |¦  «        }|                     d¦  «         |                     d¦  «         |                     ¦   «          t	          ¦   «         }|                     |¦  «         |                      |j        d¦  «         |j         	                    t          ¦  «         dS )zó
        If the entire body is delivered to the L{Response} before the
        response's C{deliverBody} method is called, the protocol passed to
        C{deliverBody} is immediately given the body data and then
        disconnected.
        rÖ   r˜   rÎ  N)r   rh   rð   rñ   r   rÉ  rL   rÐ   rÝ  rK   r/   ©rR   rg   rÝ   rŽ   s       rA   Ú)test_bodyDataFinishedBeforeStartProducingz7ResponseTests.test_bodyDataFinishedBeforeStartProducing~  sª   € õ $Ñ%Ô%ˆ	Ý(¨Ñ3Ô3ˆØ×"Ò" 6Ñ*Ô*Ð*Ø×"Ò" 6Ñ*Ô*Ð*Ø×"Ò"Ñ$Ô$Ð$å'Ñ)Ô)ˆØ×Ò˜XÑ&Ô&Ð&Ø×Ò˜œ¨	Ñ2Ô2Ð2ØÔ×"Ò"¥<Ñ0Ô0Ð0Ð0Ð0r@   c                 óV  — t          ¦   «         }t          |¦  «        }t          ¦   «         }|                     |¦  «         |                      |j        d¦  «         |                     t          t          ¦   «         ¦  «        ¦  «         |j	         
                    t          ¦  «         dS )a	  
        The L{Failure} passed to L{Response._bodyDataFinished} when the response
        is in the I{connected} state is passed to the C{connectionLost} method
        of the L{IProtocol} provider passed to the L{Response}'s
        C{deliverBody} method.
        Ú	CONNECTEDN)r   rh   r   rÉ  rL   r{   rñ   r   r9   rÝ  rK   r  s       rA   Ú#test_finishedWithErrorWhenConnectedz1ResponseTests.test_finishedWithErrorWhenConnected�  s–   € õ $Ñ%Ô%ˆ	Ý(¨Ñ3Ô3ˆå'Ñ)Ô)ˆØ×Ò˜XÑ&Ô&Ð&ð 	×Ò˜œ¨+Ñ6Ô6Ð6Ø×"Ò"¥7Õ+=Ñ+?Ô+?Ñ#@Ô#@ÑAÔAÐAàÔ×"Ò"Õ#5Ñ6Ô6Ð6Ð6Ð6r@   c                 óV  — t          ¦   «         }t          |¦  «        }|                      |j        d¦  «         |                     t          t          ¦   «         ¦  «        ¦  «         t          ¦   «         }|                     |¦  «         |j	         
                    t          ¦  «         dS )a  
        The L{Failure} passed to L{Response._bodyDataFinished} when the response
        is in the I{initial} state is passed to the C{connectionLost} method of
        the L{IProtocol} provider passed to the L{Response}'s C{deliverBody}
        method.
        ÚINITIALN)r   rh   rL   r{   rñ   r   r9   r   rÉ  rÝ  rK   r  s       rA   Ú!test_finishedWithErrorWhenInitialz/ResponseTests.test_finishedWithErrorWhenInitial£  s–   € õ $Ñ%Ô%ˆ	Ý(¨Ñ3Ô3ˆð 	×Ò˜œ¨)Ñ4Ô4Ð4Ø×"Ò"¥7Õ+=Ñ+?Ô+?Ñ#@Ô#@ÑAÔAÐAå'Ñ)Ô)ˆØ×Ò˜XÑ&Ô&Ð&àÔ×"Ò"Õ#5Ñ6Ô6Ð6Ð6Ð6r@   N)r;   r<   r=   r>   rã  rì  r÷  rþ  r  r  r  r
  r  r  r  r  r  r  r  r?   r@   rA   rà  rà  Ì
  s  € € € € € ðð ð;ð ;ð ;ð?ð ?ð ?ð,*ð *ð *ð&;ð ;ð ;ð29ð 9ð 9ð.Jð Jð JðJð Jð JðLð Lð LðLð Lð LðDð Dð DðDð Dð Dð?ð ?ð ?ð(1ð 1ð 1ð$7ð 7ð 7ð&7ð 7ð 7ð 7ð 7r@   rà  N)_r>   Útypingr   Úzope.interfacer   Úzope.interface.verifyr   Útwisted.internet.deferr   r   r   r	   Útwisted.internet.errorr
   r   Útwisted.internet.interfacesr   r   Útwisted.internet.protocolr   Útwisted.internet.testingr   r   r   r   Útwisted.loggerr   Útwisted.protocols.basicr   Útwisted.python.failurer   Útwisted.trial.unittestr   Útwisted.web._newclientr   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   Útwisted.web.clientr)   r*   r+   r,   r-   r.   r/   r0   r1   Útwisted.web.httpr2   Útwisted.web.http_headersr3   Útwisted.web.iwebr4   r5   Útwisted.web.test.requesthelperr6   r7   Ú	Exceptionr9   rC   rf   rY   r\   r^   r`   rh   rj   r„   rÁ   rÅ   rÈ   rs  r  r„  r8  rL  r¨  rÁ  rË  rà  r?   r@   rA   ú<module>r3     sL  ððð ð Ð Ð Ð Ð Ð à &Ð &Ð &Ð &Ð &Ð &Ø .Ð .Ð .Ð .Ð .Ð .à JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JÐ JØ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AØ @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø .Ð .Ð .Ð .Ð .Ð .ðð ð ð ð ð ð ð ð ð ð ð ð .Ð -Ð -Ð -Ð -Ð -Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø *Ð *Ð *Ð *Ð *Ð *Ø +Ð +Ð +Ð +Ð +Ð +ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð(
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 'Ð &Ð &Ð &Ð &Ð &Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5ðð ð ð ð ð ð ð ðð ð ð ð ˜ñ ô ð ðð ð ð ð  	ñ ô ð ð �˜' NÐ#3Ð4Ñ5Ô5€ð%ð %ð %ðPTð Tð Tðð ð ðð ð ðLð Lð Lð6ð 6ð 6ð 6ð 6 (ñ 6ô 6ð 6ðBSMð SMð SMð SMð SMñ SMô SMð SMðlð ð ð ð Ð+;¸Xñ ô ð ðð ð ð ð Ð.>Àñ ô ð ðh
.ð h
.ð h
.ð h
.ð h
.˜Hñ h
.ô h
.ð h
.ðVð ð ð ð ñ ô ð ð0ð ð ð ð ñ ô ð ðfEð fEð fEð fEð fE ñ fEô fEð fEðR €ˆ]ÑÔð ð  ð  ð  ð  ñ  ô  ñ Ôð ðFq;ð q;ð q;ð q;ð q;�8ñ q;ô q;ð q;ðhbð bð bð bð b 8ñ bô bð bðJ):ð ):ð ):ð ):ð ):˜xñ ):ô ):ð ):ðX{-ð {-ð {-ð {-ð {- (ñ {-ô {-ð {-ð|h7ð h7ð h7ð h7ð h7�Hñ h7ô h7ð h7ð h7ð h7r@   