ó
    ×›‘hˆ· ã                   ó  • S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	J
r
Jr  SSKJrJr  SSKJrJr  SSKJr  SS	KJrJrJrJr  SS
KJr  SSKJr  SSKJr  SSKJ r   SSK!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3  SSK4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=  SSK>J?r?  SSK@JArA  SSKBJCrCJDrD  SSKEJFrFJGrG   " S S\H5      rI " S S\H5      rJ\A" SS/05      rKS rLS rMS rNS rOS rP " S S \ 5      rQ " S! S"5      rR " S# S$\R\ 5      rS " S% S&\R\ 5      rT " S' S(\ 5      rU " S) S*5      rV " S+ S,5      rW " S- S.\ 5      rX\" \C5       " S/ S05      5       rY " S1 S2\ 5      rZ " S3 S4\ 5      r[ " S5 S6\ 5      r\ " S7 S8\ 5      r] " S9 S:\ 5      r^g;)<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                   ó   • \ rS rSrSrSrg)ÚArbitraryExceptionéC   zY
A unique, arbitrary exception type which L{twisted.web._newclient} knows
nothing about.
© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r;   ó    ÚcC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/web/test/test_newclient.pyr9   r9   C   s   † ôrC   r9   c                   ó   • \ rS rSrSrSrg)ÚAnotherArbitraryExceptionéJ   zA
Similar to L{ArbitraryException} but with a different identity.
r;   Nr<   r;   rC   rD   rF   rF   J   s   † ôrC   rF   ó   hostó   example.comc                 ó\   ^ ^• UU 4S jnT R                  X5      nUR                  U5        U$ )aU  
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           	      óè   >• [        U R                  T5       H  u  pUR                  U5        M     TR                  [	        U R                  5      [	        T5      SU R                   ST S35        U $ )Nzlen(z	) != len(Ú))ÚzipÚreasonsÚtrapÚassertEqualÚlen)ÚerrÚreasonÚtypeÚreasonTypesÚselfs      €€rD   ÚcbFailedÚ-assertWrapperExceptionTypes.<locals>.cbFailedn   se   ø€ Ü §¡¨[Ö9‰LˆFØ�K‰K˜Öñ :à×ÑÜ�—‘ÓÜ�ÓØ�3—;‘;�-˜y¨¨°QÐ7ô	
ð
 ˆ
rC   )ÚassertFailureÚaddCallback)rV   ÚdeferredÚmainTyperU   rW   Úds   `  `  rD   ÚassertWrapperExceptionTypesr^   U   s+   ù€ ö2ð 	×Ñ˜8Ó.€AØ‡M�M�(ÔØ€HrC   c                 ó$   • [        X[        U5      $ )zc
A simple helper to invoke L{assertWrapperExceptionTypes} with a C{mainType}
of L{ResponseFailed}.
)r^   r0   ©rV   r[   rU   s      rD   ÚassertResponseFailedra   }   s   € ô
 ' t´~À{ÓSÐSrC   c                 ó$   • [        X[        U5      $ )zl
A simple helper to invoke L{assertWrapperExceptionTypes} with a C{mainType}
of L{RequestGenerationFailed}.
)r^   r,   r`   s      rD   ÚassertRequestGenerationFailedrc   …   s   € ô
 'ØÔ/°óð rC   c                 ó$   • [        X[        U5      $ )zn
A simple helper to invoke L{assertWrapperExceptionTypes} with a C{mainType}
of L{RequestTransmissionFailed}.
)r^   r-   r`   s      rD   ÚassertRequestTransmissionFailedre   �   s   € ô
 'ØÔ1°;óð rC   c                 ó(   • [        SSS[        U 5      $ )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é   rh   éÈ   ó   OK)r.   Ú_boringHeaders©Ú	transports    rD   ÚjustTransportResponsern   ™   s   € ô �O S¨%´ÀÓKÐKrC   c                   ó   • \ rS rSrSrS rSrg)ÚMakeStatefulDispatcherTestsé£   z&
Tests for L{makeStatefulDispatcher}.
c                 ó  •  " S S5      nU" 5       nU R                  UR                  5       S5        SUl        U R                  UR                  5       S5        SUl        U R                  [        UR                  5        g)zs
A method defined with L{makeStatefulDispatcher} invokes a second
method based on the current state of the object.
c                   ó<   • \ rS rSrSrS r\" S\5      rS rS rSr	g)	ÚCMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Fooé®   ÚAc                 ó   • g ©Nr;   ©rV   s    rD   ÚbarÚGMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Foo.bar±   s   € ØrC   Úquuxc                 ó   • g)NÚar;   ry   s    rD   Ú_quux_AÚKMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Foo._quux_A¶   ó   € ØrC   c                 ó   • g)NÚbr;   ry   s    rD   Ú_quux_BÚKMakeStatefulDispatcherTests.test_functionCalledByState.<locals>.Foo._quux_B¹   r�   rC   r;   N)
r=   r>   r?   r@   Ú_staterz   r(   r   r„   rB   r;   rC   rD   ÚFoort   ®   s$   † ØˆFòñ )¨°Ó5ˆCòõrC   r‡   r~   ÚBrƒ   ÚCN)rP   rz   r†   ÚassertRaisesÚRuntimeError)rV   r‡   Ústatefuls      rD   Útest_functionCalledByStateÚ6MakeStatefulDispatcherTests.test_functionCalledByState¨   sc   € ÷	ñ 	ñ “5ˆØ×Ñ˜Ÿ™›¨Ô-ØˆŒØ×Ñ˜Ÿ™›¨Ô-ØˆŒØ×Ñœ,¨¯©Õ5rC   r;   N)r=   r>   r?   r@   rA   r�   rB   r;   rC   rD   rp   rp   £   s   † ñõ6rC   rp   c                   ój   • \ rS rSr% SrSr\\   \S'   S r	S r
S rS rS	 rS
 rS rS rS rS rSrg)Ú_HTTPParserTestséÄ   zh
Base test class for L{HTTPParser} which is responsible for the bulk of
the task of parsing HTTP bytes.
NÚsepc                 óR  • / n[        5       nUR                  Ul        UR                  [	        5       5        U R                  UR                  [        5        UR                  SU R                  -   5        U R                  US/5        U R                  UR                  [        5        g)zR
L{HTTPParser} calls its C{statusReceived} method when it receives a
status line.
ó   HTTP/1.1 200 OKN)r"   ÚappendÚstatusReceivedÚmakeConnectionr   rP   Ústater   ÚdataReceivedr’   r   )rV   ÚstatusÚprotocols      rD   Útest_statusCallbackÚ$_HTTPParserTests.test_statusCallbackÌ   s�   € ð
 ˆÜ“<ˆØ"(§-¡-ˆÔØ×Ñ¤Ó 1Ô2Ø×Ñ˜Ÿ™¬Ô0Ø×ÑÐ0°4·8±8Ñ;Ô<Ø×Ñ˜Ð"4Ð!5Ô6Ø×Ñ˜Ÿ™¬Õ0rC   c                 ó°   • 0 n[        5       nUR                  Ul        UR                  [	        5       5        UR                  SU R                  -   5        X4$ )Nr”   )r"   Ú__setitem__ÚheaderReceivedr—   r   r™   r’   ©rV   Úheaderr›   s      rD   Ú_headerTestSetupÚ!_HTTPParserTests._headerTestSetupÚ   sN   € ØˆÜ“<ˆØ"(×"4Ñ"4ˆÔØ×Ñ¤Ó 1Ô2Ø×ÑÐ0°4·8±8Ñ;Ô<ØÐÐrC   c                 ó  • U R                  5       u  pUR                  SU R                  -   5        UR                  U R                  5        U R                  USS05        U R                  UR                  [
        5        g)zM
L{HTTPParser} calls its C{headerReceived} method when it receives a
header.
s	   X-Foo:baró   X-Fooó   barN©r£   r™   r’   rP   r˜   r   r¡   s      rD   Útest_headerCallbackÚ$_HTTPParserTests.test_headerCallbackâ   si   € ð
  ×0Ñ0Ó2ÑˆØ×Ñ˜l¨T¯X©XÑ5Ô6ð 	×Ñ˜dŸh™hÔ'Ø×Ñ˜ (¨FÐ!3Ô4Ø×Ñ˜Ÿ™¬Õ.rC   c                 óz  • U R                  5       u  pUR                  SU R                  -   5        UR                  SU R                  -   5        UR                  SU R                  -   5        UR                  U R                  5        U R                  USS05        U R                  UR                  [
        5        g)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      rD   Útest_continuedHeaderCallbackÚ-_HTTPParserTests.test_continuedHeaderCallbackï   s–   € ð
  ×0Ñ0Ó2ÑˆØ×Ñ˜m¨d¯h©hÑ6Ô7Ø×Ñ˜g¨¯©Ñ0Ô1Ø×Ñ˜i¨$¯(©(Ñ2Ô3Ø×Ñ˜dŸh™hÔ'Ø×Ñ˜ (Ð,<Ð!=Ô>Ø×Ñ˜Ÿ™¬Õ.rC   c                 ó  • U R                  5       u  pU R                  R                  / SQ5      nUR                  SU-   5        UR                  SU-   5        UR                  U R                  5        U R	                  USSS.5        g)zt
Leading and trailing linear whitespace is stripped from the header
value passed to the C{headerReceived} callback.
)s    	 s    bar 	s    	rC   s   X-Bar:s   X-Foo:r§   )r¦   s   X-BarN)r£   r’   Újoinr™   rP   )rV   r¢   r›   Úvalues       rD   Útest_fieldContentWhitespaceÚ,_HTTPParserTests.test_fieldContentWhitespaceü   su   € ð
  ×0Ñ0Ó2ÑˆØ—‘—‘Ò@ÓAˆØ×Ñ˜i¨%Ñ/Ô0Ø×Ñ˜i¨%Ñ/Ô0Ø×Ñ˜dŸh™hÔ'Ø×Ñ˜¨F¸fÑ!EÕFrC   c                 óò   ^^• / mU R                  5       u  nmUU4S jnUTl        TR                  U R                  5        U R	                  T[
        /5        U R	                  TR                  [        5        g)zO
After the last header is received, L{HTTPParser} calls
C{allHeadersReceived}.
c                  óR   >• T R                  TR                  5        [        Tl        g rx   )r•   r˜   r   )Úcalledr›   s   €€rD   ÚallHeadersReceivedÚD_HTTPParserTests.test_allHeadersCallback.<locals>.allHeadersReceived  s   ø€ Ø�M‰M˜(Ÿ.™.Ô)Ü#ˆH�NrC   N)r£   r·   r™   r’   rP   r   r˜   r   )rV   r¢   r·   r¶   r›   s      @@rD   Útest_allHeadersCallbackÚ(_HTTPParserTests.test_allHeadersCallback  sd   ù€ ð
 ˆØ×0Ñ0Ó2Ñˆ�ö	$ð '9ˆÔ#Ø×Ñ˜dŸh™hÔ'Ø×Ñ˜¤& Ô*Ø×Ñ˜Ÿ™¬Õ0rC   c                 óÂ   • U R                  5       u  pUR                  U R                  5        U R                  U0 5        U R                  UR                  [
        5        g)zX
If there are no headers in the message, L{HTTPParser} does not call
C{headerReceived}.
Nr¨   r¡   s      rD   Útest_noHeaderCallbackÚ&_HTTPParserTests.test_noHeaderCallback  sK   € ð
  ×0Ñ0Ó2ÑˆØ×Ñ˜dŸh™hÔ'Ø×Ñ˜ Ô$Ø×Ñ˜Ÿ™¬Õ.rC   c                 ó¨  • [        5       nUR                  [        5       5        UR                  SU R                  -   5        UR                  SU R                  -   5        UR                  SU R                  -   5        UR                  U R                  5        SSS/4/nU R                  U[        UR                  R                  5       5      5        g)zK
All headers received by L{HTTPParser} are added to
L{HTTPParser.headers}.
r”   r¬   ó
   X-Foo: bazr¦   r§   ó   bazN)	r"   r—   r   r™   r’   rP   ÚlistÚheadersÚgetAllRawHeaders)rV   r›   Úexpecteds      rD   Útest_headersSavedOnResponseÚ,_HTTPParserTests.test_headersSavedOnResponse#  sª   € ô
 “<ˆØ×Ñ¤Ó 1Ô2Ø×ÑÐ0°4·8±8Ñ;Ô<Ø×Ñ˜m¨d¯h©hÑ6Ô7Ø×Ñ˜m¨d¯h©hÑ6Ô7Ø×Ñ˜dŸh™hÔ'Ø ¨Ð/Ð0Ð1ˆØ×Ñ˜¤4¨×(8Ñ(8×(IÑ(IÓ(KÓ#LÕMrC   c                 óÀ   • [        5       n/ SQnU H)  nU R                  UR                  U5      SU< S35        M+     U R                  UR                  S5      S5        g)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)rV   r›   ÚconnHeaderNamesr¢   s       rD   Útest_connectionControlHeadersÚ._HTTPParserTests.test_connectionControlHeaders1  sc   € ô “<ˆò	
ˆó &ˆFØ�O‰OØ×2Ñ2°6Ô:ã"ð%öñ &ð 	×ÑØ×.Ñ.¨wÓ7ð4õ	
rC   c                 óÎ   • [        5       nUR                  [        5       5        UR                  [	        5       5        U R                  [        UR                  [	        5       5        g)zQ
L{HTTPParser.switchToBodyMode} raises L{RuntimeError} if called more
than once.
N)r"   r—   r   ÚswitchToBodyModeÚobjectrŠ   r‹   ©rV   r›   s     rD   Útest_switchToBodyModeÚ&_HTTPParserTests.test_switchToBodyModeO  sF   € ô
 “<ˆØ×Ñ¤Ó 1Ô2Ø×!Ñ!¤&£(Ô+Ø×Ñœ,¨×(AÑ(AÄ6Ã8ÕLrC   r;   )r=   r>   r?   r@   rA   r’   r   ÚbytesÚ__annotations__rœ   r£   r©   r­   r²   r¹   r¼   rÅ   rÎ   rÔ   rB   r;   rC   rD   r�   r�   Ä   sL   ‡ ñð
  €Cˆ�%‰Óò1ò ò/ò/ò
Gò1ò"/òNò
õ<MrC   r�   c                   ó   • \ rS rSrSrSrSrg)Ú$HTTPParserRFCComplaintDelimeterTestsiZ  z4
L{_HTTPParserTests} using standard CR LF newlines.
ó   
r;   N©r=   r>   r?   r@   rA   r’   rB   r;   rC   rD   rÙ   rÙ   Z  s   † ñð ƒCrC   rÙ   c                   ó   • \ rS rSrSrSrSrg)Ú'HTTPParserNonRFCComplaintDelimeterTestsib  z-
L{_HTTPParserTests} using bare LF newlines.
ó   
r;   NrÛ   r;   rC   rD   rÝ   rÝ   b  s   † ñð ƒCrC   rÝ   c                   óä   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S%r'g&)'ÚHTTPClientParserTestsij  zX
Tests for L{HTTPClientParser} which is responsible for parsing HTTP
response messages.
c                 ó^   • [        SS5      nU R                  UR                  S5      S5        g)zR
L{HTTPClientParser.parseVersion} parses a status line into its three
components.
Ns	   CANDY/7.2)s   CANDYé   é   )r!   rP   ÚparseVersionrÓ   s     rD   Útest_parseVersionÚ'HTTPClientParserTests.test_parseVersionp  s,   € ô
 $ D¨$Ó/ˆØ×Ñ˜×.Ñ.¨|Ó<Ð>NÕOrC   c                 ó¶   ^ ^^• [        SS5      n[        mUR                  mUUU 4S jnU" S5        U" S5        U" S5        U" S5        U" S5        U" S5        g)	zZ
L{HTTPClientParser.parseVersion} raises L{ValueError} when passed an
unparsable version.
Nc                 ód   >• TR                  TTU 5      nTR                  UR                  U 5        g rx   )rŠ   rP   Údata)ÚsÚexcÚeÚfrV   s     €€€rD   ÚcheckParsingÚ@HTTPClientParserTests.test_parseBadVersion.<locals>.checkParsing�  s+   ø€ Ø×#Ñ# A q¨!Ó,ˆCØ×Ñ˜SŸX™X qÕ)rC   ó   foos   foo/bar/bazs   foo/s   foo/..s   foo/a.bs	   foo/-1.-1)r!   r   rä   )rV   r›   rî   rì   rí   s   `  @@rD   Útest_parseBadVersionÚ*HTTPClientParserTests.test_parseBadVersionx  sX   ú€ ô
 $ D¨$Ó/ˆÜˆØ×!Ñ!ˆ÷	*ñ 	�VÔÙ�^Ô$á�WÔÙ�YÔá�ZÔ Ù�\Õ"rC   c                 óx  • [        SS[        S5      n[        US5      nUR                  [	        5       5        UR                  S5        U R                  UR                  R                  S5        U R                  UR                  R                  S5        U R                  UR                  R                  S5        g)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
rg   ri   rj   ©r+   rk   r!   r—   r   r™   rP   ÚresponseÚversionÚcodeÚphrase©rV   Úrequestr›   s      rD   Útest_responseStatusParsingÚ0HTTPClientParserTests.test_responseStatusParsingŽ  s”   € ô
 ˜& $¬¸Ó=ˆÜ# G¨TÓ2ˆØ×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×Ñ˜×*Ñ*×2Ñ2°OÔDØ×Ñ˜×*Ñ*×/Ñ/°Ô5Ø×Ñ˜×*Ñ*×1Ñ1°5Õ9rC   c                 óx  • [        SS[        S5      n[        US5      nUR                  [	        5       5        UR                  S5        U R                  UR                  R                  S5        U R                  UR                  R                  S5        U R                  UR                  R                  S5        g)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
rg   ri   rC   r÷   rü   s      rD   Ú test_responseStatusWithoutPhraseÚ6HTTPClientParserTests.test_responseStatusWithoutPhrase›  s”   € ô ˜& $¬¸Ó=ˆÜ# G¨TÓ2ˆØ×Ñ¤Ó 1Ô2Ø×ÑÐ1Ô2Ø×Ñ˜×*Ñ*×2Ñ2°OÔDØ×Ñ˜×*Ñ*×/Ñ/°Ô5Ø×Ñ˜×*Ñ*×1Ñ1°3Õ7rC   c                 óN   ^ ^• [        SS5      mUU 4S jnU" S5        U" S5        g)zt
L{HTTPClientParser.statusReceived} raises L{ParseError} if it is called
with a status line which cannot be parsed.
Nc                 ó€   >• TR                  [        TR                  U 5      nTR                  UR                  U 5        g rx   )rŠ   r$   r–   rP   ré   )rê   rë   r›   rV   s     €€rD   rî   ÚBHTTPClientParserTests.test_badResponseStatus.<locals>.checkParsing°  s1   ø€ Ø×#Ñ#¤J°×0GÑ0GÈÓKˆCØ×Ñ˜SŸX™X qÕ)rC   rð   s   HTTP/1.1 bar OK)r!   )rV   rî   r›   s   ` @rD   Útest_badResponseStatusÚ,HTTPClientParserTests.test_badResponseStatus©  s+   ù€ ô
 $ D¨$Ó/ˆö	*ñ 	�VÔñ 	Ð'Õ(rC   c                 ór  ^	• 0 n/ n/ n/ m	[        XR                  5      nUR                  Ul        [	        5       nUR                  U5        UR                  U5        UR                  UR                  l        U	4S jUR                  l	        UR                  U5        U R                  UR                  S5        U R                  UR                  [        5        U R                  U/ 5        U R                  US/5        U R                  T	S/5        U R                  UR                  R                  S5        U$ )aà  
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                  ó&   >• T R                  S5      $ ©NT©r•   )ÚbodyDataFinisheds   €rD   Ú<lambda>Ú3HTTPClientParserTests._noBodyTest.<locals>.<lambda>Ö  s   ø€ Ð6F×6MÑ6MÈdÔ6SrC   Ú	producingrC   Tr   )r!   r•   rŸ   r    r   r—   r™   rø   Ú_bodyDataReceivedÚ_bodyDataFinishedrP   ÚproducerStater˜   r   Úlength)
rV   rý   rš   rø   r¢   ÚfinishedÚbodyr›   rm   r  s
            @rD   Ú_noBodyTestÚ!HTTPClientParserTests._noBodyTest¼  s
  ø€ ð ˆØˆØˆØÐÜ# G¯_©_Ó=ˆØ"(×"4Ñ"4ˆÔÜ#Ó%ˆ	Ø×Ñ 	Ô*ð 	×Ñ˜fÔ%Ø.2¯k©kˆ×ÑÔ+Ü.Sˆ×ÑÔ+Ø×Ñ˜hÔ'Ø×Ñ˜×0Ñ0°+Ô>Ø×Ñ˜Ÿ™¬Ô.Ø×Ñ˜˜rÔ"Ø×Ñ˜ C 5Ô)Ø×ÑÐ)¨D¨6Ô2Ø×Ñ˜×*Ñ*×1Ñ1°1Ô5ØˆrC   c                 ó|   • [        SS[        S5      nSnSnU R                  XU5      nU R                  USS05        g)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+   rk   r  rP   )rV   rý   rš   rø   r¢   s        rD   Útest_headResponseÚ'HTTPClientParserTests.test_headResponseà  sF   € ô ˜' 4¬¸Ó>ˆØ'ˆØ4ˆØ×!Ñ! '°8Ó<ˆØ×Ñ˜Ð"3°UÐ!;Õ<rC   c                 óT   • [        SS[        S5      nSnSnU R                  XU5        g)zh
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+   rk   r  ©rV   rý   rš   rø   s       rD   Útest_noContentResponseÚ,HTTPClientParserTests.test_noContentResponseì  s.   € ô
 ˜& $¬¸Ó=ˆØ/ˆØˆØ×Ñ˜¨(Õ3rC   c                 óT   • [        SS[        S5      nSnSnU R                  XU5        g)zj
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       rD   Útest_notModifiedResponseÚ.HTTPClientParserTests.test_notModifiedResponseö  s.   € ô
 ˜& $¬¸Ó=ˆØ1ˆØˆØ×Ñ˜¨(Õ3rC   c                 óØ  • [        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  S5        UR                  S5        UR                  S5        U R                  UR                  [        0 5      5        U R                  UR                  R                  [        SS	/05      5        U R                  UR                  R                  [        5        g)
zY
The response headers are added to the response object's C{headers}
L{Headers} instance.
rô   rõ   Nc                 ó   • g rx   r;   ©Úrests    rD   r  Ú<HTTPClientParserTests.test_responseHeaders.<locals>.<lambda>  ó   € ÀdrC   rö   s   X-Foo: bar
rÚ   ó   x-foor§   ©r!   r+   rk   r—   r   r™   rP   ÚconnHeadersr3   rø   rÂ   ÚassertIdenticalr  r   rÓ   s     rD   Útest_responseHeadersÚ*HTTPClientParserTests.test_responseHeaders   s¼   € ô
 $Ü�F˜D¤.°$Ó7Ñ9Jó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×ÑÐ/Ô0Ø×Ñ˜gÔ&Ø×Ñ˜×-Ñ-¬w°r«{Ô;Ø×Ñ˜×*Ñ*×2Ñ2´G¸XÈÀxÐ<PÓ4QÔRØ×Ñ˜X×.Ñ.×5Ñ5´~ÕFrC   c                 óú  • [        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        U R                  UR                  [        0 5      5        U R                  UR                  R                  [        S	S
/05      5        U R                  UR                  R                  [        5        g)zo
The multi-line response headers are folded and added to the response
object's C{headers} L{Headers} instance.
rô   rõ   Nc                 ó   • g rx   r;   r&  s    rD   r  ÚEHTTPClientParserTests.test_responseHeadersMultiline.<locals>.<lambda>  r)  rC   rö   s   X-Multiline: a
s       b
rÚ   s   x-multilines   a    br+  rÓ   s     rD   Útest_responseHeadersMultilineÚ3HTTPClientParserTests.test_responseHeadersMultiline  sÏ   € ô
 $Ü�F˜D¤.°$Ó7Ñ9Jó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×ÑÐ3Ô4Ø×Ñ˜lÔ+Ø×Ñ˜gÔ&Ø×Ñ˜×-Ñ-¬w°r«{Ô;Ø×ÑØ×Ñ×%Ñ%¤w°ÀÀÐ/LÓ'Mô	
ð 	×Ñ˜X×.Ñ.×5Ñ5´~ÕFrC   c                 óö  • [        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  S5        UR                  S5        UR                  S5        UR                  S5        U R                  UR                  R                  [        0 5      5        U R                  UR                  [        S	/S
/S.5      5        U R                  UR                  R                  S5        g)z^
The connection control headers are added to the parser's C{connHeaders}
L{Headers} instance.
rô   rõ   Nc                 ó   • g rx   r;   r&  s    rD   r  Ú>HTTPClientParserTests.test_connectionHeaders.<locals>.<lambda>)  r)  rC   rö   ó   Content-Length: 123
s   Connection: close
rÚ   ó   123s   close)rÈ   rÉ   é{   ©r!   r+   rk   r—   r   r™   rP   rø   rÂ   r3   r,  r  rÓ   s     rD   Útest_connectionHeadersÚ,HTTPClientParserTests.test_connectionHeaders#  sÓ   € ô
 $Ü�F˜D¤.°$Ó7Ñ9Jó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×ÑÐ8Ô9Ø×ÑÐ6Ô7Ø×Ñ˜gÔ&Ø×Ñ˜×*Ñ*×2Ñ2´G¸B³KÔ@Ø×ÑØ× Ñ Ü¨¨À(ÀÑLÓMô	
ð 	×Ñ˜×*Ñ*×1Ñ1°3Õ7rC   c                 óÐ  • [        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  S5        UR                  S5        UR                  S5        U R                  UR                  R                  [        SS	/05      5        U R                  UR                  [        0 5      5        U R                  UR                  R                  S
5        g)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                 ó   • g rx   r;   r&  s    rD   r  ÚRHTTPClientParserTests.test_headResponseContentLengthEntityHeader.<locals>.<lambda>=  s   € ÀtrC   rö   r8  rÚ   rÈ   r9  r   r;  rÓ   s     rD   Ú*test_headResponseContentLengthEntityHeaderÚ@HTTPClientParserTests.test_headResponseContentLengthEntityHeader7  sÂ   € ô
 $Ü�G˜T¤>°4Ó8Ñ:Kó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×ÑÐ8Ô9Ø×Ñ˜gÔ&Ø×ÑØ×Ñ×%Ñ%¤wÐ0AÀFÀ8Ð/LÓ'Mô	
ð 	×Ñ˜×-Ñ-¬w°r«{Ô;Ø×Ñ˜×*Ñ*×1Ñ1°1Õ5rC   c                 óÚ  • / n[        [        SS[        S5      UR                  5      n[	        5       nUR                  U5        UR                  S5        / nUR                  UR                  l        UR                  S5        UR                  S5        U R                  UR                  S5        U R                  UR                  [        5        UR                  S5        U R                  US/5        U R                  UR                  [        5        UR                  S	5        U R                  USS	/5        U R                  UR                  [        5        U R                  US
/5        g)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   yyyyrC   )r!   r+   rk   r•   r   r—   r™   rø   r  rP   r  r˜   r   r   ©rV   r  r›   rm   r  s        rD   Útest_contentLengthÚ(HTTPClientParserTests.test_contentLengthI  s+  € ð ˆÜ#Ü�F˜D¤.°$Ó7¸¿¹ó
ˆô $Ó%ˆ	Ø×Ñ 	Ô*Ø×ÑÐ4Ô5ØˆØ.2¯k©kˆ×ÑÔ+Ø×ÑÐ7Ô8Ø×Ñ˜gÔ&ð 	×Ñ˜×0Ñ0°(Ô;à×Ñ˜Ÿ™¬Ô.Ø×Ñ˜hÔ'Ø×Ñ˜ ˜zÔ*Ø×Ñ˜Ÿ™¬Ô.Ø×Ñ˜hÔ'Ø×Ñ˜ ¨(Ð3Ô4Ø×Ñ˜Ÿ™¬Ô.Ø×Ñ˜ C 5Õ)rC   c                 óü  • / n[        [        SS[        S5      UR                  5      nUR	                  [        5       5        UR                  S5        / nUR                  UR                  l        UR                  S5        UR                  S5        U R                  UR                  [        5        U R                  U/ 5        U R                  US/5        U R                  UR                  R                  S5        g)	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Ú   rC   r   )r!   r+   rk   r•   r—   r   r™   rø   r  rP   r˜   r   r  ©rV   r  r›   r  s       rD   Útest_zeroContentLengthÚ,HTTPClientParserTests.test_zeroContentLengthh  sÏ   € ð ˆÜ#Ü�F˜D¤.°$Ó7¸¿¹ó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5àˆØ.2¯k©kˆ×ÑÔ+à×ÑÐ6Ô7Ø×Ñ˜gÔ&à×Ñ˜Ÿ™¬Ô.Ø×Ñ˜˜rÔ"Ø×Ñ˜ C 5Ô)Ø×Ñ˜×*Ñ*×1Ñ1°1Õ5rC   c                 ó°   • [        [        SS[        S5      S5      nUR                  [	        5       5        U R                  [        UR                  S5        g)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+   rk   r—   r   rŠ   Ú
ValueErrorr™   rÓ   s     rD   Ú)test_multipleDistinctContentLengthHeadersÚ?HTTPClientParserTests.test_multipleDistinctContentLengthHeaders�  sL   € ô $¤G¨F°D¼.È$Ó$OÐQUÓVˆà×Ñ¤Ó 1Ô2Ø×ÑÜØ×!Ñ!ðõ	
rC   c                 ó  • [        [        SS[        S5      S5      nUR                  [	        5       5        UR                  S5        U R                  UR                  R                  S5        U R                  UR                  [        5        g)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

rh   ©r!   r+   rk   r—   r   r™   rP   rø   r  r˜   r   rÓ   s     rD   Ú&test_multipleEqualContentLengthHeadersÚ<HTTPClientParserTests.test_multipleEqualContentLengthHeaders“  sr   € ô $¤G¨F°D¼.È$Ó$OÐQUÓVˆà×Ñ¤Ó 1Ô2Ø×Ñðô	
ð 	×Ñ˜×*Ñ*×1Ñ1°1Ô5Ø×Ñ˜Ÿ™¬Õ.rC   c                 ó°   • [        [        SS[        S5      S5      nUR                  [	        5       5        U R                  [        UR                  S5        g)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

rN  rÓ   s     rD   Ú3test_multipleDistinctContentLengthHeaderFieldValuesÚIHTTPClientParserTests.test_multipleDistinctContentLengthHeaderFieldValues¥  sJ   € ô $¤G¨F°D¼.È$Ó$OÐQUÓVˆà×Ñ¤Ó 1Ô2Ø×ÑÜØ×!Ñ!ØFõ	
rC   c                 ó  • [        [        SS[        S5      S5      nUR                  [	        5       5        UR                  S5        U R                  UR                  R                  S5        U R                  UR                  [        5        g)zý
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

rh   rS  rÓ   s     rD   Ú0test_multipleEqualContentLengthHeaderFieldValuesÚFHTTPClientParserTests.test_multipleEqualContentLengthHeaderFieldValues´  sp   € ô $¤G¨F°D¼.È$Ó$OÐQUÓVˆà×Ñ¤Ó 1Ô2Ø×ÑØHô	
ð 	×Ñ˜×*Ñ*×1Ñ1°1Ô5Ø×Ñ˜Ÿ™¬Õ.rC   c                 ó°   • [        [        SS[        S5      S5      nUR                  [	        5       5        U R                  [        UR                  S5        g)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

rN  rÓ   s     rD   Útest_contentLengthTooPositiveÚ3HTTPClientParserTests.test_contentLengthTooPositiveÄ  óJ   € ô $¤G¨F°D¼.È$Ó$OÐQUÓVˆà×Ñ¤Ó 1Ô2Ø×ÑÜØ×!Ñ!Ø<õ	
rC   c                 ó°   • [        [        SS[        S5      S5      nUR                  [	        5       5        U R                  [        UR                  S5        g)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

rN  rÓ   s     rD   Útest_contentLengthNegativeÚ0HTTPClientParserTests.test_contentLengthNegativeÓ  r_  rC   c                 óR  • / n[        [        SS[        S5      UR                  5      nUR	                  [        5       5        UR                  S5        UR                  S5        UR                  S5        U R                  UR                  [        5        U R                  US/5        g)za
If extra bytes are received past the end of a response, they are passed
to the finish callback.
rô   rõ   Nrö   rI  ó   
Here is another thing!ó   Here is another thing!©
r!   r+   rk   r•   r—   r   r™   rP   r˜   r   ©rV   r  r›   s      rD   Útest_extraBytesPassedBackÚ/HTTPClientParserTests.test_extraBytesPassedBackâ  s�   € ð
 ˆÜ#Ü�F˜D¤.°$Ó7¸¿¹ó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×ÑÐ6Ô7Ø×ÑÐ;Ô<Ø×Ñ˜Ÿ™¬Ô.Ø×Ñ˜Ð$=Ð#>Õ?rC   c                 óR  • / n[        [        SS[        S5      UR                  5      nUR	                  [        5       5        UR                  S5        UR                  S5        UR                  S5        U R                  UR                  [        5        U R                  US/5        g)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
rd  re  rf  rg  s      rD   Útest_extraBytesPassedBackHEADÚ3HTTPClientParserTests.test_extraBytesPassedBackHEADó  s�   € ð
 ˆÜ#Ü�G˜T¤>°4Ó8¸(¿/¹/ó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5Ø×ÑÐ7Ô8Ø×ÑÐ;Ô<Ø×Ñ˜Ÿ™¬Ô.Ø×Ñ˜Ð$=Ð#>Õ?rC   c                 óx  • / n[        [        SS[        S5      UR                  5      nUR	                  [        5       5        UR                  S5        / nUR                  UR                  l        UR                  S5        UR                  S5        U R                  U/ 5        U R                  UR                  R                  [        5        UR                  S5        U R                  US/5        UR                  S	5        U R                  USS
/5        UR                  S5        U R                  US/5        g)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+   rk   r•   r—   r   r™   rø   r  rP   r-  r  r   rJ  s       rD   Útest_chunkedResponseBodyÚ.HTTPClientParserTests.test_chunkedResponseBody  s  € ð ˆÜ#Ü�F˜D¤.°$Ó7¸¿¹ó
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ4Ô5àˆØ.2¯k©kˆ×ÑÔ+à×ÑÐ?Ô@Ø×Ñ˜gÔ&ð 	×Ñ˜˜rÔ"ð 	×Ñ˜X×.Ñ.×5Ñ5´~ÔFð 	×Ñ˜iÔ(Ø×Ñ˜ ˜vÔ&Ø×Ñ˜iÔ(Ø×Ñ˜  e˜}Ô-ð
 	×ÑÐ/Ô0Ø×Ñ˜ H :Õ.rC   c                 óÎ  • / n[        [        SS[        S5      UR                  5      n[	        5       nUR                  U5        UR                  S5        / nUR                  UR                  l        UR                  S5        UR                  S5        UR                  S5        U R                  USS/5        UR                  [        S5      5        U R                  US	/5        g)
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 connectionrC   )r!   r+   rk   r•   r   r—   r™   rø   r  rP   ÚconnectionLostr
   rE  s        rD   Útest_unknownContentLengthÚ/HTTPClientParserTests.test_unknownContentLength)  sÊ   € ð ˆÜ#Ü�F˜D¤.°$Ó7¸¿¹ó
ˆô $Ó%ˆ	Ø×Ñ 	Ô*Ø×ÑÐ4Ô5àˆØ.2¯k©kˆ×ÑÔ+à×Ñ˜gÔ&Ø×Ñ˜fÔ%Ø×Ñ˜fÔ%Ø×Ñ˜ ¨Ð/Ô0Ø×Ñ¤Ð/LÓ MÔNØ×Ñ˜ C 5Õ)rC   c                 óT  • / n[        [        SS[        S5      UR                  5      n[	        5       nUR                  U5        UR                  S5        / nUR                  UR                  l        UR                  S5        U R                  US/5        U R                  US/5        g)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

ó   abcrC   )
r!   r+   rk   r•   r   r—   r™   rø   r  rP   rE  s        rD   Ú%test_contentLengthAndTransferEncodingÚ;HTTPClientParserTests.test_contentLengthAndTransferEncodingA  sž   € ð ˆÜ#Ü�F˜D¤.°$Ó7¸¿¹ó
ˆô $Ó%ˆ	Ø×Ñ 	Ô*Ø×ÑÐ4Ô5àˆØ.2¯k©kˆ×ÑÔ+à×Ñðô	
ð 	×Ñ˜ ˜xÔ(Ø×Ñ˜ C 5Õ)rC   c                 óî   • [        5       n[        [        SS[        S5      S5      nUR	                  U5        UR
                  nUR                  [        [        5       5      5        [        X[        /5      $ )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+   rk   r—   Ú_responseDeferredrr  r   r9   ra   )rV   rm   r›   ÚresponseDeferreds       rD   Útest_connectionLostBeforeBodyÚ3HTTPClientParserTests.test_connectionLostBeforeBody_  sf   € ô $Ó%ˆ	Ü#¤G¨F°D¼.È$Ó$OÐQUÓVˆØ×Ñ 	Ô*à#×5Ñ5ÐØ×Ñ¤Ô(:Ó(<Ó =Ô>ä# DÔ=OÐ<PÓQÐQrC   c                 ó  • [         R                  " U [        5      n[        5       n[	        [        SS[        S5      S5      nUR                  U5        / nUR                  R                  UR                  5        UR                  S5        US   nS	S jnXTl        UR                  S5        U R                  S[        U5      5        US   nUS   nU R!                  UR"                  [$        5        U R'                  [$        5        g)
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                 ó   • [        5       erx   ©r9   )rR   s    rD   ÚfakeBodyDataFinishedÚPHTTPClientParserTests.test_connectionLostWithError.<locals>.fakeBodyDataFinished  s   € Ü$Ó&Ð&rC   rh   Úlog_failurerx   )r   ÚcreateWithCleanupr   r   r!   r+   rk   r—   rz  rZ   r•   r™   r  rr  ÚassertEqualsrQ   ÚassertIsInstancer±   r9   ÚflushLoggedErrors)rV   ÚlogObserverrm   r›   rø   r‚  Úeventrí   s           rD   Útest_connectionLostWithErrorÚ2HTTPClientParserTests.test_connectionLostWithErrorn  sá   € ô +×<Ò<¸TÔCUÓVˆÜ#Ó%ˆ	Ü#¤G¨F°D¼.È$Ó$OÐQUÓVˆØ×Ñ 	Ô*àˆØ×"Ñ"×.Ñ.¨x¯©Ô?Ø×ÑÐUÔVØ˜A‘;ˆô	'ð &:Ô"à×Ñ Ô%Ø×Ñ˜!œS Ó-Ô.Ø˜A‘ˆØ�-Ñ ˆØ×Ñ˜aŸg™gÔ'9Ô:Ø×ÑÔ1Õ2rC   c                 óä   • [        [        SS[        S5      S 5      nUR                  nUR	                  [        5       5        UR                  [        5       5        U R                  U[        5      $ )zq
If no response at all was received and the connection is lost, the
resulting error is L{ResponseNeverReceived}.
r  rõ   Nc                 ó   • g rx   r;   ©Úigns    rD   r  Ú<HTTPClientParserTests.test_noResponseAtAll.<locals>.<lambda>‘  r)  rC   )
r!   r+   rk   rz  r—   r   rr  r   rY   r1   ©rV   r›   r]   s      rD   Útest_noResponseAtAllÚ*HTTPClientParserTests.test_noResponseAtAll‹  sb   € ô
 $Ü�G˜T¤>°4Ó8Ñ:Jó
ˆð ×&Ñ&ˆà×Ñ¤Ó 1Ô2Ø×Ñ¤Ó 0Ô1Ø×!Ñ! !Ô%:Ó;Ð;rC   c                 óB  • [        [        SS[        S5      S 5      nUR                  nUR	                  [        5       5        UR                  S5        UR                  [        5       5        U R                  U[        5      R                  U R                  [        5      $ )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                 ó   • g rx   r;   r�  s    rD   r  ÚBHTTPClientParserTests.test_someResponseButNotAll.<locals>.<lambda>   r)  rC   ó   2)r!   r+   rk   rz  r—   r   r™   rr  r   rY   r0   rZ   r‡  r’  s      rD   Útest_someResponseButNotAllÚ0HTTPClientParserTests.test_someResponseButNotAll™  s‡   € ô $Ü�G˜T¤>°4Ó8Ñ:Jó
ˆð ×&Ñ&ˆà×Ñ¤Ó 1Ô2Ø×Ñ˜dÔ#Ø×Ñ¤Ó 0Ô1Ø×!Ñ! !¤^Ó4×@Ñ@Ø×!Ñ!¤>ó
ð 	
rC   c                 ó8  • Sn[        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  U5        U R                  [        USS5      SL 5        U R                  UR                  [        5        U R                  [        [        UR                  R                  5       5      5      S5        U R                  [        [        UR                  R                  5       5      5      S5        U R                  UR                   5        g)za
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                 ó   • g rx   r;   r�  s    rD   r  ÚCHTTPClientParserTests.test_1XXResponseIsSwallowed.<locals>.<lambda>¹  ó   € ÀTrC   rø   r   )r!   r+   rk   r—   r   r™   rÊ   ÚgetattrrP   r˜   r   rQ   rÁ   rÂ   rÃ   r,  Ú_everReceivedData)rV   Úsample103Responser›   s      rD   Útest_1XXResponseIsSwallowedÚ1HTTPClientParserTests.test_1XXResponseIsSwallowed«  sß   € ðð 	ô $Ü�F˜D¤.°$Ó7Ñ9Ió
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ/Ô0ð 	�‰œ ¨*°dÓ;¸tÐCÔDØ×Ñ˜Ÿ™¬Ô0Ø×ÑœœT (×"2Ñ"2×"CÑ"CÓ"EÓFÓGÈÔKØ×ÑœœT (×"6Ñ"6×"GÑ"GÓ"IÓJÓKÈQÔOØ�‰˜×2Ñ2Õ3rC   c                 óä  • SnSn[        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  X-   5        U R                  UR                  R                  S5        U R                  UR                  R                  [        0 5      5        U R                  UR                  [        SS	/05      5        U R                  UR                  R                  S
5        g)zy
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                 ó   • g rx   r;   r�  s    rD   r  ÚUHTTPClientParserTests.test_1XXFollowedByFinalResponseOnlyEmitsFinal.<locals>.<lambda>Ô  rŸ  rC   ri   rÈ   r9  r:  ©r!   r+   rk   r—   r   r™   rP   rø   rú   rÂ   r3   r,  r  ©rV   r¢  Úfollowing200Responser›   s       rD   Ú-test_1XXFollowedByFinalResponseOnlyEmitsFinalÚCHTTPClientParserTests.test_1XXFollowedByFinalResponseOnlyEmitsFinalÅ  sÐ   € ðð 	ð  YÐä#Ü�F˜D¤.°$Ó7Ñ9Ió
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ/ÑFÔGà×Ñ˜×*Ñ*×/Ñ/°Ô5Ø×Ñ˜×*Ñ*×2Ñ2´G¸B³KÔ@Ø×Ñ˜×-Ñ-¬wÐ8IÈFÈ8Ð7TÓ/UÔVØ×Ñ˜×*Ñ*×1Ñ1°3Õ7rC   c                 óò  • SnSn[        [        SS[        S5      S 5      nUR                  [	        5       5        UR                  UU-   U-   U-   5        U R                  UR                  R                  S5        U R                  UR                  R                  [        0 5      5        U R                  UR                  [        SS	/05      5        U R                  UR                  R                  S
5        g)zX
It is acceptable for multiple 1XX responses to come through, all of
which get ignored.
rœ  r¦  rô   rõ   Nc                 ó   • g rx   r;   r�  s    rD   r  ÚKHTTPClientParserTests.test_multiple1XXResponsesAreIgnored.<locals>.<lambda>í  rŸ  rC   ri   rÈ   r9  r:  r©  rª  s       rD   Ú#test_multiple1XXResponsesAreIgnoredÚ9HTTPClientParserTests.test_multiple1XXResponsesAreIgnoredÞ  së   € ðð 	ð  YÐä#Ü�F˜D¤.°$Ó7Ñ9Ió
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑØØñ àñ ð #ñ#ô	
ð 	×Ñ˜×*Ñ*×/Ñ/°Ô5Ø×Ñ˜×*Ñ*×2Ñ2´G¸B³KÔ@Ø×Ñ˜×-Ñ-¬wÐ8IÈFÈ8Ð7TÓ/UÔVØ×Ñ˜×*Ñ*×1Ñ1°3Õ7rC   c                 ó`  • [         R                  " U [        5      nSn[        [	        SS[
        S5      S 5      nUR                  [        5       5        UR                  U5        U R                  S[        U5      5        US   nU R                  US   S	5        U R                  US
   S5        g)z6
When a 1XX response is ignored, Twisted emits a log.
rœ  rô   rõ   Nc                 ó   • g rx   r;   r�  s    rD   r  ÚHHTTPClientParserTests.test_ignored1XXResponseCausesLog.<locals>.<lambda>
  rŸ  rC   rh   r   Ú
log_formatz#Ignoring unexpected {code} responserú   ég   )r   r…  r   r!   r+   rk   r—   r   r™   r†  rQ   )rV   r‰  r¢  r›   rŠ  s        rD   Ú test_ignored1XXResponseCausesLogÚ6HTTPClientParserTests.test_ignored1XXResponseCausesLogü  s¨   € ô +×<Ò<¸TÔCUÓVˆðð 	ô $Ü�F˜D¤.°$Ó7Ñ9Ió
ˆð 	×Ñ¤Ó 1Ô2Ø×ÑÐ/Ô0à×Ñ˜!œS Ó-Ô.Ø˜A‘ˆØ×Ñ˜% Ñ-Ð/TÔUØ×Ñ˜% ™-¨Õ-rC   r;   N)(r=   r>   r?   r@   rA   rå   rñ   rþ   r  r  r  r  r  r"  r.  r3  r<  rA  rF  rK  rP  rT  rW  rZ  r]  ra  rh  rk  ro  rs  rw  r|  r‹  r“  r™  r£  r¬  r±  r¸  rB   r;   rC   rD   rà   rà   j  s¹   † ñò
Pò#ò,:ò8ò)ò&"òH
=ò4ò4òGò Gò&8ò(6ò$*ò>6ò2
ò$/ò$
ò/ò 
ò
ò@ò"@ò"#/òJ*ò0*ò<Rò3ò:<ò
ò$4ò48ò28õ<.rC   rà   c                   ó0   • \ rS rSrSrSrSrSrS rS r	Sr
g)	ÚSlowRequesti  ah  
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                 ó8   • [        5       U l        U R                  $ rx   )r   r  ©rV   rm   s     rD   ÚwriteToÚSlowRequest.writeTo%  s   € Ü ›
ˆŒØ�}‰}ÐrC   c                 ó   • SU l         g r
  ©Ústoppedry   s    rD   ÚstopWritingÚSlowRequest.stopWriting)  ó	   € Øˆ�rC   )r  rÂ  N)r=   r>   r?   r@   rA   ÚmethodrÂ  Ú
persistentr¾  rÃ  rB   r;   rC   rD   r»  r»    s"   † ñ	ð €FØ€GØ€JòõrC   r»  c                   ó"   • \ rS rSrSrSrS rSrg)ÚSimpleRequesti-  zý
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                 ó:   • UR                  S5        [        S 5      $ )Nó
   SOME BYTES)Úwriter	   r½  s     rD   r¾  ÚSimpleRequest.writeTo7  s   € Ø�‰˜Ô&Ü�t‹}ÐrC   r;   N)r=   r>   r?   r@   rA   rÇ  r¾  rB   r;   rC   rD   rÉ  rÉ  -  s   † ñð €JõrC   rÉ  c                   óî   • \ rS rSrSrS rS rS rS rS r	S r
S(S
 jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S  r!S! r"S" r#S# r$S$ r%S% r&S& r'S'r(g	))ÚHTTP11ClientProtocolTestsi<  zQ
Tests for the HTTP 1.1 client protocol implementation,
L{HTTP11ClientProtocol}.
c                 óŠ   • [        5       U l        [        5       U l        U R                  R	                  U R                  5        g)zB
Create an L{HTTP11ClientProtocol} connected to a fake transport.
N)r   rm   r)   r›   r—   ry   s    rD   ÚsetUpÚHTTP11ClientProtocolTests.setUpB  s.   € ô )Ó*ˆŒÜ,Ó.ˆŒØ�‰×$Ñ$ T§^¡^Õ4rC   c                 óž   • U R                   R                  [        5       5        U R                  U R                  R                  5       S5        g)zn
L{HTTP11ClientProtocol.request} accepts a L{Request} and calls its
C{writeTo} method with its own transport.
rË  N)r›   rý   rÉ  rP   rm   r±   ry   s    rD   Útest_requestÚ&HTTP11ClientProtocolTests.test_requestJ  s5   € ð
 	�‰×Ñœm›oÔ.Ø×Ñ˜Ÿ™×-Ñ-Ó/°Õ?rC   c                 óê   ^ • T R                   R                  [        5       5        U 4S jnT R                  T R                   R                  [	        5       5      [
        5      nUR                  U5        U$ )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                 óZ   >• TR                  TR                  R                  5       S5        g ©NrC   ©rP   rm   r±   ©ÚignoredrV   s    €rD   Ú	cbNotSentÚ?HTTP11ClientProtocolTests.test_secondRequest.<locals>.cbNotSentZ  ó    ø€ Ø×Ñ˜TŸ^™^×1Ñ1Ó3°SÕ9rC   )r›   rý   r»  rY   rÉ  r%   rZ   ©rV   rÜ  r]   s   `  rD   Útest_secondRequestÚ,HTTP11ClientProtocolTests.test_secondRequestR  sT   ø€ ð 	�‰×Ñœk›mÔ,õ	:ð ×Ñ˜tŸ}™}×4Ñ4´]³_ÓEÄ~ÓVˆØ	�‰�iÔ ØˆrC   c                 óþ   ^ • T R                   R                  [        [        S5      5      5        U 4S jnT R	                  T R                   R                  [        5       5      [        5      nUR                  U5        U$ )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                 óZ   >• TR                  TR                  R                  5       S5        g rØ  rÙ  rÚ  s    €rD   rÜ  ÚLHTTP11ClientProtocolTests.test_requestAfterConnectionLost.<locals>.cbNotSenti  rÞ  rC   )	r›   rr  r   r
   rY   rý   rÉ  r%   rZ   rß  s   `  rD   Útest_requestAfterConnectionLostÚ9HTTP11ClientProtocolTests.test_requestAfterConnectionLosta  s\   ø€ ð 	�‰×$Ñ$¤W¬^¸OÓ-LÓ%MÔNõ	:ð ×Ñ˜tŸ}™}×4Ñ4´]³_ÓEÄ~ÓVˆØ	�‰�iÔ ØˆrC   c                 ó®   ^ •  " S S5      nT R                   R                  U" 5       5      nU 4S jn[        T U[        /5      nUR	                  U5        U$ )zý
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                   ó   • \ rS rSrSrS rSrg)ÚCHTTP11ClientProtocolTests.test_failedWriteTo.<locals>.BrokenRequestix  Fc                 ó(   • [        [        5       5      $ rx   )r   r9   r½  s     rD   r¾  ÚKHTTP11ClientProtocolTests.test_failedWriteTo.<locals>.BrokenRequest.writeTo{  s   € ÜÔ.Ó0Ó1Ð1rC   r;   N©r=   r>   r?   r@   rÇ  r¾  rB   r;   rC   rD   ÚBrokenRequestré  x  s   † ØˆJõ2rC   rí  c                 óª   >• TR                  TR                  R                  5        TR                  R	                  [        [        S5      5      5        g )Nzyou asked for it)rÊ   rm   Údisconnectingr›   rr  r   r
   rÚ  s    €rD   rW   Ú>HTTP11ClientProtocolTests.test_failedWriteTo.<locals>.cbFailed€  s8   ø€ Ø�O‰O˜DŸN™N×8Ñ8Ô9ð �M‰M×(Ñ(¬´Ð@RÓ1SÓ)TÕUrC   )r›   rý   rc   r9   rZ   )rV   rí  r]   rW   s   `   rD   Útest_failedWriteToÚ,HTTP11ClientProtocolTests.test_failedWriteTop  sP   ø€ ÷	2ñ 	2ð �M‰M×!Ñ!¡-£/Ó2ˆõ	Vô *¨$°Ô4FÐ3GÓHˆØ	�‰�hÔØˆrC   c                 óx   •  " S S5      nU R                   R                  U" 5       5      n[        X[        /5      $ )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                   ó   • \ rS rSrSrS rSrg)ÚMHTTP11ClientProtocolTests.test_synchronousWriteToError.<locals>.BrokenRequesti‘  Fc                 ó   • [        5       erx   r�  r½  s     rD   r¾  ÚUHTTP11ClientProtocolTests.test_synchronousWriteToError.<locals>.BrokenRequest.writeTo”  s   € Ü(Ó*Ð*rC   r;   Nrì  r;   rC   rD   rí  rõ  ‘  s   † ØˆJõ+rC   rí  )r›   rý   rc   r9   )rV   rí  r]   s      rD   Útest_synchronousWriteToErrorÚ6HTTP11ClientProtocolTests.test_synchronousWriteToErrorŠ  s5   € ÷	+ñ 	+ð �M‰M×!Ñ!¡-£/Ó2ˆÜ,¨TÔ7IÐ6JÓKÐKrC   Nc                 óF  • [        5       nU R                  R                  U5      n[        X[        /5      nU R                  UR                  5        U R                  R                  [        [	        5       5      5        U R                  UR                  5        US:X  a  UR                  R                  S5        U$ US:X  a^  UR                  R                  [        [        5       5      5        U R                  [        5      nU R                  [!        U5      S5        U$  U$ )a
  
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Úerrbackrh   )r»  r›   rý   re   r9   rÌ   rÂ  rr  r   rÊ   r  rû  rü  rF   rˆ  rP   rQ   )rV   Úmoderý   r]   Úerrorss        rD   Ú*test_connectionLostDuringRequestGenerationÚDHTTP11ClientProtocolTests.test_connectionLostDuringRequestGenerationš  sð   € ô “-ˆØ�M‰M×!Ñ! 'Ó*ˆÜ+¨DÔ6HÐ5IÓJˆð 	×Ñ˜Ÿ™Ô)à�‰×$Ñ$¤WÔ-?Ó-AÓ%BÔCð 	�‰˜Ÿ™Ô(à�:ÓØ×Ñ×%Ñ% dÔ+ð ˆð �YÓØ×Ñ×$Ñ$¤WÔ-FÓ-HÓ%IÔJØ×+Ñ+Ô,EÓFˆFØ×ÑœS ›[¨!Ô,ð ˆð ØˆrC   c                 ó$   • U R                  S5      $ )z¢
If the request passed to L{HTTP11ClientProtocol} finishes generation
successfully after the L{HTTP11ClientProtocol}'s connection has been
lost, nothing happens.
rû  ©rÿ  ry   s    rD   Ú+test_connectionLostBeforeGenerationFinishedÚEHTTP11ClientProtocolTests.test_connectionLostBeforeGenerationFinishedº  s   € ð ×>Ñ>¸zÓJÐJrC   c                 ó$   • U R                  S5      $ )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  ry   s    rD   Ú)test_connectionLostBeforeGenerationFailedÚCHTTP11ClientProtocolTests.test_connectionLostBeforeGenerationFailedÂ  s   € ð ×>Ñ>¸yÓIÐIrC   c                 óŠ   ^ ^• [         R                  " T [        5      mUU 4S jnT R                  S5      R	                  U5      $ )zá
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                 ó¾   >• TR                  S[        T5      5        TS   nTR                  SU5        TR                  US   S5        TR                  US   S5        g )Nrh   r   r„  r¶  zJError writing request, but not in valid state to finalize request: {state}r˜   ÚCONNECTION_LOST)r†  rQ   ÚassertInrP   )ÚignorerŠ  r‰  rV   s     €€rD   ÚcheckÚnHTTP11ClientProtocolTests.test_errorMessageOnConnectionLostBeforeGenerationFailedDoesNotConfuse.<locals>.checkÓ  sa   ø€ Ø×Ñ˜a¤ [Ó!1Ô2Ø ‘NˆEØ�M‰M˜-¨Ô/Ø×ÑØ�lÑ#ð/ôð
 ×Ñ˜U 7™^Ð->Õ?rC   rü  )r   r…  r   rÿ  rZ   )rV   r  r‰  s   ` @rD   ÚEtest_errorMessageOnConnectionLostBeforeGenerationFailedDoesNotConfuseÚ_HTTP11ClientProtocolTests.test_errorMessageOnConnectionLostBeforeGenerationFailedDoesNotConfuseÊ  sA   ù€ ô +×<Ò<¸TÔCUÓVˆö		@ð ×>Ñ>¸yÓI×UÑUØó
ð 	
rC   c                 óÂ   ^ • T R                   R                  [        SS[        S5      5      nU 4S jnUR	                  U5        T R                   R                  S5        U$ )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                 ó  >• TR                  U R                  S5        TR                  U R                  [        5       5        TR	                  TR
                  R                  5        TR                  TR                  R                  S5        g )Nri   Ú	QUIESCENT)	rP   rú   rÂ   r3   rÊ   rm   rï  r›   r˜   )rø   rV   s    €rD   Ú	cbRequestÚIHTTP11ClientProtocolTests.test_receiveSimplestResponse.<locals>.cbRequestê  s_   ø€ Ø×Ñ˜XŸ]™]¨CÔ0Ø×Ñ˜X×-Ñ-¬w«yÔ9Ø�O‰O˜DŸN™N×8Ñ8Ô9Ø×Ñ˜TŸ]™]×0Ñ0°+Õ>rC   s9   HTTP/1.1 200 OK
Content-Length: 0
Connection: close

©r›   rý   r+   rk   rZ   r™   ©rV   r]   r  s   `  rD   Útest_receiveSimplestResponseÚ6HTTP11ClientProtocolTests.test_receiveSimplestResponseâ  sU   ø€ ð �M‰M×!Ñ!¤'¨&°$¼ÈÓ"MÓNˆõ	?ð 	
�‰�iÔ Ø�‰×"Ñ"ðô	
ð ˆrC   c                 óÂ   ^ • T R                   R                  [        SS[        S5      5      nU 4S jnUR	                  U5        T R                   R                  S5        U$ )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                 ó\   >• [        SSS/05      nTR                  U R                  U5        g )Nr*  r§   rÀ   )r3   rP   rÂ   )rø   rÄ   rV   s     €rD   r  ÚHHTTP11ClientProtocolTests.test_receiveResponseHeaders.<locals>.cbRequest  s-   ø€ Ü ¨6°6Ð*:Ð;Ó<ˆHØ×Ñ˜X×-Ñ-¨xÕ8rC   s+   HTTP/1.1 200 OK
X-Foo: bar
X-Foo: baz

r  r  s   `  rD   Útest_receiveResponseHeadersÚ5HTTP11ClientProtocolTests.test_receiveResponseHeadersù  sS   ø€ ð �M‰M×!Ñ!¤'¨&°$¼ÈÓ"MÓNˆõ	9ð 	
�‰�iÔ Ø�‰×"Ñ"ØNô	
ð ˆrC   c                 ó0  ^ ^^^^• / m[        5       m[        TR                  5      mTR                  T5        [	        5       mTR                  T5      nTR                  S5        UUU U4S jnUR                  U5        UU 4S jnUR                  U5        U$ )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                 ó  >^ ^• [        5       m[        5       =nTl        T R                  T5        TR	                  TR
                  S5        TR                  TR                  5        TR	                  T/ 5        UR                  UU 4S j5      $ )NÚ%TRANSMITTING_AFTER_RECEIVING_RESPONSEc                 ó    >• TTR                   4$ rx   ©ré   ©r�  Úprø   s    €€rD   r  ÚoHTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone.<locals>.cbResponse.<locals>.<lambda>*  ó   ø€ ¸À1Ç6Á6Ñ8JrC   )	r   r   ÚclosedDeferredÚdeliverBodyrP   r˜   rÊ   rï  rZ   )rø   ÚwhenFinishedr%  r›   ÚquiescentResultrV   rm   s   ` @€€€€rD   Ú
cbResponseÚ]HTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone.<locals>.cbResponse#  sq   ú€ Ü$Ó&ˆAÜ.6«jÐ8ˆL˜1Ô+Ø× Ñ  Ô#Ø×Ñ˜XŸ^™^Ð-TÔUØ�O‰O˜I×3Ñ3Ô4Ø×Ñ˜_¨bÔ1Ø×+Ñ+Õ,JÓKÐKrC   c                 ó`  >• U u  pTR                  UR                  S5        TR                  UR                  S5        TR                  UR                  S5        TR                  UR                  [        SS/05      5        TR                  US5        TR                  R                  S 5        g )Nrg   ri   rj   r*  r§   ó   foobar)rP   rù   rú   rû   rÂ   r3   r  rû  )Úresultrø   r  rý   rV   s      €€rD   ÚcbAllResponseÚ`HTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone.<locals>.cbAllResponse.  s�   ø€ Ø#‰NˆHØ×Ñ˜X×-Ñ-¨Ô?Ø×Ñ˜XŸ]™]¨CÔ0Ø×Ñ˜XŸ_™_¨eÔ4Ø×Ñ˜X×-Ñ-¬w¸À6À(Ð7KÓ/LÔMØ×Ñ˜T 9Ô-ð ×Ñ×%Ñ% dÕ+rC   )r   r)   r•   r—   r»  rý   r™   rZ   )rV   r]   r,  r1  r›   r+  rý   rm   s   `   @@@@rD   Ú/test_receiveResponseBeforeRequestGenerationDoneÚIHTTP11ClientProtocolTests.test_receiveResponseBeforeRequestGenerationDone  sŒ   ü€ ð ˆÜ#Ó%ˆ	Ü'¨×(>Ñ(>Ó?ˆØ×Ñ 	Ô*ä“-ˆØ×Ñ˜WÓ%ˆØ×Ñðô	
÷	Lð 	Lð 	
�‰�jÔ!ö
	,ð 	
�‰�mÔ$ØˆrC   c                 ó  • [        5       n[        5       nX!l        UR                  U5        S[        R
                  -  nUR                  [        SS[        S5      5      nUR                  SU-   S-   5        [        X[        /5      $ )za
The connection is closed when the server respond with a header which
is above the maximum line.
rn  rô   rõ   Ns   HTTP/1.1 200 OK
X-Foo: s   
X-Ignored: ignored

)r   r)   r›   r—   r   Ú
MAX_LENGTHrý   r+   rk   r™   ra   r
   )rV   rm   r›   ÚlongLiner]   s        rD   Ú"test_receiveResponseHeadersTooLongÚ<HTTP11ClientProtocolTests.test_receiveResponseHeadersTooLong=  sŠ   € ô
 5Ó6ˆ	Ü'Ó)ˆØ%ÔØ×Ñ 	Ô*àœ,×1Ñ1Ñ1ˆØ×ÑœW V¨T´>À4ÓHÓIˆà×ÑðØ!ñ"ð%ñô	
ô $ D¬nÐ-=Ó>Ð>rC   c                 óâ   ^ ^• [        5       mT R                  R                  T5      nT R                  R                  S5        S nUR	                  U5        UU 4S jnUR	                  U5        U$ )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                 óŠ   ^ ^• [        5       m[        5       =nTl        T R                  T5        UR	                  UU 4S j5      $ )Nc                 ó    >• TTR                   4$ rx   r#  r$  s    €€rD   r  Ú„HTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDone.<locals>.cbResponse.<locals>.<lambda>j  r'  rC   )r   r   r(  r)  rZ   )rø   r*  r%  s   ` @rD   r,  ÚrHTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDone.<locals>.cbResponsef  s:   ù€ Ü$Ó&ˆAÜ.6«jÐ8ˆL˜1Ô+Ø× Ñ  Ô#Ø×+Ñ+Õ,JÓKÐKrC   c                 óà   >• TR                   R                  S 5        TR                  R                  [	        [        5       5      5        TR                  TR                  R                  S5        g )Nr
  )r  rû  r›   rr  r   r9   rP   r†   )r  rý   rV   s    €€rD   r1  ÚuHTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDone.<locals>.cbAllResponsen  sM   ø€ Ø×Ñ×%Ñ% dÔ+à�M‰M×(Ñ(¬Ô1CÓ1EÓ)FÔGØ×Ñ˜TŸ]™]×1Ñ1Ð3DÕErC   )r»  r›   rý   r™   rZ   )rV   r]   r,  r1  rý   s   `   @rD   ÚDtest_connectionLostAfterReceivingResponseBeforeRequestGenerationDoneÚ^HTTP11ClientProtocolTests.test_connectionLostAfterReceivingResponseBeforeRequestGenerationDoneW  sd   ù€ ô “-ˆØ�M‰M×!Ñ! 'Ó*ˆØ�‰×"Ñ"ðô	
ò	Lð 	
�‰�jÔ!ö	Fð 	
�‰�mÔ$ØˆrC   c                 ó(  ^ ^• [        5       m[        5       =nTl        T R                  R	                  [        SS[        S5      5      nT R                  R                  S5        / nUR                  UR                  5        T R                  U/ 5        T R                  R                  S5        US   nUR                  T5        T R                  R                  S5        T R                  R                  S5        UU 4S	 jnUR                  U5        U$ )
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                 ó|   >• TR                  TR                  S5        TR                  R                  [        5        g )Nr/  )rP   ré   ÚclosedReasonrO   r/   )rÛ  r›   rV   s    €€rD   r1  ÚIHTTP11ClientProtocolTests.test_receiveResponseBody.<locals>.cbAllResponse™  s+   ø€ Ø×Ñ˜XŸ]™]¨IÔ6Ø×!Ñ!×&Ñ&¤|Õ4rC   )r   r   r(  r›   rý   r+   rk   r™   rZ   r•   rP   r)  )rV   r*  ÚrequestDeferredr0  rø   r1  r›   s   `     @rD   Útest_receiveResponseBodyÚ2HTTP11ClientProtocolTests.test_receiveResponseBodyw  sè   ù€ ô (Ó)ˆÜ19³Ð;ˆ�xÔ.ØŸ-™-×/Ñ/Ü�F˜D¤.°$Ó7ó
ˆð 	�‰×"Ñ"ØAô	
ð ˆØ×#Ñ# F§M¡MÔ2à×Ñ˜ Ô$ð 	�‰×"Ñ" 5Ô)Ø˜!‘9ˆà×Ñ˜XÔ&à�‰×"Ñ" 6Ô*Ø�‰×"Ñ" 6Ô*ö	5ð 	× Ñ  Ô/ØÐrC   c                 óF  • U R                   R                  [        SS[        S5      5      nU R                   R	                  S5        / nUR                  UR                  5        US   n[        5       nUR                  U5        U R                   R	                  S5        U R                   R	                  S5        U R                  UR                  S5        U R                   R                  [        [        S	5      5      5        UR                  R                  [         5        g)
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+   rk   r™   rZ   r•   r   r)  rP   ré   rr  r   r
   rE  rO   r*   ©rV   rG  r0  rø   r›   s        rD   ÚEtest_responseBodyFinishedWhenConnectionLostWhenContentLengthIsUnknownÚ_HTTP11ClientProtocolTests.test_responseBodyFinishedWhenConnectionLostWhenContentLengthIsUnknown   sà   € ð Ÿ-™-×/Ñ/Ü�F˜D¤.°$Ó7ó
ˆð 	�‰×"Ñ"Ð#AÔBàˆØ×#Ñ# F§M¡MÔ2Ø˜!‘9ˆä'Ó)ˆØ×Ñ˜XÔ&à�‰×"Ñ" 6Ô*Ø�‰×"Ñ" 6Ô*à×Ñ˜Ÿ™¨	Ô2Ø�‰×$Ñ$Ü”NÐ#EÓFÓGô	
ð 	×Ñ×"Ñ"Ô#4Õ5rC   c                 óX  • U R                   R                  [        SS[        S5      5      nU R                   R	                  S5        / nUR                  UR                  5        US   n[        5       nUR                  U5        U R                   R	                  S5        U R                   R	                  S5        U R                  UR                  S5        U R                   R                  [        [        5       5      5        [        U [        UR                   5      [        ["        /5      $ )	zà
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+   rk   r™   rZ   r•   r   r)  rP   ré   rr  r   r9   ra   r   rE  r2   rK  s        rD   Ú4test_chunkedResponseBodyUnfinishedWhenConnectionLostÚNHTTP11ClientProtocolTests.test_chunkedResponseBodyUnfinishedWhenConnectionLost½  sí   € ð Ÿ-™-×/Ñ/Ü�F˜D¤.°$Ó7ó
ˆð 	�‰×"Ñ"ØLô	
ð ˆØ×#Ñ# F§M¡MÔ2Ø˜!‘9ˆä'Ó)ˆØ×Ñ˜XÔ&à�‰×"Ñ" ?Ô3Ø�‰×"Ñ" ?Ô3à×Ñ˜Ÿ™¨	Ô2à�‰×$Ñ$¤WÔ-?Ó-AÓ%BÔCä#Ø”$�x×,Ñ,Ó-Ô0BÄIÐ/Nó
ð 	
rC   c                 óæ   ^ • T R                   R                  [        SS[        S5      5      nT R                   R	                  S5        [        T U[        /5      nU 4S jnUR                  U5        U$ )zù
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                 ó  >• TR                  TR                  R                  5        TR                  U R                  S   R
                  R                  S5        TR                  R                  [        [        S5      5      5        g )Nr   s   unparseable garbage goes herez
it is done)rÊ   rm   rï  rP   rN   r±   ré   r›   rr  r   r
   )rë   rV   s    €rD   rW   ÚLHTTP11ClientProtocolTests.test_parserDataReceivedException.<locals>.cbFailedê  s_   ø€ Ø�O‰O˜DŸN™N×8Ñ8Ô9Ø×ÑØ—‘˜A‘×$Ñ$×)Ñ)Ð+Kôð �M‰M×(Ñ(¬´ÀÓ1MÓ)NÕOrC   )r›   rý   r+   rk   r™   ra   r$   rZ   )rV   rG  r]   rW   s   `   rD   Ú test_parserDataReceivedExceptionÚ:HTTP11ClientProtocolTests.test_parserDataReceivedExceptionÝ  se   ø€ ð Ÿ-™-×/Ñ/Ü�F˜D¤.°$Ó7ó
ˆð 	�‰×"Ñ"Ð#GÔHÜ   ¼¸ÓEˆõ
	Pð 	
�‰�hÔØˆrC   c                 ó˜  • U R                   R                  [        SS[        S5      5      nU R                   R                  R
                  nU R                  UR                  U R
                  5        U R                   R                  [        [        S5      5      5        U R                  UR                  S5        [        X[        /5      $ )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+   rk   Ú_parserrm   r-  Ú	_producerÚ_disconnectParserr   r
   ra   )rV   rG  rm   s      rD   Útest_proxyStoppedÚ+HTTP11ClientProtocolTests.test_proxyStoppedù  sš   € ð Ÿ-™-×/Ñ/Ü�F˜D¤.°$Ó7ó
ˆð —M‘M×)Ñ)×3Ñ3ˆ	Ø×Ñ˜Y×0Ñ0°$·.±.ÔAØ�‰×'Ñ'¬´Ð?PÓ0QÓ(RÔSØ×Ñ˜Y×0Ñ0°$Ô7Ü# D¼NÐ;KÓLÐLrC   c                 óê  • [        5       n[        5       nUR                  U5        / n/ nUR                  5       R	                  UR
                  5        UR                  5       R	                  UR
                  5        U R                  X44/ / 45        U R                  UR                  5        UR                  [        [        5       5      5        U R                  US/5        U R                  US/5        g)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—   ÚabortrZ   r•   rP   rÊ   rï  rr  r   r
   )rV   rm   r›   Úr1Úr2s        rD   Útest_abortClosesConnectionÚ4HTTP11ClientProtocolTests.test_abortClosesConnection  sÂ   € ô $Ó%ˆ	Ü'Ó)ˆØ×Ñ 	Ô*ØˆØˆØ�‰Ó×$Ñ$ R§Y¡YÔ/Ø�‰Ó×$Ñ$ R§Y¡YÔ/Ø×Ñ˜"˜ B¨ 8Ô,Ø�‰˜	×/Ñ/Ô0ð 	×Ñ¤¬Ó(8Ó 9Ô:Ø×Ñ˜˜d˜VÔ$Ø×Ñ˜˜d˜VÕ$rC   c                 óF  • [        5       n[        5       nUR                  U5        UR                  [	        [        5       5      5        / nUR                  5       R                  UR                  5        U R                  US/5        U R                  UR                  S5        g)zq
L{HTTP11ClientProtocol.abort} called after the connection is lost
returns a C{Deferred} that fires immediately.
Nr
  )r   r)   r—   rr  r   r
   r^  rZ   r•   rP   r†   ©rV   rm   r›   r0  s       rD   Útest_abortAfterConnectionLostÚ7HTTP11ClientProtocolTests.test_abortAfterConnectionLost  s}   € ô
 $Ó%ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø×Ñ¤¬Ó(8Ó 9Ô:àˆØ�‰Ó×$Ñ$ V§]¡]Ô3Ø×Ñ˜ $ Ô(Ø×Ñ˜Ÿ™Ð*;Õ<rC   c                 óJ  • [        5       n[        5       nUR                  U5        UR                  [	        SS[
        S5      5      nUR                  5         U R                  UR                  5        UR                  [        [        5       5      5        [        X[        /5      $ )zà
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+   rk   r^  rÊ   rï  rr  r   r
   ra   r   rd  s       rD   Útest_abortBeforeResponseBodyÚ6HTTP11ClientProtocolTests.test_abortBeforeResponseBody,  s€   € ô $Ó%ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø×!Ñ!¤'¨&°$¼ÈÓ"MÓNˆØ�‰ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ¤¬Ó(8Ó 9Ô:Ü# DÔ3DÐ2EÓFÐFrC   c                 ó‚  ^ ^^^^• [        SS9m[        5       mTR                  T5        TR                  [	        SS[
        S5      5      nTR                  S5        [        5       m " UU4S jS[        5      mUUU U4S	 jnU 4S
 jnUR                  U5        [        T T[        [        /5      nUR                  U5      $ )a#  
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õ   Nr  c                   ó2   >• \ rS rSrSrU 4S jrU4S jrSrg)ÚQHTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.BodyDestinationiP  zH
A body response protocol which immediately aborts the HTTP
connection.
c                 ó&   >• TR                  5         g)z
Abort the HTTP connection.
N)r^  rÓ   s    €rD   ÚconnectionMadeÚ`HTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.BodyDestination.connectionMadeV  s   ø€ ð —‘Õ rC   c                 ó(   >• TR                  U5        g)z`
Make the reason for the losing of the connection available to
the unit test via C{testResult}.
N)rü  )rV   rS   Ú
testResults     €rD   rr  Ú`HTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.BodyDestination.connectionLost\  s   ø€ ð
 ×"Ñ" 6Õ*rC   r;   N)r=   r>   r?   r@   rA   ro  rr  rB   )r›   rr  s   €€rD   ÚBodyDestinationrm  P  s   ø† ñõ
!÷+ð +rC   rt  c                 ó¬   >• U R                  T" 5       5        TR                  TR                  5        TR                  [	        [        5       5      5        g)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ï  rr  r   r
   )rø   rt  r›   rV   rm   s    €€€€rD   r)  ÚMHTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.deliverBodyc  s>   ø€ ð × Ñ ¡Ó!2Ô3Ø�O‰O˜I×3Ñ3Ô4Ø×#Ñ#¤G¬NÓ,<Ó$=Õ>rC   c                 óF   >• TR                  U R                  [        5        g rx   )r‡  rø   r.   )ÚerrorrV   s    €rD   Ú
checkErrorÚLHTTP11ClientProtocolTests.test_abortAfterResponseHeaders.<locals>.checkErrorm  s   ø€ Ø×!Ñ! %§.¡.´(Õ;rC   )r   r)   r—   rý   r+   rk   r™   r   r   rZ   ra   r   r2   )	rV   r0  r)  ry  r[   rt  r›   rr  rm   s	   `    @@@@rD   Útest_abortAfterResponseHeadersÚ8HTTP11ClientProtocolTests.test_abortAfterResponseHeaders<  s°   ü€ ô $¨DÑ1ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø×!Ñ!¤'¨&°$¼ÈÓ"MÓNˆà×ÑÐUÔVä“Zˆ
÷	+ð 	+œhô 	+÷&	?ð 	?õ	<ð 	×Ñ˜;Ô'Ü'Ø�*Ô0´)Ð<ó
ˆð ×#Ñ# JÓ/Ð/rC   c           
      óf  ^ ^^• / mUUU 4S jn[        5       n[        U5      mTR                  U5        TR                  [	        SS[
        SSS95      nTR                  S5        T R                  T/ 5        / nUR                  UR                  5        US   n[        5       n[        5       Ul        UR                  R                  U4S	 j5        UR                  U5        TR                  S
5        UR                  R                  [         5        T R                  TTS/5        T R                  TR"                  S5        T R                  TR$                  S5        T R                  TR&                  S5        T R                  TR(                  S5        T R                  TR*                  S5        g)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                 ó„   >• TR                  U T5        TR                  U R                  S5        TR                  U 5        g ©Nr  ©rP   r˜   r•   ©r%  r›   r+  rV   s    €€€rD   rû  ÚHHTTP11ClientProtocolTests.test_quiescentCallbackCalled.<locals>.callback„  ó5   ø€ Ø×Ñ˜Q Ô)Ø×Ñ˜QŸW™W kÔ2Ø×"Ñ" 1Õ%rC   rô   rõ   NT©rÇ  s&   HTTP/1.1 200 OK
Content-length: 3

r   c                 ó&   >• TR                  S5      $ )Núresponse doner  )r�  r+  s    €rD   r  ÚHHTTP11ClientProtocolTests.test_quiescentCallbackCalled.<locals>.<lambda>ž  s   ø€ ˜×.Ñ.¨Ô?rC   rv  r†  )r   r)   r—   rý   r+   rk   r™   rP   rZ   r•   r   r   r(  r)  rE  rO   r/   rX  Ú_finishedRequestÚ_currentRequestÚ_transportProxyrz  )	rV   rû  rm   rG  r0  rø   ÚbodyProtocolr›   r+  s	   `      @@rD   Útest_quiescentCallbackCalledÚ6HTTP11ClientProtocolTests.test_quiescentCallbackCalledv  sx  ú€ ð ˆ÷	&ô
 $Ó%ˆ	Ü'¨Ó1ˆØ×Ñ 	Ô*à"×*Ñ*Ü�F˜D¤.°$À4ÑHó
ˆð 	×ÑÐUÔVð 	×Ñ˜¨"Ô-àˆØ×#Ñ# F§M¡MÔ2Ø˜!‘9ˆô ,Ó-ˆÜ&.£jˆÔ#Ø×#Ñ#×/Ñ/Ü?ô	
ð 	×Ñ˜\Ô*Ø×Ñ˜fÔ%Ø×!Ñ!×&Ñ&¤|Ô4ð 	×Ñ˜¨8°_Ð*EÔFð 	×Ñ˜×)Ñ)¨4Ô0Ø×Ñ˜×2Ñ2°DÔ9Ø×Ñ˜×1Ñ1°4Ô8Ø×Ñ˜×1Ñ1°4Ô8Ø×Ñ˜×3Ñ3°TÕ:rC   c           
      ó”  ^ ^^• / mUUU 4S jn[        5       n[        U5      mTR                  U5        TR                  [	        SS[
        SSS95      nTR                  S5        T R                  U5      nT R                  UR                  S5        T R                  [        T5      S	5        T R                  UR                  S
5        g)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                 ó„   >• TR                  U T5        TR                  U R                  S5        TR                  U 5        g r  r€  r�  s    €€€rD   rû  Ú]HTTP11ClientProtocolTests.test_transportProducingWhenQuiescentAfterFullBody.<locals>.callback¼  rƒ  rC   rô   rõ   NTr„  s)   HTTP/1.1 200 OK
Content-length: 3

BBBÚDEFERRED_CLOSErh   r  )r   r)   r—   rý   r+   rk   r™   ÚsuccessResultOfrP   r†   rQ   r  )rV   rû  rm   rG  rø   r›   r+  s   `    @@rD   Ú1test_transportProducingWhenQuiescentAfterFullBodyÚKHTTP11ClientProtocolTests.test_transportProducingWhenQuiescentAfterFullBody¯  s¾   ú€ ð ˆ÷	&ô
 $Ó%ˆ	Ü'¨Ó1ˆØ×Ñ 	Ô*Ø"×*Ñ*Ü�F˜D¤.°$À4ÑHó
ˆð 	×Ñðô	
ð ×'Ñ'¨Ó8ˆð 	×Ñ˜Ÿ™Ð*:Ô;ð
 	×Ñœ˜_Ó-¨qÔ1ð
 	×Ñ˜×0Ñ0°+Õ>rC   c           
      ó”  ^ ^^• / mUUU 4S jn[        5       n[        U5      mTR                  U5        TR                  [	        SS[
        SSS95      nUR                  TR                  5        TR                  S5        T R                  [        T5      S5        T R                  TS	   T5        T R                  TS
   [        5        g)zp
The quiescentCallback is called before the request C{Deferred} fires,
in cases where the response has no body.
c                 ó„   >• TR                  U T5        TR                  U R                  S5        TR                  U 5        g r  r€  r�  s    €€€rD   rû  ÚUHTTP11ClientProtocolTests.test_quiescentCallbackCalledEmptyResponse.<locals>.callbackä  rƒ  rC   rô   rõ   NTr„  ó&   HTTP/1.1 200 OK
Content-length: 0

rã   r   rh   )r   r)   r—   rý   r+   rk   rZ   r•   r™   rP   rQ   r-  r‡  r.   )rV   rû  rm   rG  r›   r+  s   `   @@rD   Ú)test_quiescentCallbackCalledEmptyResponseÚCHTTP11ClientProtocolTests.test_quiescentCallbackCalledEmptyResponseÝ  sµ   ú€ ð
 ˆ÷	&ô
 $Ó%ˆ	Ü'¨Ó1ˆØ×Ñ 	Ô*à"×*Ñ*Ü�F˜D¤.°$À4ÑHó
ˆð 	×#Ñ# O×$:Ñ$:Ô;Ø×ÑÐUÔVà×Ñœ˜_Ó-¨qÔ1Ø×Ñ˜_¨QÑ/°Ô:Ø×Ñ˜o¨aÑ0´(Õ;rC   c           
      óÜ  • / n[        5       n[        UR                  5      nUR                  U5        UR	                  [        SS[        SSS95      nUR                  S5        / nUR                  UR                  5        US   n[        5       nUR                  U5        UR                  R                  [        5        U R                  U/ 5        U R                  UR                   5        g)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+   rk   r™   rZ   r   r)  rE  rO   r/   rP   rÊ   rï  ©rV   r+  rm   r›   rG  r0  rø   r‹  s           rD   Útest_quiescentCallbackNotCalledÚ9HTTP11ClientProtocolTests.test_quiescentCallbackNotCalled÷  sÒ   € ð ˆÜ#Ó%ˆ	Ü'¨×(>Ñ(>Ó?ˆØ×Ñ 	Ô*à"×*Ñ*Ü�F˜D¤.°$À4ÑHó
ˆð 	×Ñðô	
ð ˆØ×#Ñ# F§M¡MÔ2Ø˜!‘9ˆä+Ó-ˆØ×Ñ˜\Ô*Ø×!Ñ!×&Ñ&¤|Ô4Ø×Ñ˜¨"Ô-Ø�‰˜	×/Ñ/Õ0rC   c           
      óÜ  • / n[        5       n[        UR                  5      nUR                  U5        UR	                  [        SS[        SSS95      nUR                  S5        / nUR                  UR                  5        US   n[        5       nUR                  U5        UR                  R                  [        5        U R                  U/ 5        U R                  UR                   5        g)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           rD   Ú1test_quiescentCallbackNotCalledNonPersistentQueryÚKHTTP11ClientProtocolTests.test_quiescentCallbackNotCalledNonPersistentQuery  sÌ   € ð
 ˆÜ#Ó%ˆ	Ü'¨×(>Ñ(>Ó?ˆØ×Ñ 	Ô*à"×*Ñ*Ü�F˜D¤.°$À5ÑIó
ˆð 	×ÑÐUÔVàˆØ×#Ñ# F§M¡MÔ2Ø˜!‘9ˆä+Ó-ˆØ×Ñ˜\Ô*Ø×!Ñ!×&Ñ&¤|Ô4Ø×Ñ˜¨"Ô-Ø�‰˜	×/Ñ/Õ0rC   c           
      ó�  • S n[         R                  " U [        5      n[        5       n[	        U5      nUR                  U5        UR                  [        SS[        SSS95      nUR                  S5        / nUR                  UR                  5        US   n[        5       nUR                  U5        UR                  R                  [         5        U R#                  S	[%        U5      5        US   n	U	S
   n
U R'                  U
R(                  [*        5        U R-                  [*        5        U R/                  UR0                  5        g)z`
If C{quiescentCallback} throws an exception, the error is logged and
protocol is disconnected.
c                 ó   • [        5       erx   )ÚZeroDivisionError)r%  s    rD   rû  ÚHHTTP11ClientProtocolTests.test_quiescentCallbackThrows.<locals>.callback5  s   € Ü#Ó%Ð%rC   rô   rõ   NTr„  r˜  r   rh   r„  )r   r…  r   r   r)   r—   rý   r+   rk   r™   rZ   r•   r   r)  rE  rO   r/   r†  rQ   r‡  r±   r¥  rˆ  rÊ   rï  )rV   rû  r‰  rm   r›   rG  r0  rø   r‹  rŠ  rí   s              rD   Útest_quiescentCallbackThrowsÚ6HTTP11ClientProtocolTests.test_quiescentCallbackThrows/  s  € ò	&ô +×<Ò<¸TÔCUÓVˆä#Ó%ˆ	Ü'¨Ó1ˆØ×Ñ 	Ô*à"×*Ñ*Ü�F˜D¤.°$À4ÑHó
ˆð 	×ÑÐUÔVàˆØ×#Ñ# F§M¡MÔ2Ø˜!‘9ˆÜ+Ó-ˆØ×Ñ˜\Ô*Ø×!Ñ!×&Ñ&¤|Ô4à×Ñ˜!œS Ó-Ô.Ø˜A‘ˆØ�-Ñ ˆØ×Ñ˜aŸg™gÔ'8Ô9à×ÑÔ0Ô1Ø�‰˜	×/Ñ/Õ0rC   c                 ó  • [        5       n[        5       nUR                  U5        UR                  [	        SS[
        S5      5      nUR                  5         U R                  UR                  5        [        X[        [        /5      $ )zà
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+   rk   ÚcancelrÊ   Údisconnectedr^   r1   r   rd  s       rD   Útest_cancelBeforeResponseÚ3HTTP11ClientProtocolTests.test_cancelBeforeResponseR  sp   € ô $Ó%ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø×!Ñ!¤'¨&°$¼ÈÓ"MÓNˆØ�‰ŒØ�‰˜	×.Ñ.Ô/Ü*ØÔ/´.Ð1Aó
ð 	
rC   c                 ó(  • [        5       n[        5       nUR                  U5        UR                  [	        SS[
        S5      5      nUR                  S5        UR                  5         U R                  UR                  5        [        X[        /5      $ )zÙ
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+   rk   r™   rª  rÊ   r«  ra   r   rd  s       rD   Útest_cancelDuringResponseÚ3HTTP11ClientProtocolTests.test_cancelDuringResponsec  sw   € ô $Ó%ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø×!Ñ!¤'¨&°$¼ÈÓ"MÓNˆØ×ÑÐ4Ô5Ø�‰ŒØ�‰˜	×.Ñ.Ô/Ü# D´>Ð2BÓCÐCrC   c                 ó°  ^^^• [        5       n[        5       nUR                  U5        [        U5      mSS0mU4S jmUU4S jnUTl        UR                  [        SS[        T5      5      nTR                  R                  S5        UR                  5         U R                  UR                  5        U R                  TS   5        [        X[        /5      $ )zè
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                 ó   >• STS'   g )NTr²  r;   )r�  ÚnonLocals    €rD   rª  ÚJHTTP11ClientProtocolTests.assertCancelDuringBodyProduction.<locals>.cancel�  s   ø€ Ø$(ˆH�[Ò!rC   c                 óJ   >• U Tl         [        T5      Tl        TR                  $ rx   ©Úconsumerr   r  )r¸  rª  Úproducers    €€rD   ÚstartProducingÚRHTTP11ClientProtocolTests.assertCancelDuringBodyProduction.<locals>.startProducing„  s$   ø€ Ø (ˆHÔÜ (¨Ó 0ˆHÔØ×$Ñ$Ð$rC   ó   POSTó   /bars   xxxxx)r   r)   r—   ÚStringProducerrº  rý   r+   rk   r¸  rÌ  rª  rÊ   r«  rc   r   )	rV   ÚproducerLengthrm   r›   rº  r0  rª  r´  r¹  s	         @@@rD   Ú assertCancelDuringBodyProductionÚ:HTTP11ClientProtocolTests.assertCancelDuringBodyProductions  s¶   ú€ ô $Ó%ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ü! .Ó1ˆà Ð'ˆõ	)ö	%ð
 #1ˆÔà×!Ñ!¤'¨'°7¼NÈHÓ"UÓVˆØ×Ñ×Ñ Ô)Ø�‰ŒØ�‰˜	×.Ñ.Ô/Ø�‰˜ Ñ-Ô.Ü,¨T¼NÐ;KÓLÐLrC   c                 ó$   • U R                  S5      $ )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À  ry   s    rD   Útest_cancelDuringBodyProductionÚ9HTTP11ClientProtocolTests.test_cancelDuringBodyProduction’  s   € ð ×4Ñ4°RÓ8Ð8rC   c                 ó,   • U R                  [        5      $ )zÿ
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   ry   s    rD   Ú&test_cancelDuringChunkedBodyProductionÚ@HTTP11ClientProtocolTests.test_cancelDuringChunkedBodyProduction›  s   € ð ×4Ñ4´^ÓDÐDrC   )r›   rm   rx   ))r=   r>   r?   r@   rA   rÑ  rÔ  rà  rå  rñ  rø  rÿ  r  r  r  r  r  r3  r8  rA  rH  rL  rP  rU  r[  ra  re  rh  r{  rŒ  r“  r™  rž  r¡  r§  r¬  r¯  rÀ  rÄ  rÇ  rB   r;   rC   rD   rÏ  rÏ  <  sÈ   † ñò
5ò@òòòò4Lô ò@KòJò
ò0ò.ò$0òd?ò4ò@'òR6ò:
ò@ò8Mò%ò*=òGò 80òt7;òr,?ò\<ò41ò>1ò2!1òF
ò"Dò Mò>9õErC   rÏ  c                   ó:   • \ rS rSrSrSrS rS rS rS r	S r
S	rg
)r¾  i¥  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                 ó   • Xl         g rx   )r  )rV   r  s     rD   Ú__init__ÚStringProducer.__init__µ  s   € Ø�rC   c                 óD   • Xl         [        5       U l        U R                  $ rx   r·  )rV   r¸  s     rD   rº  ÚStringProducer.startProducing¸  s   € Ø ŒÜ ›
ˆŒØ�}‰}ÐrC   c                 ó   • SU l         g r
  rÁ  ry   s    rD   ÚstopProducingÚStringProducer.stopProducing½  rÅ  rC   c                 ó   • g rx   r;   ry   s    rD   ÚpauseProducingÚStringProducer.pauseProducingÀ  ó   € àrC   c                 ó   • g rx   r;   ry   s    rD   ÚresumeProducingÚStringProducer.resumeProducingÄ  rÕ  rC   )r¸  r  r  rÂ  N)r=   r>   r?   r@   rA   rÂ  rË  rº  rÐ  rÓ  r×  rB   r;   rC   rD   r¾  r¾  ¥  s'   † ñ
ð €Gòòò
òõrC   r¾  c                   ó²   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rSS jrS rS rS rS rS rSrg)ÚRequestTestsiÉ  z
Tests for L{Request}.
c                 ó"   • [        5       U l        g rx   )r   rm   ry   s    rD   rÑ  ÚRequestTests.setUpÎ  s   € Ü(Ó*ˆ�rC   c                 ó®   • [        SS[        S5      R                  U R                  5        U R	                  U R                  R                  5       S5        g)zS
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+   rk   r¾  rm   rP   r±   ry   s    rD   Útest_sendSimplestRequestÚ%RequestTests.test_sendSimplestRequestÑ  sD   € ô
 	�˜œn¨dÓ3×;Ñ;¸D¿N¹NÔKØ×ÑØ�N‰N× Ñ Ó"ðõ	
rC   c                 ó°   • [        SS[        SSS9nUR                  U R                  5        U R	                  U R                  R                  5       S5        g)z?
A pesistent request does not send 'Connection: close' header.
rô   rõ   NTr„  s%   GET / HTTP/1.1
Host: example.com

rÞ  )rV   Úreqs     rD   Ú"test_sendSimplestPersistentRequestÚ/RequestTests.test_sendSimplestPersistentRequestß  sG   € ô �f˜d¤N°DÀTÑJˆØ�‰�D—N‘NÔ#Ø×ÑØ�N‰N× Ñ Ó"ØBõ	
rC   c                 óv  • [        SS/S/S.5      n[        SSUS5      R                  U R                  5        U R                  R	                  5       R                  S5      nU R                  US	   S
5        U R                  USS SS/5        US		 USS2	 UR                  5         U R                  U/ SQ5        g)zN
L{Request.writeTo} formats header data and writes it to the given
transport.
r§   rÀ   rI   ©r*  rH   rô   ó   /fooNrÚ   r   ó   GET /foo HTTP/1.1éþÿÿÿrC   )ó   Connection: closes   Host: example.comr¬   r¿   )r3   r+   r¾  rm   r±   ÚsplitrP   Úsort)rV   rÂ   Úliness      rD   Útest_sendRequestHeadersÚ$RequestTests.test_sendRequestHeadersê  s°   € ô
  f¨fÐ%5ÀÐ@PÑQÓRˆÜ�˜ ¨$Ó/×7Ñ7¸¿¹ÔGØ—‘×$Ñ$Ó&×,Ñ,¨WÓ5ˆØ×Ñ˜˜q™Ð#7Ô8Ø×Ñ˜˜r˜s˜ c¨3 ZÔ0Ø�!ˆH�e˜B™C�jØ�
‰
ŒØ×ÑØÚVõ	
rC   c                 óª  • [          HÉ  n[        U/S/S.5      n[        5       n[        SSUS5      R	                  U5        UR                  5       R                  S5      nU R                  US   S5        U R                  US	S S
S
/5        US	 US	S2	 UR                  S5        UR                  S5        U R                  US[        -   /5        MË     g)zM
Linear whitespace in request header values is replaced with a
single space.
s   example.invalidræ  rô   rç  NrÚ   r   rè  ré  rC   rê  s   Host: example.invalids   X-Foo: )
r6   r3   r   r+   r¾  r±   rë  rP   Úremover7   )rV   Ú	componentrÂ   rm   rí  s        rD   Ú-test_sanitizeLinearWhitespaceInRequestHeadersÚ:RequestTests.test_sanitizeLinearWhitespaceInRequestHeadersû  sË   € ÷
 9ˆIÜ¨)¨Ð@RÐ?SÑTÓUˆGÜ'Ó)ˆIÜ�F˜G W¨dÓ3×;Ñ;¸IÔFØ—O‘OÓ%×+Ñ+¨GÓ4ˆEØ×Ñ˜U 1™XÐ';Ô<Ø×Ñ˜U 2 3˜Z¨#¨s¨Ô4Ø�a�˜% ¡˜*Ø�L‰LÐ-Ô.Ø�L‰LÐ1Ô2Ø×Ñ˜U Z´.Ñ%@Ð$AÖBò 9rC   c                 ó  • [        [        5      n[        SS[        U5      nUR	                  U R
                  5        U R                  UR                  S5        U R                  U R
                  R                  U5        U R                  U R
                  R                  5        U R                  U R
                  R                  5       S5        U R
                  R                  5         UR                  R                  S5        UR                  R                  S5        UR                   R#                  S5        U R                  U R
                  R                  S5        U R                  U R
                  R                  5       S5        g)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.
r¼  r½  NsX   POST /bar HTTP/1.1
Connection: close
Transfer-Encoding: chunked
Host: example.com

s   xxxs   yyyyyyyyyyyyyyys!   3
xxx
f
yyyyyyyyyyyyyyy
0

)r¾  r   r+   rk   r¾  rm   ÚassertNotIdenticalr¸  r-  r¹  rÊ   Ú	streamingrP   r±   ÚclearrÌ  r  rû  ©rV   r¹  rý   s      rD   Útest_sendChunkedRequestBodyÚ(RequestTests.test_sendChunkedRequestBody  s   € ô "¤.Ó1ˆÜ˜' 7¬N¸HÓEˆØ�‰˜Ÿ™Ô'à×Ñ × 1Ñ 1°4Ô8Ø×Ñ˜TŸ^™^×4Ñ4°hÔ?Ø�‰˜Ÿ™×0Ñ0Ô1à×ÑØ�N‰N× Ñ Ó"ðô	
ð 	�‰×ÑÔà×Ñ×Ñ Ô)Ø×Ñ×Ñ 	Ô*Ø×Ñ×"Ñ" 4Ô(Ø×Ñ˜TŸ^™^×4Ñ4°dÔ;Ø×ÑØ�N‰N× Ñ Ó"ØPõ	
rC   c                 óT  ^ • [        [        5      n[        SS[        U5      nUR	                  T R
                  5      nT R
                  R                  5         UR                  R                  [        5       5        U 4S jnT R                  U[        5      nUR                  U5        U$ )ab  
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.
r¼  r½  c                 ó¦   >• TR                  TR                  R                  5       S5        TR                  TR                  R                  S 5        g rØ  )rP   rm   r±   r-  r¹  rÚ  s    €rD   rW   ÚCRequestTests.test_sendChunkedRequestBodyWithError.<locals>.cbFailed<  s:   ø€ Ø×Ñ˜TŸ^™^×1Ñ1Ó3°SÔ9Ø× Ñ  §¡×!8Ñ!8¸$Õ?rC   )r¾  r   r+   rk   r¾  rm   rø  r  rü  r9   rY   rZ   )rV   r¹  rý   ÚwriteDeferredrW   r]   s   `     rD   Ú$test_sendChunkedRequestBodyWithErrorÚ1RequestTests.test_sendChunkedRequestBodyWithError-  s…   ø€ ô "¤.Ó1ˆÜ˜' 7¬N¸HÓEˆØŸ™¨¯©Ó7ˆØ�‰×ÑÔØ×Ñ×!Ñ!Ô"4Ó"6Ô7õ	@ð ×Ñ˜}Ô.@ÓAˆØ	�‰�hÔØˆrC   c                 óÖ  • [        S5      n[        SS[        U5      nUR                  U R                  5        U R                  UR                  S5        U R                  U R                  R                  U5        U R                  U R                  R                  5        U R                  U R                  R                  5       S5        U R                  R                  5         UR                  R                  S5        UR                  R!                  S5        U R                  U R                  R                  S5        U R                  U R                  R                  5       S5        g)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.
é   r¼  r½  NsO   POST /bar HTTP/1.1
Connection: close
Content-Length: 3
Host: example.com

rv  )r¾  r+   rk   r¾  rm   rö  r¸  r-  r¹  rÊ   r÷  rP   r±   rø  rÌ  r  rû  rù  s      rD   Útest_sendRequestBodyWithLengthÚ+RequestTests.test_sendRequestBodyWithLengthD  s  € ô " !Ó$ˆÜ˜' 7¬N¸HÓEˆØ�‰˜Ÿ™Ô'à×Ñ × 1Ñ 1°4Ô8Ø×Ñ˜TŸ^™^×4Ñ4°hÔ?Ø�‰˜Ÿ™×0Ñ0Ô1à×ÑØ�N‰N× Ñ Ó"ðô	
ð 	�‰×ÑÔà×Ñ×Ñ Ô'Ø×Ñ×"Ñ" 4Ô(Ø×Ñ˜TŸ^™^×4Ñ4°dÔ;Ø×Ñ˜Ÿ™×-Ñ-Ó/°Õ8rC   c                 ó¸   • [        US[        S5      nUR                  U R                  5        U R	                  U R                  R                  5       US-   5        g)zò
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}
rç  NsK    /foo HTTP/1.1
Connection: close
Content-Length: 0
Host: example.com

rÞ  )rV   rÆ  rý   s      rD   Ú_sendRequestEmptyBodyWithLengthÚ,RequestTests._sendRequestEmptyBodyWithLengtha  sO   € ô ˜& '¬>¸4Ó@ˆØ�‰˜Ÿ™Ô'à×ÑØ�N‰N× Ñ Ó"Øð ñ õ	
rC   c                 ó&   • U R                  S5        g)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©r  ry   s    rD   Útest_sendPUTRequestEmptyBodyÚ)RequestTests.test_sendPUTRequestEmptyBodyv  s   € ð 	×,Ñ,¨VÕ4rC   c                 ó&   • U R                  S5        g)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.
r¼  Nr
  ry   s    rD   Útest_sendPOSTRequestEmptyBodyÚ*RequestTests.test_sendPOSTRequestEmptyBody~  s   € ð 	×,Ñ,¨WÕ5rC   c                 óV  • [        S5      n[        SS[        U5      nUR                  U R                  5      nUR
                  R                  S5        UR                  R                  S5        U R                  U R                  R                  S5        U R                  U[        5      $ )zè
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.
r  r¼  r½  ó   abN)r¾  r+   rk   r¾  rm   r¸  rÌ  r  rû  r-  r¹  rY   r'   ©rV   r¹  rý   rÿ  s       rD   Ú#test_sendRequestBodyWithTooFewBytesÚ0RequestTests.test_sendRequestBodyWithTooFewBytes†  s…   € ô " !Ó$ˆÜ˜' 7¬N¸HÓEˆØŸ™¨¯©Ó7ˆØ×Ñ×Ñ Ô&Ø×Ñ×"Ñ" 4Ô(Ø×Ñ˜TŸ^™^×4Ñ4°dÔ;Ø×!Ñ! -´ÓAÐArC   c                 óþ  ^ ^^• [        S5      m[        SS[        T5      nUR                  T R                  5      nTR
                  R                  S5        T R                  TR                  5        TR
                  R                  S5        T R                  TR                  5        T R                  T R                  R                  S5        UUU 4S jnT R                  U[        5      nUR                  U5        U$ )aï  
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.
r  r¼  r½  r  ó   cdNc                 óH  >• TR                  TR                  R                  5       S5        TR                  R                  5         TR	                  [
        TR                  R                  S5        T" T5        TR                  TR                  R                  5       S5        g )NsQ   POST /bar HTTP/1.1
Connection: close
Content-Length: 3
Host: example.com

abs   efrC   )rP   rm   r±   rø  rŠ   r    r¸  rÌ  )rë   Úfinisherr¹  rV   s    €€€rD   rW   ÚCRequestTests._sendRequestBodyWithTooManyBytesTest.<locals>.cbFailedµ  sƒ   ø€ ð ×ÑØ—‘×$Ñ$Ó&ðôð �N‰N× Ñ Ô"ð ×Ñœk¨8×+<Ñ+<×+BÑ+BÀEÔJñ
 �XÔð ×Ñ˜TŸ^™^×1Ñ1Ó3°SÕ9rC   )r¾  r+   rk   r¾  rm   r¸  rÌ  rÌ   rÂ  rÊ   r-  r¹  rY   r'   rZ   )rV   r  rý   rÿ  rW   r]   r¹  s   ``    @rD   Ú$_sendRequestBodyWithTooManyBytesTestÚ1RequestTests._sendRequestBodyWithTooManyBytesTest•  sÉ   ú€ ô " !Ó$ˆÜ˜' 7¬N¸HÓEˆØŸ™¨¯©Ó7ˆà×Ñ×Ñ Ô&ð 	×Ñ˜×)Ñ)Ô*à×Ñ×Ñ Ô&ð 	�‰˜×(Ñ(Ô)ð 	×Ñ˜TŸ^™^×4Ñ4°dÔ;÷	:ð: ×Ñ˜}¬oÓ>ˆØ	�‰�hÔØˆrC   c                 ó*   • S nU R                  U5      $ )úò
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                 ó:   • U R                   R                  S 5        g rx   ©r  rû  ©r¹  s    rD   r  ÚCRequestTests.test_sendRequestBodyWithTooManyBytes.<locals>.finisherÞ  ó   € Ø×Ñ×&Ñ& tÕ,rC   )r  ©rV   r  s     rD   Ú$test_sendRequestBodyWithTooManyBytesÚ1RequestTests.test_sendRequestBodyWithTooManyBytesÖ  s   € ò	-ð ×8Ñ8¸ÓBÐBrC   c                 ól   ^ ^• [         R                  " T [        5      mUU 4S jnT R                  U5      $ )r  c                 ó$  >• U R                   R                  [        5       5        TS   nTR                  SU5        US   nTR	                  UR
                  [        5        TR                  [        5      nTR                  [        U5      S5        g )Nr   r„  rh   )	r  rü  r9   r  r‡  r±   rˆ  rP   rQ   )r¹  rŠ  rí   rþ  r‰  rV   s       €€rD   r  ÚHRequestTests.test_sendRequestBodyErrorWithTooManyBytes.<locals>.finisherì  sv   ø€ Ø×Ñ×%Ñ%Ô&8Ó&:Ô;Ø ‘NˆEØ�M‰M˜-¨Ô/Ø�mÑ$ˆAØ×!Ñ! !§'¡'Ô+=Ô>Ø×+Ñ+Ô,>Ó?ˆFØ×ÑœS ›[¨!Õ,rC   )r   r…  r   r  )rV   r  r‰  s   ` @rD   Ú)test_sendRequestBodyErrorWithTooManyBytesÚ6RequestTests.test_sendRequestBodyErrorWithTooManyBytesã  s0   ù€ ô +×<Ò<¸TÔCUÓVˆö	-ð ×8Ñ8¸ÓBÐBrC   c                 óH  • [         R                  " U [        5      n[        S5      n[	        SS[
        U5      nUR                  U R                  5        UR                  R                  nUR                  R                  S5        UR                  R                  S5        UR                  [        5       5        US   nU R                  SU5        US   nU R!                  UR"                  [        5        U R%                  ['        U R)                  [        5      5      S5        g)	aZ  
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.
r  r¼  r½  rv  Nr   r„  rh   )r   r…  r   r¾  r+   rk   r¾  rm   r¸  Ú	_finishedrÌ  r  rû  rü  r9   r  r‡  r±   rP   rQ   rˆ  )rV   r‰  r¹  rý   ÚfinishedConsumingrŠ  rí   s          rD   Ú*test_sendRequestBodyErrorWithConsumerErrorÚ7RequestTests.test_sendRequestBodyErrorWithConsumerError÷  sä   € ô +×<Ò<¸TÔCUÓVˆÜ! !Ó$ˆÜ˜' 7¬N¸HÓEˆØ�‰˜Ÿ™Ô'à$×-Ñ-×7Ñ7Ðà×Ñ×Ñ Ô'Ø×Ñ×"Ñ" 4Ô(à×!Ñ!Ô"4Ó"6Ô7Ø˜A‘ˆØ�‰�m UÔ+Ø�-Ñ ˆØ×Ñ˜aŸg™gÔ'9Ô:Ø×Ñœ˜T×3Ñ3Ô4FÓGÓHÈ!ÕLrC   c                 óæ  • [        S5      n[        SS[        U5      nUR                  U R                  5      nUR
                  R                  S5        U" U5        U R                  U R                  R                  S5        U R                  R                  5         U R                  [        UR
                  R                  S5        U R                  U R                  R                  5       S5        U$ )z÷
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.
r  r¼  r½  r  Nr  rC   )r¾  r+   rk   r¾  rm   r¸  rÌ  r-  r¹  rø  rŠ   r    rP   r±   )rV   r  r¹  rý   rÿ  s        rD   Ú-_sendRequestBodyFinishedEarlyThenTooManyBytesÚ:RequestTests._sendRequestBodyFinishedEarlyThenTooManyBytes	  s·   € ô " !Ó$ˆÜ˜' 7¬N¸HÓEˆØŸ™¨¯©Ó7ˆà×Ñ×Ñ Ô&Ù�ÔØ×Ñ˜TŸ^™^×4Ñ4°dÔ;Ø�‰×ÑÔØ×Ñœ+ x×'8Ñ'8×'>Ñ'>ÀÔFØ×Ñ˜Ÿ™×-Ñ-Ó/°Ô5ØÐrC   c                 óR   • S nU R                  U R                  U5      [        5      $ )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                 ó:   • U R                   R                  S 5        g rx   r  r   s    rD   r  ÚPRequestTests.test_sendRequestBodyFinishedEarlyThenTooManyBytes.<locals>.finisher-	  r"  rC   )rY   r1  r'   r#  s     rD   Ú1test_sendRequestBodyFinishedEarlyThenTooManyBytesÚ>RequestTests.test_sendRequestBodyFinishedEarlyThenTooManyBytes%	  s-   € ò	-ð ×!Ñ!Ø×>Ñ>¸xÓHÜó
ð 	
rC   c                 óR   • S nU R                  U R                  U5      [        5      $ )a  
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                 óJ   • U R                   R                  [        5       5        g rx   )r  rü  r9   r   s    rD   r  ÚORequestTests.test_sendRequestBodyErroredEarlyThenTooManyBytes.<locals>.finisher=	  s   € Ø×Ñ×%Ñ%Ô&8Ó&:Õ;rC   )rY   r1  r9   r#  s     rD   Ú0test_sendRequestBodyErroredEarlyThenTooManyBytesÚ=RequestTests.test_sendRequestBodyErroredEarlyThenTooManyBytes5	  s-   € ò	<ð ×!Ñ!Ø×>Ñ>¸xÓHÜó
ð 	
rC   Nc                 ó’  • [        [        5      n[        SS[        U5      nUR	                  U R
                  5      nUR                  R                  U5        U R
                  R                  5         U R                  [        UR                  R                  S5        U R                  U R
                  R                  5       S5        U$ )zê
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.
r¼  r½  rð   rC   )r¾  r   r+   rk   r¾  rm   r  rû  rø  rŠ   r    r¸  rÌ  rP   r±   )rV   Ú_withr¹  rý   rÿ  s        rD   Ú0test_sendChunkedRequestBodyFinishedThenWriteMoreÚ=RequestTests.test_sendChunkedRequestBodyFinishedThenWriteMoreE	  s•   € ô "¤.Ó1ˆÜ˜' 7¬N¸HÓEˆØŸ™¨¯©Ó7ˆØ×Ñ×"Ñ" 5Ô)Ø�‰×ÑÔà×Ñœ+ x×'8Ñ'8×'>Ñ'>ÀÔGØ×Ñ˜Ÿ™×-Ñ-Ó/°Ô5ØÐrC   c                 ór   • U R                  [        [        5       5      5      nU R                  U[        5      $ )zü
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   rY   )rV   r]   s     rD   Ú9test_sendChunkedRequestBodyFinishedWithErrorThenWriteMoreÚFRequestTests.test_sendChunkedRequestBodyFinishedWithErrorThenWriteMoreV	  s6   € ð ×AÑAÜÔ&Ó(Ó)ó
ˆð ×!Ñ! !Ô%7Ó8Ð8rC   c                 óö  • [        S5      n[        SS[        U5      nUR                  U R                  5      nU R                  U R                  R                  U5        U R                  U R                  R                  5        UR                  R                  S5        U R                  U R                  R                  5       S5        U R                  U R                  R                  5        UR                  R!                  [#        [%        5       5      5        U R                  U R                  R                  5        U R                  U R                  R                  S5        U R'                  U[$        5      $ )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}.
é   r¼  r½  r  sQ   POST /bar HTTP/1.1
Connection: close
Content-Length: 5
Host: example.com

abN)r¾  r+   rk   r¾  rm   r-  r¹  rÊ   r÷  r¸  rÌ  rP   r±   rÌ   rï  r  rü  r   r9   rY   r  s       rD   Útest_sendRequestBodyWithErrorÚ*RequestTests.test_sendRequestBodyWithErrorb	  s  € ô " !Ó$ˆÜ˜' 7¬N¸HÓEˆØŸ™¨¯©Ó7ˆð 	×Ñ˜TŸ^™^×4Ñ4°hÔ?Ø�‰˜Ÿ™×0Ñ0Ô1à×Ñ×Ñ Ô&Ø×ÑØ�N‰N× Ñ Ó"ðô	
ð 	×Ñ˜Ÿ™×5Ñ5Ô6Ø×Ñ×!Ñ!¤'Ô*<Ó*>Ó"?Ô@ð 	×Ñ˜Ÿ™×5Ñ5Ô6ð 	×Ñ˜TŸ^™^×4Ñ4°dÔ;à×!Ñ! -Ô1CÓDÐDrC   c           	      ó¼  • [        SS[        0 5      S5      nU R                  [        UR                  U R
                  5        U R                  U R
                  R                  5       S5        [        SS[        SSS/05      S5      nU R                  [        UR                  U R
                  5        U R                  U R
                  R                  5       S5        g)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õ   NrC   s   HostrI   s   example.org)r+   r3   rŠ   r   r¾  rm   rP   r±   )rV   rý   s     rD   Útest_hostHeaderRequiredÚ$RequestTests.test_hostHeaderRequired‰	  s«   € ô
 ˜& $¬°«°TÓ:ˆØ×Ñœ* g§o¡o°t·~±~ÔFØ×Ñ˜Ÿ™×-Ñ-Ó/°Ô5äØ�Dœ' 7¨^¸^Ð,LÐ"MÓNÐPTó
ˆð 	×Ñœ* g§o¡o°t·~±~ÔFØ×Ñ˜Ÿ™×-Ñ-Ó/°Õ5rC   c                 ó   • [        S5      n[        SS[        U5      nUR                  U R                  5        U R                  UR                  5        UR                  5         U R                  UR                  5        g)zK
L{Request.stopWriting} calls its body producer's C{stopProducing}
method.
r  rô   rõ   N)	r¾  r+   rk   r¾  rm   rÌ   rÂ  rÃ  rÊ   rù  s      rD   Útest_stopWritingÚRequestTests.test_stopWriting˜	  s`   € ô
 " !Ó$ˆÜ˜& $¬¸ÓAˆØ�‰˜Ÿ™Ô'Ø×Ñ˜×)Ñ)Ô*Ø×ÑÔØ�‰˜×(Ñ(Õ)rC   c                 óæ  • [         R                  " U [        5      n[        S5      nS nX2l        [        SS[        U5      nUR                  U R                  5        UR                  5         U R                  [        U R                  [        5      5      S5        U R                  S[        U5      5        US   nU R                  SU5        US   nU R!                  UR"                  [        5        g)	z~
If the body producer's C{stopProducing} method raises an exception,
L{Request.stopWriting} logs it and does not re-raise it.
r  c                  ó   • [        S5      e©NzstopProducing is bustedr�  r;   rC   rD   ÚbrokenStopProducingÚBRequestTests.test_brokenStopProducing.<locals>.brokenStopProducing¬	  s   € Ü$Ð%>Ó?Ð?rC   rô   rõ   rh   r   r„  N)r   r…  r   r¾  rÐ  r+   rk   r¾  rm   rÃ  rP   rQ   rˆ  r9   r†  r  r‡  r±   )rV   r‰  r¹  rQ  rý   rŠ  rí   s          rD   Útest_brokenStopProducingÚ%RequestTests.test_brokenStopProducing¤	  sÇ   € ô
 +×<Ò<¸TÔCUÓVˆÜ! !Ó$ˆò	@ð "5Ôä˜& $¬¸ÓAˆØ�‰˜Ÿ™Ô'Ø×ÑÔØ×Ñœ˜T×3Ñ3Ô4FÓGÓHÈ!ÔLØ×Ñ˜!œS Ó-Ô.Ø˜A‘ˆØ�‰�m UÔ+Ø�-Ñ ˆØ×Ñ˜aŸg™gÔ'9Õ:rC   rl   rx   )r=   r>   r?   r@   rA   rÑ  rß  rã  rî  ró  rú  r   r  r  r  r  r  r  r$  r)  r.  r1  r6  r;  r?  rB  rF  rI  rL  rS  rB   r;   rC   rD   rÚ  rÚ  É  s�   † ñò+ò
ò	
ò
ò"Cò"
òBò.9ò:
ò*5ò6òBò?òBCòCò(Mò6ò&
ò 
ô ò"
9ò%EòN6ò
*õ;rC   rÚ  c                   óL   • \ rS rSrSrS rS rS rSS jrS r	S r
S	 rS
 rSrg)ÚLengthEnforcingConsumerTestsi¼	  z'
Tests for L{LengthEnforcingConsumer}.
c                 óÀ   • [        5       U l        [        S5      U l        [	        5       U l        [        U R                  U R
                  U R                  5      U l        g )NrÃ  )r   r0  r¾  r¹  r   rm   r#   Úenforcerry   s    rD   rÑ  Ú"LengthEnforcingConsumerTests.setUpÁ	  s@   € Ü“jˆŒÜ& rÓ*ˆŒÜ(Ó*ˆŒÜ/Ø�M‰M˜4Ÿ>™>¨4¯;©;ó
ˆ�rC   c                 óL  • U R                   R                  S5        U R                  U R                  R	                  5       S5        U R                  R                  5         U R                   R                  S5        U R                  U R                  R	                  5       S5        g)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.
rv  s   defN)rX  rÌ  rP   rm   r±   rø  ry   s    rD   Ú
test_writeÚ'LengthEnforcingConsumerTests.test_writeÉ	  sr   € ð 	�‰×Ñ˜FÔ#Ø×Ñ˜Ÿ™×-Ñ-Ó/°Ô8Ø�‰×ÑÔØ�‰×Ñ˜FÔ#Ø×Ñ˜Ÿ™×-Ñ-Ó/°Õ8rC   c                 óŽ   • U R                   R                  S5        U R                  [        U R                   R                  5        g)z”
L{LengthEnforcingConsumer._noMoreWritesExpected} raises
L{WrongBodyLength} if it is called before the indicated number of bytes
have been written.
s	   xxxxxxxxxN)rX  rÌ  rŠ   r'   Ú_noMoreWritesExpectedry   s    rD   Útest_finishedEarlyÚ/LengthEnforcingConsumerTests.test_finishedEarlyÕ	  s0   € ð 	�‰×Ñ˜HÔ%Ø×Ñœ/¨4¯=©=×+NÑ+NÕOrC   c                 ó„  • U R                   R                  S5        U R                  U R                  R                  5        U R                   R                  S5        U R                  U R                  R                  5        U(       a  U R                   R                  5         U R                  U R                  [        5      $ )a  
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)
rX  rÌ  rÌ   r¹  rÂ  rÊ   r^  rY   r0  r'   )rV   Ú_unregisterAfters     rD   Útest_writeTooManyÚ.LengthEnforcingConsumerTests.test_writeTooManyÞ	  s€   € ð 	�‰×Ñ˜IÔ&Ø×Ñ˜Ÿ™×.Ñ.Ô/Ø�‰×Ñ˜DÔ!Ø�‰˜Ÿ™×-Ñ-Ô.ÞØ�M‰M×/Ñ/Ô1Ø×!Ñ! $§+¡+¬Ó?Ð?rC   c                 óX  • U R                   R                  S5        U R                   R                  5         U R                  U R                  R
                  5        U R                  [        U R                   R                  S5        U R                  U R                  R
                  5        g)z²
If L{LengthEnforcingConsumer.write} is called after
L{LengthEnforcingConsumer._noMoreWritesExpected}, it calls the
producer's C{stopProducing} method and raises L{ExcessWrite}.
rb  rc  N)	rX  rÌ  r^  rÌ   r¹  rÂ  rŠ   r    rÊ   ry   s    rD   Útest_writeAfterNoMoreExpectedÚ:LengthEnforcingConsumerTests.test_writeAfterNoMoreExpectedî	  sp   € ð 	�‰×Ñ˜IÔ&Ø�‰×+Ñ+Ô-Ø×Ñ˜Ÿ™×.Ñ.Ô/Ø×Ñœ+ t§}¡}×':Ñ':¸DÔAØ�‰˜Ÿ™×-Ñ-Õ.rC   c                 ó$   • U R                  S5      $ )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)re  ry   s    rD   Útest_finishedLateÚ.LengthEnforcingConsumerTests.test_finishedLateú	  s   € ð ×%Ñ% dÓ+Ð+rC   c                 óŽ   • U R                   R                  S5        U R                  U R                   R                  5       S5        g)z‡
If L{LengthEnforcingConsumer._noMoreWritesExpected} is called after
the correct number of bytes have been written it returns L{None}.
rb  N)rX  rÌ  r-  r^  ry   s    rD   Útest_finishedÚ*LengthEnforcingConsumerTests.test_finished
  s3   € ð
 	�‰×Ñ˜IÔ&Ø×Ñ˜TŸ]™]×@Ñ@ÓBÀDÕIrC   c                 ó„   ^ • U 4S jnUT R                   l        U 4S jnT R                  5       nUR                  U5        U$ )a  
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                  óX   >• [         R                  T R                  5        [        S5      erP  )r¾  rÐ  r¹  r9   ry   s   €rD   rQ  ÚRLengthEnforcingConsumerTests.test_stopProducingRaises.<locals>.brokenStopProducing
  s!   ø€ Ü×(Ñ(¨¯©Ô7Ü$Ð%>Ó?Ð?rC   c                 ób   >• TR                  [        TR                  [        5      5      S5        g )Nrh   )rP   rQ   rˆ  r9   rÚ  s    €rD   Ú
cbFinishedÚILengthEnforcingConsumerTests.test_stopProducingRaises.<locals>.cbFinished
  s$   ø€ Ø×ÑœS ×!7Ñ!7Ô8JÓ!KÓLÈaÕPrC   )r¹  rÐ  re  rZ   )rV   rQ  rt  r]   s   `   rD   Útest_stopProducingRaisesÚ5LengthEnforcingConsumerTests.test_stopProducingRaises

  s>   ø€ õ	@ð ':ˆ�‰Ô#õ	Qð ×"Ñ"Ó$ˆØ	�‰�jÔ!ØˆrC   )rX  r¹  r0  rm   N)F)r=   r>   r?   r@   rA   rÑ  r[  r_  re  rh  rk  rn  rv  rB   r;   rC   rD   rV  rV  ¼	  s2   † ñò
ò
9òPô@ò 
/ò,òJõrC   rV  c                   ó*   • \ rS rSrSrS rS rS rSrg)ÚRequestBodyConsumerTestsi!
  z”
Tests for L{ChunkedEncoder} which sits between an L{ITransport} and a
request/response body producer and chunked encodes everything written to
it.
c           	      ód   • U R                  [        [        [        [	        5       5      5      5        g)z3
L{ChunkedEncoder} instances provide L{IConsumer}.
N)rÊ   r   r   r   r   ry   s    rD   Útest_interfaceÚ'RequestBodyConsumerTests.test_interface(
  s   € ð 	�‰œ¤Y´¼Ó?PÓ0QÓRÕSrC   c                 ó  • [        5       n[        U5      nUR                  S5        U R                  UR	                  5       S5        UR                  5         UR                  S5        U R                  UR	                  5       S5        g)ze
L{ChunkedEncoder.write} writes to the transport the chunked encoded
form of the bytes passed to it.
rð   rO  s   xxxxxxxxxxxxxxxxs   10
xxxxxxxxxxxxxxxx
N)r   r   rÌ  rP   r±   rø  )rV   rm   Úencoders      rD   r[  Ú#RequestBodyConsumerTests.test_write.
  sg   € ô
 $Ó%ˆ	Ü  Ó+ˆØ�‰�fÔØ×Ñ˜Ÿ™Ó*¨OÔ<Ø�‰ÔØ�‰�iÔ Ø×Ñ˜Ÿ™Ó*Ð,KÕLrC   c                 ól  • [        5       n[        5       n[        U5      nUR                  US5        U R	                  UR
                  U5        U R                  UR                  5        UR                  5         U R	                  UR
                  S5        U R                  UR                  5       S5        g)zÝ
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-  r¹  rÊ   r÷  ÚunregisterProducerrP   r±   )rV   rm   r¹  r~  s       rD   Útest_producerRegistrationÚ2RequestBodyConsumerTests.test_producerRegistration;
  sŽ   € ô $Ó%ˆ	Ü“8ˆÜ  Ó+ˆØ× Ñ  ¨4Ô0Ø×Ñ˜Y×/Ñ/°Ô:Ø�‰˜	×+Ñ+Ô,Ø×"Ñ"Ô$Ø×Ñ˜Y×/Ñ/°Ô6Ø×Ñ˜Ÿ™Ó*¨LÕ9rC   r;   N)	r=   r>   r?   r@   rA   r{  r[  rƒ  rB   r;   rC   rD   ry  ry  !
  s   † ñòTòMõ:rC   ry  c                   óB   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
rg)ÚTransportProxyProducerTestsiM
  zb
Tests for L{TransportProxyProducer} which proxies the L{IPushProducer}
interface of a transport.
c                 óT   • U R                  [        [        [        S5      5      5        g)z?
L{TransportProxyProducer} instances provide L{IPushProducer}.
N)rÊ   r   r   r&   ry   s    rD   r{  Ú*TransportProxyProducerTests.test_interfaceS
  s   € ð 	�‰œ¤]Ô4JÈ4Ó4PÓQÕRrC   c                 ó¾   • [        5       n[        U5      nU R                  UR                  U5        UR	                  5         U R                  UR                  S5        g)zf
L{TransportProxyProducer.stopProxying} drops the reference to the
wrapped L{IPushProducer} provider.
N)r   r&   r-  rY  ÚstopProxying©rV   rm   Úproxys      rD   Ú%test_stopProxyingUnreferencesProducerÚATransportProxyProducerTests.test_stopProxyingUnreferencesProducerY
  sJ   € ô
 $Ó%ˆ	Ü& yÓ1ˆØ×Ñ˜UŸ_™_¨iÔ8Ø×ÑÔØ×Ñ˜UŸ_™_¨dÕ3rC   c                 óv  • [        5       nUR                  5         [        U5      nU R                  UR                  S5        UR                  5         U R                  UR                  S5        UR                  5         UR                  5         UR                  5         U R                  UR                  S5        g)z�
L{TransportProxyProducer.resumeProducing} calls the wrapped
transport's C{resumeProducing} method unless told to stop proxying.
rD  r  N)r   rÓ  r&   rP   r  r×  rŠ  r‹  s      rD   Útest_resumeProducingÚ0TransportProxyProducerTests.test_resumeProducingd
  s–   € ô
 $Ó%ˆ	Ø× Ñ Ô"ä& yÓ1ˆà×Ñ˜×0Ñ0°(Ô;Ø×ÑÔà×Ñ˜×0Ñ0°+Ô>à× Ñ Ô"Ø×ÑÔð 	×ÑÔØ×Ñ˜×0Ñ0°(Õ;rC   c                 óV  • [        5       n[        U5      nU R                  UR                  S5        UR	                  5         U R                  UR                  S5        UR                  5         UR                  5         UR	                  5         U R                  UR                  S5        g)z
L{TransportProxyProducer.pauseProducing} calls the wrapped transport's
C{pauseProducing} method unless told to stop proxying.
r  rD  N)r   r&   rP   r  rÓ  r×  rŠ  r‹  s      rD   Útest_pauseProducingÚ/TransportProxyProducerTests.test_pauseProducingz
  sŠ   € ô
 $Ó%ˆ	ä& yÓ1ˆà×Ñ˜×0Ñ0°+Ô>Ø×ÑÔà×Ñ˜×0Ñ0°(Ô;à×!Ñ!Ô#Ø×ÑÔð 	×ÑÔØ×Ñ˜×0Ñ0°+Õ>rC   c                 ó`  • [        5       n[        U5      nU R                  UR                  S5        UR	                  5         U R                  UR                  S5        [        5       n[        U5      nUR                  5         UR	                  5         U R                  UR                  S5        g)z}
L{TransportProxyProducer.stopProducing} calls the wrapped transport's
C{stopProducing} method unless told to stop proxying.
r  rÂ  N)r   r&   rP   r  rÐ  rŠ  r‹  s      rD   Útest_stopProducingÚ.TransportProxyProducerTests.test_stopProducing�
  sŽ   € ô
 $Ó%ˆ	Ü& yÓ1ˆà×Ñ˜×0Ñ0°+Ô>Ø×ÑÔà×Ñ˜×0Ñ0°)Ô<ä#Ó%ˆ	Ü& yÓ1ˆØ×ÑÔØ×ÑÔà×Ñ˜×0Ñ0°+Õ>rC   c                 ól  • [        5       n[        5       nUR                  U5        X!l        [	        U5      nU R                  UR                  5        U R                  UR                  S5        UR                  5         U R                  UR                  S5        U R                  UR                  5        g)z[
L{TransportProxyProducer.loseConnection} calls the wrapped transport's
C{loseConnection}.
r  N)r   r   r—   r›   r&   rÊ   Ú	connectedrP   r  ÚloseConnectionrÌ   ©rV   rm   r›   rŒ  s       rD   Ú test_loseConnectionWhileProxyingÚ<TransportProxyProducerTests.test_loseConnectionWhileProxying£
  s’   € ô
 5Ó6ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø%ÔÜ& yÓ1ˆà�‰˜	×+Ñ+Ô,Ø×Ñ˜×0Ñ0°+Ô>à×ÑÔð 	×Ñ˜×0Ñ0°+Ô>Ø×Ñ˜×,Ñ,Õ-rC   c                 ó  • [        5       n[        5       nUR                  U5        X!l        [	        U5      nUR                  5         U R                  UR                  5        UR                  5         U R                  UR                  5        g)zU
L{TransportProxyProducer.loseConnection} does nothing when the
proxy is not active.
N)	r   r   r—   r›   r&   rŠ  rÊ   r™  rš  r›  s       rD   Útest_loseConnectionNotProxyingÚ:TransportProxyProducerTests.test_loseConnectionNotProxying¸
  sp   € ô
 5Ó6ˆ	Ü'Ó)ˆØ×Ñ 	Ô*Ø%ÔÜ& yÓ1ˆØ×ÑÔØ�‰˜	×+Ñ+Ô,à×ÑÔð 	�‰˜	×+Ñ+Õ,rC   r;   N)r=   r>   r?   r@   rA   r{  r�  r�  r“  r–  rœ  rŸ  rB   r;   rC   rD   r†  r†  M
  s+   † ñò
Sò	4ò<ò,?ò*?ò(.õ*-rC   r†  c                   ór   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rSrg)ÚResponseTestsiË
  z
Tests for L{Response}.
c                 óh   • [        [        5       5      nU R                  [        [        U5      5        g)z-
L{Response} instances provide L{IResponse}.
N)rn   r   rÊ   r   r5   ©rV   rø   s     rD   Útest_verifyInterfaceÚ"ResponseTests.test_verifyInterfaceÐ
  s$   € ô )¬Ó):Ó;ˆØ�‰œ¤Y°Ó9Õ:rC   c                 ó@  ^• / m[        5       n " U4S jS[        5      nU" 5       n[        U5      nUR                  U5        Tu  nUR	                  5         U R                  UR                  S5        UR                  5         U R                  UR                  S5        g)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                   ó"   >• \ rS rSrU 4S jrSrg)Ú7ResponseTests.test_makeConnection.<locals>.SomeProtocolià
  c                 ó(   >• TR                  U5        g rx   r  )rV   r¹  Ú	producerss     €rD   r—   ÚFResponseTests.test_makeConnection.<locals>.SomeProtocol.makeConnectioná
  s   ø€ Ø× Ñ  Õ*rC   r;   N©r=   r>   r?   r@   r—   rB   )r«  s   €rD   ÚSomeProtocolr©  à
  s   ø† ÷+ð +rC   r®  rD  r  N)r   r   rn   r)  rÓ  rP   r  r×  )rV   rm   r®  r¸  rø   ÚtheProducerr«  s         @rD   Útest_makeConnectionÚ!ResponseTests.test_makeConnection×
  sŠ   ø€ ð ˆ	Ü#Ó%ˆ	÷	+œ8ô 	+ñ  “>ˆÜ(¨Ó3ˆØ×Ñ˜XÔ&Ø!‰ˆØ×"Ñ"Ô$Ø×Ñ˜×0Ñ0°(Ô;Ø×#Ñ#Ô%Ø×Ñ˜×0Ñ0°+Õ>rC   c                 óÌ   ^• / m " U4S jS[         5      nU" 5       n[        [        5       5      nUR                  U5        UR	                  S5        U R                  TS/5        g)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                   ó"   >• \ rS rSrU 4S jrSrg)Ú5ResponseTests.test_dataReceived.<locals>.ListConsumeriõ
  c                 ó(   >• TR                  U5        g rx   r  ©rV   ré   rÖ   s     €rD   r™   ÚBResponseTests.test_dataReceived.<locals>.ListConsumer.dataReceivedö
  ó   ø€ Ø—‘˜TÕ"rC   r;   N©r=   r>   r?   r@   r™   rB   ©rÖ   s   €rD   ÚListConsumerr´  õ
  ó   ø† ÷#ð #rC   r»  rð   N)r   rn   r   r)  r  rP   )rV   r»  r¸  rø   rÖ   s       @rD   Útest_dataReceivedÚResponseTests.test_dataReceivedí
  sZ   ø€ ð ˆ÷	#œ8ô 	#ñ  “>ˆÜ(¬Ó):Ó;ˆØ×Ñ˜XÔ&à×"Ñ" 6Ô*Ø×Ñ˜  Õ)rC   c                 óB  ^• / m " U4S jS[         5      nU" 5       n[        [        5       5      nUR                  U5        UR	                  5         TS   R                  [        5        U R                  [        T5      S5        U R                  UR                  S5        g)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                   ó"   >• \ rS rSrU 4S jrSrg)Ú7ResponseTests.test_connectionLost.<locals>.ListConsumeri	  c                 ó(   >• TR                  U5        g rx   r  )rV   rS   Úlosts     €rD   rr  ÚFResponseTests.test_connectionLost.<locals>.ListConsumer.connectionLost
  s   ø€ Ø—‘˜FÕ#rC   r;   N)r=   r>   r?   r@   rr  rB   )rÃ  s   €rD   r»  rÁ  	  s   ø† ÷$ð $rC   r»  r   rh   N)r   rn   r   r)  r  rO   r/   rP   rQ   r-  Ú_bodyProtocol)rV   r»  r¸  rø   rÃ  s       @rD   Útest_connectionLostÚ!ResponseTests.test_connectionLost   s‚   ø€ ð ˆ÷	$œ8ô 	$ñ  “>ˆÜ(¬Ó):Ó;ˆØ×Ñ˜XÔ&à×"Ñ"Ô$ØˆQ‰�‰”\Ô"Ø×Ñœ˜T› AÔ&ð 	×Ñ˜X×3Ñ3°TÕ:rC   c                 óJ  ^• / m " U4S jS[         5      nU" 5       n[        [        5       5      nUR                  S5        UR                  S5        UR	                  U5        UR                  S5        U R                  T/ SQ5        U R                  UR                  S5        g)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                   ó"   >• \ rS rSrU 4S jrSrg)Ú8ResponseTests.test_bufferEarlyData.<locals>.ListConsumeri!  c                 ó(   >• TR                  U5        g rx   r  r¶  s     €rD   r™   ÚEResponseTests.test_bufferEarlyData.<locals>.ListConsumer.dataReceived"  r¸  rC   r;   Nr¹  rº  s   €rD   r»  rÊ  !  r¼  rC   r»  rð   r§   rÀ   )rð   r§   rÀ   N)r   rn   r   r  r)  rP   r-  Ú_bodyBuffer)rV   r»  r›   rø   rÖ   s       @rD   Útest_bufferEarlyDataÚ"ResponseTests.test_bufferEarlyData  s�   ø€ ð ˆ÷	#œ8ô 	#ñ  “>ˆÜ(¬Ó):Ó;ˆØ×"Ñ" 6Ô*Ø×"Ñ" 6Ô*Ø×Ñ˜XÔ&Ø×"Ñ" 6Ô*Ø×Ñ˜Ò 8Ô9ð 	×Ñ˜X×1Ñ1°4Õ8rC   c                 ó®   • [        [        5       5      nUR                  [        5       5        U R	                  [
        UR                  [        5       5        g)zJ
L{Response.deliverBody} raises L{RuntimeError} if called more than
once.
N)rn   r   r)  r   rŠ   r‹   r¤  s     rD   Ú test_multipleStartProducingFailsÚ.ResponseTests.test_multipleStartProducingFails0  s;   € ô
 )¬Ó):Ó;ˆØ×ÑœX›ZÔ(Ø×Ñœ,¨×(<Ñ(<¼h»jÕIrC   c                 óÎ   • [        [        5       5      nUR                  [        5       5        UR	                  5         U R                  [        UR                  [        5       5        g)z_
L{Response.deliverBody} raises L{RuntimeError} if called after
L{Response._bodyDataFinished}.
N)rn   r   r)  r   r  rŠ   r‹   r¤  s     rD   Ú%test_startProducingAfterFinishedFailsÚ3ResponseTests.test_startProducingAfterFinishedFails9  sG   € ô
 )¬Ó):Ó;ˆØ×ÑœX›ZÔ(Ø×"Ñ"Ô$Ø×Ñœ,¨×(<Ñ(<¼h»jÕIrC   c                 óŒ   • [        [        5       5      nUR                  5         U R                  [        UR
                  S5        g)zˆ
L{Response._bodyDataReceived} raises L{RuntimeError} if called after
L{Response._bodyDataFinished} but before L{Response.deliverBody}.
rð   N)rn   r   r  rŠ   r‹   r  r¤  s     rD   Ú'test_bodyDataReceivedAfterFinishedFailsÚ5ResponseTests.test_bodyDataReceivedAfterFinishedFailsC  s5   € ô
 )¬Ó):Ó;ˆØ×"Ñ"Ô$Ø×Ñœ,¨×(BÑ(BÀFÕKrC   c                 ó¾   • [        [        5       5      nUR                  5         UR                  [	        5       5        U R                  [        UR                  S5        g)z‡
L{Response._bodyDataReceived} raises L{RuntimeError} if called after
L{Response._bodyDataFinished} and after L{Response.deliverBody}.
rð   N)rn   r   r  r)  r   rŠ   r‹   r  r¤  s     rD   Ú'test_bodyDataReceivedAfterDeliveryFailsÚ5ResponseTests.test_bodyDataReceivedAfterDeliveryFailsL  sE   € ô
 )¬Ó):Ó;ˆØ×"Ñ"Ô$Ø×ÑœX›ZÔ(Ø×Ñœ,¨×(BÑ(BÀFÕKrC   c                 óŠ   • [        [        5       5      nUR                  5         U R                  [        UR                  5        g)zP
L{Response._bodyDataFinished} raises L{RuntimeError} if called more
than once.
N)rn   r   r  rŠ   r‹   r¤  s     rD   Ú'test_bodyDataFinishedAfterFinishedFailsÚ5ResponseTests.test_bodyDataFinishedAfterFinishedFailsV  s3   € ô
 )¬Ó):Ó;ˆØ×"Ñ"Ô$Ø×Ñœ,¨×(BÑ(BÕCrC   c                 ó¼   • [        [        5       5      nUR                  5         UR                  [	        5       5        U R                  [        UR                  5        g)zc
L{Response._bodyDataFinished} raises L{RuntimeError} if called after
the body has been delivered.
N)rn   r   r  r)  r   rŠ   r‹   r¤  s     rD   Ú'test_bodyDataFinishedAfterDeliveryFailsÚ5ResponseTests.test_bodyDataFinishedAfterDeliveryFails_  sC   € ô
 )¬Ó):Ó;ˆØ×"Ñ"Ô$Ø×ÑœX›ZÔ(Ø×Ñœ,¨×(BÑ(BÕCrC   c                 ó>  ^• / m " U4S jS[         5      n[        5       nUR                  5         U" 5       n[        U5      nU R	                  UR
                  S5        UR                  U5        U R	                  TS/5        U R	                  UR
                  S5        g)z~
L{Response.deliverBody} resumes the HTTP connection's transport
after passing it to the consumer's C{makeConnection} method.
c                   ó"   >• \ rS rSrU 4S jrSrg)Ú9ResponseTests.test_transportResumed.<locals>.ListConsumerip  c                 ó<   >• TR                  UR                  5        g rx   )r•   r  )rV   rm   ÚtransportStates     €rD   r—   ÚHResponseTests.test_transportResumed.<locals>.ListConsumer.makeConnectionq  s   ø€ Ø×%Ñ% i×&=Ñ&=Õ>rC   r;   Nr­  )ræ  s   €rD   r»  rä  p  s   ø† ÷?ð ?rC   r»  rD  r  N)r   r   rÓ  rn   rP   r  r)  )rV   r»  rm   r›   rø   ræ  s        @rD   Útest_transportResumedÚ#ResponseTests.test_transportResumedi  s‰   ø€ ð
 ˆ÷	?œ8ô 	?ô $Ó%ˆ	Ø× Ñ Ô"Ù“>ˆÜ(¨Ó3ˆØ×Ñ˜×0Ñ0°(Ô;Ø×Ñ˜XÔ&Ø×Ñ˜¨(¨Ô4Ø×Ñ˜×0Ñ0°+Õ>rC   c                 ó>  • [        5       n[        U5      nUR                  S5        UR                  S5        UR                  5         [	        5       nUR                  U5        U R                  UR                  S5        UR                  R                  [        5        g)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   rn   r  r  r   r)  rP   ré   rE  rO   r/   ©rV   rm   rø   r›   s       rD   Ú)test_bodyDataFinishedBeforeStartProducingÚ7ResponseTests.test_bodyDataFinishedBeforeStartProducing}  s|   € ô $Ó%ˆ	Ü(¨Ó3ˆØ×"Ñ" 6Ô*Ø×"Ñ" 6Ô*Ø×"Ñ"Ô$ä'Ó)ˆØ×Ñ˜XÔ&Ø×Ñ˜Ÿ™¨	Ô2Ø×Ñ×"Ñ"¤<Õ0rC   c                 ó  • [        5       n[        U5      n[        5       nUR                  U5        U R	                  UR
                  S5        UR                  [        [        5       5      5        UR                  R                  [        5        g)zá
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   rn   r   r)  rP   r†   r  r   r9   rE  rO   rë  s       rD   Ú#test_finishedWithErrorWhenConnectedÚ1ResponseTests.test_finishedWithErrorWhenConnected�  sn   € ô $Ó%ˆ	Ü(¨Ó3ˆä'Ó)ˆØ×Ñ˜XÔ&ð 	×Ñ˜Ÿ™¨+Ô6Ø×"Ñ"¤7Ô+=Ó+?Ó#@ÔAà×Ñ×"Ñ"Ô#5Õ6rC   c                 ó  • [        5       n[        U5      nU R                  UR                  S5        UR	                  [        [        5       5      5        [        5       nUR                  U5        UR                  R                  [        5        g)zß
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   rn   rP   r†   r  r   r9   r   r)  rE  rO   rë  s       rD   Ú!test_finishedWithErrorWhenInitialÚ/ResponseTests.test_finishedWithErrorWhenInitial¢  sn   € ô $Ó%ˆ	Ü(¨Ó3ˆð 	×Ñ˜Ÿ™¨)Ô4Ø×"Ñ"¤7Ô+=Ó+?Ó#@ÔAä'Ó)ˆØ×Ñ˜XÔ&à×Ñ×"Ñ"Ô#5Õ6rC   r;   N)r=   r>   r?   r@   rA   r¥  r°  r½  rÆ  rÎ  rÑ  rÔ  r×  rÚ  rÝ  rà  rè  rì  rð  rô  rB   r;   rC   rD   r¢  r¢  Ë
  sX   † ñò;ò?ò,*ò&;ò29ò.JòJòLòLòDòDò?ò(1ò$7õ&7rC   r¢  N)_rA   Ú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   rF   rk   r^   ra   rc   re   rn   rp   r�   rÙ   rÝ   rà   r»  rÉ  rÏ  r¾  rÚ  rV  ry  r†  r¢  r;   rC   rD   Ú<module>r	     s‘  ðñõ å &Ý .ç JÓ Jß Aß @Ý .÷ó õ .Ý 0Ý *Ý +÷÷ ÷ ÷ ÷ ÷(
÷ 
õ 
õ 'Ý ,ß 5÷ô˜ô ô 	ô ñ ˜' NÐ#3Ð4Ó5€ò%òPTòòòLô6 (ô 6÷BSMñ SMôlÐ+;¸Xô ôÐ.>Àô ôh
.˜Hô h
.÷Vñ ÷0ñ ôfE ô fEñR ˆ]Ó÷ ð  ó ð ôFp;�8ô p;ôfb 8ô bôJ):˜xô ):ôX{- (ô {-ô|h7�Hõ h7rC   