ó
    ×›‘h,ª ã                   ó´  • S r SSKrSSKJrJr  SSKrSSKJrJrJ	r	J
r
  SSKJr  SSK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  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#  SSK$J%r%J&r&J'r'J(r(J)r)J*r*J+r+  Sr, SSK-r-SSK.r-SSK/r-SSK0r0SSK1r1SSK2J3r3J4r4  SSK5J6r6   " S S5      r8 " S S5      r9S4S jr:S4S jr;S r< " S S\Rz                  5      r>\+" \>5      r? " S S\Rz                  5      r@\+" \@5      rA " S  S!\@5      rB\+" \B5      rC " S" S#\Rz                  5      rD\+" \D5      rE " S$ S%5      rF\+" \F5      rG " S& S'5      rH " S( S)\R’                  \H5      rJ " S* S+\R’                  \H5      rK " S, S-\R’                  \H5      rL " S. S/\R’                  \H5      rM " S0 S1\R’                  \H5      rN " S2 S3\R’                  5      rOg! \7 a    Sr, GN6f = f)5z
Test HTTP/2 support.
é    N)ÚdirectlyProvidesÚ
providedBy)ÚdeferÚerrorÚreactorÚtask)ÚIPv4Address)ÚMemoryReactorClockÚStringTransport)ÚdeferToThread)Úfailure)Ú	iterbytes)ÚrequireModule)ÚDummyProducer)Ú!certificatesForAuthorityAndServer)Úunittest)Úhttp)ÚSite)ÚData)ÚDelayedHTTPHandlerÚDelayedHTTPHandlerProxyÚDummyHTTPHandlerÚDummyHTTPHandlerProxyÚDummyPullProducerHandlerProxyÚ._IDeprecatedHTTPChannelToRequestInterfaceProxyÚ_makeRequestProxyFactory)ÚDecoderÚEncoder)ÚH2ConnectionzHTTP/2 support not enabledc                   ó|   • \ rS rSrSrS rS rS r/ S4S jrSS	 jr	SS
 jr
S rSS jrSS jrSS jr/ 4S jrSrg)ÚFrameFactoryé7   z˜
A class containing lots of helper methods and state to build frames. This
allows test cases to easily build correct HTTP/2 frames to feed to
hyper-h2.
c                 ó"   • [        5       U l        g ©N©r   Úencoder©Úselfs    Ú_C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/web/test/test_http2.pyÚ__init__ÚFrameFactory.__init__>   ó   € Ü“yˆ�ó    c                 ó"   • [        5       U l        g r$   r%   r'   s    r)   ÚrefreshEncoderÚFrameFactory.refreshEncoderA   r,   r-   c                 ó   • g)Ns   PRI * HTTP/2.0

SM

© r'   s    r)   ÚclientConnectionPrefaceÚ$FrameFactory.clientConnectionPrefaceD   s   € Ø2r-   é   c                 óL  • [         R                  R                  U5      nU R                  R	                  U5      Ul        UR                  R                  S5        U H  nUR                  R                  U5        M      UR                  5        H  u  px[        XWU5        M     U$ )zC
Builds a single valid headers frame out of the contained headers.
ÚEND_HEADERS)
Ú
hyperframeÚframeÚHeadersFramer&   ÚencodeÚdataÚflagsÚaddÚitemsÚsetattr)	r(   Úheadersr=   ÚstreamIDÚpriorityKwargsÚfÚflagÚkÚvs	            r)   ÚbuildHeadersFrameÚFrameFactory.buildHeadersFrameG   s‚   € ô ×Ñ×)Ñ)¨(Ó3ˆØ—‘×$Ñ$ WÓ-ˆŒØ	�‰�‰�MÔ"ÛˆDØ�G‰G�K‰K˜Öñ ð #×(Ñ(Ö*‰DˆAÜ�A˜!Öñ +ð ˆr-   Nc                 óŒ   • Ub  [        U5      O	[        5       n[        R                  R                  U5      nXl        X$l        U$ )z4
Builds a single data frame out of a chunk of data.
)Úsetr8   r9   Ú	DataFramer<   r=   )r(   r<   r=   rB   rD   s        r)   ÚbuildDataFrameÚFrameFactory.buildDataFrameV   s;   € ð $Ñ/”�E”
´S³UˆÜ×Ñ×&Ñ& xÓ0ˆØŒØŒØˆr-   c                 ó”   • [         R                  R                  S5      nU(       a  UR                  R	                  S5        Xl        U$ )z!
Builds a single settings frame.
r   ÚACK)r8   r9   ÚSettingsFramer=   r>   Úsettings)r(   rR   ÚackrD   s       r)   ÚbuildSettingsFrameÚFrameFactory.buildSettingsFrame`   s7   € ô ×Ñ×*Ñ*¨1Ó-ˆÞØ�G‰G�K‰K˜ÔàŒ
Øˆr-   c                 óP   • [         R                  R                  U5      nX#l        U$ )z%
Builds a single WindowUpdate frame.
)r8   r9   ÚWindowUpdateFrameÚwindow_increment)r(   rB   Ú	incrementrD   s       r)   ÚbuildWindowUpdateFrameÚ#FrameFactory.buildWindowUpdateFramek   s%   € ô ×Ñ×.Ñ.¨xÓ8ˆØ&ÔØˆr-   c                 óh   • [         R                  R                  S5      nX$l        Xl        X4l        U$ )z
Builds a single GOAWAY frame.
r   )r8   r9   ÚGoAwayFrameÚ
error_codeÚlast_stream_idÚadditional_data)r(   ÚlastStreamIDÚ	errorCodeÚadditionalDatarD   s        r)   ÚbuildGoAwayFrameÚFrameFactory.buildGoAwayFrames   s0   € ô ×Ñ×(Ñ(¨Ó+ˆØ ŒØ'ÔØ*ÔØˆr-   c                 óP   • [         R                  R                  U5      nX#l        U$ )z#
Builds a single RST_STREAM frame.
)r8   r9   ÚRstStreamFramer^   )r(   rB   rb   rD   s       r)   ÚbuildRstStreamFrameÚ FrameFactory.buildRstStreamFrame}   s$   € ô ×Ñ×+Ñ+¨HÓ5ˆØ ŒØˆr-   c                 óh   • [         R                  R                  U5      nX5l        X%l        XEl        U$ )z!
Builds a single priority frame.
)r8   r9   ÚPriorityFrameÚ
depends_onÚstream_weightÚ	exclusive)r(   rB   ÚweightÚ	dependsOnrn   rD   s         r)   ÚbuildPriorityFrameÚFrameFactory.buildPriorityFrame…   s.   € ô ×Ñ×*Ñ*¨8Ó4ˆØ ŒØ ŒØŒØˆr-   c                 óæ   • [         R                  R                  U5      nX%l        U R                  R                  U5      Ul        [        U5      Ul        UR                  R                  S5        U$ )z%
Builds a single Push Promise frame.
r7   )
r8   r9   ÚPushPromiseFrameÚpromised_stream_idr&   r;   r<   rK   r=   r>   )r(   rB   ÚpromisedStreamIDrA   r=   rD   s         r)   ÚbuildPushPromiseFrameÚ"FrameFactory.buildPushPromiseFrame�   sV   € ô ×Ñ×-Ñ-¨hÓ7ˆØ/ÔØ—‘×$Ñ$ WÓ-ˆŒÜ�e“*ˆŒØ	�‰�‰�MÔ"Øˆr-   )r&   ©Nr5   )F)r   r-   )r   )r   F)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r*   r/   r3   rH   rM   rT   rZ   rd   rh   rq   rw   Ú__static_attributes__r2   r-   r)   r!   r!   7   sL   † ñò!ò!ò3ð 02¸Aô ôô	òôôôð PR÷ 	r-   r!   c                   ó4   • \ rS rSrSrS rS rS rS r\r	Sr
g)	ÚFrameBufferé›   a¾  
A test object that converts data received from Twisted's HTTP/2 stack and
turns it into a sequence of hyperframe frame objects.

This is primarily used to make it easier to write and debug tests: rather
than have to serialize the expected frames and then do byte-level
comparison (which can be unclear in debugging output), this object makes it
possible to work with the frames directly.

It also ensures that headers are properly decompressed.
c                 ó0   • [        5       U l        SU l        g )Nr-   )r   ÚdecoderÚ_datar'   s    r)   r*   ÚFrameBuffer.__init__¨   s   € Ü“yˆŒØˆ�
r-   c                 ó.   • U =R                   U-  sl         g r$   )r…   )r(   r<   s     r)   ÚreceiveDataÚFrameBuffer.receiveData¬   s   € Ø�
Š
�dÑŽ
r-   c                 ó   • U $ r$   r2   r'   s    r)   Ú__iter__ÚFrameBuffer.__iter__¯   s   € Øˆr-   c                 ó.  • [        U R                  5      S:  a
  [        5       e[        R                  R
                  R                  U R                  S S 5      u  p[        U R                  5      US-   :  a
  [        5       eUR                  [        U R                  SSU-    5      5        U R                  SU-   S  U l        [        U[        R                  R                  5      (       a)  U R                  R                  UR                  SS9Ul        U$ )Né	   T)Úraw)Úlenr…   ÚStopIterationr8   r9   ÚFrameÚparse_frame_headerÚ
parse_bodyÚ
memoryviewÚ
isinstancer:   r„   Údecoder<   )r(   r9   Úlengths      r)   ÚnextÚFrameBuffer.next²   sÓ   € Üˆt�z‰z‹?˜QÓÜ“/Ð!ä"×(Ñ(×.Ñ.×AÑAÀ$Ç*Á*ÈRÈaÀ.ÓQ‰ˆÜˆt�z‰z‹?˜V a™ZÓ'Ü“/Ð!à×Ñœ D§J¡J¨q°1°v±:Ð$>Ó?Ô@Ø—Z‘Z  F¡
 Ð-ˆŒ
ä�eœZ×-Ñ-×:Ñ:×;Ñ;ØŸ™×,Ñ,¨U¯Z©Z¸TÐ,ÐBˆEŒJàˆr-   )r…   r„   N)rz   r{   r|   r}   r~   r*   rˆ   r‹   r™   Ú__next__r   r2   r-   r)   r�   r�   ›   s"   † ñ
òòòòð  ƒHr-   r�   c                 óÚ   ^^• Tc
  [        5       m/ nUR                  TR                  U TS95        UR                  UU4S jU 5       5        US   R                  R                  S5        U$ )aª  
Provides a sequence of HTTP/2 frames that encode a single HTTP request.
This should be used when you want to control the serialization yourself,
e.g. because you want to interleave other frames with these. If that's not
necessary, prefer L{buildRequestBytes}.

@param headers: The HTTP/2 headers to send.
@type headers: L{list} of L{tuple} of L{bytes}

@param data: The HTTP data to send. Each list entry will be sent in its own
frame.
@type data: L{list} of L{bytes}

@param frameFactory: The L{FrameFactory} that will be used to construct the
frames.
@type frameFactory: L{FrameFactory}

@param streamID: The ID of the stream on which to send the request.
@type streamID: L{int}
©rA   rB   c              3   óD   >#   • U  H  nTR                  UTS 9v •  M     g7f)©rB   N)rM   )Ú.0ÚchunkÚframeFactoryrB   s     €€r)   Ú	<genexpr>Ú%buildRequestFrames.<locals>.<genexpr>ß   s$   øé € ð ÚKOÀ%ˆ×#Ñ# E°HÐ#Õ=Ê4ùs   ƒ éÿÿÿÿÚ
END_STREAM)r!   ÚappendrH   Úextendr=   r>   ©rA   r<   r¢   rB   Úframess     `` r)   ÚbuildRequestFramesr«   Å   sk   ù€ ð* ÑÜ#“~ˆà€FØ
‡M�M�,×0Ñ0¸È8Ð0ÐTÔUØ
‡M�Mõ ÙKOóô ð ˆ2�J×Ñ×Ñ˜Ô&Ø€Mr-   c                 óJ   • [        XX#5      nSR                  S U 5       5      $ )a  
Provides the byte sequence for a collection of HTTP/2 frames representing
the provided request.

@param headers: The HTTP/2 headers to send.
@type headers: L{list} of L{tuple} of L{bytes}

@param data: The HTTP data to send. Each list entry will be sent in its own
frame.
@type data: L{list} of L{bytes}

@param frameFactory: The L{FrameFactory} that will be used to construct the
frames.
@type frameFactory: L{FrameFactory}

@param streamID: The ID of the stream on which to send the request.
@type streamID: L{int}
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   ©Ú	serialize©r    rD   s     r)   r£   Ú$buildRequestBytes.<locals>.<genexpr>ú   s   é € Ð2ª6 a—K‘K—M�Mª6ùó   ‚)r«   Újoinr©   s        r)   ÚbuildRequestBytesr´   æ   s%   € ô&   ¨|ÓF€FØ�8‰8Ñ2©6Ó2Ó2Ð2r-   c                 óN   • [        5       nUR                  U 5        [        U5      $ )a¶  
Given a sequence of bytes, decodes them into frames.

Note that this method should almost always be called only once, before
making some assertions. This is because decoding HTTP/2 frames is extremely
stateful, and this function doesn't preserve any of that state between
calls.

@param data: The serialized HTTP/2 frames.
@type data: L{bytes}

@returns: A list of HTTP/2 frames.
@rtype: L{list} of L{hyperframe.frame.Frame} subclasses.
)r�   rˆ   Úlist)r<   Úbuffers     r)   ÚframesFromBytesr¸   ý   s#   € ô ‹]€FØ
×Ñ�tÔÜ�‹<Ðr-   c                   ó"   • \ rS rSrSrSrS rSrg)ÚChunkedHTTPHandleri  zŠ
A HTTP request object that writes chunks of data back to the network based
on the URL.

Must be called with a path /chunked/<num_chunks>
s   hello world!c                 óî   • [        U R                  R                  S5      S   5      nU R                  S5        [	        U5       H  nU R                  U R                  5        M      U R                  5         g )Nó   /r¥   éÈ   )ÚintÚuriÚsplitÚsetResponseCodeÚrangeÚwriteÚ	chunkDataÚfinish)r(   ÚchunksÚ_s      r)   ÚprocessÚChunkedHTTPHandler.process  sU   € Ü�T—X‘X—^‘^ DÓ)¨"Ñ-Ó.ˆØ×Ñ˜SÔ!ä�v–ˆAØ�J‰J�t—~‘~Ö&ñ ð 	�‰�r-   r2   N)rz   r{   r|   r}   r~   rÄ   rÈ   r   r2   r-   r)   rº   rº     s   † ñð  €Iõr-   rº   c                   ó0   • \ rS rSrSrS rS rS rS rSr	g)	ÚConsumerDummyHandleri(  zî
This is a HTTP request handler that works with the C{IPushProducer}
implementation in the L{H2Stream} object. No current IRequest object does
that, but in principle future implementations could: that codepath should
therefore be tested.
c                 óœ   • [         R                  R                  " U /UQ70 UD6  U R                  R	                  5         SU l        S U l        g )NF)r   ÚRequestr*   ÚchannelÚpauseProducingÚ_requestReceivedr…   ©r(   ÚargsÚkwargss      r)   r*   ÚConsumerDummyHandler.__init__0  s?   € Ü�‰×Ò˜dÐ4 TÒ4¨VÒ4ð 	�‰×#Ñ#Ô%Ø %ˆÔØˆ�
r-   c                 ó8   • U R                   R                  5         g)z
Start the data pipe.
N)rÎ   ÚresumeProducingr'   s    r)   Ú
acceptDataÚConsumerDummyHandler.acceptData8  s   € ð 	�‰×$Ñ$Õ&r-   c                 óX   • SU l         [        R                  R                  " U /UQ70 UD6$ )NT)rÐ   r   rÍ   ÚrequestReceivedrÑ   s      r)   rÚ   Ú$ConsumerDummyHandler.requestReceived>  s)   € Ø $ˆÔÜ�|‰|×+Ò+¨DÐB°4ÒB¸6ÑBÐBr-   c                 óª   • U R                  S5        U R                  R                  5       U l        SnU R	                  U5        U R                  5         g )Nr½   s0   this is a response from a consumer dummy handler)rÁ   ÚcontentÚreadr…   rÃ   rÅ   )r(   Ú
returnDatas     r)   rÈ   ÚConsumerDummyHandler.processB  s>   € Ø×Ñ˜SÔ!Ø—\‘\×&Ñ&Ó(ˆŒ
ØHˆ
Ø�
‰
�:ÔØ�‰�r-   )r…   rÐ   N)
rz   r{   r|   r}   r~   r*   r×   rÚ   rÈ   r   r2   r-   r)   rË   rË   (  s   † ñòò'òCõr-   rË   c                   ó   • \ rS rSrSrS rSrg)ÚAbortingConsumerDummyHandleriM  zê
This is a HTTP request handler that works with the C{IPushProducer}
implementation in the L{H2Stream} object. The difference between this and
the ConsumerDummyHandler is that after resuming production it immediately
aborts it again.
c                 ól   • U R                   R                  5         U R                   R                  5         g)z0
Start and then immediately stop the data pipe.
N)rÎ   rÖ   ÚstopProducingr'   s    r)   r×   Ú'AbortingConsumerDummyHandler.acceptDataU  s$   € ð 	�‰×$Ñ$Ô&Ø�‰×"Ñ"Õ$r-   r2   N)rz   r{   r|   r}   r~   r×   r   r2   r-   r)   râ   râ   M  s   † ñõ%r-   râ   c                   ó   • \ rS rSrSrS rSrg)ÚDummyProducerHandlerib  z…
An HTTP request handler that registers a dummy producer to serve the body.

The owner must call C{finish} to complete the response.
c                 óZ   • U R                  S5        U R                  [        5       S5        g )Nr½   T)rÁ   ÚregisterProducerr   r'   s    r)   rÈ   ÚDummyProducerHandler.processi  s"   € Ø×Ñ˜SÔ!Ø×Ñœm›o¨tÕ4r-   r2   N)rz   r{   r|   r}   r~   rÈ   r   r2   r-   r)   rç   rç   b  s   † ñõ5r-   rç   c                   ó$   • \ rS rSrSrS rS rSrg)ÚNotifyingRequestFactoryiq  a  
A L{http.Request} factory that calls L{http.Request.notifyFinish} on all
L{http.Request} objects before it returns them, and squirrels the resulting
L{defer.Deferred} away on the class for later use. This is done as early
as possible to ensure that we always see the result.
c                 ól   • / U l         Xl        [        U R                  5       H  n[        X5        M     g r$   )ÚresultsÚ_wrappedFactoryr   r   )r(   ÚwrappedFactoryÚ	interfaces      r)   r*   Ú NotifyingRequestFactory.__init__y  s.   € ØˆŒØ-Ôô
 $ D×$8Ñ$8Ö9ˆIÜ˜TÖ-ò :r-   c                 óŽ   • U R                   " U0 UD6nU R                  R                  UR                  5       5        [	        U5      $ r$   )rï   rî   r§   ÚnotifyFinishr   )r(   rÒ   rÓ   Úreqs       r)   Ú__call__Ú NotifyingRequestFactory.__call__ƒ  s=   € Ø×"Ò" DÐ3¨FÑ3ˆØ�‰×Ñ˜C×,Ñ,Ó.Ô/Ü=¸cÓBÐBr-   )rï   rî   N)rz   r{   r|   r}   r~   r*   rö   r   r2   r-   r)   rì   rì   q  s   † ñò.õCr-   rì   c                   ó0   • \ rS rSrSr\(       a  \rS rSrg)ÚHTTP2TestHelpersiŒ  zQ
A superclass that contains no tests but provides test helpers for HTTP/2
tests.
c                 ób   • U R                  [        R                  [        UR                  5        g)z}
Confirm that all streams are blocked: that is, the priority tree
believes that none of the streams have data ready to send.
N)ÚassertRaisesÚpriorityÚDeadlockErrorr™   )r(   Ú
connections     r)   ÚassertAllStreamsBlockedÚ(HTTP2TestHelpers.assertAllStreamsBlocked•  s"   € ð
 	×Ñœ(×0Ñ0´$¸
×8KÑ8KÕLr-   r2   N)	rz   r{   r|   r}   r~   ÚskipH2Úskiprÿ   r   r2   r-   r)   rù   rù   Œ  s   † ñö
 ØˆõMr-   rù   c                   ó
  • \ rS rSr/ SQr/ SQr/ SQr/ SQrSr/ SQ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+),ÚHTTP2ServerTestsi�  ©©ó   :methodó   GET©s
   :authoritys	   localhost©ó   :pathr¼   ©s   :schemes   https©s
   user-agents   twisted-test-code)ó   custom-headeró   1)r  ó   2©)r  ó   POSTr	  )r  ó   /post_endpointr  r  )ó   content-lengths   25©s   hello s   world, s   it's s   http/2!)©ó   :statuss   200)ó   requestr¼   )ó   commandr  ©s   versions   HTTP/2)r  s   13ó   '''
None
'''
)r  ©r  r  ©r  r  r  )r  s   36ó$   '''
25
hello world, it's http/2!'''
c                 óÖ   • [        5       n[        5       nUR                  5       nU[        X#U5      -  nUR	                  U5        [        U5       H  nUR                  U5        M     XE4$ )aÑ  
Takes a single L{H2Connection} object and connects it to a
L{StringTransport} using a brand new L{FrameFactory}.

@param connection: The L{H2Connection} object to connect.
@type connection: L{H2Connection}

@param headers: The headers to send on the first request.
@type headers: L{Iterable} of L{tuple} of C{(bytes, bytes)}

@param body: Chunks of body to send, if any.
@type body: L{Iterable} of L{bytes}

@return: A tuple of L{FrameFactory}, L{StringTransport}
)r!   r   r3   r´   ÚmakeConnectionr   ÚdataReceived)r(   rþ   rA   Úbodyr¢   Ú	transportÚrequestBytesÚbytes           r)   ÚconnectAndReceiveÚ"HTTP2ServerTests.connectAndReceiveÇ  si   € ô  $“~ˆÜ#Ó%ˆ	à#×;Ñ;Ó=ˆØÔ)¨'¸ÓFÑFˆà×!Ñ! )Ô,ä˜lÖ+ˆDØ×#Ñ# DÖ)ñ ,ð Ð&Ð&r-   c                 óº   ^ ^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmU U4S jnUR
                  S   R                  U5      $ )zu
Send request over a TCP connection and confirm that we get back the
expected data in the order and style we expect.
c                 óB  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        S USS   5       5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  [        US   [        R                  R                  5      5        TR                  [        US   R                  5      [        TR                  5      5        TR                  US   R                  TR                  5        TR                  US   R                  S5        TR	                  SUS   R                  ;   5        g )Né   c              3   ó>   #   • U  H  oR                   S :H  v •  M     g7f©r5   N©Ú	stream_idr°   s     r)   r£   ÚGHTTP2ServerTests.test_basicRequest.<locals>.validate.<locals>.<genexpr>ó  ó   é € ÐEº*°Q§¡¨qÖ 0º*ùó   ‚r5   é   é   r-   r¦   )r¸   ÚvalueÚassertEqualr�   Ú
assertTrueÚallr–   r8   r9   r:   rL   Údictr<   ÚgetResponseHeadersÚgetResponseDatar=   ©rB   rª   r(   r#  s     €€r)   ÚvalidateÚ4HTTP2ServerTests.test_basicRequest.<locals>.validateï  s%  ø€ Ü$ Y§_¡_Ó%6Ó7ˆFà×ÑœS ›[¨!Ô,Ø�O‰OœCÑE¸&ÀÀ¹*ÓEÓEÔFà�O‰OœJ v¨a¡y´*×2BÑ2B×2OÑ2OÓPÔQØ�O‰OœJ v¨a¡y´*×2BÑ2B×2LÑ2LÓMÔNØ�O‰OœJ v¨a¡y´*×2BÑ2B×2LÑ2LÓMÔNà×ÑœT &¨¡)§.¡.Ó1´4¸×8OÑ8OÓ3PÔQØ×Ñ˜V A™YŸ^™^¨T×-AÑ-AÔBØ×Ñ˜V A™YŸ^™^¨SÔ1Ø�O‰O˜L¨F°1©I¯O©OÑ;Õ<r-   r5   )r   r   ÚrequestFactoryr&  ÚgetRequestHeadersÚ_streamCleanupCallbacksÚaddCallback©r(   rþ   rÇ   r<  r#  s   `   @r)   Útest_basicRequestÚ"HTTP2ServerTests.test_basicRequestä  sV   ù€ ô "“^ˆ
Ü$9ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ö	=ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr-   c                 óÎ   ^ ^• [        5       n[        Ul        T R                  UT R                  T R
                  5      u  nmU U4S jnUR                  S   R                  U5      $ )zF
Send a POST request and confirm that the data is safely transferred.
c                 óB  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        S USS   5       5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  [        US   [        R                  R                  5      5        TR                  [        US   R                  5      [        TR                  5      5        TR                  US   R                  TR                  5        TR                  US   R                  S5        TR	                  SUS   R                  ;   5        g )Nr*  c              3   ó>   #   • U  H  oR                   S :H  v •  M     g7fr,  r-  r°   s     r)   r£   ÚFHTTP2ServerTests.test_postRequest.<locals>.validate.<locals>.<genexpr>  ó   é € ÐFº+°Q§¡¨qÖ 0º+ùr1  éýÿÿÿéþÿÿÿr¥   r-   r¦   )r¸   r4  r5  r�   r6  r7  r–   r8   r9   r:   rL   r8  r<   ÚpostResponseHeadersÚpostResponseDatar=   r;  s     €€r)   r<  Ú3HTTP2ServerTests.test_postRequest.<locals>.validate
  s)  ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰OœCÑF¸&ÀÀ¹+ÓFÓFÔGà�O‰OœJ v¨b¡z´:×3CÑ3C×3PÑ3PÓQÔRØ�O‰OœJ v¨b¡z´:×3CÑ3C×3MÑ3MÓNÔOØ�O‰OœJ v¨b¡z´:×3CÑ3C×3MÑ3MÓNÔOà×ÑœT &¨¡*§/¡/Ó2´D¸×9QÑ9QÓ4RÔSØ×Ñ˜V B™ZŸ_™_¨d×.CÑ.CÔDØ×Ñ˜V B™ZŸ_™_¨cÔ2Ø�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   r5   )r   r   r>  r&  ÚpostRequestHeadersÚpostRequestDatar@  rA  rB  s   `   @r)   Útest_postRequestÚ!HTTP2ServerTests.test_postRequest   s^   ù€ ô "“^ˆ
Ü$9ˆ
Ô!Ø×-Ñ-Ø˜×/Ñ/°×1EÑ1Eó
‰ˆˆ9ö	>ð  ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr-   c                 ó*  ^ ^^^	• / SQmSmT R                    VVs/ s H  u  pUS:w  d  M  X4PM     nnn[        5       n[        Ul        T R	                  XCT R
                  5      u  nm	UUU U	4S jnUR                  S   R                  U5      $ s  snnf )zU
Send a POST request without length and confirm that the data is safely
transferred.
)r  r  r  r  )r  s   38s&   '''
None
hello world, it's http/2!'''
r  c                 ó  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        S USS   5       5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  [        US   [        R                  R                  5      5        TR                  [        US   R                  5      [        T5      5        TR                  US   R                  T5        TR                  US   R                  S5        TR	                  SUS   R                  ;   5        g )Nr*  c              3   ó>   #   • U  H  oR                   S :H  v •  M     g7fr,  r-  r°   s     r)   r£   ÚNHTTP2ServerTests.test_postRequestNoLength.<locals>.validate.<locals>.<genexpr>:  rI  r1  rJ  rK  r¥   r-   r¦   )r¸   r4  r5  r�   r6  r7  r–   r8   r9   r:   rL   r8  r<   r=   )rB   rª   rM  rL  r(   r#  s     €€€€r)   r<  Ú;HTTP2ServerTests.test_postRequestNoLength.<locals>.validate5  s  ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰OœCÑF¸&ÀÀ¹+ÓFÓFÔGà�O‰OœJ v¨b¡z´:×3CÑ3C×3PÑ3PÓQÔRØ�O‰OœJ v¨b¡z´:×3CÑ3C×3MÑ3MÓNÔOØ�O‰OœJ v¨b¡z´:×3CÑ3C×3MÑ3MÓNÔOà×ÑœT &¨¡*§/¡/Ó2´DÐ9LÓ4MÔNØ×Ñ˜V B™ZŸ_™_Ð.>Ô?Ø×Ñ˜V B™ZŸ_™_¨cÔ2Ø�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   r5   )rO  r   r   r>  r&  rP  r@  rA  )
r(   ÚxÚyrO  rþ   rÇ   r<  rM  rL  r#  s
   `      @@@r)   Útest_postRequestNoLengthÚ)HTTP2ServerTests.test_postRequestNoLength  s¤   û€ ò

Ðð HÐð  $×6Ò6ô
Ú6‘t�q¸!Ð?PÑ:P‹FˆQ‹FÑ6ð 	ñ 
ô "“^ˆ
Ü$9ˆ
Ô!Ø×-Ñ-Ø¨D×,@Ñ,@ó
‰ˆˆ9÷	>ð 	>ð  ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJùó5
s
   šBªBc           	      ó   ^ ^	^
• Sn[        5       n[        5       m	[        5       n[        Ul        [        [        SUS-  S5      5      m
T
 Vs/ s H$  n[        T R                  T R                  X$5      PM&     nnUR                  5       n[        R                  R                  [        U6 5      nUSR                  S U 5       5      -  nUR!                  T	5        [#        U5       H  nUR%                  U5        M     U	U U
4S jn[&        R(                  " [        UR*                  R-                  5       5      5      R/                  U5      $ s  snf )zQ
Many interleaved POST requests all get received and responded to
appropriately.
é(   r5   r2  r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   ©r    r9   s     r)   r£   Ú<HTTP2ServerTests.test_interleavedRequests.<locals>.<genexpr>b  ó   é € Ð GÂ°u§¡×!2Ð!2Âùr²   c                 óª  >• [        TR                  5       5      nTR                  [        U5      S5        T GH  nU Vs/ s HB  nUR                  U:X  d  M  [        U[        R                  R                  5      (       a  M@  UPMD     nnTR                  [        U5      S5        TR                  [        US   R                  5      [        TR                  5      5        TR                  US   R                  TR                  5        TR                  US   R                  S5        TR                  SUS   R                  ;   5        GM     g s  snf )Néy   r3  r   r5   r2  r-   r¦   )r¸   r4  r5  r�   r.  r–   r8   r9   rW   r8  r<   rL  rM  r6  r=   )rî   rª   rB   rD   ÚstreamFramesÚbr(   Ú	streamIDss        €€€r)   r<  Ú;HTTP2ServerTests.test_interleavedRequests.<locals>.validateh  s   ø€ Ü$ Q§W¡W£YÓ/ˆFð
 ×ÑœS ›[¨,Ô7ô &�ñ $ó â#˜Ø—{‘{ hÑ.ó ô ' q¬*×*:Ñ*:×*LÑ*L×M÷ Ù#ð ð  ð × Ñ ¤ \Ó!2°AÔ6à× Ñ Ü˜ a™×-Ñ-Ó.´°T×5MÑ5MÓ0Nôð × Ñ  ¨a¡×!5Ñ!5°t×7LÑ7LÔMØ× Ñ  ¨a¡×!5Ñ!5°sÔ;Ø—‘ °¸Q±×0EÑ0EÑ E×Fò &ùò s   Á EÁ'EÂE)r!   r   r   r   r>  r¶   rÂ   r«   rO  rP  r3   Ú	itertoolsÚchainÚfrom_iterableÚzipr³   r   r   r!  r   ÚDeferredListr@  ÚvaluesrA  )r(   ÚREQUEST_COUNTrD   ÚarB   rª   r$  r%  r<  re  rf  s   `        @@r)   Útest_interleavedRequestsÚ)HTTP2ServerTests.test_interleavedRequestsG  s/  ú€ ð ˆä‹NˆÜÓˆÜ‹NˆÜ0ˆÔô œ˜q -°!Ñ"3°QÓ7Ó8ˆ	ñ
 &ó	
ò &�ô Ø×'Ñ'¨×)=Ñ)=¸qöñ &ð	 	ð 
ð ×0Ñ0Ó2ˆô —‘×.Ñ.¬s°F¨|Ó<ˆØ˜Ÿ™Ñ GÁÓ GÓGÑGˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,÷	Gô6 ×!Ò!¤$ q×'@Ñ'@×'GÑ'GÓ'IÓ"JÓK×WÑWØó
ð 	
ùò[
s   Á+Ec           	      óZ  ^ ^
• [        5       n[        5       m
[        5       n[        Ul        T R
                  nSUS'   S Vs/ s H  n[        U/ X5      PM     nnUS   S   R                  R                  S5        SUS   S   l	        US   S   R                  R                  S5        SUS   S   l	        UR                  S	S
SSS9nUS   R                  SU5        [        R                  R                  U5      nUR                  5       nUSR!                  S U 5       5      -  nUR#                  T
5        [%        U5       H  nUR'                  U5        M     U
U 4S jn	[(        R*                  " [-        UR.                  R1                  5       5      5      R3                  U	5      $ s  snf )zB
Data in responses is interleaved according to HTTP/2 priorities.
)z:pathz
/chunked/4r2  )r5   r3  é   r   ÚPRIORITYé@   r5   é    rs  é   T)rB   ro   rp   rn   r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r_  s     r)   r£   Ú@HTTP2ServerTests.test_sendAccordingToPriority.<locals>.<genexpr>¶  ra  r²   c                 ó0  >• [        TR                  5       5      nTR                  [        U5      S5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nn/ SQnTR                  X45        g s  snf )Né   )r5   r3  r5   r5   r3  r5   r5   r3  rs  r3  rs  r3  rs  rs  rs  )	r¸   r4  r5  r�   r–   r8   r9   rL   r.  )rî   rª   rD   rf  ÚexpectedOrderre  r(   s        €€r)   r<  Ú?HTTP2ServerTests.test_sendAccordingToPriority.<locals>.validate½  s}   ø€ Ü$ Q§W¡W£YÓ/ˆFð ×ÑœS ›[¨"Ô-ñ &,óÚ%+ ¬z¸!¼Z×=MÑ=M×=WÑ=W×/X“�—”¡Vð ð ò JˆMØ×Ñ˜YÕ6ùò	s   º-BÁ+B)r!   r   r   ÚChunkedHTTPHandlerProxyr>  r?  r«   r=   r>   rm   rq   Úinsertrh  ri  rj  r3   r³   r   r   r!  r   rl  r¶   r@  rm  rA  )r(   rD   ro  r?  rB   rª   ÚpriorityFramer$  r%  r<  re  s   `         @r)   Útest_sendAccordingToPriorityÚ-HTTP2ServerTests.test_sendAccordingToPriority‡  s�  ù€ ô" ‹NˆÜÓˆÜ‹NˆÜ2ˆÔØ ×2Ñ2ÐØ6Ð˜!Ññ &ó
â%�ô Ð0°"°aÖBÙ%ð 	ð 
ð 	ˆq‰	�!‰×Ñ×Ñ˜zÔ*Ø%'ˆˆq‰	�!‰Ô"àˆq‰	�!‰×Ñ×Ñ˜zÔ*Ø%'ˆˆq‰	�!‰Ô"à×,Ñ,ØØØØð	 -ð 
ˆð 	ˆq‰	×Ñ˜˜MÔ*ä—‘×.Ñ.¨vÓ6ˆØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ GÁÓ GÓGÑGˆà	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ö	7ô ×!Ò!¤$ q×'@Ñ'@×'GÑ'GÓ'IÓ"JÓK×WÑWØó
ð 	
ùòW
s   ÁF(c                 óœ  • [        5       n[        5       n[        5       n[        Ul        UR                  5       nU[        U R                  / U5      -  nXAR                  SSU R                  S/S9R                  5       -  nUR                  U5        [        U5       H'  nUR                  U5        UR                  (       d  M'    O   [        UR                  5       5      nU R!                  [#        U5      S5        U R%                  ['        US   [(        R*                  R,                  5      5        U R%                  UR                  5        g)zB
A protocol error from the remote peer terminates the connection.
r5   r2  r7   )rB   rv   rA   r=   r3  r¥   N)r!   r   r   r   r>  r3   r´   r?  rw   r¯   r   r   r!  Údisconnectingr¸   r4  r5  r�   r6  r–   r8   r9   r]   )r(   rD   re  ro  r$  r%  rª   s          r)   Ú&test_protocolErrorTerminatesConnectionÚ7HTTP2ServerTests.test_protocolErrorTerminatesConnectionÎ  s  € ô ‹NˆÜÓˆÜ‹NˆÜ0ˆÔð ×0Ñ0Ó2ˆØÔ)¨$×*@Ñ*@À"ÀaÓHÑHˆØ×/Ñ/ØØØ×*Ñ*Ø �/ð	 0ð 
÷
 ‰)‹+ñ	ˆð 	
×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ô ð ��‰Ùñ ,ô ! §¡£Ó+ˆð
 	×Ñœ˜V› aÔ(Ø�‰œ
 6¨"¡:¬z×/?Ñ/?×/KÑ/KÓLÔMØ�‰˜Ÿ™Õ(r-   c                 ó¨  ^ ^• [        5       n[        Ul        T R                  UT R                  T R
                  5      u  nmUR                  S   R                  R                  nT R                  UR                  5        [        TR                  5       5      nT R                  [        U5      S5        UR                  5         T R!                  UR                  5        T R!                  UR"                  S5        [        TR                  5       5      nT R                  [        U5      S5        U U4S jnUR$                  S   R'                  U5      $ )zƒ
The H2Stream data implements IPushProducer, and can have its data
production controlled by the Request if the Request chooses to.
r5   s   hello world, it's http/2!r2  c                 ó°   >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  SUS   R
                  ;   5        g ©Nr*  r¦   r¥   ©r¸   r4  r5  r�   r6  r=   r;  s     €€r)   r<  Ú;HTTP2ServerTests.test_streamProducingData.<locals>.validate  sE   ø€ ä$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   )r   ÚConsumerDummyHandlerProxyr>  r&  rO  rP  ÚstreamsÚ_requestÚoriginalÚassertFalserÐ   r¸   r4  r5  r�   r×   r6  r…   r@  rA  )r(   rþ   rÇ   Úrequestrª   r<  r#  s   `     @r)   Útest_streamProducingDataÚ)HTTP2ServerTests.test_streamProducingDataõ  s  ù€ ô
 "“^ˆ
Ü$=ˆ
Ô!Ø×-Ñ-Ø˜×/Ñ/°×1EÑ1Eó
‰ˆˆ9ð ×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆØ×Ñ˜×1Ñ1Ô2ô
 ! §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(ð
 	×ÑÔØ�‰˜×0Ñ0Ô1Ø�‰˜Ÿ™Ð'CÔDô
 ! §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(ö	>ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr-   c                 óf  ^ ^	• [        5       n[        5       m	[        5       n[        Ul        [        T R                  T R                  U5      n[        5       US   l	        UR                  5       nUSR                  S U 5       5      -  nUR                  T	5        [        U5       H  nUR                  U5        M     UR                  S   R                   R"                  nT R%                  UR&                  5        UR(                  S   nUR+                  5         U	U 4S jnUR-                  U5      $ )zÑ
The H2Stream data implements IPushProducer, and can have its data
production controlled by the Request if the Request chooses to.
When the production is stopped, that causes the stream connection to
be lost.
r¥   r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚAHTTP2ServerTests.test_abortStreamProducingData.<locals>.<genexpr>2  ó   é € Ð ?º°1§¡§ ºùr²   r5   c                 ó  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        US   [        R                  R                  5      5        TR                  US   R                  S5        g )Nr2  r¥   r5   )
r¸   r4  r5  r�   r6  r–   r8   r9   rg   r.  )rB   rª   re  r(   s     €€r)   r<  Ú@HTTP2ServerTests.test_abortStreamProducingData.<locals>.validateE  sf   ø€ ä$ Q§W¡W£YÓ/ˆFð ×ÑœS ›[¨!Ô,Ø�O‰OœJ v¨b¡z´:×3CÑ3C×3RÑ3RÓSÔTØ×Ñ˜V B™Z×1Ñ1°1Õ5r-   )r!   r   r   Ú!AbortingConsumerDummyHandlerProxyr>  r«   rO  rP  rK   r=   r3   r³   r   r   r!  r�  rŽ  r�  r�  rÐ   r@  r×   rA  )
r(   rD   ro  rª   r$  r%  r‘  ÚcleanupCallbackr<  re  s
   `        @r)   Útest_abortStreamProducingDataÚ.HTTP2ServerTests.test_abortStreamProducingData"  s  ù€ ô ‹NˆÜÓˆÜ‹NˆÜ<ˆÔô $ D×$;Ñ$;¸T×=QÑ=QÐSTÓUˆÜ›5ˆˆr‰
ÔØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð
 —)‘)˜A‘,×'Ñ'×0Ñ0ˆØ×Ñ˜×1Ñ1Ô2ð ×3Ñ3°AÑ6ˆð 	×ÑÔö	6ð ×*Ñ*¨8Ó4Ð4r-   c                 ó4  ^ ^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   R                  R                  nUR                  S5        UR                  S5        UR                  S   nUR                  UR                  SSS9R                  5       5        T R                  UR                  5        T R                  UR                  SL 5        UR                  S5        U U4S jnUR!                  U5      $ )z“
When a RstStream frame is received, the L{H2Connection} and L{H2Stream}
objects tear down the L{http.Request} and swallow all outstanding
writes.
r5   ó   first chunkó   second chunk)rb   Ns   third chunkc                 ó  >• [        TR                  5       5      nTR                  [        U5      S5        TR                  US   R                  S5        TR                  [        US   [        R                  R                  5      5        g ©Nr2  r5   ©
r¸   r4  r5  r�   r.  r6  r–   r8   r9   r:   r;  s     €€r)   r<  Ú9HTTP2ServerTests.test_terminatedRequest.<locals>.validate{  óe   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFà×ÑœS ›[¨!Ô,Ø×Ñ˜V A™Y×0Ñ0°!Ô4à�O‰OœJ v¨a¡y´*×2BÑ2B×2OÑ2OÓPÕQr-   )r   ÚDummyProducerHandlerProxyr>  r&  r?  r�  rŽ  r�  rÃ   r@  r!  rh   r¯   r6  Ú_disconnectedrÎ   rA  ©r(   rþ   r¢   r‘  r›  r<  r#  s   `     @r)   Útest_terminatedRequestÚ'HTTP2ServerTests.test_terminatedRequestP  sü   ù€ ô "“^ˆ
Ü$=ˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�ið
 ×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆð 	�‰�nÔ%Ø�‰�oÔ&ð %×<Ñ<¸QÑ?ˆð 	×ÑØ×,Ñ,¨Q¸!Ð,Ð<×FÑFÓHô	
ð
 	�‰˜×-Ñ-Ô.Ø�‰˜Ÿ™¨4Ð/Ô0ð 	�‰�nÔ%ö	Rð ×*Ñ*¨8Ó4Ð4r-   c                 óF  ^ ^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   R                  R                  nUR                  S5        UR                  S5        UR                  S   nUR                  UR                  SS9R                  5       5        T R                  UR                  5        T R                  UR                  SL 5        T R!                  UR"                  5        U U4S jnUR%                  U5      $ )z–
When a GoAway frame is received, the L{H2Connection} and L{H2Stream}
objects tear down all outstanding L{http.Request} objects and stop all
writing.
r5   rŸ  r   r   ©ra   Nc                 ó  >• [        TR                  5       5      nTR                  [        U5      S5        TR                  US   R                  S5        TR                  [        US   [        R                  R                  5      5        g r¢  r£  r;  s     €€r)   r<  Ú<HTTP2ServerTests.test_terminatedConnection.<locals>.validate¯  r¥  r-   )r   r¦  r>  r&  r?  r�  rŽ  r�  rÃ   r@  r!  rd   r¯   r6  r§  rÎ   r�  Ú_stillProducingrA  r¨  s   `     @r)   Útest_terminatedConnectionÚ*HTTP2ServerTests.test_terminatedConnection…  s  ù€ ô "“^ˆ
Ü$=ˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�ið
 ×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆð 	�‰�nÔ%Ø�‰�oÔ&ð %×<Ñ<¸QÑ?ˆð 	×ÑØ×)Ñ)°qÐ)Ð9×CÑCÓEô	
ð
 	�‰˜×-Ñ-Ô.Ø�‰˜Ÿ™¨4Ð/Ô0ð 	×Ñ˜×3Ñ3Ô4ö	Rð ×*Ñ*¨8Ó4Ð4r-   c                 óÄ   ^ ^• [        5       n[        Ul        T R                  S/-   nT R	                  X/ 5      u  nmU U4S jnUR
                  S   R                  U5      $ )zY
Requests containing Expect: 100-continue cause provisional 100
responses to be emitted.
)s   expects   100-continuec                 ó¤  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        S USS   5       5      5        TR	                  [        US   [        R                  R                  5      5        TR                  US   R                  S/5        TR	                  SUS   R                  ;   5        g )Nrs  c              3   ó>   #   • U  H  oR                   S :H  v •  M     g7fr,  r-  r°   s     r)   r£   ÚQHTTP2ServerTests.test_respondWith100Continue.<locals>.validate.<locals>.<genexpr>Í  r0  r1  r5   )r  s   100r¦   r¥   )r¸   r4  r5  r�   r6  r7  r–   r8   r9   r:   r<   r=   r;  s     €€r)   r<  Ú>HTTP2ServerTests.test_respondWith100Continue.<locals>.validateÉ  sŸ   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFà×ÑœS ›[¨!Ô,Ø�O‰OœCÑE¸&ÀÀ¹*ÓEÓEÔFà�O‰OœJ v¨a¡y´*×2BÑ2B×2OÑ2OÓPÔQØ×Ñ˜V A™YŸ^™^Ð.BÐ-CÔDØ�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   r5   )r   r   r>  r?  r&  r@  rA  )r(   rþ   rA   rÇ   r<  r#  s   `    @r)   Útest_respondWith100ContinueÚ,HTTP2ServerTests.test_respondWith100Continue¹  sc   ù€ ô
 "“^ˆ
Ü$9ˆ
Ô!ð ×(Ñ(Ð,HÐ+IÑIˆà×-Ñ-¨jÀ2ÓF‰ˆˆ9ö
	>ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr-   c                 ó˜  ^ ^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   nUR                  R                  nUR                  S   nUR                  5         T R                  UR                  5        T R                  UR                  SL 5        U U4S jnUR                  U5      $ )z”
Triggering the call to L{H2Stream._respondToBadRequestAndDisconnect}
leads to a 400 error being sent automatically and the stream being torn
down.
r5   Nc                 ó\  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        US   [        R                  R                  5      5        TR                  US   R                  S/5        TR	                  SUS   R                  ;   5        g )Nr2  r5   )r  s   400r¦   r¥   )r¸   r4  r5  r�   r6  r–   r8   r9   r:   r<   r=   r;  s     €€r)   r<  Ú6HTTP2ServerTests.test_respondWith400.<locals>.validateñ  s‚   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFà×ÑœS ›[¨!Ô,à�O‰OœJ v¨a¡y´*×2BÑ2B×2OÑ2OÓPÔQØ×Ñ˜V A™YŸ^™^Ð.BÐ-CÔDØ�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   )r   r¦  r>  r&  r?  r�  rŽ  r�  r@  Ú!_respondToBadRequestAndDisconnectr6  r§  rÎ   rA  )r(   rþ   rÇ   Ústreamr‘  r›  r<  r#  s   `      @r)   Útest_respondWith400Ú$HTTP2ServerTests.test_respondWith400Õ  s³   ù€ ô "“^ˆ
Ü$=ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆØ$×<Ñ<¸QÑ?ˆð 	×0Ñ0Ô2ð 	�‰˜×-Ñ-Ô.Ø�‰˜Ÿ™¨4Ð/Ô0ö	>ð ×*Ñ*¨8Ó4Ð4r-   c                 ód  ^ ^^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   nUR                  R                  n/ SQmT H  nUR                  U5        M     UR                  5         UU U4S jnUR                  S   R                  U5      $ )z„
Calling L{Request.loseConnection} causes all data that has previously
been sent to be flushed, and then the stream cleanly closed.
r5   )ó   helloó   worldó   hereó   areó   someó   writesc                 ó(  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        S USS   5       5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  SUS   R                  ;   5        U Vs/ s H:  n[        U[        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  UTS/-   5        g s  snf )NrŽ   c              3   ó>   #   • U  H  oR                   S :H  v •  M     g7fr,  r-  r°   s     r)   r£   ÚQHTTP2ServerTests.test_loseH2StreamConnection.<locals>.validate.<locals>.<genexpr>  r0  r1  r5   r¦   r¥   r-   ©r¸   r4  r5  r�   r6  r7  r–   r8   r9   r:   r=   rL   r<   )rB   rª   rD   ÚreceivedDataChunksÚ
dataChunksr(   r#  s       €€€r)   r<  Ú>HTTP2ServerTests.test_loseH2StreamConnection.<locals>.validate  sà   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰OœCÑE¸&ÀÀ¹*ÓEÓEÔFà�O‰OœJ v¨a¡y´*×2BÑ2B×2OÑ2OÓPÔQØ�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'ó"Ú &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð "ð ×ÑØ"Ø˜c˜UÑ"õùò"s   Â5-DÃ&D)r   r¦  r>  r&  r?  r�  rŽ  r�  rÃ   ÚloseConnectionr@  rA  )	r(   rþ   rÇ   r½  r‘  r¡   r<  rÌ  r#  s	   `      @@r)   Útest_loseH2StreamConnectionÚ,HTTP2ServerTests.test_loseH2StreamConnectionü  s£   ú€ ô "“^ˆ
Ü$=ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆò Oˆ
ÛˆEØ�M‰M˜%Ö ñ  ð 	×ÑÔ ÷	ð$ ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr-   c                 óô   • [        5       n[        Ul        U R                  XR                  / 5        UR
                  S   nUR                  R                  nU R                  [        UR                  US5        g)z;
The L{H2Stream} object forbids registering two producers.
r5   TN)r   r¦  r>  r&  r?  r�  rŽ  r�  rû   Ú
ValueErrorré   )r(   rþ   r½  r‘  s       r)   Útest_cannotRegisterTwoProducersÚ0HTTP2ServerTests.test_cannotRegisterTwoProducers)  sd   € ô "“^ˆ
Ü$=ˆ
Ô!Ø×Ñ˜z×+AÑ+AÀ2ÔFð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆà×Ñœ* f×&=Ñ&=¸wÈÕMr-   c                 ó\  ^ ^^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   nUR                  R                  mTR                  R                  nUR                  U4S j5        U U4S jnUR                  S   R                  U5      $ )zt
L{Request} objects that have registered pull producers get blocked and
unblocked according to HTTP/2 flow control.
r5   c                 ó$   >• TR                  5       $ r$   )rÅ   )rX  r‘  s    €r)   Ú<lambda>Ú;HTTP2ServerTests.test_handlesPullProducer.<locals>.<lambda>E  s   ø€ ¨w¯~©~Ô/?r-   c                 ó:  >• [        TR                  5       5      nTR                  SUS   R                  ;   5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  U/ SQ5        g s  snf )Nr¦   r¥   )ó   0r  r  ó   3ó   4ó   5ó   6ó   7ó   8ó   9r-   ©
r¸   r4  r6  r=   r–   r8   r9   rL   r<   r5  ©rB   rª   rD   rÌ  r(   r#  s       €€r)   r<  Ú;HTTP2ServerTests.test_handlesPullProducer.<locals>.validateH  s…   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×ÑØÚQõùòó   Á -BÁ1B)r   r   r>  r&  r?  r�  rŽ  r�  Ú_actualProducerÚresultrA  r@  )r(   rþ   rÇ   r½  ÚproducerCompleter<  r‘  r#  s   `     @@r)   Útest_handlesPullProducerÚ)HTTP2ServerTests.test_handlesPullProducer7  s˜   ú€ ô
 "“^ˆ
Ü$Aˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆØ"×2Ñ2×9Ñ9ÐØ×$Ñ$Ô%?Ô@ö	ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr-   c                 ó$  • [        5       n[        Ul        U R                  XR                  / 5        UR
                  S   R                  R                  nU R                  UR                  5       5        UR
                  S   R                  5         g)z:
L{Request} objects can correctly ask isSecure on HTTP/2.
r5   N)r   r   r>  r&  r?  r�  rŽ  r�  r�  ÚisSecureÚabortConnection)r(   rþ   r‘  s      r)   Útest_isSecureWorksProperlyÚ+HTTP2ServerTests.test_isSecureWorksProperlyY  ss   € ô "“^ˆ
Ü$;ˆ
Ô!Ø×Ñ˜z×+AÑ+AÀ2ÔFà×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆØ×Ñ˜×)Ñ)Ó+Ô,Ø×Ñ˜1Ñ×-Ñ-Õ/r-   c                 óB  ^ ^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   R                  R                  n[        R                  " SUR                  5        U U4S jnUR                  S   R                  U5      $ )z<
L{H2Connection} correctly unblocks when a stream is ended.
r5   ç{®Gáz„?c                  ó°   >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  SUS   R
                  ;   5        g )Nr3  r¦   r¥   rŠ  )rÒ   rª   r(   r#  s     €€r)   ÚvalidateCompleteÚCHTTP2ServerTests.test_lateCompletionWorks.<locals>.validateCompleter  sE   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   )r   r   r>  r&  r?  r�  rŽ  r�  r   Ú	callLaterrÅ   r@  rA  )r(   rþ   rÇ   r‘  ró  r#  s   `    @r)   Útest_lateCompletionWorksÚ)HTTP2ServerTests.test_lateCompletionWorkse  s‰   ù€ ô "“^ˆ
Ü$;ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆÜ×Ò˜$ §¡Ô/ö	>ð ×1Ñ1°!Ñ4×@Ñ@ÐAQÓRÐRr-   c                 óp  ^ ^• [        5       n[        Ul        T R                  UT R                  / 5      u  nmUR
                  S   nUR                  R                  nUR                  S5        UR                  / SQ5        UR                  5         UR                  S   nU U4S jnUR                  U5      $ )zG
L{H2Stream} objects can send a series of frames via C{writeSequence}.
r5   r½   )ó   Helloó   ,ó   world!c                 ó:  >• [        TR                  5       5      nTR                  SUS   R                  ;   5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  U/ SQ5        g s  snf )Nr¦   r¥   )rù  rú  rû  r-   râ  rã  s       €€r)   r<  Ú@HTTP2ServerTests.test_writeSequenceForChannels.<locals>.validateŒ  s‚   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×Ñ˜ZÒ)IÕJùòrå  )r   r   r>  r&  r?  r�  rŽ  r�  rÁ   ÚwriteSequencerÅ   r@  rA  )r(   rþ   rÇ   r½  r‘  ÚcompletionDeferredr<  r#  s   `      @r)   Útest_writeSequenceForChannelsÚ.HTTP2ServerTests.test_writeSequenceForChannels{  s£   ù€ ô "“^ˆ
Ü$;ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9à×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆà×Ñ Ô$Ø×ÑÒ8Ô9Ø�‰Ôà'×?Ñ?ÀÑBÐö
	Kð "×-Ñ-¨hÓ7Ð7r-   c                 óÚ  ^ ^^^	^
^• [        5       m
[        5       m[        5       m[        Tl        T
R                  5       nUT
R                  [        R                  R                  R                  S05      R                  5       -  nU[        T R                  / T
5      -  nTR                  T5        [        U5       H  nTR!                  U5        M     TR"                  S   nUR$                  R&                  mTR)                  S5        / SQm	U	U4S jn[*        R,                  " [.        SU5      nUR1                  UU
4S j5        UU	U 4S jnTR2                  S   R1                  U5      $ )	z´
Delaying writes from L{Request} causes the L{H2Connection} to block on
sending until data is available. However, data is *not* sent if there's
no room in the flow control window.
rs  r5   ó   fiver)rÃ  rÄ  rÅ  rÆ  c                  óZ   >• T H  n TR                  U 5        M     TR                  5         g r$   )rÃ   rÅ   )r¡   rÌ  r‘  s    €€r)   Úwrite_chunksÚ7HTTP2ServerTests.test_delayWrites.<locals>.write_chunks¹  s#   ø€ ã#�Ø—‘˜eÖ$ñ $à�N‰NÕr-   rñ  c                  ó^   >• TR                  TR                  SSS9R                  5       5      $ )Nr5   é2   ©rB   rY   )r!  rZ   r¯   )rÒ   ro  rD   s    €€r)   r×  Ú3HTTP2ServerTests.test_delayWrites.<locals>.<lambda>Á  s*   ø€ ˜!Ÿ.™.Ø×(Ñ(°!¸rÐ(ÐB×LÑLÓNôr-   c                 ó0  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        S USS   5       5      5        TR	                  [        US   [        R                  R                  5      5        TR	                  SUS   R                  ;   5        U Vs/ s H:  n[        U[        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  US/T-   S/-   5        g s  snf )NrŽ   c              3   ó>   #   • U  H  oR                   S :H  v •  M     g7fr,  r-  r°   s     r)   r£   ÚFHTTP2ServerTests.test_delayWrites.<locals>.validate.<locals>.<genexpr>Í  r0  r1  r2  r¦   r¥   r  r-   rÊ  )rB   rª   rD   rË  re  rÌ  r(   s       €€€r)   r<  Ú3HTTP2ServerTests.test_delayWrites.<locals>.validateÈ  sæ   ø€ Ü$ Q§W¡W£YÓ/ˆFð ×ÑœS ›[¨!Ô,Ø�O‰OœCÑE¸&ÀÀ¹*ÓEÓEÔFà�O‰OœJ v¨a¡y´*×2BÑ2B×2OÑ2OÓPÔQØ�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'ó"Ú &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð "ð ×ÑØ"Ø�
˜ZÑ'¨3¨%Ñ/õùò"s   Â5-DÃ&D)r!   r   r   r   r>  r3   rT   Úh2rR   ÚSettingCodesÚINITIAL_WINDOW_SIZEr¯   r´   r?  r   r   r!  r�  rŽ  r�  rÃ   r   Ú
deferLaterr   rA  r@  )r(   r$  r%  r½  r  Údr<  ro  re  rÌ  rD   r‘  s   `      @@@@@r)   Útest_delayWritesÚ!HTTP2ServerTests.test_delayWritesš  s*  ý€ ô ‹NˆÜÓˆÜ‹NˆÜ2ˆÔà×0Ñ0Ó2ˆØ˜×,Ñ,Ü�[‰[×%Ñ%×9Ñ9¸1Ð=ó
ç
‰)‹+ñ	ˆð 	Ô)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆð 	�‰�hÔÚ:ˆ
ö	ô �OŠOœG T¨<Ó8ˆØ	�‰õô	
÷	ð$ ×(Ñ(¨Ñ+×7Ñ7¸ÓAÐAr-   c                 óÈ  • [        5       n[        5       n[        5       n[        Ul        UR                  5       nU[        U R                  / US9-  nXAR                  SS9R                  5       -  nUR                  U5        UR                  U5        [        UR                  5       5      nU R                  [        U5      S5        U R!                  SUR"                  5        g)z]
A client that immediately resets after sending the body causes Twisted
to send no response.
©rA   r<   r¢   r5   rŸ   N)r!   r   r   r   r>  r3   r´   r?  rh   r¯   r   r!  r¸   r4  r5  r�   ÚassertNotInr@  )r(   r¢   r#  ro  r$  rª   s         r)   Útest_resetAfterBodyÚ$HTTP2ServerTests.test_resetAfterBodyÜ  sÅ   € ô
 $“~ˆÜ#Ó%ˆ	Ü‹NˆÜ0ˆÔà#×;Ñ;Ó=ˆØÔ)Ø×*Ñ*°À,ñ
ñ 	
ˆð 	×8Ñ8À!Ð8ÐD×NÑNÓPÑPˆØ	×Ñ˜Ô#Ø	�‰�|Ô$ä  §¡Ó!2Ó3ˆà×Ñœ˜V› aÔ(Ø×Ñ˜˜A×5Ñ5Õ6r-   c                 ó˜  ^ ^^• [         R                  " 5       m " U4S jS[        5      n[        5       m[        R
                  " 5       n[        U5      Tl        UTl        [        5       Tl
        T R                  TT R                  / 5        UU 4S jnTR                  U5        TR                  S   n[         R                  " TU/5      $ )zi
A custom L{Request} subclass that requires the site and factory in the
constructor is able to get them.
c                   ó"   >• \ rS rSrU 4S jrSrg)ÚTHTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.SuperRequestiú  c                 ó°   >• [         R                  " U /UQ70 UD6  TR                  U R                  R                  U R                  R
                  45        g r$   )r   r*   ÚcallbackrÎ   ÚsiteÚfactory)r(   rÒ   rÓ   r  s      €r)   r*   Ú]HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.SuperRequest.__init__û  s@   ø€ Ü ×)Ò)¨$Ð@°Ò@¸Ò@Ø—
‘
˜DŸL™L×-Ñ-¨t¯|©|×/CÑ/CÐDÕEr-   r2   N)rz   r{   r|   r}   r*   r   )r  s   €r)   ÚSuperRequestr  ú  s   ø† ÷Fð Fr-   r#  c                 ó~   >• U u  pTR                  UTR                  5        TR                  UTR                  5        g r$   )ÚassertIsr   r!  )rÒ   r   r!  rþ   r(   s      €€r)   ÚvalidateFactoryAndSiteÚ^HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.validateFactoryAndSite	  s0   ø€ Ø ‰MˆDØ�M‰M˜$ 
§¡Ô0Ø�M‰M˜' :×#5Ñ#5Õ6r-   r5   )r   ÚDeferredr   r   r   ÚHTTPFactoryr   r>  r!  Úobjectr   r&  r?  rA  r@  ÚgatherResults)r(   r#  ÚhttpFactoryr&  r›  rþ   r  s   `    @@r)   Ú-test_RequestRequiringFactorySiteInConstructorÚ>HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructoró  s«   ú€ ô
 �NŠNÓˆ÷	FÔ+ô 	Fô
 "“^ˆ
Ü×&Ò&Ó(ˆÜ$<¸\Ó$Jˆ
Ô!ð )ˆ
ÔÜ ›(ˆ
Œà×Ñ˜z¨4×+AÑ+AÀ2ÔFö	7ð
 	
�‰Ð,Ô-ð %×<Ñ<¸QÑ?ˆÜ×"Ò" A Ð#7Ó8Ð8r-   c                 ód  ^ • [        5       n[        [        5      Ul        T R	                  UT R
                  / 5      u  p#UR                  R                  nT R                  [        U5      S5        U 4S jnUS   nUR                  U5        UR                  S   n[        R                  " Xg/5      $ )zm
A request sent to a HTTP/2 connection fires the
L{http.Request.notifyFinish} callback with a L{None} value.
r5   c                 ó(   >• TR                  U 5        g r$   )ÚassertIsNone)rç  r(   s    €r)   r<  Ú?HTTP2ServerTests.test_notifyOnCompleteRequest.<locals>.validate!  s   ø€ Ø×Ñ˜fÕ%r-   r   )r   rì   r   r>  r&  r?  rî   r5  r�   rA  r@  r   r+  )r(   rþ   rÇ   r#  Ú	deferredsr<  r  r›  s   `       r)   Útest_notifyOnCompleteRequestÚ-HTTP2ServerTests.test_notifyOnCompleteRequest  sž   ø€ ô
 "“^ˆ
Ü$;Ô<LÓ$Mˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆà×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+õ	&ð �a‰LˆØ	�‰�hÔð %×<Ñ<¸QÑ?ˆÜ×"Ò" AÐ#7Ó8Ð8r-   c                 ó„  ^ • [        5       n[        [        5      Ul        T R	                  UT R
                  / 5      u  p#UR                  R                  nT R                  [        U5      S5        U 4S jnU 4S jnUS   nUR                  XV5        UR                  SS9R                  5       nUR                  U5        U$ )z_
A HTTP/2 reset stream fires the L{http.Request.notifyFinish} deferred
with L{ConnectionLost}.
r5   c                 ó(   >• TR                  S5        g ©Nz#Didn't errback, called back instead©Úfail©Úignr(   s    €r)   r  Ú;HTTP2ServerTests.test_notifyOnResetStream.<locals>.callback<  ó   ø€ Ø�I‰IÐ;Õ<r-   c                 óš   >• TR                  U [        R                  5        TR                  U R                  [
        R                  5        g r$   ©ÚassertIsInstancer   ÚFailurer%  Útyper   ÚConnectionLost©Úreasonr(   s    €r)   ÚerrbackÚ:HTTP2ServerTests.test_notifyOnResetStream.<locals>.errback?  ó2   ø€ Ø×!Ñ! &¬'¯/©/Ô:Ø�M‰M˜&Ÿ+™+¤u×';Ñ';Ô<Ør-   r   rŸ   )r   rì   r   r>  r&  r?  rî   r5  r�   ÚaddCallbacksrh   r¯   r!  )	r(   rþ   r¢   r#  r3  r  rG  r  ÚinvalidDatas	   `        r)   Útest_notifyOnResetStreamÚ)HTTP2ServerTests.test_notifyOnResetStream,  s³   ø€ ô
 "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+õ	=õ	ð
 �a‰LˆØ	�‰�xÔ)ð #×6Ñ6ÀÐ6ÐB×LÑLÓNˆØ×Ñ Ô,àˆr-   c                 ó  ^ • [        5       n[        [        5      Ul        T R	                  UT R
                  / 5      u  p#[        T R
                  / USS9nUR                  U5        UR                  R                  nT R                  [        U5      S5        U 4S jnU 4S jnU H  nUR                  Xg5        M     UR                  SSS9R                  5       n	UR                  U	5        [        R                  " U5      $ )	z 
A HTTP/2 protocol error triggers the L{http.Request.notifyFinish}
deferred for all outstanding requests with a Failure that contains the
underlying exception.
r3  ©r¢   rB   r2  c                 ó(   >• TR                  S5        g r8  r9  r;  s    €r)   r  Ú=HTTP2ServerTests.test_failWithProtocolError.<locals>.callbackg  r>  r-   c                 ó®   >• TR                  U [        R                  5        TR                  U R                  [        R
                  R                  5        g r$   )rA  r   rB  r4  r  Ú
exceptionsÚProtocolErrorrE  s    €r)   rG  Ú<HTTP2ServerTests.test_failWithProtocolError.<locals>.errbackj  s8   ø€ Ø×!Ñ! &¬'¯/©/Ô:Ø×!Ñ! &§,¡,´·±×0KÑ0KÔLØr-   ó   yoéð   ©r<   rB   )r   rì   r   r>  r&  r?  r´   r!  rî   r5  r�   rJ  rM   r¯   r   r+  ©
r(   rþ   r¢   r#  ÚsecondRequestr3  r  rG  r  rK  s
   `         r)   Útest_failWithProtocolErrorÚ+HTTP2ServerTests.test_failWithProtocolErrorM  sí   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆô *Ø×"Ñ" B°\ÈAñ
ˆð 	×Ñ Ô.ð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+õ	=õ	ó
 ˆAØ�N‰N˜8Ö-ñ ð
 #×1Ñ1°uÀtÐ1ÐL×VÑVÓXˆØ×Ñ Ô,ä×"Ò" 9Ó-Ð-r-   c                 ó  ^ • [        5       n[        [        5      Ul        T R	                  UT R
                  / 5      u  p#[        T R
                  / USS9nUR                  U5        UR                  R                  nT R                  [        U5      S5        U 4S jnU 4S jnU H  nUR                  Xg5        M     UR                  SS9R                  5       n	UR                  U	5        [        R                  " U5      $ )z”
A HTTP/2 GoAway triggers the L{http.Request.notifyFinish}
deferred for all outstanding requests with a Failure that contains a
RemoteGoAway error.
r3  rO  r2  c                 ó(   >• TR                  S5        g r8  r9  r;  s    €r)   r  Ú4HTTP2ServerTests.test_failOnGoaway.<locals>.callback’  r>  r-   c                 óš   >• TR                  U [        R                  5        TR                  U R                  [
        R                  5        g r$   r@  rE  s    €r)   rG  Ú3HTTP2ServerTests.test_failOnGoaway.<locals>.errback•  rI  r-   r¬  )r   rì   r   r>  r&  r?  r´   r!  rî   r5  r�   rJ  rd   r¯   r   r+  rY  s
   `         r)   Útest_failOnGoawayÚ"HTTP2ServerTests.test_failOnGoawayy  së   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆô *Ø×"Ñ" B°\ÈAñ
ˆð 	×Ñ Ô.ð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+õ	=õ	ó
 ˆAØ�N‰N˜8Ö-ñ ð #×3Ñ3ÀÐ3ÐC×MÑMÓOˆØ×Ñ Ô,ä×"Ò" 9Ó-Ð-r-   c                 óÆ  ^ • [        5       n[        [        5      Ul        T R	                  UT R
                  / 5      u  p#[        T R
                  / USS9nUR                  U5        UR                  R                  nT R                  [        U5      S5        U 4S jnU 4S jnU H  nUR                  Xg5        M     UR                  5         [        R                  " U5      $ )z‚
The transport telling the HTTP/2 connection to stop producing will
fire all L{http.Request.notifyFinish} errbacks with L{error.}
r3  rO  r2  c                 ó(   >• TR                  S5        g r8  r9  r;  s    €r)   r  Ú;HTTP2ServerTests.test_failOnStopProducing.<locals>.callback¼  r>  r-   c                 óš   >• TR                  U [        R                  5        TR                  U R                  [
        R                  5        g r$   r@  rE  s    €r)   rG  Ú:HTTP2ServerTests.test_failOnStopProducing.<locals>.errback¿  rI  r-   )r   rì   r   r>  r&  r?  r´   r!  rî   r5  r�   rJ  rä   r   r+  )	r(   rþ   r¢   r#  rZ  r3  r  rG  r  s	   `        r)   Útest_failOnStopProducingÚ)HTTP2ServerTests.test_failOnStopProducing£  sÍ   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆô *Ø×"Ñ" B°\ÈAñ
ˆð 	×Ñ Ô.ð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+õ	=õ	ó
 ˆAØ�N‰N˜8Ö-ñ ð 	× Ñ Ô"ä×"Ò" 9Ó-Ð-r-   c                 óf  ^ • [        5       n[        [        5      Ul        T R	                  UT R
                  / 5      u  p#UR                  R                  nT R                  [        U5      S5        U 4S jnU 4S jnUS   nUR                  XV5        UR                  S   nUR                  5         U$ )z«
A HTTP/2 stream that has had _respondToBadRequestAndDisconnect called
on it from a request handler calls the L{http.Request.notifyFinish}
errback with L{ConnectionLost}.
r5   c                 ó(   >• TR                  S5        g r8  r9  r;  s    €r)   r  Ú7HTTP2ServerTests.test_notifyOnFast400.<locals>.callbackÝ  r>  r-   c                 óš   >• TR                  U [        R                  5        TR                  U R                  [
        R                  5        g r$   r@  rE  s    €r)   rG  Ú6HTTP2ServerTests.test_notifyOnFast400.<locals>.errbackà  rI  r-   r   )r   rì   r   r>  r&  r?  rî   r5  r�   rJ  r�  r¼  )	r(   rþ   r¢   r#  r3  r  rG  r  r½  s	   `        r)   Útest_notifyOnFast400Ú%HTTP2ServerTests.test_notifyOnFast400Ì  s¥   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+õ	=õ	ð
 �a‰LˆØ	�‰�xÔ)ð ×#Ñ# AÑ&ˆØ×0Ñ0Ô2àˆr-   c           	      óÄ  • [        5       n[        U5      nUR                  Ul        [        Ul        Sn[        5       n[        5       nUR                  5       nUR                  U5        UR                  U5        UR                  [        U R                  / XCS95        UR                  5         SUl        UR                  U5        U R                  UR                   5        g)z¸
A HTTP/2 stream that has had _respondToBadRequestAndDisconnect
called on it does not write control frame data if its
transport is paused and its control frame limit has been
reached.
r5   rŸ   r   N)r
   r   rõ  r   r>  r!   r   r3   r   r!  r´   r?  rÏ   Ú_maxBufferedControlFrameBytesr¼  r6  Údisconnected)r(   ÚmemoryReactorrþ   rB   r¢   r#  r3   s          r)   Útest_fast400WithCircuitBreakerÚ/HTTP2ServerTests.test_fast400WithCircuitBreakeró  sÉ   € ô +Ó,ˆÜ! -Ó0ˆ
Ø,×6Ñ6ˆ
Ôô %7ˆ
Ô!àˆä#“~ˆÜ#Ó%ˆ	ð #/×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8à×ÑÜØ×&Ñ&¨¨Lñô	
ð 	×!Ñ!Ô#Ø34ˆ
Ô0à×4Ñ4°XÔ>à�‰˜	×.Ñ.Õ/r-   c                 óL  • [        5       n[        Ul        [        5       n[	        5       nUR                  5       nUR                  U5        UR                  U5        UR                  5         [        SS5       H1  nUR                  UR                  0 5      R                  5       5        M3     [        UR                  5       5      nU R                  [        U5      S5        UR!                  5         [        UR                  5       5      nU R                  [        U5      S5        g)zx
If a the L{H2Connection} has been paused by the transport, it will
not write automatic frame data triggered by writes.
r   éd   r5   ée   N)r   r   r>  r!   r   r3   r   r!  rÏ   rÂ   rT   r¯   r¸   r4  r5  r�   rÖ   )r(   rþ   r¢   r#  r3   rÇ   rª   s          r)   Ú test_bufferingAutomaticFrameDataÚ1HTTP2ServerTests.test_bufferingAutomaticFrameData  sê   € ô "“^ˆ
Ü$9ˆ
Ô!Ü#“~ˆÜ#Ó%ˆ	à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×!Ñ!Ô#ô �q˜#–ˆAØ×#Ñ# L×$CÑ$CÀBÓ$G×$QÑ$QÓ$SÖTñ ô ! §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(ð 	×"Ñ"Ô$Ü  §¡Ó!2Ó3ˆØ×Ñœ˜V› cÕ*r-   c                 óh  • [        5       n[        Ul        [        5       n[	        5       nUR                  5       nUR                  U5        UR                  U5        UR                  5         SUl	        U R                  UR                  5        [        SS5       H1  nUR                  UR                  0 5      R                  5       5        M3     U R                  UR                  5        UR                  UR                  0 5      R                  5       5        U R                  UR                   5        g)zµ
If the L{H2Connection} has been paused by the transport, it will
not write automatic frame data triggered by writes. If this buffer
gets too large, the connection will be dropped.
ry  r   é   N)r   r   r>  r!   r   r3   r   r!  rÏ   rs  r�  r„  rÂ   rT   r¯   r6  rt  )r(   rþ   r¢   r#  r3   rÇ   s         r)   Ú2test_bufferingAutomaticFrameDataWithCircuitBreakerÚCHTTP2ServerTests.test_bufferingAutomaticFrameDataWithCircuitBreaker<  sø   € ô "“^ˆ
Ü$9ˆ
Ô!Ü#“~ˆÜ#Ó%ˆ	à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×!Ñ!Ô#ð 47ˆ
Ô0ð 	×Ñ˜×0Ñ0Ô1Ü�q˜"–ˆAØ×#Ñ# L×$CÑ$CÀBÓ$G×$QÑ$QÓ$SÖTñ à×Ñ˜×0Ñ0Ô1ð 	×Ñ × ?Ñ ?ÀÓ C× MÑ MÓ OÔPØ�‰˜	×.Ñ.Õ/r-   c                 ó®  •  " S S[         5      n[        5       n[        Ul        [	        5       nU" 5       nUR                  US5        UR                  5       nUR                  U5        UR                  U5        U R                  UR                  5        [        UR                  5       5      nU R                  [        U5      S5        U R                  UR                  S5        [!        SS5       H1  nUR                  UR#                  0 5      R%                  5       5        M3     [        UR                  5       5      nU R                  [        U5      S5        U R                  UR                  S5        UR'                  5         [        UR                  5       5      nU R                  [        U5      S5        U R                  UR                  S	5        g
)z—
If the L{H2Connection} has buffered control frames, is unpaused, and then
paused while unbuffering, it persists the buffer and stops trying to write.
c                   ó   • \ rS rSrS rSrg)ÚeHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite.<locals>.AutoPausingStringTransportid  c                 ól   • [         R                  " U /UQ70 UD6  U R                  R                  5         g r$   )r   rÃ   ÚproducerrÏ   rÑ   s      r)   rÃ   ÚkHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite.<locals>.AutoPausingStringTransport.writee  s*   € Ü×%Ò% dÐ<¨TÒ<°VÒ<Ø—‘×,Ñ,Õ.r-   r2   N)rz   r{   r|   r}   rÃ   r   r2   r-   r)   ÚAutoPausingStringTransportrƒ  d  s   † õ/r-   r‡  Tr5   r   r~  éc   r2  éZ   N)r   r   r   r>  r!   ré   r3   r   r!  ÚassertIsNotNoneÚ_consumerBlockedr¸   r4  r5  r�   Ú_bufferedControlFrameBytesrÂ   rT   r¯   rÖ   )r(   r‡  rþ   r¢   r#  r3   rª   rÇ   s           r)   Ú0test_bufferingContinuesIfProducerIsPausedOnWriteÚAHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite^  su  € ô	/¬ô 	/ô "“^ˆ
Ü$9ˆ
Ô!Ü#“~ˆÙ.Ó0ˆ	Ø×"Ñ" :¨tÔ4à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×Ñ˜Z×8Ñ8Ô9Ü  §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(Ø×Ñ˜×>Ñ>ÀÔBô �q˜"–ˆAØ×#Ñ# L×$CÑ$CÀBÓ$G×$QÑ$QÓ$SÖTñ ô ! §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(Ø×Ñ˜×>Ñ>ÀÔGð 	×"Ñ"Ô$ä  §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(Ø×Ñ˜×>Ñ>ÀÕGr-   c                 óž  • [        5       n[        U5      nUR                  Ul        [        5       n[	        5       nUR                  5       nUR                  U5        UR                  U5        UR                  5         SUl	        UR                  SSS9R                  5       nUR                  U5        U R                  UR                  5        g)z¨
A client that triggers a L{h2.exceptions.ProtocolError} over a
paused connection that's reached its buffered control frame
limit causes that connection to be aborted.
r   rV  rW  rX  N)r
   r   rõ  r!   r   r3   r   r!  rÏ   rs  rM   r¯   r6  rt  )r(   ru  rþ   r¢   r#  r3   rK  s          r)   Ú+test_circuitBreakerAbortsAfterProtocolErrorÚ<HTTP2ServerTests.test_circuitBreakerAbortsAfterProtocolError‹  s¹   € ô +Ó,ˆÜ! -Ó0ˆ
Ø,×6Ñ6ˆ
Ôä#“~ˆÜ#Ó%ˆ	ð #/×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×!Ñ!Ô#Ø34ˆ
Ô0ð #×1Ñ1°uÀtÐ1ÐL×VÑVÓXˆð 	×Ñ Ô,Ø�‰˜	×.Ñ.Õ/r-   r2   N)-rz   r{   r|   r}   r?  rO  rP  r9  r:  rL  rM  r&  rC  rQ  rZ  rp  r�  r…  r’  rœ  r©  r°  r·  r¾  rÏ  rÓ  ré  rî  rö  r   r  r  r-  r4  rL  r[  rb  ri  rp  rv  r{  r  r�  r�  r   r2   r-   r)   r  r  �  s  † òÐòÐò D€OòÐð *€OòÐð BÐò'ò:Kò8Kò8)KòV>
ò@E
òN%)òN+KòZ,5ò\35òj25òhKò8%5òN+KòZNò KòD
0òSò,8ò>@BòD7ò. 9òD9ò.òB*.òX(.òT'.òR%òN(0òT+ò> 0òD+HõZ0r-   r  c                   ó†   • \ rS rSrSr/ SQrSr/ SQr/ SQ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)ÚH2FlowControlTestsi«  zL
Tests that ensure that we handle HTTP/2 flow control limits appropriately.
)r  r	  r
  r  r  r  r  r  r  c                 óš  ^ ^	• [        5       n[        5       m	[        5       n[        Ul        UR                  5       nX1R                  [        R                  R                  R                  S05      R                  5       -  nU[        T R                  / U5      -  nUR                  T	5        [        U5       H  nUR!                  U5        M     [#        T R$                  5      S-
  n['        U5       H2  nUR)                  SSS9nUR!                  UR                  5       5        M4     U	U 4S jnUR*                  S   R-                  U5      $ )zÇ
When a L{Request} object is not using C{IProducer} to generate data and
so is not having backpressure exerted on it, the L{H2Stream} object
will buffer data until the flow control window is opened.
rs  r5   r	  c                 óâ   >• [        TR                  5       5      nTR                  SUS   R                  ;   5        SR	                  S U 5       5      nTR                  TR                  U5        g )Nr¦   r¥   r-   c              3   ó�   #   • U  H<  n[        U[        R                  R                  5      (       d  M.  UR                  v •  M>     g 7fr$   ©r–   r8   r9   rL   r<   r°   s     r)   r£   ÚMH2FlowControlTests.test_bufferExcessData.<locals>.validate.<locals>.<genexpr>í  ó.   é € ð *Ú &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—–¢ùó
   ‚-A³A)r¸   r4  r6  r=   r³   r5  r:  ©rB   rª   ÚactualResponseDatare  r(   s      €€r)   r<  Ú:H2FlowControlTests.test_bufferExcessData.<locals>.validateæ  sg   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ð "%§¡ñ *Ù &ó*ó "Ðð ×Ñ˜T×1Ñ1Ð3EÕFr-   )r!   r   r   r   r>  r3   rT   r  rR   r  r  r¯   r´   r?  r   r   r!  r�   r:  rÂ   rZ   r@  rA  )
r(   rD   ro  r$  r%  ÚbonusFramesrÇ   r9   r<  re  s
   `        @r)   Útest_bufferExcessDataÚ(H2FlowControlTests.test_bufferExcessDataÇ  s  ù€ ô ‹NˆÜÓˆÜ‹NˆÜ0ˆÔð ×0Ñ0Ó2ˆØ×,Ñ,Ü�[‰[×%Ñ%×9Ñ9¸1Ð=ó
ç
‰)‹+ñ	ˆð 	Ô)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ô ˜$×.Ñ.Ó/°!Ñ3ˆÜ�{Ö#ˆAØ×,Ñ,°aÀ1Ð,ÐEˆEØ�N‰N˜5Ÿ?™?Ó,Ö-ñ $ö

	Gð ×(Ñ(¨Ñ+×7Ñ7¸ÓAÐAr-   c                 ór  ^ ^• [        5       n[        5       m[        5       n[        Ul        UR                  5       nX1R                  [        R                  R                  R                  S05      R                  5       -  nU[        T R                  / U5      -  nUR                  T5        [        U5       H  nUR!                  U5        M     UR"                  S   nUR$                  R&                  nT R)                  UR*                  5        UR-                  S5        T R/                  UR*                  5        T R1                  UR2                  R4                  S/5        UR!                  UR7                  SSS9R                  5       5        T R/                  UR*                  5        T R1                  UR2                  R4                  S/5        UR!                  UR7                  SSS9R                  5       5        T R/                  UR*                  5        T R1                  UR2                  R4                  S/5        UR!                  UR7                  SSS9R                  5       5        T R)                  UR*                  5        T R1                  UR2                  R4                  SS/5        UR-                  S5        T R/                  UR*                  5        T R1                  UR2                  R4                  / SQ5        UR!                  UR7                  SS	S9R                  5       5        T R)                  UR*                  5        T R1                  UR2                  R4                  / S
Q5        UR9                  5         UR;                  5         UU 4S jnUR<                  S   R?                  U5      $ )zo
L{Request} objects that have registered producers get blocked and
unblocked according to HTTP/2 flow control.
rs  r5   ó
   helloworldÚpauser	  r   Úresume)r£  r¤  r£  r  )r£  r¤  r£  r¤  c                 ó:  >• [        TR                  5       5      nTR                  SUS   R                  ;   5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  U/ SQ5        g s  snf )Nr¦   r¥   )r¢  r¢  r-   râ  ©rB   rª   rD   rÌ  re  r(   s       €€r)   r<  ÚDH2FlowControlTests.test_producerBlockingUnblocking.<locals>.validate9  s�   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×Ñ˜ZÒ)LÕMùòrå  ) r!   r   r   r¦  r>  r3   rT   r  rR   r  r  r¯   r´   r?  r   r   r!  r�  rŽ  r�  r6  Ú_producerProducingrÃ   r�  r5  r…  ÚeventsrZ   ÚunregisterProducerrÅ   r@  rA  ©	r(   rD   ro  r$  r%  r½  r‘  r<  re  s	   `       @r)   Útest_producerBlockingUnblockingÚ2H2FlowControlTests.test_producerBlockingUnblockingô  s   ù€ ô
 ‹NˆÜÓˆÜ‹NˆÜ4ˆÔð ×0Ñ0Ó2ˆØ×,Ñ,Ü�[‰[×%Ñ%×9Ñ9¸1Ð=ó
ç
‰)‹+ñ	ˆð 	Ô)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆð 	�‰˜×1Ñ1Ô2ð 	�‰�mÔ$ð 	×Ñ˜×2Ñ2Ô3Ø×Ñ˜×)Ñ)×0Ñ0°7°)Ô<ð 	
�‰�q×/Ñ/¸ÀaÐ/ÐH×RÑRÓTÔUØ×Ñ˜×2Ñ2Ô3Ø×Ñ˜×)Ñ)×0Ñ0°7°)Ô<ð 	
�‰�q×/Ñ/¸ÀaÐ/ÐH×RÑRÓTÔUØ×Ñ˜×2Ñ2Ô3Ø×Ñ˜×)Ñ)×0Ñ0°7°)Ô<ð 	
�‰�q×/Ñ/¸ÀaÐ/ÐH×RÑRÓTÔUØ�‰˜×1Ñ1Ô2Ø×Ñ˜×)Ñ)×0Ñ0°7¸HÐ2EÔFð
 	�‰�mÔ$Ø×Ñ˜×2Ñ2Ô3Ø×Ñ˜×)Ñ)×0Ñ0Ò2NÔOð 	
�‰�q×/Ñ/¸ÀbÐ/ÐI×SÑSÓUÔVØ�‰˜×1Ñ1Ô2Ø×ÑØ×Ñ×#Ñ#Ò%Kô	
ð 	×"Ñ"Ô$Ø�‰Ôö
	Nð ×(Ñ(¨Ñ+×7Ñ7¸ÓAÐAr-   c                 ó´  ^ ^^^	^
^• [        5       m	[        5       m[        5       m[        Tl        T	R                  5       nUT	R                  [        R                  R                  R                  S05      R                  5       -  nU[        T R                  / T	5      -  nTR                  T5        [        U5       H  nTR!                  U5        M     TR"                  S   mTR$                  R&                  m
T R)                  TR*                  5        T
R-                  S5        T R/                  TR*                  5        T R1                  T
R2                  R4                  S/5        T
R-                  S5        UU	U
U U4S jn[6        R8                  " [:        SU5      nUU 4S jnTR<                  S   R?                  U5      n[@        RB                  " XF/5      $ )	zA
Exactly filling the flow control window still blocks producers.
rs  r5   r¢  r£  ó   hc                  ó&  >• T R                  TR                  SSS9R                  5       5        TR                  TR                  5        TR                  TR                  R                  SS/5        TR                  5         TR                  5         g )Nr5   r  r	  r£  r¤  )
r!  rZ   r¯   r6  r¨  r5  r…  r©  rª  rÅ   )ro  rD   r‘  r(   r½  s   €€€€€r)   Úwindow_openÚ=H2FlowControlTests.test_flowControlExact.<locals>.window_openn  sv   ø€ Ø�N‰NØ×(Ñ(°!¸rÐ(ÐB×LÑLÓNôð �O‰O˜F×5Ñ5Ô6Ø×Ñ˜W×-Ñ-×4Ñ4°wÀÐ6IÔJØ×&Ñ&Ô(Ø�N‰NÕr-   r   c                 ó:  >• [        TR                  5       5      nTR                  SUS   R                  ;   5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  U/ SQ5        g s  snf )Nr¦   r¥   )rÁ  rÂ  r¯  r-   râ  r¦  s       €€r)   r<  Ú:H2FlowControlTests.test_flowControlExact.<locals>.validatez  s�   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×Ñ˜ZÒ)HÕIùòrå  )"r!   r   r   r¦  r>  r3   rT   r  rR   r  r  r¯   r´   r?  r   r   r!  r�  rŽ  r�  r6  r¨  rÃ   r�  r5  r…  r©  r   r  r   r@  rA  r   rl  )r(   r$  r%  r±  ÚwindowDeferr<  ÚvalidateDeferro  re  rD   r‘  r½  s   `      @@@@@r)   Útest_flowControlExactÚ(H2FlowControlTests.test_flowControlExactG  sƒ  ý€ ô ‹NˆÜÓˆÜ‹NˆÜ4ˆÔð ×0Ñ0Ó2ˆØ˜×,Ñ,Ü�[‰[×%Ñ%×9Ñ9¸1Ð=ó
ç
‰)‹+ñ	ˆð 	Ô)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆð 	�‰˜×1Ñ1Ô2ð 	�‰�mÔ$Ø×Ñ˜×2Ñ2Ô3Ø×Ñ˜×)Ñ)×0Ñ0°7°)Ô<ð 	�‰�dÔ÷	ñ 	ô —o’o¤g¨q°+Ó>ˆö
	Jð ×1Ñ1°!Ñ4×@Ñ@ÀÓJˆÜ×!Ò! ;Ð">Ó?Ð?r-   c           	      ó|  ^ ^• [        5       n[        5       m[        5       n[        Ul        UR                  5       nX1R                  [        R                  R                  R                  S05      R                  5       -  nU[        T R                  / U5      -  nUR                  T5        [        U5       H  nUR!                  U5        M     UR"                  S   nUR$                  R&                  nT R)                  UR*                  5        UR-                  S5        UR/                  5         UR1                  5         T R)                  UR2                  5        [4        R6                  " SUR                   UR9                  SSS9R                  5       5        UU 4S jnUR:                  S   R=                  U5      $ )z�
L{Request} objects that end a stream that is currently blocked behind
flow control can still end the stream and get cleaned up.
rs  r5   r¢  r   r  r	  c                 ó:  >• [        TR                  5       5      nTR                  SUS   R                  ;   5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  U/ SQ5        g s  snf )Nr¦   r¥   )rÁ  rÂ  r-   râ  r¦  s       €€r)   r<  Ú=H2FlowControlTests.test_endingBlockedStream.<locals>.validateµ  s�   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×Ñ˜ZÒ)BÕCùòrå  )r!   r   r   r¦  r>  r3   rT   r  rR   r  r  r¯   r´   r?  r   r   r!  r�  rŽ  r�  r6  r¨  rÃ   rª  rÅ   Úfinishedr   rõ  rZ   r@  rA  r«  s	   `       @r)   Útest_endingBlockedStreamÚ+H2FlowControlTests.test_endingBlockedStream‰  sp  ù€ ô
 ‹NˆÜÓˆÜ‹NˆÜ4ˆÔð ×0Ñ0Ó2ˆØ×,Ñ,Ü�[‰[×%Ñ%×9Ñ9¸1Ð=ó
ç
‰)‹+ñ	ˆð 	Ô)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆð 	�‰˜×1Ñ1Ô2ð 	�‰�mÔ$Ø×"Ñ"Ô$Ø�‰Ôð 	�‰˜×(Ñ(Ô)ô 	×ÒØØ�N‰NØ×$Ñ$¨a¸2Ð$Ð>×HÑHÓJô	
ö
	Dð ×(Ñ(¨Ñ+×7Ñ7¸ÓAÐAr-   c                 ó"  ^ ^	• [        5       n[        5       m	[        5       n[        Ul        UR                  5       nU[        T R                  / U5      -  nUR                  T	5        [        U5       H  nUR                  U5        M     UR                  S   nUR                  R                  nUR                  S   nUR                  5         UR!                  5         T R#                  UR$                  5        U	U 4S jnUR'                  U5      $ )z,
We safely handle responses without bodies.
r5   c                 ón  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  SUS   R
                  ;   5        U Vs/ s H:  n[        U[        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  US/5        g s  snf ©Nr3  r¦   r¥   r-   ©r¸   r4  r5  r�   r6  r=   r–   r8   r9   rL   r<   r¦  s       €€r)   r<  Ú=H2FlowControlTests.test_responseWithoutBody.<locals>.validateä  óš   ø€ Ü$ Q§W¡W£YÓ/ˆFà×ÑœS ›[¨!Ô,ð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×ÑØØ�õùòó   Á-B2ÂB2)r!   r   r   r¦  r>  r3   r´   r?  r   r   r!  r�  rŽ  r�  r@  rª  rÅ   r6  r¼  rA  ©
r(   rD   ro  r$  r%  r½  r‘  r›  r<  re  s
   `        @r)   Útest_responseWithoutBodyÚ+H2FlowControlTests.test_responseWithoutBodyÃ  sê   ù€ ô ‹NˆÜÓˆÜ‹Nˆô 5ˆÔð ×0Ñ0Ó2ˆØÔ)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆØ×3Ñ3°AÑ6ˆð 	×"Ñ"Ô$Ø�‰Ôð 	�‰˜×(Ñ(Ô)ö	ð" ×*Ñ*¨8Ó4Ð4r-   c                 ó|  ^ ^	• [        5       n[        5       m	[        5       n[        Ul        UR                  5       nU[        T R                  / U5      -  nUR                  T	5        [        U5       H  nUR                  U5        M     UR                  S   nUR                  R                  nUR                  S   nUR                  5         UR!                  5         T R#                  UR$                  5        UR                  UR'                  SSS9R)                  5       5        U	U 4S jnUR+                  U5      $ )zS
WindowUpdate frames received after we've completed the stream are
safely handled.
r5   r  r	  c                 ón  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  SUS   R
                  ;   5        U Vs/ s H:  n[        U[        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  US/5        g s  snf rÁ  rÂ  r¦  s       €€r)   r<  ÚGH2FlowControlTests.test_windowUpdateForCompleteStream.<locals>.validate  rÄ  rÅ  )r!   r   r   r¦  r>  r3   r´   r?  r   r   r!  r�  rŽ  r�  r@  rª  rÅ   r6  r¼  rZ   r¯   rA  rÆ  s
   `        @r)   Ú"test_windowUpdateForCompleteStreamÚ5H2FlowControlTests.test_windowUpdateForCompleteStream÷  s  ù€ ô ‹NˆÜÓˆÜ‹Nˆô 5ˆÔð ×0Ñ0Ó2ˆØÔ)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆØ×3Ñ3°AÑ6ˆð 	×"Ñ"Ô$Ø�‰Ôð 	�‰˜×(Ñ(Ô)ð 	
�‰�q×/Ñ/¸ÀbÐ/ÐI×SÑSÓUÔVö	ð" ×*Ñ*¨8Ó4Ð4r-   c                 ó(  ^ ^• [        5       n[        5       m[        5       n[        Ul        UR                  5       nX1R                  [        R                  R                  R                  S05      R                  5       -  nU[        T R                  / U5      -  nUR                  T5        [        U5       H  nUR!                  U5        M     UR"                  S   nUR$                  R&                  nT R)                  UR*                  5        UR-                  S5        T R)                  UR*                  5        T R/                  UR0                  R2                  / 5        UR!                  UR5                  SSS9R                  5       5        T R)                  UR*                  5        T R/                  UR0                  R2                  / 5        UR7                  5         UR9                  5         UU 4S jnUR:                  S   R=                  U5      $ )z�
L{Request} objects that have registered producers that are not blocked
behind flow control do not have their producer notified.
rs  r5   ó   wordr	  c                 ó:  >• [        TR                  5       5      nTR                  SUS   R                  ;   5        U Vs/ s H:  n[	        U[
        R                  R                  5      (       d  M.  UR                  PM<     nnTR                  USS/5        g s  snf )Nr¦   r¥   rÏ  r-   râ  r¦  s       €€r)   r<  Ú;H2FlowControlTests.test_producerUnblocked.<locals>.validate`  s„   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ñ !'óÚ &˜1¬*°Q¼
×8HÑ8H×8RÑ8R×*S“�—”¡ð ð ð ×Ñ˜Z¨'°3¨Õ8ùòrå  )r!   r   r   r¦  r>  r3   rT   r  rR   r  r  r¯   r´   r?  r   r   r!  r�  rŽ  r�  r6  r¨  rÃ   r5  r…  r©  rZ   rª  rÅ   r@  rA  r«  s	   `       @r)   Útest_producerUnblockedÚ)H2FlowControlTests.test_producerUnblocked2  s¬  ù€ ô
 ‹NˆÜÓˆÜ‹NˆÜ4ˆÔð ×0Ñ0Ó2ˆØ×,Ñ,Ü�[‰[×%Ñ%×9Ñ9¸1Ð=ó
ç
‰)‹+ñ	ˆð 	Ô)¨$×*@Ñ*@À"ÀaÓHÑHˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð —‘˜1‘ˆØ—/‘/×*Ñ*ˆð 	�‰˜×1Ñ1Ô2ð 	�‰�gÔð 	�‰˜×1Ñ1Ô2Ø×Ñ˜×)Ñ)×0Ñ0°"Ô5ð 	
�‰�q×/Ñ/¸ÀaÐ/ÐH×RÑRÓTÔUØ�‰˜×1Ñ1Ô2Ø×Ñ˜×)Ñ)×0Ñ0°"Ô5ð 	×"Ñ"Ô$Ø�‰Ôö
	9ð ×(Ñ(¨Ñ+×7Ñ7¸ÓAÐAr-   c                 óâ  ^ ^• [        5       n[        5       m[        5       n[        Ul        [        T R                  T R                  U5      nUR                  SUR                  SSS95        UR                  5       nUSR                  S U 5       5      -  nUR                  T5        [        U5       H  nUR                  U5        M     UU 4S jnUR                  S   R!                  U5      $ )z|
When a WindowUpdate frame is received for the whole connection but no
data is currently waiting, nothing exciting happens.
r5   r   rs  r	  r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚBH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.<genexpr>|  r—  r²   c                 óâ   >• [        TR                  5       5      nTR                  SUS   R                  ;   5        SR	                  S U 5       5      nTR                  TR                  U5        g )Nr¦   r¥   r-   c              3   ó�   #   • U  H<  n[        U[        R                  R                  5      (       d  M.  UR                  v •  M>     g 7fr$   r—  r°   s     r)   r£   ÚTH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.validate.<locals>.<genexpr>Š  r™  rš  )r¸   r4  r6  r=   r³   r5  rM  r›  s      €€r)   r<  ÚAH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.validateƒ  sg   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ñ<Ô=ð "%§¡ñ *Ù &ó*ó "Ðð ×Ñ˜T×2Ñ2Ð4FÕGr-   )r!   r   r   r   r>  r«   rO  rP  r  rZ   r3   r³   r   r   r!  r@  rA  )r(   rD   ro  rª   r$  r%  r<  re  s   `      @r)   Útest_unnecessaryWindowUpdateÚ/H2FlowControlTests.test_unnecessaryWindowUpdaten  sÒ   ù€ ô
 ‹NˆÜÓˆÜ‹NˆÜ0ˆÔô $ D×$;Ñ$;¸T×=QÑ=QÐSTÓUˆØ�‰�a˜×1Ñ1¸1ÈÐ1ÐJÔKØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ö
	Hð ×(Ñ(¨Ñ+×7Ñ7¸ÓAÐAr-   c                 ó¦  • [        5       n[        5       n[        5       n[        Ul        / nUR                  UR                  U R                  SS95        UR                  UR                  SSS95        UR                  5       nUSR                  S U 5       5      -  nUR                  U5        UR                  U5        U R                  U5        g)zÄ
When a WindowUpdate frame is received for a stream but no data is
currently waiting, that stream is not marked as unblocked and the
priority tree continues to assert that no stream can progress.
r5   r�   rs  r	  r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚKH2FlowControlTests.test_unnecessaryWindowUpdateForStream.<locals>.<genexpr>£  s   é € Ð7²¨1Ÿ™Ÿ˜²ùr²   N)r!   r   r   r   r>  r§   rH   rO  rZ   r3   r³   r   r!  rÿ   )r(   rD   r#  Úconnrª   r<   s         r)   Ú%test_unnecessaryWindowUpdateForStreamÚ8H2FlowControlTests.test_unnecessaryWindowUpdateForStream‘  s¹   € ô ‹NˆÜ#Ó%ˆ	Ü‹~ˆÜ3ˆÔð
 ˆØ�‰�a×)Ñ)°$×2IÑ2IÐTUÐ)ÐVÔWØ�‰�a×.Ñ.¸ÀQÐ.ÐGÔHØ×(Ñ(Ó*ˆØ�—‘Ñ7±Ó7Ó7Ñ7ˆà×Ñ˜IÔ&Ø×Ñ˜$Ôà×$Ñ$ TÕ*r-   c                 óŒ  • [        5       n[        5       n[        5       n[        Ul        [        U R                  U R                  U5      nUR                  5       nUSR                  S U 5       5      -  nUR                  U5        [        U5       H  nUR                  U5        M     UR                  S   R                  5         UR                  SSS9nUR                  UR!                  5       5        [#        UR%                  5       5      nU R'                  [)        US   [*        R,                  R.                  5      5        g)zY
When a WindowUpdate frame is received for a stream that has been
aborted it is ignored.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚEH2FlowControlTests.test_windowUpdateAfterTerminate.<locals>.<genexpr>·  r—  r²   r5   rs  r	  r¥   N)r!   r   r   r   r>  r«   rO  rP  r3   r³   r   r   r!  r�  rí  rZ   r¯   r¸   r4  r6  r–   r8   r9   rg   )r(   rD   re  ro  rª   r$  r%  ÚwindowUpdateFrames           r)   Útest_windowUpdateAfterTerminateÚ2H2FlowControlTests.test_windowUpdateAfterTerminateª  s
  € ô
 ‹NˆÜÓˆÜ‹NˆÜ0ˆÔô $ D×$;Ñ$;¸T×=QÑ=QÐSTÓUˆØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð 	
�	‰	�!‰×$Ñ$Ô&ð ×4Ñ4¸aÈ1Ð4ÐMÐØ	�‰Ð(×2Ñ2Ó4Ô5ô ! §¡£Ó+ˆð 	�‰œ
 6¨"¡:¬z×/?Ñ/?×/NÑ/NÓOÕPr-   c                 óÖ  ^ ^^^	• [        5       m	[        5       m[        5       m[        Tl        [        T R                  T R                  T	5      nT	R                  5       nUSR                  S U 5       5      -  nTR                  T5        [        U5       H  nTR                  U5        M     UU	4S jnUU 4S jnTR                  S   R                  U5      nUR                  U5      $ )z[
When a WindowUpdate frame is received for a stream that has been
completed it is ignored.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚDH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.<genexpr>×  r—  r²   c                  ód   >• TR                  SSS9nTR                  UR                  5       5        g )Nr5   rs  r	  )rZ   r!  r¯   )rÒ   ræ  ro  rD   s     €€r)   Úupdate_windowÚHH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.update_windowÝ  s/   ø€ à !× 8Ñ 8À!ÈqÐ 8Ð QÐØ�N‰NÐ,×6Ñ6Ó8Õ9r-   c                  óv   >• [        TR                  5       5      nTR                  SUS   R                  5        g )Nr¦   r¥   )r¸   r4  ÚassertInr=   ©rÒ   rª   re  r(   s     €€r)   r<  ÚCH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.validateâ  s-   ø€ ä$ Q§W¡W£YÓ/ˆFð �M‰M˜,¨¨r©
×(8Ñ(8Õ9r-   r5   )r!   r   r   r   r>  r«   rO  rP  r3   r³   r   r   r!  r@  rA  )
r(   rª   r$  r%  rí  r<  r  ro  re  rD   s
   `      @@@r)   Útest_windowUpdateAfterCompleteÚ1H2FlowControlTests.test_windowUpdateAfterCompleteÊ  sÆ   û€ ô
 ‹NˆÜÓˆÜ‹NˆÜ0ˆÔô $ D×$;Ñ$;¸T×=QÑ=QÐSTÓUˆØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜Ôä˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ö	:ö
	:ð ×%Ñ% aÑ(×4Ñ4°]ÓCˆØ�}‰}˜XÓ&Ð&r-   c                 ó*  • [        5       n[        5       n[        5       n[        Ul        SS-  /S-  n[        S U 5       5       nU R                  SS SU4/-   n[        XdUS9nUS	 UR                  UR                  S	[        R                  R                  R                  S
95        UR                  5       nUSR                  S U 5       5      -  nUR!                  U5        UR#                  U5        [%        UR'                  5       5      nU V	s/ s H:  n	[)        U	[*        R,                  R.                  5      (       d  M.  U	R0                  PM<     n
n	U R3                  S/U
5        U V	s/ s H0  n	[)        U	[*        R,                  R4                  5      (       d  M.  U	PM2     nn	U V	s/ s H0  n	[)        U	[*        R,                  R6                  5      (       d  M.  U	PM2     nn	U R9                  U5        U R9                  U5        gs  sn	f s  sn	f s  sn	f )zz
When a DATA frame is received at the same time as RST_STREAM,
Twisted does not send WINDOW_UPDATE frames for the stream.
ó    i @  r*  c              3   ó8   #   • U  H  n[        U5      v •  M     g 7fr$   )r�   )r    r<   s     r)   r£   Ú;H2FlowControlTests.test_dataAndRstStream.<locals>.<genexpr>ú  s   é € Ð<²)¨$œC ŸI˜I²)ùs   ‚Nr¥   zcontent-lengthr  r5   )rB   rb   r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   rø  	  r—  r²   r   )r!   r   r   r   r>  ÚsumrO  r«   r§   rh   r  ÚerrorsÚ
ErrorCodesÚINTERNAL_ERRORr3   r³   r   r!  r¸   r4  r–   r8   r9   rW   r.  r5  r:   rL   r�  )r(   r¢   r#  ro  Ú	frameDataÚ
bodyLengthrA   rª   r$  rD   ÚwindowUpdateFrameIDsÚheadersFramesÚ
dataFramess                r)   Útest_dataAndRstStreamÚ(H2FlowControlTests.test_dataAndRstStreamì  sê  € ô
 $“~ˆÜ#Ó%ˆ	Ü‹NˆÜ0ˆÔð
  Ñ&Ð'¨!Ñ+ˆ	ÜÑ<±)Ó<Ó<Ð=ˆ
Ø×)Ñ)¨#¨2Ð.Ð3CÀZÐ2PÐ1QÑQˆÜ#Ø¸,ñ
ˆð �2ˆJØ�‰Ø×,Ñ,Ø¤b§i¡i×&:Ñ&:×&IÑ&Ið -ð ô	
ð $×;Ñ;Ó=ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜Ô#ð 	
�‰�|Ô$ô ! §¡Ó!2Ó3ˆñ
 ó 
â�Ü˜!œZ×-Ñ-×?Ñ?×@ó ˆA�KŒKÙð 	ð  
ð
 	×Ñ˜!˜Ð2Ô3ñ
 ó
Ú�!¤¨A¬z×/?Ñ/?×/LÑ/L×!M�A‘vð 	ð 
ñ "(ÓU¢˜A¬:°a¼×9IÑ9I×9SÑ9S×+T—a¡ˆ
ÐUØ×Ñ˜Ô'Ø×Ñ˜Õ$ùò 
ùò
ùò Vs$   Ä-HÅHÅ--HÆHÆ*-HÇHc                 óL  • [        5       n[        U5      nUR                  Ul        [        Ul        [        5       n[        5       nUR                  5       nUR                  U5        UR                  U5        SnUR                  U R                  US9R                  5       nUR                  U5        UR                  5         SUl        UR                  5         UR!                  U5        U R#                  UR%                  5       5        U R'                  UR(                  5        g)zŽ
Aborting a request associated with a paused connection that's
reached its buffered control frame limit causes that
connection to be aborted.
r5   r�   r   N)r
   r   rõ  r   r>  r!   r   r3   r   r!  rH   rO  r¯   rÏ   rs  ÚclearÚabortRequestr�  r4  r6  rt  )r(   ru  rþ   r¢   r#  r3   rB   ÚheadersFrameDatas           r)   Ú#test_abortRequestWithCircuitBreakerÚ6H2FlowControlTests.test_abortRequestWithCircuitBreaker#	  s  € ô +Ó,ˆÜ! -Ó0ˆ
Ø,×6Ñ6ˆ
ÔÜ$9ˆ
Ô!ä#“~ˆÜ#Ó%ˆ	ð #/×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð ˆØ'×9Ñ9Ø×+Ñ+°hð :ð 
ç
‰)‹+ð 	ð 	×ÑÐ 0Ô1ð 	×!Ñ!Ô#Ø34ˆ
Ô0ð 	�‰Ôð 	×Ñ Ô)ð 	×Ñ˜Ÿ™Ó*Ô+ð 	�‰˜	×.Ñ.Õ/r-   r2   N)rz   r{   r|   r}   r~   r?  r:  rO  rP  rM  rŸ  r¬  r·  r½  rÇ  rÌ  rÒ  rÛ  rá  rç  ró  r  r	  r   r2   r-   r)   r“  r“  «  s�   † ñòÐð *€OòÐò D€OàAÐò+BòZQBòf@@òD8Bòt25òh95òv:Bòx!BòF+ò2Qò@ 'òD5%õn)0r-   r“  c                   ó4   • \ rS rSr/ SQrS rS rS rS rSr	g)	ÚHTTP2TransportCheckingiO	  r  c                 ó    • [        5       n[        5       n[        Ul        UR	                  US5        U R                  UR                  UL 5        g)zE
L{H2Connection} can be registered with the transport as a producer.
TN)r   r   r   r>  ré   r6  r…  )r(   re  ro  s      r)   Ú"test_registerProducerWithTransportÚ9HTTP2TransportChecking.test_registerProducerWithTransportZ	  s?   € ô ÓˆÜ‹NˆÜ0ˆÔà	×Ñ˜1˜dÔ#Ø�‰˜Ÿ
™
 a˜Õ(r-   c                 ó(  ^ ^^	^
• [        5       n[        5       m	[        5       m[        Tl        [        T R                  / U5      nUR                  5       nUSR                  S U 5       5      -  nTR                  T	5        T	R                  TS5        [        U5       H  nTR                  U5        M     TR                  5         TR                  S   m
UU	U
U 4S jnU	U 4S jn[        R                   " ["        SU5      nUR%                  U5        U$ )zd
L{H2Connection} can be paused by its consumer. When paused it stops
sending data to the transport.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚNHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.<genexpr>r	  r—  r²   Tr5   c                  ó|  >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  [        US   [        R                  R                  5      5        TR                  5         TR                  5         TR                  5         TR                  5         TR                  5         T$ )Nr2  r¥   )
r¸   r4  r5  r�   r�  r–   r8   r9   rL   rÖ   )rÒ   rª   ro  re  r›  r(   s     €€€€r)   ÚvalidateNotSentÚTHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.validateNotSent‰	  s�   ø€ Ü$ Q§W¡W£YÓ/ˆFà×ÑœS ›[¨!Ô,Ø×ÑœZ¨¨r©
´J×4DÑ4D×4NÑ4NÓOÔPØ×ÑÔð ×ÑÔØ×ÑÔØ×ÑÔØ×ÑÔØ"Ð"r-   c                  ó°   >• [        TR                  5       5      nTR                  [        U5      S5        TR	                  SUS   R
                  ;   5        g r‰  rŠ  rñ  s     €€r)   ró  ÚUHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.validateComplete—	  sD   ø€ Ü$ Q§W¡W£YÓ/ˆFð ×ÑœS ›[¨!Ô,Ø�O‰O˜L¨F°2©J×,<Ñ,<Ñ<Õ=r-   rñ  )r!   r   r   r   r>  r«   r?  r3   r³   r   ré   r   r!  rÏ   r@  r   r  r   rA  )r(   rD   rª   r$  r%  r  ró  r  ro  re  r›  s   `       @@@r)   Ú$test_pausingProducerPreventsDataSendÚ;HTTP2TransportChecking.test_pausingProducerPreventsDataSende	  sð   û€ ô
 ‹NˆÜÓˆÜ‹NˆÜ0ˆÔô $ D×$:Ñ$:¸BÀÓBˆØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜ÔØ	×Ñ˜1˜dÔ#ô ˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð 	
×ÑÔð ×3Ñ3°AÑ6ˆ÷	#ð 	#ö	>ô �OŠOœG T¨?Ó;ˆØ	�‰Ð&Ô'àˆr-   c                 ó�  • [        5       n[        5       n[        5       n[        Ul        [        U R                  / U5      nUR                  5       nUSR                  S U 5       5      -  nUR                  U5        UR                  US5        [        U5       H  nUR                  U5        M     UR                  5         [        UR                  5       5      nU R!                  [#        U5      S5        U R%                  ['        US   [(        R*                  R,                  5      5        U R%                  UR.                  5        g)zW
L{H2Connection} can be stopped by its producer. That causes it to lose
its transport.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   Ú<HTTP2TransportChecking.test_stopProducing.<locals>.<genexpr>°	  r—  r²   Tr2  r¥   N)r!   r   r   r   r>  r«   r?  r3   r³   r   ré   r   r!  rä   r¸   r4  r5  r�   r�  r–   r8   r9   rL   r¯  )r(   rD   re  ro  rª   r$  r%  s          r)   Útest_stopProducingÚ)HTTP2TransportChecking.test_stopProducing£	  s  € ô
 ‹NˆÜÓˆÜ‹NˆÜ0ˆÔô $ D×$:Ñ$:¸BÀÓBˆØ×0Ñ0Ó2ˆØ˜Ÿ™Ñ ?¹Ó ?Ó?Ñ?ˆØ	×Ñ˜ÔØ	×Ñ˜1˜dÔ#ô ˜lÖ+ˆDØ�N‰N˜4Ö ñ ,ð
 	
�‰Ôä  §¡£Ó+ˆà×Ñœ˜V› aÔ(Ø×Ñœ F¨2¡J´
×0@Ñ0@×0JÑ0JÓKÔLØ×Ñ˜×*Ñ*Õ+r-   c                 ól  ^ ^	^
^• [        SSS5      m	[        SSS5      m
[        5       n[        T	T
S9n[        5       n[        Ul        UR                  U5        [        T R                  / U5      nUR                  5       nUSR                  S U 5       5      -  n[        U5       H  nUR                  U5        M     UR                  S	   mT R                  TR                  5       T	5        T R                  TR!                  5       T
5        UR"                  S	   nU	U
U U4S
 jnUR%                  U5      $ )zc
A L{H2Stream} object correctly passes through host and peer information
from its L{H2Connection}.
ÚTCPz
17.52.24.8i»  z17.188.0.12i}  )ÚhostAddressÚpeerAddressr-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r_  s     r)   r£   ÚEHTTP2TransportChecking.test_passthroughHostAndPeer.<locals>.<genexpr>Ò	  ra  r²   r5   c                  ó†   >• TR                  TR                  5       T5        TR                  TR                  5       T5        g r$   )r5  ÚgetHostÚgetPeer)rÒ   r!  r"  r(   r½  s    €€€€r)   r<  ÚDHTTP2TransportChecking.test_passthroughHostAndPeer.<locals>.validateß	  s1   ø€ Ø×Ñ˜VŸ^™^Ó-¨{Ô;Ø×Ñ˜VŸ^™^Ó-¨{Õ;r-   )r	   r!   r   r   r   r>  r   r«   r?  r3   r³   r   r!  r�  r5  r&  r'  r@  rA  )r(   r¢   r#  rþ   rª   r$  r%  r›  r<  r!  r"  r½  s   `        @@@r)   Útest_passthroughHostAndPeerÚ2HTTP2TransportChecking.test_passthroughHostAndPeerÂ	  s  û€ ô
 " %¨°sÓ;ˆÜ! %¨¸Ó>ˆä#“~ˆÜ#°ÈÑUˆ	Ü!“^ˆ
Ü$9ˆ
Ô!Ø×!Ñ! )Ô,ä# D×$:Ñ$:¸BÀÓMˆØ#×;Ñ;Ó=ˆØ˜Ÿ™Ñ GÁÓ GÓGÑGˆä˜lÖ+ˆDØ×#Ñ# DÖ)ñ ,ð ×#Ñ# AÑ&ˆØ×Ñ˜Ÿ™Ó)¨;Ô7Ø×Ñ˜Ÿ™Ó)¨;Ô7ð %×<Ñ<¸QÑ?ˆ÷	<ð 	<ð ×*Ñ*¨8Ó4Ð4r-   r2   N)
rz   r{   r|   r}   r?  r  r  r  r)  r   r2   r-   r)   r  r  O	  s   † òÐò	)ò<ò|,õ>!5r-   r  c                   ó   • \ rS rSrSrS rSrg)ÚHTTP2SchedulingTestsiæ	  z°
The H2Connection object schedules certain events (mostly its data sending
loop) using callbacks from the reactor. These tests validate that the calls
are scheduled correctly.
c                 óØ  • [         R                  " 5       n[        U5      nUR                  " 5       nU R	                  [        U5      S5        US   nU R                  UR                  5       5        U R	                  UR                  S5        U R	                  UR                  UR                  5        U R	                  UR                  S5        U R	                  UR                  0 5        g)ze
When a H2Connection is established it schedules one call to be run as
soon as the reactor has time.
r5   r   r2   N)r   ÚClockr   ÚgetDelayedCallsr5  r�   r6  ÚactiveÚtimeÚfuncÚ_sendPrioritisedDatarÒ   Úkw)r(   r   ro  ÚcallsÚcalls        r)   Ú"test_initiallySchedulesOneDataCallÚ7HTTP2SchedulingTests.test_initiallySchedulesOneDataCallí	  s®   € ô
 —*’*“,ˆÜ˜Ó!ˆà×'Ò'Ó)ˆØ×Ñœ˜U› QÔ'Ø�Q‰xˆð 	�‰˜Ÿ™›Ô&Ø×Ñ˜Ÿ™ AÔ&Ø×Ñ˜Ÿ™ A×$:Ñ$:Ô;Ø×Ñ˜Ÿ™ BÔ'Ø×Ñ˜Ÿ™ "Õ%r-   r2   N)rz   r{   r|   r}   r~   r7  r   r2   r-   r)   r,  r,  æ	  s   † ñõ&r-   r,  c                   óˆ   • \ rS rSrSr/ SQr\" 5       rS rS r	S r
\4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g)ÚHTTP2TimeoutTestsi
  z8
The L{H2Connection} object times out idle connections.
r  c                 ó&   • UR                   Ul         g)a™  
Unfortunately, TimeoutMixin does not allow passing an explicit reactor
to test timeouts. For that reason, we need to monkeypatch the method
set up by the TimeoutMixin.

@param connection: The HTTP/2 connection object to patch.
@type connection: L{H2Connection}

@param reactor: The reactor whose callLater method we want.
@type reactor: An object implementing
    L{twisted.internet.interfaces.IReactorTime}
N)rõ  )r(   rþ   r   s      r)   Úpatch_TimeoutMixin_clockÚ*HTTP2TimeoutTests.patch_TimeoutMixin_clock
  s   € ð  '×0Ñ0ˆ
Õr-   c                 ó  • [         R                  " 5       n[        U5      nSUl        U R	                  XC5        [        5       n[        U5      Ul        UR                  U5        [        U5       H  nUR                  U5        M     X4U4$ )a]  
Performs test setup by building a HTTP/2 connection object, a transport
to back it, a reactor to run in, and sending in some initial data as
needed.

@param initialData: The initial HTTP/2 data to be fed into the
    connection after setup.
@type initialData: L{bytes}

@param requestFactory: The L{Request} factory to use with the
    connection.
ry  )r   r.  r   ÚtimeOutr<  r   r   r>  r   r   r!  )r(   ÚinitialDatar>  r   rà  r#  r%  s          r)   ÚinitiateH2ConnectionÚ&HTTP2TimeoutTests.initiateH2Connection#
  s}   € ô —*’*“,ˆÜ˜GÓ$ˆØˆŒØ×%Ñ% dÔ4ä#Ó%ˆ	Ü6°~ÓFˆÔØ×Ñ˜IÔ&ô ˜kÖ*ˆDØ×Ñ˜dÖ#ñ +ð ˜yÐ)Ð)r-   c                 ó8  • [        U5      nU R                  [        U5      U5        U R                  [	        US   [
        R                  R                  5      5        U R                  US   R                  U5        U R                  US   R                  U5        g)z¬
Confirm that the data that was sent matches what we expect from a
timeout: namely, that it ends with a GOAWAY frame carrying an
appropriate error code and last stream ID.
r¥   N)
r¸   r5  r�   r6  r–   r8   r9   r]   r^   r_   )r(   r<   Ú
frameCountrb   ra   rª   s         r)   ÚassertTimedOutÚ HTTP2TimeoutTests.assertTimedOut?
  sy   € ô ! Ó&ˆà×Ñœ˜V› jÔ1Ø�‰œ
 6¨"¡:¬z×/?Ñ/?×/KÑ/KÓLÔMØ×Ñ˜ ™×.Ñ.°	Ô:Ø×Ñ˜ ™×2Ñ2°LÕAr-   c                 óÈ  • XR                   L a  [        R                  n[        5       nUR	                  5       nU R                  U[        S9u  pEnXl        UR                  " S5        U R                  UR                  5       S[        R                  R                  R                  SS9  U R                  UR                  5        U R!                  UR"                  5        XEU4$ )au  
Does the common setup for tests that want to test the aborting
functionality of the HTTP/2 stack.

@param abortTimeout: The value to use for the abortTimeout. Defaults to
    whatever is set on L{H2Connection.abortTimeout}.
@type abortTimeout: L{int} or L{None}

@return: A tuple of the reactor being used for the connection, the
    connection itself, and the transport.
©r>  ry  r2  r   ©rD  rb   ra   )Ú_DEFAULTr   ÚabortTimeoutr!   r3   rA  r   ÚadvancerE  r4  r  rû  rü  ÚNO_ERRORr6  r„  r�  rt  )r(   rK  r¢   r@  r   rà  r#  s          r)   ÚprepareAbortTestÚ"HTTP2TimeoutTests.prepareAbortTestL
  sÍ   € ð Ÿ=™=Ò(Ü'×4Ñ4ˆLä#“~ˆØ"×:Ñ:Ó<ˆà#'×#<Ñ#<ØÜ+ð $=ð $
Ñ ˆ�yð )Ôð 	�Š˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×3Ñ3Øð	 	ñ 	
ð 	�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Ô0à˜iÐ'Ð'r-   c                 óü  • [        5       nUR                  5       nU R                  U[        S9u  p4nUR	                  5       nUR
                  " S5        U R                  XeR	                  5       5        U R                  UR                  5        UR
                  " S5        U R                  UR	                  5       S[        R                  R                  R                  SS9  U R                  UR                  5        g)zy
When a L{H2Connection} does not receive any data for more than the
time out interval, it closes the connection cleanly.
rH  rˆ  r2  r   rI  N)r!   r3   rA  r   r4  rL  r5  r�  r„  rE  r  rû  rü  rM  r6  )r(   r¢   r@  r   rà  r#  Úpreambles          r)   Útest_timeoutAfterInactivityÚ-HTTP2TimeoutTests.test_timeoutAfterInactivityr
  sØ   € ô
 $“~ˆØ"×:Ñ:Ó<ˆà#'×#<Ñ#<ØÜ+ð $=ð $
Ñ ˆ�yð —?‘?Ó$ˆð 	�Š˜Ôð 	×Ñ˜§?¡?Ó#4Ô5Ø×Ñ˜×0Ñ0Ô1ð 	�Š˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×3Ñ3Øð	 	ñ 	
ð 	�‰˜	×/Ñ/Õ0r-   c                 óä  • [        5       nSnU R                  U[        S9u  p4n[        UR	                  5       5       HA  nUR                  U5        UR                  " S5        U R                  UR                  5        MC     UR                  " S5        U R                  UR                  5       S[        R                  R                  R                  SS9  U R                  UR                  5        g)z=
When a L{H2Connection} receives data, the timeout is reset.
r-   rH  rˆ  r2  r   rI  N)r!   rA  r   r   r3   r!  rL  r�  r„  rE  r4  r  rû  rü  rM  r6  )r(   r¢   r@  r   rà  r#  r%  s          r)   Útest_timeoutResetByRequestDataÚ0HTTP2TimeoutTests.test_timeoutResetByRequestData”
  sÕ   € ô
 $“~ˆØˆà#'×#<Ñ#<ØÜ+ð $=ð $
Ñ ˆ�yô ˜l×BÑBÓDÖEˆDØ×Ñ˜dÔ#ð �OŠO˜BÔð ×Ñ˜Y×4Ñ4Ö5ñ Fð 	�Š˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×3Ñ3Øð	 	ñ 	
ð 	�‰˜	×/Ñ/Õ0r-   c                 ó¾  ^	• [        5       nSn/ m	[        U R                  / U5      nUR                  5       nUSR	                  S U 5       5      -  nU	4S jnU R                  UUS9u  pVnUR                  UR                  5       5        UR                  " S5        U R                  [        T	5      S5        [        S5       HD  nT	S   R                  S	5        UR                  " S5        U R                  UR                  5        MF     UR                  " S
5        U R                  UR                  5       S[         R"                  R$                  R&                  SS9  g)z:
When a L{H2Connection} sends data, the timeout is reset.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚDHTTP2TimeoutTests.test_timeoutResetByResponseData.<locals>.<genexpr>Á
  ó   é € Ð>²v°!§¡§ ²vùr²   c                 ó<   >• [        XS9nTR                  U5        U$ )N)Úqueued)r   r§   )r½  r\  rõ   Úrequestss      €r)   ÚsaveRequestÚFHTTP2TimeoutTests.test_timeoutResetByResponseData.<locals>.saveRequestÃ
  s   ø€ Ü$ VÑ;ˆCØ�O‰O˜CÔ ØˆJr-   rH  rˆ  r5   é
   r   s
   some bytesr2  é   rI  N)r!   r«   r?  r3   r³   rA  r!  rL  ÚassertEqualsr�   rÂ   rÃ   r�  r„  rE  r4  r  rû  rü  ÚPROTOCOL_ERROR)
r(   r¢   r@  rª   r^  r   rà  r#  rX  r]  s
            @r)   Útest_timeoutResetByResponseDataÚ1HTTP2TimeoutTests.test_timeoutResetByResponseData¶
  s7  ø€ ô
 $“~ˆØˆØˆä# D×$:Ñ$:¸BÀÓMˆØ"×:Ñ:Ó<ˆØ�s—x‘xÑ>±vÓ>Ó>Ñ>ˆõ	ð
 $(×#<Ñ#<ØØ&ð $=ð $
Ñ ˆ�yð
 	×Ñ˜,×>Ñ>Ó@ÔAð 	�Š˜ÔØ×Ñœ#˜h›-¨Ô+ä�r–ˆAà�Q‰K×Ñ˜mÔ,Ø�OŠO˜BÔØ×Ñ˜Y×4Ñ4Ö5ñ	 ð 	�Š˜ÔØ×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×9Ñ9Øð	 	ò 	
r-   c                 ó¨  • [        5       n[        U R                  / U5      nUR                  5       nUSR	                  S U 5       5      -  nU R                  U[        S9u  pEnUR                  " S5        U R                  UR                  5       S[        R                  R                  R                  SS9  U R                  UR                  5        g)	zz
When a L{H2Connection} times out with active streams, the error code
returned is L{h2.errors.ErrorCodes.PROTOCOL_ERROR}.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚOHTTP2TimeoutTests.test_timeoutWithProtocolErrorIfStreamsOpen.<locals>.<genexpr>ê
  rZ  r²   rH  rz  r2  r5   rI  N)r!   r«   r?  r3   r³   rA  rç   rL  rE  r4  r  rû  rü  rc  r6  r„  )r(   r¢   rª   r@  r   rà  r#  s          r)   Ú*test_timeoutWithProtocolErrorIfStreamsOpenÚ<HTTP2TimeoutTests.test_timeoutWithProtocolErrorIfStreamsOpenâ
  s¾   € ô
 $“~ˆÜ# D×$:Ñ$:¸BÀÓMˆØ"×:Ñ:Ó<ˆØ�s—x‘xÑ>±vÓ>Ó>Ñ>ˆà#'×#<Ñ#<ØÜ/ð $=ð $
Ñ ˆ�yð 	�Š˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×9Ñ9Øð	 	ñ 	
ð 	�‰˜	×/Ñ/Õ0r-   c                 ó  • [        5       n[        U R                  / U5      nUR                  5       nUSR	                  S U 5       5      -  nU R                  U[        S9u  pEnUR                  5       n[        UR                  " 5       5      nUR                  S5        [        UR                  " 5       5      n	U R                  US-
  U	5        UR                  " S5        U R                  UR                  5       U5        g)zE
When a L{H2Connection} loses its connection it cancels its timeout.
r-   c              3   ó@   #   • U  H  oR                  5       v •  M     g 7fr$   r®   r°   s     r)   r£   ÚCHTTP2TimeoutTests.test_noTimeoutIfConnectionLost.<locals>.<genexpr>  rZ  r²   rH  rF  r5   rz  N)r!   r«   r?  r3   r³   rA  rç   r4  r�   r/  ÚconnectionLostr5  rL  )
r(   r¢   rª   r@  r   rà  r#  ÚsentDataÚoldCallCountÚcurrentCallCounts
             r)   Útest_noTimeoutIfConnectionLostÚ0HTTP2TimeoutTests.test_noTimeoutIfConnectionLostü
  sè   € ô $“~ˆÜ# D×$:Ñ$:¸BÀÓMˆØ"×:Ñ:Ó<ˆØ�s—x‘xÑ>±vÓ>Ó>Ñ>ˆà#'×#<Ñ#<ØÜ/ð $=ð $
Ñ ˆ�yð
 —?‘?Ó$ˆÜ˜7×2Ò2Ó4Ó5ˆð 	×Ñ˜HÔ%ô ˜w×6Ò6Ó8Ó9ÐØ×Ñ˜¨Ñ)Ð+;Ô<ð 	�Š˜ÔØ×Ñ˜Ÿ™Ó*¨HÕ5r-   c                 óJ  • U R                  5       u  pnUR                  " S5        U R                  UR                  5        U R	                  UR
                  5        UR                  " S5        U R                  UR                  5        U R                  UR
                  5        g)zŠ
When a L{H2Connection} has timed the connection out, and the transport
doesn't get torn down within 15 seconds, it gets forcibly closed.
é   r5   N©rN  rL  r6  r„  r�  rt  ©r(   r   rà  r#  s       r)   Ú,test_timeoutEventuallyForcesConnectionClosedÚ>HTTP2TimeoutTests.test_timeoutEventuallyForcesConnectionClosed  s{   € ð
 $(×#8Ñ#8Ó#:Ñ ˆ�yð 	�Š˜ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Ô0Ø�Š˜ÔØ�‰˜	×/Ñ/Ô0Ø�‰˜	×.Ñ.Õ/r-   c                 ó   • U R                  5       u  pnUR                  " S5        UR                  S5        UR                  " S5        U R                  UR                  5        U R                  UR                  5        g)z„
When a L{H2Connection} has timed the connection out, getting
C{connectionLost} called on it cancels the forcible connection close.
ru  Nr5   )rN  rL  rn  r6  r„  r�  rt  rw  s       r)   Ú$test_losingConnectionCancelsTheAbortÚ6HTTP2TimeoutTests.test_losingConnectionCancelsTheAbort'  sg   € ð
 $(×#8Ñ#8Ó#:Ñ ˆ�yð 	�Š˜ÔØ×Ñ˜DÔ!ð 	�Š˜ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Õ0r-   c                 ó¸   • U R                  SS9u  pnUR                  " S5        U R                  UR                  5        U R	                  UR
                  5        g)z�
When a L{H2Connection} has timed the connection out but the
C{abortTimeout} is set to L{None}, the connection is never aborted.
N)rK  l        rv  rw  s       r)   Ú'test_losingConnectionWithNoAbortTimeOutÚ9HTTP2TimeoutTests.test_losingConnectionWithNoAbortTimeOut7  sP   € ð
 $(×#8Ñ#8ÀdÐ#8Ð#KÑ ˆ�yð 	�Š˜ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Õ0r-   c                 óø   • U R                  5       u  pnUR                  " S5        U R                  UR                  5        U R                  UR                  5        UR                  [        R                  5        g)ze
If a timed out transport doesn't close after 15 seconds, the
L{HTTPChannel} will forcibly close it.
é   N)rN  rL  r6  r„  rt  rn  r   ÚConnectionDonerw  s       r)   Ú"test_connectionLostAfterForceCloseÚ4HTTP2TimeoutTests.test_connectionLostAfterForceCloseD  s_   € ð
 $(×#8Ñ#8Ó#:Ñ ˆ�yð 	�Š˜ÔØ�‰˜	×/Ñ/Ô0Ø�‰˜	×.Ñ.Ô/ð
 	×ÑœE×0Ñ0Õ1r-   c                 óð  • [        5       n[        U5      nUR                  Ul        SUl        [	        5       n[        5       nUR                  5       nUR                  U5        UR                  U5        [        UR                  UR                  -   5       HB  nUR                  UR                  S5      R                  5       5        UR                  S5        MD     U R                  UR                  5        g)zB
A client that sends only invalid frames is eventually timed out.
é<   r5   N)r
   r   rõ  r?  r!   r   r3   r   r!  rÂ   rK  rh   r¯   rL  r6  rt  )r(   ru  rþ   r¢   r#  r3   rÇ   s          r)   Ú,test_timeOutClientThatSendsOnlyInvalidFramesÚ>HTTP2TimeoutTests.test_timeOutClientThatSendsOnlyInvalidFramesU  sÎ   € ô +Ó,ˆä! -Ó0ˆ
Ø,×6Ñ6ˆ
ÔØˆ
Ôä#“~ˆÜ#Ó%ˆ	à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ô �z×)Ñ)¨J×,CÑ,CÑCÖDˆAØ×#Ñ# L×$DÑ$DÀQÓ$G×$QÑ$QÓ$SÔTØ×!Ñ! !Ö$ñ Eð 	�‰˜	×.Ñ.Õ/r-   r2   N)rz   r{   r|   r}   r~   r?  r*  rJ  r<  rA  rE  rN  rR  rU  rd  ri  rr  rx  r{  r~  rƒ  r‡  r   r2   r-   r)   r:  r:  
  sh   † ñòÐñ ‹x€Hò1ò*ò8Bð -5ô $(òL 1òD 1òD*
òX1ò46ò80ò1ò 1ò2õ"0r-   r:  c                   óN   • \ rS rSrSr\(       d  \" S5      (       d  \rSS jrSr	g)ÚEndToEndTestsiq  zC
Tests that run real TCP-based communication with a HTTP/2 server.
ÚOpenSSLNc              ƒ   ó˜  ^#   • [        S5      u  p[        SS5      nSUl        [        R                  " S[        U5      UR                  5       5      nUR                  5       R                  mU R                  UR                  5        U4S jn[        U5      I Sh  v•N u  pgU R                  US5        U R                  US5        g N+7f)	zB
Twisted's HTTP/2 server can talk to a third-party HTTP/2 client.
z
test.locals   hello worldzapplication/octet-streamTr   c                  ó¬   >• [         R                  " SSS9n U R                  ST S35      nUR                  UR                  4nU R                  5         U$ )NTF)Úhttp2Úverifyzhttps://127.0.0.1:Ú/)ÚhttpxÚClientÚgetÚhttp_versionrÝ   Úclose)ÚclientÚresponserç  ÚportNums      €r)   Úrun_http2_queryÚ7EndToEndTests.test_realRequest.<locals>.run_http2_query„  sO   ø€ Ü—\’\¨°UÑ;ˆFØ—z‘zÐ$6°w°i¸qÐ"AÓBˆHØ×+Ñ+¨X×-=Ñ-=Ð>ˆFØ�L‰LŒNØˆMr-   NzHTTP/2)r   r   ÚisLeafr   Ú	listenSSLr   Úoptionsr&  ÚportÚ
addCleanupÚstopListeningr   r5  )	r(   rÇ   Ú
serverCertÚresourcerž  r™  ÚhttpVersionrÝ   r˜  s	           @r)   Útest_realRequestÚEndToEndTests.test_realRequesty  s©   øé € ô :¸,ÓG‰ˆÜ˜Ð(BÓCˆØˆŒÜ× Ò  ¤D¨£N°J×4FÑ4FÓ4HÓIˆØ—,‘,“.×%Ñ%ˆØ�‰˜×*Ñ*Ô+õ	ô (5°_Ó'E×!EÑˆØ×Ñ˜ hÔ/Ø×Ñ˜ .Õ1ñ "Fùs   ƒBC
ÂCÂ,C
r2   )ÚreturnN)
rz   r{   r|   r}   r~   r  r   r  r¤  r   r2   r-   r)   rŠ  rŠ  q  s    † ñö ‘] 9×-Ñ-Øˆ÷2r-   rŠ  ry   )Pr~   rh  Úzope.interfacer   r   r‘  Útwisted.internetr   r   r   r   Útwisted.internet.addressr	   Útwisted.internet.testingr
   r   Útwisted.internet.threadsr   Útwisted.pythonr   Útwisted.python.compatr   Útwisted.python.reflectr   Útwisted.test.test_internetr   Útwisted.test.test_sslverifyr   Útwisted.trialr   Útwisted.webr   Útwisted.web.serverr   Útwisted.web.staticr   Útwisted.web.test.test_httpr   r   r   r   r   r   r   r  r  Ú	h2.errorsÚh2.exceptionsr8   rü   Úhpack.hpackr   r   Útwisted.web._http2r   ÚImportErrorr!   r�   r«   r´   r¸   rÍ   rº   r~  rË   rŒ  râ   rš  rç   r¦  rì   ÚNotifyingRequestFactoryProxyrù   ÚTestCaser  r“  r  r,  r:  rŠ  r2   r-   r)   Ú<module>r½     sÖ  ðñó ç 7ã ç 8Ó 8Ý 0ß HÝ 2Ý "Ý +Ý 0Ý 4Ý IÝ "Ý Ý #Ý #÷÷ ñ ð 
€ð*ó ÛÛÛÛß,å/÷añ a÷H'ñ 'ôTôB3ò.ô(˜Ÿ™ô ñ( 3Ð3EÓFÐ ô˜4Ÿ<™<ô ñD 5Ð5IÓJÐ ô%Ð#7ô %ñ  %=Ø ó%Ð !ô
	5˜4Ÿ<™<ô 	5ñ 5Ð5IÓJÐ ÷Cñ Cñ0  8Ð8OÓPÐ ÷Mñ Mô"K0�x×(Ñ(Ð*:ô K0ô\(a
0˜×*Ñ*Ð,<ô a
0ôHT5˜X×.Ñ.Ð0@ô T5ôn&˜8×,Ñ,Ð.>ô &ô8l0˜×)Ñ)Ð+;ô l0ô^2�H×%Ñ%õ 2øðY ó *Ø)ƒFð*ús   Á>"G ÇGÇG