Ë
    oj²¤ ã                   ó@  — d Z ddlZddlmZmZ ddlmZmZmZm	Z	 ddl
mZ ddlmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZmZmZmZm Z  dZ!	 ddl"Z"ddl#Z"ddl$Z"ddl%Z%ddl&Z&ddl'm(Z(m)Z) ddl*m+Z+  G d„ d«      Z- G d„ d«      Z.d-d„Z/d-d„Z0d„ Z1 G d„ dejd                  «      Z3 e e3«      Z4 G d„ dejd                  «      Z5 e e5«      Z6 G d„ de5«      Z7 e e7«      Z8 G d„ dejd                  «      Z9 e e9«      Z: G d„ d «      Z; e e;«      Z< G d!„ d"«      Z= G d#„ d$ej|                  e=«      Z? G d%„ d&ej|                  e=«      Z@ G d'„ d(ej|                  e=«      ZA G d)„ d*ej|                  e=«      ZB G d+„ d,ej|                  e=«      ZCy# e,$ r dZ!Y �Œw xY w).z
Test HTTP/2 support.
é    N)ÚdirectlyProvidesÚ
providedBy)ÚdeferÚerrorÚreactorÚtask)ÚIPv4Address)ÚMemoryReactorClockÚStringTransport)Úfailure)Ú	iterbytes)ÚDummyProducer)Úunittest)Úhttp)ÚDelayedHTTPHandlerÚDelayedHTTPHandlerProxyÚDummyHTTPHandlerÚDummyHTTPHandlerProxyÚDummyPullProducerHandlerProxyÚ._IDeprecatedHTTPChannelToRequestInterfaceProxyÚ_makeRequestProxyFactory)ÚDecoderÚEncoder)ÚH2ConnectionzHTTP/2 support not enabledc                   óf   — e Zd ZdZd„ Zd„ Zd„ Zg dfd„Zdd„Zdd	„Z	d
„ Z
dd„Zdd„Zdd„Zg fd„Zy)ÚFrameFactoryz¨
    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                 ó"   — t        «       | _        y ©N©r   Úencoder©Úselfs    ú=/usr/lib/python3/dist-packages/twisted/web/test/test_http2.pyÚ__init__zFrameFactory.__init__8   ó   € Ü“yˆ�ó    c                 ó"   — t        «       | _        y r   r   r!   s    r#   ÚrefreshEncoderzFrameFactory.refreshEncoder;   r%   r&   c                  ó   — y)Ns   PRI * HTTP/2.0

SM

© r!   s    r#   ÚclientConnectionPrefacez$FrameFactory.clientConnectionPreface>   s   € Ø2r&   é   c                 óH  — t         j                  j                  |«      }| j                  j	                  |«      |_        |j                  j                  d«       |D ]  }|j                  j                  |«       Œ |j                  «       D ]  \  }}t        |||«       Œ |S )zS
        Builds a single valid headers frame out of the contained headers.
        ÚEND_HEADERS)
Ú
hyperframeÚframeÚHeadersFramer    ÚencodeÚdataÚflagsÚaddÚitemsÚsetattr)	r"   Úheadersr4   ÚstreamIDÚpriorityKwargsÚfÚflagÚkÚvs	            r#   ÚbuildHeadersFramezFrameFactory.buildHeadersFrameA   s�   € ô ×Ñ×)Ñ)¨(Ó3ˆØ—‘×$Ñ$ WÓ-ˆŒØ	�‰�‰�MÔ"Øò 	ˆDØ�G‰G�K‰K˜Õð	ð #×(Ñ(Ó*ò 	‰DˆAˆqÜ�A�q˜!Õð	ð ˆr&   Nc                 óŽ   — |�t        |«      n	t        «       }t        j                  j                  |«      }||_        ||_        |S )zD
        Builds a single data frame out of a chunk of data.
        )Úsetr/   r0   Ú	DataFramer3   r4   )r"   r3   r4   r9   r;   s        r#   ÚbuildDataFramezFrameFactory.buildDataFrameP   s?   € ð $Ð/”�E”
´S³UˆÜ×Ñ×&Ñ& xÓ0ˆØˆŒØˆŒØˆr&   c                 óŒ   — t         j                  j                  d«      }|r|j                  j	                  d«       ||_        |S )z1
        Builds a single settings frame.
        r   ÚACK)r/   r0   ÚSettingsFramer4   r5   Úsettings)r"   rG   Úackr;   s       r#   ÚbuildSettingsFramezFrameFactory.buildSettingsFrameZ   s9   € ô ×Ñ×*Ñ*¨1Ó-ˆÙØ�G‰G�K‰K˜ÔàˆŒ
Øˆr&   c                 óR   — t         j                  j                  |«      }||_        |S )z5
        Builds a single WindowUpdate frame.
        )r/   r0   ÚWindowUpdateFrameÚwindow_increment)r"   r9   Ú	incrementr;   s       r#   ÚbuildWindowUpdateFramez#FrameFactory.buildWindowUpdateFramee   s'   € ô ×Ñ×.Ñ.¨xÓ8ˆØ&ˆÔØˆr&   c                 ón   — t         j                  j                  d«      }||_        ||_        ||_        |S )z/
        Builds a single GOAWAY frame.
        r   )r/   r0   ÚGoAwayFrameÚ
error_codeÚlast_stream_idÚadditional_data)r"   ÚlastStreamIDÚ	errorCodeÚadditionalDatar;   s        r#   ÚbuildGoAwayFramezFrameFactory.buildGoAwayFramem   s6   € ô ×Ñ×(Ñ(¨Ó+ˆØ ˆŒØ'ˆÔØ*ˆÔØˆr&   c                 óR   — t         j                  j                  |«      }||_        |S )z3
        Builds a single RST_STREAM frame.
        )r/   r0   ÚRstStreamFramerQ   )r"   r9   rU   r;   s       r#   ÚbuildRstStreamFramez FrameFactory.buildRstStreamFramew   s&   € ô ×Ñ×+Ñ+¨HÓ5ˆØ ˆŒØˆr&   c                 ón   — t         j                  j                  |«      }||_        ||_        ||_        |S )z1
        Builds a single priority frame.
        )r/   r0   ÚPriorityFrameÚ
depends_onÚstream_weightÚ	exclusive)r"   r9   ÚweightÚ	dependsOnr_   r;   s         r#   ÚbuildPriorityFramezFrameFactory.buildPriorityFrame   s4   € ô ×Ñ×*Ñ*¨8Ó4ˆØ ˆŒØ ˆŒØˆŒØˆr&   c                 óè   — t         j                  j                  |«      }||_        | j                  j                  |«      |_        t        |«      |_        |j                  j                  d«       |S )z5
        Builds a single Push Promise frame.
        r.   )
r/   r0   ÚPushPromiseFrameÚpromised_stream_idr    r2   r3   rA   r4   r5   )r"   r9   ÚpromisedStreamIDr8   r4   r;   s         r#   ÚbuildPushPromiseFramez"FrameFactory.buildPushPromiseFrame‰   sX   € ô ×Ñ×-Ñ-¨hÓ7ˆØ/ˆÔØ—‘×$Ñ$ WÓ-ˆŒÜ�e“*ˆŒØ	�‰�‰�MÔ"Øˆr&   ©Nr,   )F)r   r&   )r   )r   F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$   r(   r+   r?   rC   rI   rN   rW   rZ   rb   rg   r*   r&   r#   r   r   1   sL   „ ñò!ò!ò3ð 02¸Aó óó	òóóóð PRô 	r&   r   c                   ó,   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZeZy)ÚFrameBufferaÞ  
    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   — t        «       | _        d| _        y )Nr&   )r   ÚdecoderÚ_datar!   s    r#   r$   zFrameBuffer.__init__¢   s   € Ü“yˆŒØˆ�
r&   c                 ó.   — | xj                   |z  c_         y r   )rq   )r"   r3   s     r#   ÚreceiveDatazFrameBuffer.receiveData¦   s   € Ø�
Š
�dÑŽ
r&   c                 ó   — | S r   r*   r!   s    r#   Ú__iter__zFrameBuffer.__iter__©   s   € Øˆr&   c                 ó(  — t        | j                  «      dk  r
t        «       ‚t        j                  j
                  j                  | j                  d d «      \  }}t        | j                  «      |dz   k  r
t        «       ‚|j                  t        | j                  dd|z    «      «       | j                  d|z   d  | _        t        |t        j                  j                  «      r,| j                  j                  |j                  d¬«      |_        |S )Né	   T)Úraw)Úlenrq   ÚStopIterationr/   r0   ÚFrameÚparse_frame_headerÚ
parse_bodyÚ
memoryviewÚ
isinstancer1   rp   Údecoder3   )r"   r0   Úlengths      r#   ÚnextzFrameBuffer.next¬   sÒ   € Üˆt�z‰z‹?˜QÒÜ“/Ð!ä"×(Ñ(×.Ñ.×AÑAÀ$Ç*Á*ÈRÈaÀ.ÓQ‰ˆˆvÜˆ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&   N)	ri   rj   rk   rl   r$   rs   ru   r‚   Ú__next__r*   r&   r#   rn   rn   •   s"   „ ñ
òòòòð  �Hr&   rn   c                 óÜ   ‡‡— ‰€
t        «       Šg }|j                  ‰j                  | ‰¬«      «       |j                  ˆˆfd„|D «       «       |d   j                  j                  d«       |S )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}
    ©r8   r9   c              3   óD   •K  — | ]  }‰j                  |‰¬ «      –— Œ y­w)©r9   N)rC   )Ú.0ÚchunkÚframeFactoryr9   s     €€r#   ú	<genexpr>z%buildRequestFrames.<locals>.<genexpr>Ù   s&   øè ø€ ò ØBGˆ×#Ñ# E°HÐ#×=ñùs   ƒ éÿÿÿÿÚ
END_STREAM)r   Úappendr?   Úextendr4   r5   ©r8   r3   rŠ   r9   Úframess     `` r#   ÚbuildRequestFramesr’   ¿   sk   ù€ ð* ÐÜ#“~ˆà€FØ
‡M�M�,×0Ñ0¸È8Ð0ÓTÔUØ
‡M�Mô ØKOôô ð ˆ2�J×Ñ×Ñ˜Ô&Ø€Mr&   c                 óN   — t        | |||«      }dj                  d„ |D «       «      S )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   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   ©Ú	serialize©rˆ   r;   s     r#   r‹   z$buildRequestBytes.<locals>.<genexpr>ô   s   è ø€ Ò2 a�A—K‘K—MÑ2ùó   ‚)r’   Újoinr�   s        r#   ÚbuildRequestBytesrš   à   s)   € ô&   ¨¨|¸XÓF€FØ�8‰8Ñ2¨6Ô2Ó2Ð2r&   c                 óN   — t        «       }|j                  | «       t        |«      S )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.
    )rn   rs   Úlist)r3   Úbuffers     r#   ÚframesFromBytesrž   ÷   s#   € ô ‹]€FØ
×Ñ�tÔÜ�‹<Ðr&   c                   ó   — e Zd ZdZdZd„ Zy)ÚChunkedHTTPHandlerzš
    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                 óê   — t        | j                  j                  d«      d   «      }| j                  d«       t	        |«      D ]  }| j                  | j                  «       Œ | j                  «        y )Nó   /rŒ   éÈ   )ÚintÚuriÚsplitÚsetResponseCodeÚrangeÚwriteÚ	chunkDataÚfinish)r"   ÚchunksÚ_s      r#   ÚprocesszChunkedHTTPHandler.process  sZ   € Ü�T—X‘X—^‘^ DÓ)¨"Ñ-Ó.ˆØ×Ñ˜SÔ!ä�v“ò 	'ˆAØ�J‰J�t—~‘~Õ&ð	'ð 	�‰�r&   N)ri   rj   rk   rl   rª   r®   r*   r&   r#   r    r      s   „ ñð  €Iór&   r    c                   ó(   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zy)ÚConsumerDummyHandlera  
    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                 óš   — t        j                  j                  | g|¢­i |¤Ž | j                  j	                  «        d| _        d | _        y )NF)r   ÚRequestr$   ÚchannelÚpauseProducingÚ_requestReceivedrq   ©r"   ÚargsÚkwargss      r#   r$   zConsumerDummyHandler.__init__*  s?   € Ü�‰×Ñ˜dÐ4 TÒ4¨VÒ4ð 	�‰×#Ñ#Ô%Ø %ˆÔØˆ�
r&   c                 ó8   — | j                   j                  «        y)z&
        Start the data pipe.
        N)r³   ÚresumeProducingr!   s    r#   Ú
acceptDatazConsumerDummyHandler.acceptData2  s   € ð 	�‰×$Ñ$Õ&r&   c                 óV   — d| _         t        j                  j                  | g|¢­i |¤ŽS )NT)rµ   r   r²   ÚrequestReceivedr¶   s      r#   r½   z$ConsumerDummyHandler.requestReceived8  s)   € Ø $ˆÔÜ�|‰|×+Ñ+¨DÐB°4ÒB¸6ÑBÐBr&   c                 óª   — | j                  d«       | j                  j                  «       | _        d}| j	                  |«       | j                  «        y )Nr£   s0   this is a response from a consumer dummy handler)r§   ÚcontentÚreadrq   r©   r«   )r"   Ú
returnDatas     r#   r®   zConsumerDummyHandler.process<  s>   € Ø×Ñ˜SÔ!Ø—\‘\×&Ñ&Ó(ˆŒ
ØHˆ
Ø�
‰
�:ÔØ�‰�r&   N)ri   rj   rk   rl   r$   r»   r½   r®   r*   r&   r#   r°   r°   "  s   „ ñòò'òCór&   r°   c                   ó   — e Zd ZdZd„ Zy)ÚAbortingConsumerDummyHandlerzþ
    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   — | j                   j                  «        | j                   j                  «        y)z@
        Start and then immediately stop the data pipe.
        N)r³   rº   ÚstopProducingr!   s    r#   r»   z'AbortingConsumerDummyHandler.acceptDataO  s$   € ð 	�‰×$Ñ$Ô&Ø�‰×"Ñ"Õ$r&   N)ri   rj   rk   rl   r»   r*   r&   r#   rÃ   rÃ   G  s   „ ñó%r&   rÃ   c                   ó   — e Zd ZdZd„ Zy)ÚDummyProducerHandlerz‘
    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   — | j                  d«       | j                  t        «       d«       y )Nr£   T)r§   ÚregisterProducerr   r!   s    r#   r®   zDummyProducerHandler.processc  s"   € Ø×Ñ˜SÔ!Ø×Ñœm›o¨tÕ4r&   N)ri   rj   rk   rl   r®   r*   r&   r#   rÇ   rÇ   \  s   „ ñó5r&   rÇ   c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚNotifyingRequestFactorya(  
    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   — g | _         || _        t        | j                  «      D ]  }t        | |«       Œ y r   )ÚresultsÚ_wrappedFactoryr   r   )r"   ÚwrappedFactoryÚ	interfaces      r#   r$   z NotifyingRequestFactory.__init__s  s7   € ØˆŒØ-ˆÔô
 $ D×$8Ñ$8Ó9ò 	.ˆIÜ˜T 9Õ-ñ	.r&   c                 óŽ   —  | j                   |i |¤Ž}| j                  j                  |j                  «       «       t	        |«      S r   )rÎ   rÍ   rŽ   ÚnotifyFinishr   )r"   r·   r¸   Úreqs       r#   Ú__call__z NotifyingRequestFactory.__call__}  s?   € Ø"ˆd×"Ñ" DÐ3¨FÑ3ˆØ�‰×Ñ˜C×,Ñ,Ó.Ô/Ü=¸cÓBÐBr&   N)ri   rj   rk   rl   r$   rÔ   r*   r&   r#   rË   rË   k  s   „ ñò.óCr&   rË   c                   ó   — e Zd ZdZereZd„ Zy)ÚHTTP2TestHelpersz]
    A superclass that contains no tests but provides test helpers for HTTP/2
    tests.
    c                 ób   — | j                  t        j                  t        |j                  «       y)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#   ÚassertAllStreamsBlockedz(HTTP2TestHelpers.assertAllStreamsBlocked�  s"   € ð
 	×Ñœ(×0Ñ0´$¸
×8KÑ8KÕLr&   N)ri   rj   rk   rl   ÚskipH2ÚskiprÜ   r*   r&   r#   rÖ   rÖ   †  s   „ ññ
 ØˆóMr&   rÖ   c                   ó  — e Zd Zg d¢Zg d¢Zg d¢Zg d¢ZdZg d¢ZdZ	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d „ Z"d!„ Z#d"„ Z$d#„ Z%d$„ Z&d%„ Z'd&„ Z(d'„ Z)d(„ Z*y))*ÚHTTP2ServerTests©©ó   :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                 óÖ   — t        «       }t        «       }|j                  «       }|t        |||«      z  }|j	                  |«       t        |«      D ]  }|j                  |«       Œ ||fS )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   r+   rš   ÚmakeConnectionr   ÚdataReceived)r"   rÛ   r8   ÚbodyrŠ   Ú	transportÚrequestBytesÚbytes           r#   ÚconnectAndReceivez"HTTP2ServerTests.connectAndReceiveÁ  sr   € ô  $“~ˆÜ#Ó%ˆ	à#×;Ñ;Ó=ˆØÔ)¨'°4¸ÓFÑFˆà×!Ñ! )Ô,ä˜lÓ+ò 	*ˆDØ×#Ñ# DÕ)ð	*ð ˜YÐ&Ð&r&   c                 ó¸   ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Šˆ ˆfd„}|j
                  d   j                  |«      S )z�
        Send request over a TCP connection and confirm that we get back the
        expected data in the order and style we expect.
        c                 ó@  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        d„ |dd  D «       «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  t        |d   j                  «      t        ‰j                  «      «       ‰j                  |d   j                  ‰j                  «       ‰j                  |d   j                  d«       ‰j	                  d|d   j                  v «       y )Né   c              3   ó:   K  — | ]  }|j                   d k(  –— Œ y­w©r,   N©Ú	stream_idr—   s     r#   r‹   zGHTTP2ServerTests.test_basicRequest.<locals>.validate.<locals>.<genexpr>í  ó   è ø€ ÒE°Q §¡¨qÕ 0ÑEùó   ‚r,   é   é   r&   r�   )rž   ÚvalueÚassertEqualry   Ú
assertTrueÚallr   r/   r0   r1   rB   Údictr3   ÚgetResponseHeadersÚgetResponseDatar4   ©r9   r‘   r"   rÿ   s     €€r#   Úvalidatez4HTTP2ServerTests.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&   r,   )r   r   ÚrequestFactoryr  ÚgetRequestHeadersÚ_streamCleanupCallbacksÚaddCallback©r"   rÛ   r­   r  rÿ   s   `   @r#   Útest_basicRequestz"HTTP2ServerTests.test_basicRequestÞ  sV   ù€ ô "“^ˆ
Ü$9ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9õ	=ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr&   c                 óÌ   ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  ‰ j
                  «      \  }Šˆ ˆfd„}|j                  d   j                  |«      S )zV
        Send a POST request and confirm that the data is safely transferred.
        c                 ó@  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        d„ |dd  D «       «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  t        |d   j                  «      t        ‰j                  «      «       ‰j                  |d   j                  ‰j                  «       ‰j                  |d   j                  d«       ‰j	                  d|d   j                  v «       y )Nr  c              3   ó:   K  — | ]  }|j                   d k(  –— Œ y­wr  r  r—   s     r#   r‹   zFHTTP2ServerTests.test_postRequest.<locals>.validate.<locals>.<genexpr>	  ó   è ø€ ÒF°Q §¡¨qÕ 0ÑFùr  éýÿÿÿéþÿÿÿrŒ   r&   r�   )rž   r  r  ry   r  r  r   r/   r0   r1   rB   r  r3   ÚpostResponseHeadersÚpostResponseDatar4   r  s     €€r#   r  z3HTTP2ServerTests.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&   r,   )r   r   r  r  ÚpostRequestHeadersÚpostRequestDatar  r  r  s   `   @r#   Útest_postRequestz!HTTP2ServerTests.test_postRequestú  s^   ù€ ô "“^ˆ
Ü$9ˆ
Ô!Ø×-Ñ-Ø˜×/Ñ/°×1EÑ1Eó
‰ˆˆ9õ	>ð  ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr&   c                 ó$  ‡ ‡‡‡	— g d¢ŠdŠ‰ j                   D ��cg c]  \  }}|dk7  sŒ||f‘Œ }}}t        «       }t        |_        ‰ j	                  ||‰ j
                  «      \  }Š	ˆˆˆ ˆ	fd„}|j                  d   j                  |«      S c c}}w )zm
        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        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        d„ |dd  D «       «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  t        |d   j                  «      t        ‰«      «       ‰j                  |d   j                  ‰«       ‰j                  |d   j                  d«       ‰j	                  d|d   j                  v «       y )Nr  c              3   ó:   K  — | ]  }|j                   d k(  –— Œ y­wr  r  r—   s     r#   r‹   zNHTTP2ServerTests.test_postRequestNoLength.<locals>.validate.<locals>.<genexpr>4  r   r  r!  r"  rŒ   r&   r�   )rž   r  r  ry   r  r  r   r/   r0   r1   rB   r  r3   r4   )r9   r‘   r$  r#  r"   rÿ   s     €€€€r#   r  z;HTTP2ServerTests.test_postRequestNoLength.<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Ð9LÓ4MÔNØ×Ñ˜V B™ZŸ_™_Ð.>Ô?Ø×Ñ˜V B™ZŸ_™_¨cÔ2Ø�O‰O˜L¨F°2©J×,<Ñ,<Ð<Õ=r&   r,   )r%  r   r   r  r  r&  r  r  )
r"   ÚxÚyr%  rÛ   r­   r  r$  r#  rÿ   s
   `      @@@r#   Útest_postRequestNoLengthz)HTTP2ServerTests.test_postRequestNoLength  s¢   û€ ò

Ðð HÐð  $×6Ñ6÷
Ù�q˜!¸!Ð?PÓ:PˆQ�ŠFð
Ðñ 
ô "“^ˆ
Ü$9ˆ
Ô!Ø×-Ñ-ØÐ*¨D×,@Ñ,@ó
‰ˆˆ9÷	>ð  ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJùó5
s
   šB¨Bc           	      ó”  ‡ ‡	‡
— d}t        «       }t        «       Š	t        «       }t        |_        t        t        d|dz  d«      «      Š
‰
D �cg c]$  }t        ‰ j                  ‰ j                  ||«      ‘Œ& }}|j                  «       }t        j                  j                  t        |Ž «      }|dj                  d„ |D «       «      z  }|j!                  ‰	«       t#        |«      D ]  }|j%                  |«       Œ ˆ	ˆ ˆ
fd„}t'        j(                  t        |j*                  j-                  «       «      «      j/                  |«      S c c}w )zi
        Many interleaved POST requests all get received and responded to
        appropriately.
        é(   r,   r  r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   ©rˆ   r0   s     r#   r‹   z<HTTP2ServerTests.test_interleavedRequests.<locals>.<genexpr>\  ó   è ø€ Ò G°u §¡×!2Ñ Gùr˜   c                 óŠ  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰D �]  }|D �cg c]7  }|j                  |k(  r&t        |t        j                  j                  «      s|‘Œ9 }}‰j                  t        |«      d«       ‰j                  t        |d   j                  «      t        ‰j                  «      «       ‰j                  |d   j                  ‰j                  «       ‰j                  |d   j                  d«       ‰j                  d|d   j                  v «       �Œ y c c}w )Néy   r  r   r,   r  r&   r�   )rž   r  r  ry   r	  r   r/   r0   rK   r  r3   r#  r$  r  r4   )rÍ   r‘   r9   r;   ÚstreamFramesÚbr"   Ú	streamIDss        €€€r#   r  z;HTTP2ServerTests.test_interleavedRequests.<locals>.validateb  s  ø€ Ü$ Q§W¡W£YÓ/ˆFð
 ×ÑœS ›[¨,Ô7ð &ó G�ð $ö àØ—{‘{ 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ñGùò s   Á <E )r   r   r   r   r  rœ   r¨   r’   r%  r&  r+   Ú	itertoolsÚchainÚfrom_iterableÚzipr™   rü   r   rý   r   ÚDeferredListr  Úvaluesr  )r"   ÚREQUEST_COUNTr;   Úar9   r‘   r   r  r  r6  r7  s   `        @@r#   Útest_interleavedRequestsz)HTTP2ServerTests.test_interleavedRequestsA  s1  ú€ ð ˆä‹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           	      óT  ‡ ‡
— t        «       }t        «       Š
t        «       }t        |_        ‰ j
                  }d|d<   dD �cg c]  }t        |g ||«      ‘Œ }}|d   d   j                  j                  d«       d|d   d   _	        |d   d   j                  j                  d«       d|d   d   _	        |j                  d	d
dd¬«      }|d   j                  d|«       t        j                  j                  |«      }|j                  «       }|dj!                  d„ |D «       «      z  }|j#                  ‰
«       t%        |«      D ]  }|j'                  |«       Œ ˆ
ˆ fd„}	t)        j*                  t-        |j.                  j1                  «       «      «      j3                  |	«      S c c}w )zR
        Data in responses is interleaved according to HTTP/2 priorities.
        )z:pathz
/chunked/4r  )r,   r  é   r   ÚPRIORITYé@   r,   é    rB  é   T)r9   r`   ra   r_   r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r1  s     r#   r‹   z@HTTP2ServerTests.test_sendAccordingToPriority.<locals>.<genexpr>°  r2  r˜   c                 ó   •— t        ‰j                  «       «      }‰j                  t        |«      d«       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}g d¢}‰j                  ||«       y c c}w )Né   )r,   r  r,   r,   r  r,   r,   r  rB  r  rB  r  rB  rB  rB  )	rž   r  r  ry   r   r/   r0   rB   r	  )rÍ   r‘   r;   r7  ÚexpectedOrderr6  r"   s        €€r#   r  z?HTTP2ServerTests.test_sendAccordingToPriority.<locals>.validate·  s{   ø€ Ü$ Q§W¡W£YÓ/ˆFð ×ÑœS ›[¨"Ô-ð &,öØ !¬z¸!¼Z×=MÑ=M×=WÑ=WÕ/X�—“ðˆIð ò JˆMØ×Ñ˜Y¨Õ6ùò	s   º)BÁ$B)r   r   r   ÚChunkedHTTPHandlerProxyr  r  r’   r4   r5   r^   rb   Úinsertr8  r9  r:  r+   r™   rü   r   rý   r   r<  rœ   r  r=  r  )r"   r;   r?  r  r9   r‘   ÚpriorityFramer   r  r  r6  s   `         @r#   Útest_sendAccordingToPriorityz-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                 ó–  — t        «       }t        «       }t        «       }t        |_        |j                  «       }|t        | j                  g |«      z  }||j                  dd| j                  dg¬«      j                  «       z  }|j                  |«       t        |«      D ]!  }|j                  |«       |j                  sŒ! n t        |j                  «       «      }| j!                  t#        |«      d«       | j%                  t'        |d   t(        j*                  j,                  «      «       | j%                  |j                  «       y)zR
        A protocol error from the remote peer terminates the connection.
        r,   r  r.   )r9   rf   r8   r4   r  rŒ   N)r   r   r   r   r  r+   rš   r  rg   r–   rü   r   rý   Údisconnectingrž   r  r  ry   r  r   r/   r0   rP   )r"   r;   r6  r?  r   r  r‘   s          r#   Ú&test_protocolErrorTerminatesConnectionz7HTTP2ServerTests.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                 ó¦  ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  ‰ j
                  «      \  }Š|j                  d   j                  j                  }‰ j                  |j                  «       t        ‰j                  «       «      }‰ j                  t        |«      d«       |j                  «        ‰ j!                  |j                  «       ‰ j!                  |j"                  d«       t        ‰j                  «       «      }‰ j                  t        |«      d«       ˆ ˆfd„}|j$                  d   j'                  |«      S )z›
        The H2Stream data implements IPushProducer, and can have its data
        production controlled by the Request if the Request chooses to.
        r,   s   hello world, it's http/2!r  c                 ó®   •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  d|d   j
                  v «       y ©Nr  r�   rŒ   ©rž   r  r  ry   r  r4   r  s     €€r#   r  z;HTTP2ServerTests.test_streamProducingData.<locals>.validate  sE   ø€ ä$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰O˜L¨F°2©J×,<Ñ,<Ð<Õ=r&   )r   ÚConsumerDummyHandlerProxyr  r  r%  r&  ÚstreamsÚ_requestÚoriginalÚassertFalserµ   rž   r  r  ry   r»   r  rq   r  r  )r"   rÛ   r­   Úrequestr‘   r  rÿ   s   `     @r#   Útest_streamProducingDataz)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                 ó`  ‡ ‡	— t        «       }t        «       Š	t        «       }t        |_        t        ‰ j                  ‰ j                  |«      }t        «       |d   _	        |j                  «       }|dj                  d„ |D «       «      z  }|j                  ‰	«       t        |«      D ]  }|j                  |«       Œ |j                  d   j                   j"                  }‰ j%                  |j&                  «       |j(                  d   }|j+                  «        ˆ	ˆ fd„}|j-                  |«      S )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   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zAHTTP2ServerTests.test_abortStreamProducingData.<locals>.<genexpr>,  ó   è ø€ Ò ?°1 §¡§Ñ ?ùr˜   r,   c                 ó  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  |d   j                  d«       y )Nr  rŒ   r,   )
rž   r  r  ry   r  r   r/   r0   rY   r	  )r9   r‘   r6  r"   s     €€r#   r  z@HTTP2ServerTests.test_abortStreamProducingData.<locals>.validate?  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’   r%  r&  rA   r4   r+   r™   rü   r   rý   rW  rX  rY  rZ  rµ   r  r»   r  )
r"   r;   r?  r‘   r   r  r[  ÚcleanupCallbackr  r6  s
   `        @r#   Útest_abortStreamProducingDataz.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                 ó8  ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   j                  j                  }|j                  d«       |j                  d«       |j                  d   }|j                  |j                  dd¬«      j                  «       «       ‰ j                  |j                  «       ‰ j                  |j                  du «       |j                  d«       ˆ ˆfd„}|j!                  |«      S )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.
        r,   ó   first chunkó   second chunk)rU   Ns   third chunkc                 ó  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j                  |d   j                  d«       ‰j                  t        |d   t        j                  j                  «      «       y ©Nr  r,   ©
rž   r  r  ry   r	  r  r   r/   r0   r1   r  s     €€r#   r  z9HTTP2ServerTests.test_terminatedRequest.<locals>.validateu  ó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  rW  rX  rY  r©   r  rý   rZ   r–   r  Ú_disconnectedr³   r  ©r"   rÛ   rŠ   r[  rb  r  rÿ   s   `     @r#   Útest_terminatedRequestz'HTTP2ServerTests.test_terminatedRequestJ  sü   ù€ ô "“^ˆ
Ü$=ˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�ið
 ×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆð 	�‰�nÔ%Ø�‰�oÔ&ð %×<Ñ<¸QÑ?ˆð 	×ÑØ×,Ñ,¨Q¸!Ð,Ó<×FÑFÓHô	
ð
 	�‰˜×-Ñ-Ô.Ø�‰˜Ÿ™¨4Ð/Ô0ð 	�‰�nÔ%õ	Rð ×*Ñ*¨8Ó4Ð4r&   c                 óJ  ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   j                  j                  }|j                  d«       |j                  d«       |j                  d   }|j                  |j                  d¬«      j                  «       «       ‰ j                  |j                  «       ‰ j                  |j                  du «       ‰ j!                  |j"                  «       ˆ ˆfd„}|j%                  |«      S )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.
        r,   re  rf  r   ©rT   Nc                 ó  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j                  |d   j                  d«       ‰j                  t        |d   t        j                  j                  «      «       y rh  ri  r  s     €€r#   r  z<HTTP2ServerTests.test_terminatedConnection.<locals>.validate©  rj  r&   )r   rk  r  r  r  rW  rX  rY  r©   r  rý   rW   r–   r  rl  r³   rZ  Ú_stillProducingr  rm  s   `     @r#   Útest_terminatedConnectionz*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                 óÄ   ‡ ‡— t        «       }t        |_        ‰ j                  dgz   }‰ j	                  ||g «      \  }Šˆ ˆfd„}|j
                  d   j                  |«      S )zq
        Requests containing Expect: 100-continue cause provisional 100
        responses to be emitted.
        )s   expects   100-continuec                 ó¢  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        d„ |dd  D «       «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  |d   j                  dg«       ‰j	                  d|d   j                  v «       y )NrB  c              3   ó:   K  — | ]  }|j                   d k(  –— Œ y­wr  r  r—   s     r#   r‹   zQHTTP2ServerTests.test_respondWith100Continue.<locals>.validate.<locals>.<genexpr>Ç  r
  r  r,   )ró   s   100r�   rŒ   )rž   r  r  ry   r  r  r   r/   r0   r1   r3   r4   r  s     €€r#   r  z>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&   r,   )r   r   r  r  r  r  r  )r"   rÛ   r8   r­   r  rÿ   s   `    @r#   Útest_respondWith100Continuez,HTTP2ServerTests.test_respondWith100Continue³  se   ù€ ô
 "“^ˆ
Ü$9ˆ
Ô!ð ×(Ñ(Ð,HÐ+IÑIˆà×-Ñ-¨j¸'À2ÓF‰ˆˆ9õ
	>ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr&   c                 ó–  ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   }|j                  j                  }|j                  d   }|j                  «        ‰ j                  |j                  «       ‰ j                  |j                  du «       ˆ ˆfd„}|j                  |«      S )z´
        Triggering the call to L{H2Stream._respondToBadRequestAndDisconnect}
        leads to a 400 error being sent automatically and the stream being torn
        down.
        r,   Nc                 óZ  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  |d   j                  dg«       ‰j	                  d|d   j                  v «       y )Nr  r,   )ró   s   400r�   rŒ   )rž   r  r  ry   r  r   r/   r0   r1   r3   r4   r  s     €€r#   r  z6HTTP2ServerTests.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   rk  r  r  r  rW  rX  rY  r  Ú!_respondToBadRequestAndDisconnectr  rl  r³   r  )r"   rÛ   r­   Ústreamr[  rb  r  rÿ   s   `      @r#   Útest_respondWith400z$HTTP2ServerTests.test_respondWith400Ï  s³   ù€ ô "“^ˆ
Ü$=ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆØ$×<Ñ<¸QÑ?ˆð 	×0Ñ0Ô2ð 	�‰˜×-Ñ-Ô.Ø�‰˜Ÿ™¨4Ð/Ô0õ	>ð ×*Ñ*¨8Ó4Ð4r&   c                 ó^  ‡ ‡‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   }|j                  j                  }g d¢Š‰D ]  }|j                  |«       Œ |j                  «        ˆˆ ˆfd„}|j                  d   j                  |«      S )zœ
        Calling L{Request.loseConnection} causes all data that has previously
        been sent to be flushed, and then the stream cleanly closed.
        r,   )ó   helloó   worldó   hereó   areó   someó   writesc                 ó  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        d„ |dd  D «       «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  d|d   j                  v «       |D �cg c]3  }t        |t        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |‰dgz   «       y c c}w )Nrw   c              3   ó:   K  — | ]  }|j                   d k(  –— Œ y­wr  r  r—   s     r#   r‹   zQHTTP2ServerTests.test_loseH2StreamConnection.<locals>.validate.<locals>.<genexpr>  r
  r  r,   r�   rŒ   r&   ©rž   r  r  ry   r  r  r   r/   r0   r1   r4   rB   r3   )r9   r‘   r;   ÚreceivedDataChunksÚ
dataChunksr"   rÿ   s       €€€r#   r  z>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×,<Ñ,<Ð<Ô=ð !'ö"Ø¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ð"Ðð "ð ×ÑØ"Ø˜c˜UÑ"õùò"s   Â4)DÃD)r   rk  r  r  r  rW  rX  rY  r©   ÚloseConnectionr  r  )	r"   rÛ   r­   r{  r[  r‰   r  rˆ  rÿ   s	   `      @@r#   Útest_loseH2StreamConnectionz,HTTP2ServerTests.test_loseH2StreamConnectionö  s¨   ú€ ô "“^ˆ
Ü$=ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆò Oˆ
Øò 	!ˆEØ�M‰M˜%Õ ð	!ð 	×ÑÔ ö	ð$ ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr&   c                 óö   — t        «       }t        |_        | j                  || j                  g «       |j
                  d   }|j                  j                  }| j                  t        |j                  |d«       y)zK
        The L{H2Stream} object forbids registering two producers.
        r,   TN)r   rk  r  r  r  rW  rX  rY  rØ   Ú
ValueErrorrÉ   )r"   rÛ   r{  r[  s       r#   Útest_cannotRegisterTwoProducersz0HTTP2ServerTests.test_cannotRegisterTwoProducers#  sf   € ô "“^ˆ
Ü$=ˆ
Ô!Ø×Ñ˜z¨4×+AÑ+AÀ2ÔFð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆà×Ñœ* f×&=Ñ&=¸wÈÕMr&   c                 óX  ‡ ‡‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   }|j                  j                  Š‰j                  j                  }|j                  ˆfd„«       ˆ ˆfd„}|j                  d   j                  |«      S )zŒ
        L{Request} objects that have registered pull producers get blocked and
        unblocked according to HTTP/2 flow control.
        r,   c                 ó$   •— ‰j                  «       S r   )r«   )r+  r[  s    €r#   ú<lambda>z;HTTP2ServerTests.test_handlesPullProducer.<locals>.<lambda>?  s   ø€ ¨w¯~©~Ó/?€ r&   c                 ó&  •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |g d¢«       y c c}w )Nr�   rŒ   )ó   0rë   rì   ó   3ó   4ó   5ó   6ó   7ó   8ó   9r&   ©
rž   r  r  r4   r   r/   r0   rB   r3   r  ©r9   r‘   r;   rˆ  r"   rÿ   s       €€r#   r  z;HTTP2ServerTests.test_handlesPullProducer.<locals>.validateB  s�   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×ÑØÚQõùòó   ¿)BÁ)B)r   r   r  r  r  rW  rX  rY  Ú_actualProducerÚresultr  r  )r"   rÛ   r­   r{  ÚproducerCompleter  r[  rÿ   s   `     @@r#   Útest_handlesPullProducerz)HTTP2ServerTests.test_handlesPullProducer1  s˜   ú€ ô
 "“^ˆ
Ü$Aˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆØ"×2Ñ2×9Ñ9ÐØ×$Ñ$Ó%?Ô@õ	ð ×1Ñ1°!Ñ4×@Ñ@ÀÓJÐJr&   c                 ó&  — t        «       }t        |_        | j                  || j                  g «       |j
                  d   j                  j                  }| j                  |j                  «       «       |j
                  d   j                  «        y)zJ
        L{Request} objects can correctly ask isSecure on HTTP/2.
        r,   N)r   r   r  r  r  rW  rX  rY  rZ  ÚisSecureÚabortConnection)r"   rÛ   r[  s      r#   Útest_isSecureWorksProperlyz+HTTP2ServerTests.test_isSecureWorksProperlyS  su   € ô "“^ˆ
Ü$;ˆ
Ô!Ø×Ñ˜z¨4×+AÑ+AÀ2ÔFà×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆØ×Ñ˜×)Ñ)Ó+Ô,Ø×Ñ˜1Ñ×-Ñ-Õ/r&   c                 ó>  ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   j                  j                  }t        j                  d|j                  «       ˆ ˆfd„}|j                  d   j                  |«      S )zL
        L{H2Connection} correctly unblocks when a stream is ended.
        r,   ç{®Gáz„?c                  ó®   •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  d|d   j
                  v «       y )Nr  r�   rŒ   rU  )r·   r‘   r"   rÿ   s     €€r#   ÚvalidateCompletezCHTTP2ServerTests.test_lateCompletionWorks.<locals>.validateCompletel  sE   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð ×ÑœS ›[¨!Ô,Ø�O‰O˜L¨F°2©J×,<Ñ,<Ð<Õ=r&   )r   r   r  r  r  rW  rX  rY  r   Ú	callLaterr«   r  r  )r"   rÛ   r­   r[  r¨  rÿ   s   `    @r#   Útest_lateCompletionWorksz)HTTP2ServerTests.test_lateCompletionWorks_  s‰   ù€ ô "“^ˆ
Ü$;ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9ð ×$Ñ$ QÑ'×0Ñ0×9Ñ9ˆÜ×Ñ˜$ §¡Ô/õ	>ð ×1Ñ1°!Ñ4×@Ñ@ÐAQÓRÐRr&   c                 ón  ‡ ‡— t        «       }t        |_        ‰ j                  |‰ j                  g «      \  }Š|j
                  d   }|j                  j                  }|j                  d«       |j                  g d¢«       |j                  «        |j                  d   }ˆ ˆfd„}|j                  |«      S )zW
        L{H2Stream} objects can send a series of frames via C{writeSequence}.
        r,   r£   )ó   Helloó   ,ó   world!c                 ó&  •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |g d¢«       y c c}w )Nr�   rŒ   )r¬  r­  r®  r&   rš  r›  s       €€r#   r  z@HTTP2ServerTests.test_writeSequenceForChannels.<locals>.validate†  s~   ø€ Ü$ Y§_¡_Ó%6Ó7ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×Ñ˜ZÒ)IÕJùòrœ  )r   r   r  r  r  rW  rX  rY  r§   ÚwriteSequencer«   r  r  )r"   rÛ   r­   r{  r[  ÚcompletionDeferredr  rÿ   s   `      @r#   Útest_writeSequenceForChannelsz.HTTP2ServerTests.test_writeSequenceForChannelsu  s£   ù€ ô "“^ˆ
Ü$;ˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9à×#Ñ# AÑ&ˆØ—/‘/×*Ñ*ˆà×Ñ Ô$Ø×ÑÒ8Ô9Ø�‰Ôà'×?Ñ?ÀÑBÐõ
	Kð "×-Ñ-¨hÓ7Ð7r&   c                 óÎ  ‡ ‡‡‡	‡
‡— t        «       Š
t        «       Št        «       Št        ‰_        ‰
j                  «       }|‰
j                  t        j                  j                  j                  di«      j                  «       z  }|t        ‰ j                  g ‰
«      z  }‰j                  ‰«       t        |«      D ]  }‰j!                  |«       Œ ‰j"                  d   }|j$                  j&                  Š‰j)                  d«       g d¢Š	ˆ	ˆfd„}t+        j,                  t.        d|«      }|j1                  ˆˆ
fd„«       ˆˆ	ˆ fd„}‰j2                  d   j1                  |«      S )	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.
        rB  r,   ó   fiver)r€  r�  r‚  rƒ  c                  óV   •— ‰D ]  } ‰j                  | «       Œ ‰j                  «        y r   )r©   r«   )r‰   rˆ  r[  s    €€r#   Úwrite_chunksz7HTTP2ServerTests.test_delayWrites.<locals>.write_chunks³  s(   ø€ à#ò %�Ø—‘˜eÕ$ð%à�N‰NÕr&   r¦  c                  ód   •— ‰j                  ‰j                  dd¬«      j                  «       «      S )Nr,   é2   ©r9   rM   )rý   rN   r–   )r·   r?  r;   s    €€r#   r�  z3HTTP2ServerTests.test_delayWrites.<locals>.<lambda>»  s,   ø€ ˜!Ÿ.™.Ø×(Ñ(°!¸rÐ(ÓB×LÑLÓNó€ r&   c                 ó  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        d„ |dd  D «       «      «       ‰j	                  t        |d   t        j                  j                  «      «       ‰j	                  d|d   j                  v «       |D �cg c]3  }t        |t        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |dg‰z   dgz   «       y c c}w )Nrw   c              3   ó:   K  — | ]  }|j                   d k(  –— Œ y­wr  r  r—   s     r#   r‹   zFHTTP2ServerTests.test_delayWrites.<locals>.validate.<locals>.<genexpr>Ç  r
  r  r  r�   rŒ   r´  r&   r†  )r9   r‘   r;   r‡  r6  rˆ  r"   s       €€€r#   r  z3HTTP2ServerTests.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×,<Ñ,<Ð<Ô=ð !'ö"Ø¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ð"Ðð "ð ×ÑØ"Ø�
˜ZÑ'¨3¨%Ñ/õùò"s   Â4)D	ÃD	)r   r   r   r   r  r+   rI   Úh2rG   ÚSettingCodesÚINITIAL_WINDOW_SIZEr–   rš   r  rü   r   rý   rW  rX  rY  r©   r   Ú
deferLaterr   r  r  )r"   r   r  r{  r¶  Údr  r?  r6  rˆ  r;   r[  s   `      @@@@@r#   Útest_delayWritesz!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                 óÖ  — t        «       }t        «       }t        «       }t        |_        |j                  «       }|t        | j                  g |¬«      z  }||j                  d¬«      j                  «       z  }|j                  |«       |j                  |«       t        |j                  «       «      }| j                  t        |«      d«       | j!                  d|j"                  «       y)zu
        A client that immediately resets after sending the body causes Twisted
        to send no response.
        ©r8   r3   rŠ   r,   r‡   N)r   r   r   r   r  r+   rš   r  rZ   r–   rü   rý   rž   r  r  ry   ÚassertNotInr  )r"   rŠ   rÿ   r?  r   r‘   s         r#   Útest_resetAfterBodyz$HTTP2ServerTests.test_resetAfterBodyÖ  sÇ   € ô
 $“~ˆÜ#Ó%ˆ	Ü‹NˆÜ0ˆÔà#×;Ñ;Ó=ˆØÔ)Ø×*Ñ*°À,ô
ñ 	
ˆð 	˜×8Ñ8À!Ð8ÓD×NÑNÓPÑPˆØ	×Ñ˜Ô#Ø	�‰�|Ô$ä  §¡Ó!2Ó3ˆà×Ñœ˜V› aÔ(Ø×Ñ˜˜A×5Ñ5Õ6r&   c                 óŽ  ‡ ‡‡— t        j                  «       Š G ˆfd„dt        «      }t        «       Št	        j
                  «       }t        |«      ‰_        |‰_        t        «       ‰_
        ‰ j                  ‰‰ j                  g «       ˆˆ fd„}‰j                  |«       ‰j                  d   }t        j                  ‰|g«      S )z�
        A custom L{Request} subclass that requires the site and factory in the
        constructor is able to get them.
        c                   ó   •— e Zd Zˆ fd„Zy)úTHTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.SuperRequestc                 ó®   •— t        j                  | g|¢­i |¤Ž ‰j                  | j                  j                  | j                  j
                  f«       y r   )r   r$   Úcallbackr³   ÚsiteÚfactory)r"   r·   r¸   rÀ  s      €r#   r$   z]HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.SuperRequest.__init__õ  s@   ø€ Ü ×)Ñ)¨$Ð@°Ò@¸Ò@Ø—
‘
˜DŸL™L×-Ñ-¨t¯|©|×/CÑ/CÐDÕEr&   N)ri   rj   rk   r$   )rÀ  s   €r#   ÚSuperRequestrÈ  ô  s	   ø„ õFr&   rÍ  c                 ó€   •— | \  }}‰j                  |‰j                  «       ‰j                  |‰j                  «       y r   )ÚassertIsrË  rÌ  )r·   rË  rÌ  rÛ   r"   s      €€r#   ÚvalidateFactoryAndSitez^HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.validateFactoryAndSite  s2   ø€ Ø ‰MˆD�'Ø�M‰M˜$ 
§¡Ô0Ø�M‰M˜' :×#5Ñ#5Õ6r&   r,   )r   ÚDeferredr   r   r   ÚHTTPFactoryr   r  rÌ  ÚobjectrË  r  r  r  r  ÚgatherResults)r"   rÍ  ÚhttpFactoryrÐ  rb  rÛ   rÀ  s   `    @@r#   Ú-test_RequestRequiringFactorySiteInConstructorz>HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructorí  s«   ú€ ô
 �N‰NÓˆö	FÔ+ô 	Fô
 "“^ˆ
Ü×&Ñ&Ó(ˆÜ$<¸\Ó$Jˆ
Ô!ð )ˆ
ÔÜ ›(ˆ
Œà×Ñ˜z¨4×+AÑ+AÀ2ÔFõ	7ð
 	
�‰Ð,Ô-ð %×<Ñ<¸QÑ?ˆÜ×"Ñ" A Ð#7Ó8Ð8r&   c                 ód  ‡ — t        «       }t        t        «      |_        ‰ j	                  |‰ j
                  g «      \  }}|j                  j                  }‰ j                  t        |«      d«       ˆ fd„}|d   }|j                  |«       |j                  d   }t        j                  ||g«      S )z…
        A request sent to a HTTP/2 connection fires the
        L{http.Request.notifyFinish} callback with a L{None} value.
        r,   c                 ó(   •— ‰j                  | «       y r   )ÚassertIsNone)rž  r"   s    €r#   r  z?HTTP2ServerTests.test_notifyOnCompleteRequest.<locals>.validate  s   ø€ Ø×Ñ˜fÕ%r&   r   )r   rË   r   r  r  r  rÍ   r  ry   r  r  r   rÔ  )r"   rÛ   r­   rÿ   Ú	deferredsr  rÀ  rb  s   `       r#   Útest_notifyOnCompleteRequestz-HTTP2ServerTests.test_notifyOnCompleteRequest  s¢   ø€ ô
 "“^ˆ
Ü$;Ô<LÓ$Mˆ
Ô!Ø×-Ñ-¨j¸$×:PÑ:PÐRTÓU‰ˆˆ9à×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+ô	&ð �a‰LˆØ	�‰�hÔð %×<Ñ<¸QÑ?ˆÜ×"Ñ" A Ð#7Ó8Ð8r&   c                 óŠ  ‡ — t        «       }t        t        «      |_        ‰ j	                  |‰ j
                  g «      \  }}|j                  j                  }‰ j                  t        |«      d«       ˆ fd„}ˆ fd„}|d   }|j                  ||«       |j                  d¬«      j                  «       }|j                  |«       |S )zw
        A HTTP/2 reset stream fires the L{http.Request.notifyFinish} deferred
        with L{ConnectionLost}.
        r,   c                 ó(   •— ‰j                  d«       y ©Nz#Didn't errback, called back instead©Úfail©Úignr"   s    €r#   rÊ  z;HTTP2ServerTests.test_notifyOnResetStream.<locals>.callback6  ó   ø€ Ø�I‰IÐ;Õ<r&   c                 óš   •— ‰j                  | t        j                  «       ‰j                  | j                  t
        j                  «       y r   ©ÚassertIsInstancer   ÚFailurerÏ  Útyper   ÚConnectionLost©Úreasonr"   s    €r#   Úerrbackz:HTTP2ServerTests.test_notifyOnResetStream.<locals>.errback9  ó2   ø€ Ø×!Ñ! &¬'¯/©/Ô:Ø�M‰M˜&Ÿ+™+¤u×';Ñ';Ô<Ør&   r   r‡   )r   rË   r   r  r  r  rÍ   r  ry   ÚaddCallbacksrZ   r–   rý   )	r"   rÛ   rŠ   rÿ   rÚ  rÊ  rì  rÀ  ÚinvalidDatas	   `        r#   Útest_notifyOnResetStreamz)HTTP2ServerTests.test_notifyOnResetStream&  s·   ø€ ô
 "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�ið ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+ô	=ô	ð
 �a‰LˆØ	�‰�x Ô)ð #×6Ñ6ÀÐ6ÓB×LÑLÓNˆØ×Ñ Ô,àˆr&   c                 ó
  ‡ — t        «       }t        t        «      |_        ‰ j	                  |‰ j
                  g «      \  }}t        ‰ j
                  g |d¬«      }|j                  |«       |j                  j                  }‰ j                  t        |«      d«       ˆ fd„}ˆ fd„}|D ]  }|j                  ||«       Œ |j                  dd¬«      j                  «       }	|j                  |	«       t        j                  |«      S )	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.
        r  ©rŠ   r9   r  c                 ó(   •— ‰j                  d«       y rÞ  rß  rá  s    €r#   rÊ  z=HTTP2ServerTests.test_failWithProtocolError.<locals>.callbacka  rã  r&   c                 ó®   •— ‰j                  | t        j                  «       ‰j                  | j                  t        j
                  j                  «       y r   )ræ  r   rç  r  r¼  Ú
exceptionsÚProtocolErrorrê  s    €r#   rì  z<HTTP2ServerTests.test_failWithProtocolError.<locals>.errbackd  s8   ø€ Ø×!Ñ! &¬'¯/©/Ô:Ø×!Ñ! &§,¡,´·±×0KÑ0KÔLØr&   ó   yoéð   ©r3   r9   )r   rË   r   r  r  r  rš   rý   rÍ   r  ry   rî  rC   r–   r   rÔ  ©
r"   rÛ   rŠ   rÿ   ÚsecondRequestrÚ  rÊ  rì  rÀ  rï  s
   `         r#   Útest_failWithProtocolErrorz+HTTP2ServerTests.test_failWithProtocolErrorG  sö   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�iô *Ø×"Ñ" B°\ÈAô
ˆð 	×Ñ Ô.ð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+ô	=ô	ð
 ò 	.ˆAØ�N‰N˜8 WÕ-ð	.ð
 #×1Ñ1°uÀtÐ1ÓL×VÑVÓXˆØ×Ñ Ô,ä×"Ñ" 9Ó-Ð-r&   c                 ó  ‡ — t        «       }t        t        «      |_        ‰ j	                  |‰ j
                  g «      \  }}t        ‰ j
                  g |d¬«      }|j                  |«       |j                  j                  }‰ j                  t        |«      d«       ˆ fd„}ˆ fd„}|D ]  }|j                  ||«       Œ |j                  d¬«      j                  «       }	|j                  |	«       t        j                  |«      S )z´
        A HTTP/2 GoAway triggers the L{http.Request.notifyFinish}
        deferred for all outstanding requests with a Failure that contains a
        RemoteGoAway error.
        r  rò  r  c                 ó(   •— ‰j                  d«       y rÞ  rß  rá  s    €r#   rÊ  z4HTTP2ServerTests.test_failOnGoaway.<locals>.callbackŒ  rã  r&   c                 óš   •— ‰j                  | t        j                  «       ‰j                  | j                  t
        j                  «       y r   rå  rê  s    €r#   rì  z3HTTP2ServerTests.test_failOnGoaway.<locals>.errback�  rí  r&   rp  )r   rË   r   r  r  r  rš   rý   rÍ   r  ry   rî  rW   r–   r   rÔ  rú  s
   `         r#   Útest_failOnGoawayz"HTTP2ServerTests.test_failOnGoaways  sô   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�iô *Ø×"Ñ" B°\ÈAô
ˆð 	×Ñ Ô.ð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+ô	=ô	ð
 ò 	.ˆAØ�N‰N˜8 WÕ-ð	.ð #×3Ñ3ÀÐ3ÓC×MÑMÓOˆØ×Ñ Ô,ä×"Ñ" 9Ó-Ð-r&   c                 óÆ  ‡ — t        «       }t        t        «      |_        ‰ j	                  |‰ j
                  g «      \  }}t        ‰ j
                  g |d¬«      }|j                  |«       |j                  j                  }‰ j                  t        |«      d«       ˆ fd„}ˆ fd„}|D ]  }|j                  ||«       Œ |j                  «        t        j                  |«      S )zš
        The transport telling the HTTP/2 connection to stop producing will
        fire all L{http.Request.notifyFinish} errbacks with L{error.}
        r  rò  r  c                 ó(   •— ‰j                  d«       y rÞ  rß  rá  s    €r#   rÊ  z;HTTP2ServerTests.test_failOnStopProducing.<locals>.callback¶  rã  r&   c                 óš   •— ‰j                  | t        j                  «       ‰j                  | j                  t
        j                  «       y r   rå  rê  s    €r#   rì  z:HTTP2ServerTests.test_failOnStopProducing.<locals>.errback¹  rí  r&   )r   rË   r   r  r  r  rš   rý   rÍ   r  ry   rî  rÅ   r   rÔ  )	r"   rÛ   rŠ   rÿ   rû  rÚ  rÊ  rì  rÀ  s	   `        r#   Útest_failOnStopProducingz)HTTP2ServerTests.test_failOnStopProducing�  sÖ   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�iô *Ø×"Ñ" B°\ÈAô
ˆð 	×Ñ Ô.ð ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+ô	=ô	ð
 ò 	.ˆAØ�N‰N˜8 WÕ-ð	.ð 	× Ñ Ô"ä×"Ñ" 9Ó-Ð-r&   c                 óf  ‡ — t        «       }t        t        «      |_        ‰ j	                  |‰ j
                  g «      \  }}|j                  j                  }‰ j                  t        |«      d«       ˆ fd„}ˆ fd„}|d   }|j                  ||«       |j                  d   }|j                  «        |S )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}.
        r,   c                 ó(   •— ‰j                  d«       y rÞ  rß  rá  s    €r#   rÊ  z7HTTP2ServerTests.test_notifyOnFast400.<locals>.callback×  rã  r&   c                 óš   •— ‰j                  | t        j                  «       ‰j                  | j                  t
        j                  «       y r   rå  rê  s    €r#   rì  z6HTTP2ServerTests.test_notifyOnFast400.<locals>.errbackÚ  rí  r&   r   )r   rË   r   r  r  r  rÍ   r  ry   rî  rW  rz  )	r"   rÛ   rŠ   rÿ   rÚ  rÊ  rì  rÀ  r{  s	   `        r#   Útest_notifyOnFast400z%HTTP2ServerTests.test_notifyOnFast400Æ  s©   ø€ ô "“^ˆ
Ü$;Ô<NÓ$Oˆ
Ô!Ø"&×"8Ñ"8Ø˜×.Ñ.°ó#
Ñˆ�ið ×-Ñ-×5Ñ5ˆ	Ø×Ñœ˜Y›¨Ô+ô	=ô	ð
 �a‰LˆØ	�‰�x Ô)ð ×#Ñ# AÑ&ˆØ×0Ñ0Ô2àˆr&   c                 óÌ  — t        «       }t        |«      }|j                  |_        t        |_        d}t        «       }t        «       }|j                  «       }|j                  |«       |j                  |«       |j                  t        | j                  g ||¬«      «       |j                  «        d|_        |j                  |«       | j                  |j                   «       y)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.
        r,   r‡   r   N)r
   r   r©  r   r  r   r   r+   rü   rý   rš   r  r´   Ú_maxBufferedControlFrameBytesrz  r  Údisconnected)r"   ÚmemoryReactorrÛ   r9   rŠ   rÿ   r+   s          r#   Útest_fast400WithCircuitBreakerz/HTTP2ServerTests.test_fast400WithCircuitBreakerí  sË   € ô +Ó,ˆÜ! -Ó0ˆ
Ø,×6Ñ6ˆ
Ôô %7ˆ
Ô!àˆä#“~ˆÜ#Ó%ˆ	ð #/×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8à×ÑÜØ×&Ñ&¨¨LÀ8ôô	
ð 	×!Ñ!Ô#Ø34ˆ
Ô0à×4Ñ4°XÔ>à�‰˜	×.Ñ.Õ/r&   c                 óH  — t        «       }t        |_        t        «       }t	        «       }|j                  «       }|j                  |«       |j                  |«       |j                  «        t        dd«      D ]0  }|j                  |j                  i «      j                  «       «       Œ2 t        |j                  «       «      }| j                  t        |«      d«       |j!                  «        t        |j                  «       «      }| j                  t        |«      d«       y)z�
        If a the L{H2Connection} has been paused by the transport, it will
        not write automatic frame data triggered by writes.
        r   éd   r,   ée   N)r   r   r  r   r   r+   rü   rý   r´   r¨   rI   r–   rž   r  r  ry   rº   )r"   rÛ   rŠ   rÿ   r+   r­   r‘   s          r#   Ú test_bufferingAutomaticFrameDataz1HTTP2ServerTests.test_bufferingAutomaticFrameData  sñ   € ô "“^ˆ
Ü$9ˆ
Ô!Ü#“~ˆÜ#Ó%ˆ	à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×!Ñ!Ô#ô �q˜#“ò 	UˆAØ×#Ñ# L×$CÑ$CÀBÓ$G×$QÑ$QÓ$SÕTð	Uô ! §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(ð 	×"Ñ"Ô$Ü  §¡Ó!2Ó3ˆØ×Ñœ˜V› cÕ*r&   c                 ód  — t        «       }t        |_        t        «       }t	        «       }|j                  «       }|j                  |«       |j                  |«       |j                  «        d|_	        | j                  |j                  «       t        dd«      D ]0  }|j                  |j                  i «      j                  «       «       Œ2 | j                  |j                  «       |j                  |j                  i «      j                  «       «       | j                  |j                   «       y)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.
        r  r   é   N)r   r   r  r   r   r+   rü   rý   r´   r
  rZ  rP  r¨   rI   r–   r  r  )r"   rÛ   rŠ   rÿ   r+   r­   s         r#   Ú2test_bufferingAutomaticFrameDataWithCircuitBreakerzCHTTP2ServerTests.test_bufferingAutomaticFrameDataWithCircuitBreaker6  sÿ   € ô "“^ˆ
Ü$9ˆ
Ô!Ü#“~ˆÜ#Ó%ˆ	à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×!Ñ!Ô#ð 47ˆ
Ô0ð 	×Ñ˜×0Ñ0Ô1Ü�q˜"“ò 	UˆAØ×#Ñ# L×$CÑ$CÀBÓ$G×$QÑ$QÓ$SÕTð	Uà×Ñ˜×0Ñ0Ô1ð 	×Ñ × ?Ñ ?ÀÓ C× MÑ MÓ OÔPØ�‰˜	×.Ñ.Õ/r&   c                 óª  —  G d„ dt         «      }t        «       }t        |_        t	        «       } |«       }|j                  |d«       |j                  «       }|j                  |«       |j                  |«       | j                  |j                  «       t        |j                  «       «      }| j                  t        |«      d«       | j                  |j                  d«       t!        dd«      D ]0  }|j                  |j#                  i «      j%                  «       «       Œ2 t        |j                  «       «      }| j                  t        |«      d«       | j                  |j                  d«       |j'                  «        t        |j                  «       «      }| j                  t        |«      d«       | j                  |j                  d	«       y
)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                   ó   — e Zd Zd„ Zy)úeHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite.<locals>.AutoPausingStringTransportc                 ój   — t        j                  | g|¢­i |¤Ž | j                  j                  «        y r   )r   r©   Úproducerr´   r¶   s      r#   r©   zkHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite.<locals>.AutoPausingStringTransport.write_  s*   € Ü×%Ñ% dÐ<¨TÒ<°VÒ<Ø—‘×,Ñ,Õ.r&   N)ri   rj   rk   r©   r*   r&   r#   ÚAutoPausingStringTransportr  ^  s   „ ó/r&   r  Tr,   r   r  éc   r  éZ   N)r   r   r   r  r   rÉ   r+   rü   rý   ÚassertIsNotNoneÚ_consumerBlockedrž   r  r  ry   Ú_bufferedControlFrameBytesr¨   rI   r–   rº   )r"   r  rÛ   rŠ   rÿ   r+   r‘   r­   s           r#   Ú0test_bufferingContinuesIfProducerIsPausedOnWritezAHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWriteX  s|  € ô	/¬ô 	/ô "“^ˆ
Ü$9ˆ
Ô!Ü#“~ˆÙ.Ó0ˆ	Ø×"Ñ" :¨tÔ4à".×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×Ñ˜Z×8Ñ8Ô9Ü  §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(Ø×Ñ˜×>Ñ>ÀÔBô �q˜"“ò 	UˆAØ×#Ñ# L×$CÑ$CÀBÓ$G×$QÑ$QÓ$SÕTð	Uô ! §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(Ø×Ñ˜×>Ñ>ÀÔGð 	×"Ñ"Ô$ä  §¡Ó!2Ó3ˆØ×Ñœ˜V› aÔ(Ø×Ñ˜×>Ñ>ÀÕGr&   c                 ó¤  — t        «       }t        |«      }|j                  |_        t        «       }t	        «       }|j                  «       }|j                  |«       |j                  |«       |j                  «        d|_	        |j                  dd¬«      j                  «       }|j                  |«       | j                  |j                  «       y)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   r÷  rø  rù  N)r
   r   r©  r   r   r+   rü   rý   r´   r
  rC   r–   r  r  )r"   r  rÛ   rŠ   rÿ   r+   rï  s          r#   Ú+test_circuitBreakerAbortsAfterProtocolErrorz<HTTP2ServerTests.test_circuitBreakerAbortsAfterProtocolError…  s¹   € ô +Ó,ˆÜ! -Ó0ˆ
Ø,×6Ñ6ˆ
Ôä#“~ˆÜ#Ó%ˆ	ð #/×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð 	×!Ñ!Ô#Ø34ˆ
Ô0ð #×1Ñ1°uÀtÐ1ÓL×VÑVÓXˆð 	×Ñ Ô,Ø�‰˜	×.Ñ.Õ/r&   N)+ri   rj   rk   r  r%  r&  r  r  r#  r$  r  r  r'  r-  r@  rN  rQ  r\  rc  rn  rs  rw  r|  rŠ  r�  r   r¤  rª  r²  rÁ  rÅ  rÖ  rÛ  rð  rü  r   r  r  r  r  r  r   r"  r*   r&   r#   rà   rà   —  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                   ó~   — e Zd ZdZg d¢ZdZg d¢Zg d¢ZdZd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚH2FlowControlTestszT
    Tests that ensure that we handle HTTP/2 flow control limits appropriately.
    )râ   rå   ræ   rè   ré   r÷   rí   rñ   rú   c                 ó˜  ‡ ‡	— t        «       }t        «       Š	t        «       }t        |_        |j                  «       }||j                  t        j                  j                  j                  di«      j                  «       z  }|t        ‰ j                  g |«      z  }|j                  ‰	«       t        |«      D ]  }|j!                  |«       Œ t#        ‰ j$                  «      dz
  }t'        |«      D ]4  }|j)                  dd¬«      }|j!                  |j                  «       «       Œ6 ˆ	ˆ fd„}|j*                  d   j-                  |«      S )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.
        rB  r,   r¹  c                 óà   •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       dj	                  d„ |D «       «      }‰j                  ‰j                  |«       y )Nr�   rŒ   r&   c              3   ó~   K  — | ]5  }t        |t        j                  j                  «      sŒ(|j                  –— Œ7 y ­wr   ©r   r/   r0   rB   r3   r—   s     r#   r‹   zMH2FlowControlTests.test_bufferExcessData.<locals>.validate.<locals>.<genexpr>ç  ó.   è ø€ ò *Ø¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—•ñ*ùó   ‚)=¬=)rž   r  r  r4   r™   r  r  ©r9   r‘   ÚactualResponseDatar6  r"   s      €€r#   r  z: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  r+   rI   r¼  rG   r½  r¾  r–   rš   r  rü   r   rý   ry   r  r¨   rN   r  r  )
r"   r;   r?  r   r  ÚbonusFramesr­   r0   r  r6  s
   `        @r#   Útest_bufferExcessDataz(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                 ó†  ‡ ‡— t        «       }t        «       Št        «       }t        |_        |j                  «       }||j                  t        j                  j                  j                  di«      j                  «       z  }|t        ‰ j                  g |«      z  }|j                  ‰«       t        |«      D ]  }|j!                  |«       Œ |j"                  d   }|j$                  j&                  }‰ j)                  |j*                  «       |j-                  d«       ‰ j/                  |j*                  «       ‰ j1                  |j2                  j4                  dg«       |j!                  |j7                  dd¬«      j                  «       «       ‰ j/                  |j*                  «       ‰ j1                  |j2                  j4                  dg«       |j!                  |j7                  dd¬«      j                  «       «       ‰ j/                  |j*                  «       ‰ j1                  |j2                  j4                  dg«       |j!                  |j7                  dd¬«      j                  «       «       ‰ j)                  |j*                  «       ‰ j1                  |j2                  j4                  ddg«       |j-                  d«       ‰ j/                  |j*                  «       ‰ j1                  |j2                  j4                  g d¢«       |j!                  |j7                  dd	¬«      j                  «       «       ‰ j)                  |j*                  «       ‰ j1                  |j2                  j4                  g d
¢«       |j9                  «        |j;                  «        ˆˆ fd„}|j<                  d   j?                  |«      S )z‡
        L{Request} objects that have registered producers get blocked and
        unblocked according to HTTP/2 flow control.
        rB  r,   ó
   helloworldÚpauser¹  r   Úresume)r1  r2  r1  r¸  )r1  r2  r1  r2  c                 ó&  •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |g d¢«       y c c}w )Nr�   rŒ   )r0  r0  r&   rš  ©r9   r‘   r;   rˆ  r6  r"   s       €€r#   r  zDH2FlowControlTests.test_producerBlockingUnblocking.<locals>.validate3  s}   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×Ñ˜ZÒ)LÕMùòrœ  ) r   r   r   rk  r  r+   rI   r¼  rG   r½  r¾  r–   rš   r  rü   r   rý   rW  rX  rY  r  Ú_producerProducingr©   rZ  r  r  ÚeventsrN   ÚunregisterProducerr«   r  r  ©	r"   r;   r?  r   r  r{  r[  r  r6  s	   `       @r#   Útest_producerBlockingUnblockingz2H2FlowControlTests.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                 óª  ‡ ‡‡‡	‡
‡— t        «       Š	t        «       Št        «       Št        ‰_        ‰	j                  «       }|‰	j                  t        j                  j                  j                  di«      j                  «       z  }|t        ‰ j                  g ‰	«      z  }‰j                  ‰«       t        |«      D ]  }‰j!                  |«       Œ ‰j"                  d   Š‰j$                  j&                  Š
‰ j)                  ‰j*                  «       ‰
j-                  d«       ‰ j/                  ‰j*                  «       ‰ j1                  ‰
j2                  j4                  dg«       ‰
j-                  d«       ˆˆ	ˆ
ˆ ˆfd„}t7        j8                  t:        d|«      }ˆˆ fd„}‰j<                  d   j?                  |«      }tA        jB                  ||g«      S )	zQ
        Exactly filling the flow control window still blocks producers.
        rB  r,   r0  r1  ó   hc                  ó,  •— ‰ j                  ‰j                  dd¬«      j                  «       «       ‰j                  ‰j                  «       ‰j                  ‰j                  j                  ddg«       ‰j                  «        ‰j                  «        y )Nr,   r¸  r¹  r1  r2  )
rý   rN   r–   r  r5  r  r  r6  r7  r«   )r?  r;   r[  r"   r{  s   €€€€€r#   Úwindow_openz=H2FlowControlTests.test_flowControlExact.<locals>.window_openh  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        ‰j                  «       «      }‰j                  d|d   j                  v «       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |g d¢«       y c c}w )Nr�   rŒ   )r~  r  r;  r&   rš  r4  s       €€r#   r  z:H2FlowControlTests.test_flowControlExact.<locals>.validatet  s}   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×Ñ˜ZÒ)HÕIùòrœ  )"r   r   r   rk  r  r+   rI   r¼  rG   r½  r¾  r–   rš   r  rü   r   rý   rW  rX  rY  r  r5  r©   rZ  r  r  r6  r   r¿  r   r  r  r   r<  )r"   r   r  r=  ÚwindowDeferr  ÚvalidateDeferr?  r6  r;   r[  r{  s   `      @@@@@r#   Útest_flowControlExactz(H2FlowControlTests.test_flowControlExactA  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                 ó|  ‡ ‡— t        «       }t        «       Št        «       }t        |_        |j                  «       }||j                  t        j                  j                  j                  di«      j                  «       z  }|t        ‰ j                  g |«      z  }|j                  ‰«       t        |«      D ]  }|j!                  |«       Œ |j"                  d   }|j$                  j&                  }‰ j)                  |j*                  «       |j-                  d«       |j/                  «        |j1                  «        ‰ j)                  |j2                  «       t5        j6                  d|j                   |j9                  dd¬«      j                  «       «       ˆˆ fd„}|j:                  d   j=                  |«      S )z™
        L{Request} objects that end a stream that is currently blocked behind
        flow control can still end the stream and get cleaned up.
        rB  r,   r0  r   r¸  r¹  c                 ó&  •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |g d¢«       y c c}w )Nr�   rŒ   )r~  r  r&   rš  r4  s       €€r#   r  z=H2FlowControlTests.test_endingBlockedStream.<locals>.validate¯  s}   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×Ñ˜ZÒ)BÕCùòrœ  )r   r   r   rk  r  r+   rI   r¼  rG   r½  r¾  r–   rš   r  rü   r   rý   rW  rX  rY  r  r5  r©   r7  r«   Úfinishedr   r©  rN   r  r  r8  s	   `       @r#   Útest_endingBlockedStreamz+H2FlowControlTests.test_endingBlockedStreamƒ  sw  ù€ ô
 ‹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                 ó  ‡ ‡	— t        «       }t        «       Š	t        «       }t        |_        |j                  «       }|t        ‰ j                  g |«      z  }|j                  ‰	«       t        |«      D ]  }|j                  |«       Œ |j                  d   }|j                  j                  }|j                  d   }|j                  «        |j!                  «        ‰ j#                  |j$                  «       ˆ	ˆ fd„}|j'                  |«      S )z<
        We safely handle responses without bodies.
        r,   c                 óZ  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  d|d   j
                  v «       |D �cg c]3  }t        |t        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |dg«       y c c}w ©Nr  r�   rŒ   r&   ©rž   r  r  ry   r  r4   r   r/   r0   rB   r3   r4  s       €€r#   r  z=H2FlowControlTests.test_responseWithoutBody.<locals>.validateÞ  ó–   ø€ Ü$ Q§W¡W£YÓ/ˆFà×ÑœS ›[¨!Ô,ð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×ÑØØ�õùòó   Á)B(ÂB()r   r   r   rk  r  r+   rš   r  rü   r   rý   rW  rX  rY  r  r7  r«   r  rD  r  ©
r"   r;   r?  r   r  r{  r[  rb  r  r6  s
   `        @r#   Útest_responseWithoutBodyz+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                 ó|  ‡ ‡	— t        «       }t        «       Š	t        «       }t        |_        |j                  «       }|t        ‰ j                  g |«      z  }|j                  ‰	«       t        |«      D ]  }|j                  |«       Œ |j                  d   }|j                  j                  }|j                  d   }|j                  «        |j!                  «        ‰ j#                  |j$                  «       |j                  |j'                  dd¬«      j)                  «       «       ˆ	ˆ fd„}|j+                  |«      S )zk
        WindowUpdate frames received after we've completed the stream are
        safely handled.
        r,   r¸  r¹  c                 óZ  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  d|d   j
                  v «       |D �cg c]3  }t        |t        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |dg«       y c c}w rH  rI  r4  s       €€r#   r  zGH2FlowControlTests.test_windowUpdateForCompleteStream.<locals>.validate  rJ  rK  )r   r   r   rk  r  r+   rš   r  rü   r   rý   rW  rX  rY  r  r7  r«   r  rD  rN   r–   r  rL  s
   `        @r#   Ú"test_windowUpdateForCompleteStreamz5H2FlowControlTests.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                 ó*  ‡ ‡— t        «       }t        «       Št        «       }t        |_        |j                  «       }||j                  t        j                  j                  j                  di«      j                  «       z  }|t        ‰ j                  g |«      z  }|j                  ‰«       t        |«      D ]  }|j!                  |«       Œ |j"                  d   }|j$                  j&                  }‰ j)                  |j*                  «       |j-                  d«       ‰ j)                  |j*                  «       ‰ j/                  |j0                  j2                  g «       |j!                  |j5                  dd¬«      j                  «       «       ‰ j)                  |j*                  «       ‰ j/                  |j0                  j2                  g «       |j7                  «        |j9                  «        ˆˆ fd„}|j:                  d   j=                  |«      S )z™
        L{Request} objects that have registered producers that are not blocked
        behind flow control do not have their producer notified.
        rB  r,   ó   wordr¹  c                 ó&  •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       |D �cg c]3  }t	        |t
        j                  j                  «      sŒ(|j                  ‘Œ5 }}‰j                  |ddg«       y c c}w )Nr�   rŒ   rR  r&   rš  r4  s       €€r#   r  z;H2FlowControlTests.test_producerUnblocked.<locals>.validateZ  s€   ø€ Ü$ Q§W¡W£YÓ/ˆFð �O‰O˜L¨F°2©J×,<Ñ,<Ð<Ô=ð !'öØ¬*°Q¼
×8HÑ8H×8RÑ8RÕ*S�—“ðˆJð ð ×Ñ˜Z¨'°3¨Õ8ùòrœ  )r   r   r   rk  r  r+   rI   r¼  rG   r½  r¾  r–   rš   r  rü   r   rý   rW  rX  rY  r  r5  r©   r  r  r6  rN   r7  r«   r  r  r8  s	   `       @r#   Útest_producerUnblockedz)H2FlowControlTests.test_producerUnblocked,  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                 óâ  ‡ ‡— t        «       }t        «       Št        «       }t        |_        t        ‰ j                  ‰ j                  |«      }|j                  d|j                  dd¬«      «       |j                  «       }|dj                  d„ |D «       «      z  }|j                  ‰«       t        |«      D ]  }|j                  |«       Œ ˆˆ fd„}|j                  d   j!                  |«      S )z”
        When a WindowUpdate frame is received for the whole connection but no
        data is currently waiting, nothing exciting happens.
        r,   r   rB  r¹  r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zBH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.<genexpr>v  r_  r˜   c                 óà   •— t        ‰j                  «       «      }‰j                  d|d   j                  v «       dj	                  d„ |D «       «      }‰j                  ‰j                  |«       y )Nr�   rŒ   r&   c              3   ó~   K  — | ]5  }t        |t        j                  j                  «      sŒ(|j                  –— Œ7 y ­wr   r(  r—   s     r#   r‹   zTH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.validate.<locals>.<genexpr>„  r)  r*  )rž   r  r  r4   r™   r  r$  r+  s      €€r#   r  zAH2FlowControlTests.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’   r%  r&  rL  rN   r+   r™   rü   r   rý   r  r  )r"   r;   r?  r‘   r   r  r  r6  s   `      @r#   Útest_unnecessaryWindowUpdatez/H2FlowControlTests.test_unnecessaryWindowUpdateh  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                 ó²  — t        «       }t        «       }t        «       }t        |_        g }|j                  |j                  | j                  d¬«      «       |j                  |j                  dd¬«      «       |j                  «       }|dj                  d„ |D «       «      z  }|j                  |«       |j                  |«       | j                  |«       y)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.
        r,   r…   rB  r¹  r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zKH2FlowControlTests.test_unnecessaryWindowUpdateForStream.<locals>.<genexpr>�  s   è ø€ Ò7¨1˜Ÿ™ŸÑ7ùr˜   N)r   r   r   r   r  rŽ   r?   r%  rN   r+   r™   rü   rý   rÜ   )r"   r;   rÿ   Úconnr‘   r3   s         r#   Ú%test_unnecessaryWindowUpdateForStreamz8H2FlowControlTests.test_unnecessaryWindowUpdateForStream‹  s¹   € ô ‹NˆÜ#Ó%ˆ	Ü‹~ˆÜ3ˆÔð
 ˆØ�‰�a×)Ñ)°$×2IÑ2IÐTUÐ)ÓVÔWØ�‰�a×.Ñ.¸ÀQÐ.ÓGÔHØ×(Ñ(Ó*ˆØ�—‘Ñ7°Ô7Ó7Ñ7ˆà×Ñ˜IÔ&Ø×Ñ˜$Ôà×$Ñ$ TÕ*r&   c                 óŽ  — t        «       }t        «       }t        «       }t        |_        t        | j                  | j                  |«      }|j                  «       }|dj                  d„ |D «       «      z  }|j                  |«       t        |«      D ]  }|j                  |«       Œ |j                  d   j                  «        |j                  dd¬«      }|j                  |j!                  «       «       t#        |j%                  «       «      }| j'                  t)        |d   t*        j,                  j.                  «      «       y)zq
        When a WindowUpdate frame is received for a stream that has been
        aborted it is ignored.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zEH2FlowControlTests.test_windowUpdateAfterTerminate.<locals>.<genexpr>±  r_  r˜   r,   rB  r¹  rŒ   N)r   r   r   r   r  r’   r%  r&  r+   r™   rü   r   rý   rW  r£  rN   r–   rž   r  r  r   r/   r0   rY   )r"   r;   r6  r?  r‘   r   r  ÚwindowUpdateFrames           r#   Útest_windowUpdateAfterTerminatez2H2FlowControlTests.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                 óÎ  ‡ ‡‡‡	— t        «       Š	t        «       Št        «       Št        ‰_        t        ‰ j                  ‰ j                  ‰	«      }‰	j                  «       }|dj                  d„ |D «       «      z  }‰j                  ‰«       t        |«      D ]  }‰j                  |«       Œ ˆˆ	fd„}ˆˆ fd„}‰j                  d   j                  |«      }|j                  |«      S )zs
        When a WindowUpdate frame is received for a stream that has been
        completed it is ignored.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zDH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.<genexpr>Ñ  r_  r˜   c                  ój   •— ‰j                  dd¬«      }‰j                  |j                  «       «       y )Nr,   rB  r¹  )rN   rý   r–   )r·   r`  r?  r;   s     €€r#   Úupdate_windowzHH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.update_window×  s/   ø€ à !× 8Ñ 8À!ÈqÐ 8Ó QÐØ�N‰NÐ,×6Ñ6Ó8Õ9r&   c                  óv   •— t        ‰j                  «       «      }‰j                  d|d   j                  «       y )Nr�   rŒ   )rž   r  ÚassertInr4   ©r·   r‘   r6  r"   s     €€r#   r  zCH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.validateÜ  s-   ø€ ä$ Q§W¡W£YÓ/ˆFð �M‰M˜,¨¨r©
×(8Ñ(8Õ9r&   r,   )r   r   r   r   r  r’   r%  r&  r+   r™   rü   r   rý   r  r  )
r"   r‘   r   r  re  r  rÀ  r?  r6  r;   s
   `      @@@r#   Útest_windowUpdateAfterCompletez1H2FlowControlTests.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                 ó   — t        «       }t        «       }t        «       }t        |_        ddz  gdz  }t        d„ |D «       «      › }| j                  dd d|fgz   }t        |||¬«      }|d= |j                  |j                  d	t        j                  j                  j                  ¬
«      «       |j                  «       }|dj                  d„ |D «       «      z  }|j!                  |«       |j#                  |«       t%        |j'                  «       «      }|D �	cg c]2  }	t)        |	t*        j,                  j.                  «      r|	j0                  ‘Œ4 }
}	| j3                  dg|
«       |D �	cg c])  }	t)        |	t*        j,                  j4                  «      sŒ(|	‘Œ+ }}	|D �	cg c])  }	t)        |	t*        j,                  j6                  «      sŒ(|	‘Œ+ }}	| j9                  |«       | j9                  |«       yc c}	w c c}	w c c}	w )z’
        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   ó2   K  — | ]  }t        |«      –— Œ y ­wr   )ry   )rˆ   r3   s     r#   r‹   z;H2FlowControlTests.test_dataAndRstStream.<locals>.<genexpr>ô  s   è ø€ Ò<¨$œC ŸIÑ<ùs   ‚NrŒ   zcontent-lengthrÃ  r,   )r9   rU   r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   z;H2FlowControlTests.test_dataAndRstStream.<locals>.<genexpr>	  r_  r˜   r   )r   r   r   r   r  Úsumr%  r’   rŽ   rZ   r¼  ÚerrorsÚ
ErrorCodesÚINTERNAL_ERRORr+   r™   rü   rý   rž   r  r   r/   r0   rK   r	  r  r1   rB   rZ  )r"   rŠ   rÿ   r?  Ú	frameDataÚ
bodyLengthr8   r‘   r   r;   ÚwindowUpdateFrameIDsÚheadersFramesÚ
dataFramess                r#   Útest_dataAndRstStreamz(H2FlowControlTests.test_dataAndRstStreamæ  så  € ô
 $“~ˆÜ#Ó%ˆ	Ü‹NˆÜ0ˆÔð
  Ñ&Ð'¨!Ñ+ˆ	ÜÑ<°)Ô<Ó<Ð=ˆ
Ø×)Ñ)¨#¨2Ð.Ð3CÀZÐ2PÐ1QÑQˆÜ#Ø )¸,ô
ˆð �2ˆJØ�‰Ø×,Ñ,Ø¤b§i¡i×&:Ñ&:×&IÑ&Ið -ó ô	
ð $×;Ñ;Ó=ˆØ˜Ÿ™Ñ ?¸Ô ?Ó?Ñ?ˆØ	×Ñ˜Ô#ð 	
�‰�|Ô$ô ! §¡Ó!2Ó3ˆð
 ö 
àÜ˜!œZ×-Ñ-×?Ñ?Ô@ð �K‹Kð 
Ðð  
ð
 	×Ñ˜!˜Ð2Ô3ð
 ö
Ø¤¨A¬z×/?Ñ/?×/LÑ/LÕ!MŠAð
ˆð 
ð "(ÖU˜A¬:°a¼×9IÑ9I×9SÑ9SÕ+T’aÐUˆ
ÐUØ×Ñ˜Ô'Ø×Ñ˜Õ$ùò 
ùò
ùò Vs   Ä7G1Å*)G6ÆG6Æ)G;ÇG;c                 óR  — t        «       }t        |«      }|j                  |_        t        |_        t        «       }t        «       }|j                  «       }|j                  |«       |j                  |«       d}|j                  | j                  |¬«      j                  «       }|j                  |«       |j                  «        d|_        |j                  «        |j!                  |«       | j#                  |j%                  «       «       | j'                  |j(                  «       y)z®
        Aborting a request associated with a paused connection that's
        reached its buffered control frame limit causes that
        connection to be aborted.
        r,   r…   r   N)r
   r   r©  r   r  r   r   r+   rü   rý   r?   r%  r–   r´   r
  ÚclearÚabortRequestrZ  r  r  r  )r"   r  rÛ   rŠ   rÿ   r+   r9   ÚheadersFrameDatas           r#   Ú#test_abortRequestWithCircuitBreakerz6H2FlowControlTests.test_abortRequestWithCircuitBreaker	  s  € ô +Ó,ˆÜ! -Ó0ˆ
Ø,×6Ñ6ˆ
ÔÜ$9ˆ
Ô!ä#“~ˆÜ#Ó%ˆ	ð #/×"FÑ"FÓ"HÐØ×!Ñ! )Ô,Ø×ÑÐ 7Ô8ð ˆØ'×9Ñ9Ø×+Ñ+°hð :ó 
ç
‰)‹+ð 	ð 	×ÑÐ 0Ô1ð 	×!Ñ!Ô#Ø34ˆ
Ô0ð 	�‰Ôð 	×Ñ Ô)ð 	×Ñ˜Ÿ™Ó*Ô+ð 	�‰˜	×.Ñ.Õ/r&   N)ri   rj   rk   rl   r  r  r%  r&  r$  r.  r9  rA  rE  rM  rP  rT  rY  r]  ra  ri  rw  r|  r*   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                   ó,   — e Zd Zg d¢Zd„ Zd„ Zd„ Zd„ Zy)ÚHTTP2TransportCheckingrá   c                 ó    — t        «       }t        «       }t        |_        |j	                  |d«       | j                  |j                  |u «       y)zU
        L{H2Connection} can be registered with the transport as a producer.
        TN)r   r   r   r  rÉ   r  r  )r"   r6  r?  s      r#   Ú"test_registerProducerWithTransportz9HTTP2TransportChecking.test_registerProducerWithTransportT	  s?   € ô ÓˆÜ‹NˆÜ0ˆÔà	×Ñ˜1˜dÔ#Ø�‰˜Ÿ
™
 a˜Õ(r&   c                 ó  ‡ ‡‡	‡
— t        «       }t        «       Š	t        «       Št        ‰_        t        ‰ j                  g |«      }|j                  «       }|dj                  d„ |D «       «      z  }‰j                  ‰	«       ‰	j                  ‰d«       t        |«      D ]  }‰j                  |«       Œ ‰j                  «        ‰j                  d   Š
ˆˆ	ˆ
ˆ fd„}ˆ	ˆ fd„}t        j                   t"        d|«      }|j%                  |«       |S )z|
        L{H2Connection} can be paused by its consumer. When paused it stops
        sending data to the transport.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zNHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.<genexpr>l	  r_  r˜   Tr,   c                  ó|  •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  t        |d   t        j                  j                  «      «       ‰j                  «        ‰j                  «        ‰j                  «        ‰j                  «        ‰j                  «        ‰S )Nr  rŒ   )
rž   r  r  ry   rZ  r   r/   r0   rB   rº   )r·   r‘   r?  r6  rb  r"   s     €€€€r#   ÚvalidateNotSentzTHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.validateNotSentƒ	  s�   ø€ Ü$ Q§W¡W£YÓ/ˆFà×ÑœS ›[¨!Ô,Ø×ÑœZ¨¨r©
´J×4DÑ4D×4NÑ4NÓOÔPØ×ÑÔð ×ÑÔØ×ÑÔØ×ÑÔØ×ÑÔØ"Ð"r&   c                  ó®   •— t        ‰j                  «       «      }‰j                  t        |«      d«       ‰j	                  d|d   j
                  v «       y rT  rU  rh  s     €€r#   r¨  zUHTTP2TransportChecking.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  r+   r™   rü   rÉ   r   rý   r´   r  r   r¿  r   r  )r"   r;   r‘   r   r  r„  r¨  rÀ  r?  r6  rb  s   `       @@@r#   Ú$test_pausingProducerPreventsDataSendz;HTTP2TransportChecking.test_pausingProducerPreventsDataSend_	  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                 óŒ  — t        «       }t        «       }t        «       }t        |_        t        | j                  g |«      }|j                  «       }|dj                  d„ |D «       «      z  }|j                  |«       |j                  |d«       t        |«      D ]  }|j                  |«       Œ |j                  «        t        |j                  «       «      }| j!                  t#        |«      d«       | j%                  t'        |d   t(        j*                  j,                  «      «       | j%                  |j.                  «       y)zo
        L{H2Connection} can be stopped by its producer. That causes it to lose
        its transport.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   z<HTTP2TransportChecking.test_stopProducing.<locals>.<genexpr>ª	  r_  r˜   Tr  rŒ   N)r   r   r   r   r  r’   r  r+   r™   rü   rÉ   r   rý   rÅ   rž   r  r  ry   rZ  r   r/   r0   rB   rr  )r"   r;   r6  r?  r‘   r   r  s          r#   Útest_stopProducingz)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  ‡ ‡	‡
‡— t        ddd«      Š	t        ddd«      Š
t        «       }t        ‰	‰
¬«      }t        «       }t        |_        |j                  |«       t        ‰ j                  g |«      }|j                  «       }|dj                  d„ |D «       «      z  }t        |«      D ]  }|j                  |«       Œ |j                  d	   Š‰ j                  ‰j                  «       ‰	«       ‰ j                  ‰j!                  «       ‰
«       |j"                  d	   }ˆ	ˆ
ˆ ˆfd
„}|j%                  |«      S )z{
        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   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r1  s     r#   r‹   zEHTTP2TransportChecking.test_passthroughHostAndPeer.<locals>.<genexpr>Ì	  r2  r˜   r,   c                  ó†   •— ‰j                  ‰j                  «       ‰«       ‰j                  ‰j                  «       ‰«       y r   )r  ÚgetHostÚgetPeer)r·   rŒ  r�  r"   r{  s    €€€€r#   r  zDHTTP2TransportChecking.test_passthroughHostAndPeer.<locals>.validateÙ	  s1   ø€ Ø×Ñ˜VŸ^™^Ó-¨{Ô;Ø×Ñ˜VŸ^™^Ó-¨{Õ;r&   )r	   r   r   r   r   r  rü   r’   r  r+   r™   r   rý   rW  r  r�  r‘  r  r  )r"   rŠ   rÿ   rÛ   r‘   r   r  rb  r  rŒ  r�  r{  s   `        @@@r#   Útest_passthroughHostAndPeerz2HTTP2TransportChecking.test_passthroughHostAndPeer¼	  s  û€ ô
 " %¨°sÓ;ˆÜ! %¨¸Ó>ˆä#“~ˆÜ#°ÈÔUˆ	Ü!“^ˆ
Ü$9ˆ
Ô!Ø×!Ñ! )Ô,ä# D×$:Ñ$:¸BÀÓMˆØ#×;Ñ;Ó=ˆØ˜Ÿ™Ñ GÀÔ GÓGÑGˆä˜lÓ+ò 	*ˆDØ×#Ñ# DÕ)ð	*ð ×#Ñ# AÑ&ˆØ×Ñ˜Ÿ™Ó)¨;Ô7Ø×Ñ˜Ÿ™Ó)¨;Ô7ð %×<Ñ<¸QÑ?ˆ÷	<ð ×*Ñ*¨8Ó4Ð4r&   N)ri   rj   rk   r  r€  r†  r‰  r’  r*   r&   r#   r~  r~  I	  s   „ òÐò	)ò<ò|,ó>!5r&   r~  c                   ó   — e Zd ZdZd„ Zy)ÚHTTP2SchedulingTestszÀ
    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                 óÖ  — t        j                  «       }t        |«      } |j                  «       }| j	                  t        |«      d«       |d   }| j                  |j                  «       «       | j	                  |j                  d«       | j	                  |j                  |j                  «       | j	                  |j                  d«       | j	                  |j                  i «       y)z}
        When a H2Connection is established it schedules one call to be run as
        soon as the reactor has time.
        r,   r   r*   N)r   ÚClockr   ÚgetDelayedCallsr  ry   r  ÚactiveÚtimeÚfuncÚ_sendPrioritisedDatar·   Úkw)r"   r   r?  ÚcallsÚcalls        r#   Ú"test_initiallySchedulesOneDataCallz7HTTP2SchedulingTests.test_initiallySchedulesOneDataCallç	  s°   € ô
 —*‘*“,ˆÜ˜Ó!ˆà'�×'Ñ'Ó)ˆØ×Ñœ˜U› QÔ'Ø�Q‰xˆð 	�‰˜Ÿ™›Ô&Ø×Ñ˜Ÿ™ AÔ&Ø×Ñ˜Ÿ™ A×$:Ñ$:Ô;Ø×Ñ˜Ÿ™ BÔ'Ø×Ñ˜Ÿ™ "Õ%r&   N)ri   rj   rk   rl   rŸ  r*   r&   r#   r”  r”  à	  s   „ ñó&r&   r”  c                   ó~   — e Zd ZdZg d¢Z e«       Zd„ Zd„ Zd„ Z	efd„Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚHTTP2TimeoutTestsz@
    The L{H2Connection} object times out idle connections.
    rá   c                 ó&   — |j                   |_         y)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_clockz*HTTP2TimeoutTests.patch_TimeoutMixin_clock
  s   € ð  '×0Ñ0ˆ
Õr&   c                 ó  — t        j                  «       }t        |«      }d|_        | j	                  ||«       t        «       }t        |«      |_        |j                  |«       t        |«      D ]  }|j                  |«       Œ |||fS )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.
        r  )r   r–  r   ÚtimeOutr£  r   r   r  rü   r   rý   )r"   ÚinitialDatar  r   r\  rÿ   r  s          r#   ÚinitiateH2Connectionz&HTTP2TimeoutTests.initiateH2Connection
  s†   € ô —*‘*“,ˆÜ˜GÓ$ˆØˆŒØ×%Ñ% d¨GÔ4ä#Ó%ˆ	Ü6°~ÓFˆÔØ×Ñ˜IÔ&ô ˜kÓ*ò 	$ˆDØ×Ñ˜dÕ#ð	$ð ˜˜yÐ)Ð)r&   c                 ó8  — t        |«      }| j                  t        |«      |«       | j                  t	        |d   t
        j                  j                  «      «       | j                  |d   j                  |«       | j                  |d   j                  |«       y)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ž   r  ry   r  r   r/   r0   rP   rQ   rR   )r"   r3   Ú
frameCountrU   rT   r‘   s         r#   ÚassertTimedOutz HTTP2TimeoutTests.assertTimedOut9
  sy   € ô ! Ó&ˆà×Ñœ˜V› jÔ1Ø�‰œ
 6¨"¡:¬z×/?Ñ/?×/KÑ/KÓLÔMØ×Ñ˜ ™×.Ñ.°	Ô:Ø×Ñ˜ ™×2Ñ2°LÕAr&   c                 óÚ  — || j                   u rt        j                  }t        «       }|j	                  «       }| j                  |t        ¬«      \  }}}||_         |j                  d«       | j                  |j                  «       dt        j                  j                  j                  d¬«       | j                  |j                  «       | j!                  |j"                  «       |||fS )aµ  
        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  r  r  r   ©r©  rU   rT   )Ú_DEFAULTr   ÚabortTimeoutr   r+   r§  r   Úadvancerª  r  r¼  ro  rp  ÚNO_ERRORr  rP  rZ  r  )r"   r¯  rŠ   r¦  r   r\  rÿ   s          r#   ÚprepareAbortTestz"HTTP2TimeoutTests.prepareAbortTestF
  s×   € ð ˜4Ÿ=™=Ñ(Ü'×4Ñ4ˆLä#“~ˆØ"×:Ñ:Ó<ˆà#'×#<Ñ#<ØÜ+ð $=ó $
Ñ ˆ��yð )ˆÔð 	ˆ�‰˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×3Ñ3Øð	 	ô 	
ð 	�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Ô0à˜˜iÐ'Ð'r&   c                 ó  — t        «       }|j                  «       }| j                  |t        ¬«      \  }}}|j	                  «       } |j
                  d«       | j                  ||j	                  «       «       | j                  |j                  «        |j
                  d«       | j                  |j	                  «       dt        j                  j                  j                  d¬«       | j                  |j                  «       y)z‘
        When a L{H2Connection} does not receive any data for more than the
        time out interval, it closes the connection cleanly.
        r¬  r  r  r   r­  N)r   r+   r§  r   r  r°  r  rZ  rP  rª  r¼  ro  rp  r±  r  )r"   rŠ   r¦  r   r\  rÿ   Úpreambles          r#   Útest_timeoutAfterInactivityz-HTTP2TimeoutTests.test_timeoutAfterInactivityl
  sà   € ô
 $“~ˆØ"×:Ñ:Ó<ˆà#'×#<Ñ#<ØÜ+ð $=ó $
Ñ ˆ��yð —?‘?Ó$ˆð 	ˆ�‰˜Ôð 	×Ñ˜ 9§?¡?Ó#4Ô5Ø×Ñ˜×0Ñ0Ô1ð 	ˆ�‰˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×3Ñ3Øð	 	ô 	
ð 	�‰˜	×/Ñ/Õ0r&   c                 óî  — t        «       }d}| j                  |t        ¬«      \  }}}t        |j	                  «       «      D ]@  }|j                  |«        |j                  d«       | j                  |j                  «       ŒB  |j                  d«       | j                  |j                  «       dt        j                  j                  j                  d¬«       | j                  |j                  «       y)zM
        When a L{H2Connection} receives data, the timeout is reset.
        r&   r¬  r  r  r   r­  N)r   r§  r   r   r+   rý   r°  rZ  rP  rª  r  r¼  ro  rp  r±  r  )r"   rŠ   r¦  r   r\  rÿ   r  s          r#   Útest_timeoutResetByRequestDataz0HTTP2TimeoutTests.test_timeoutResetByRequestDataŽ
  sß   € ô
 $“~ˆØˆà#'×#<Ñ#<ØÜ+ð $=ó $
Ñ ˆ��yô ˜l×BÑBÓDÓEò 	6ˆDØ×Ñ˜dÔ#ð ˆG�O‰O˜BÔð ×Ñ˜Y×4Ñ4Õ5ð	6ð 	ˆ�‰˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×3Ñ3Øð	 	ô 	
ð 	�‰˜	×/Ñ/Õ0r&   c                 óÆ  ‡	— t        «       }d}g Š	t        | j                  g |«      }|j                  «       }|dj	                  d„ |D «       «      z  }ˆ	fd„}| j                  ||¬«      \  }}}|j                  |j                  «       «        |j                  d«       | j                  t        ‰	«      d«       t        d«      D ]C  }‰	d   j                  d	«        |j                  d«       | j                  |j                  «       ŒE  |j                  d
«       | j                  |j                  «       dt         j"                  j$                  j&                  d¬«       y)zJ
        When a L{H2Connection} sends data, the timeout is reset.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zDHTTP2TimeoutTests.test_timeoutResetByResponseData.<locals>.<genexpr>»
  ó   è ø€ Ò>°! §¡§Ñ>ùr˜   c                 óD   •— t        | |¬«      }‰j                  |«       |S )N)Úqueued)r   rŽ   )r{  r¼  rÓ   Úrequestss      €r#   ÚsaveRequestzFHTTP2TimeoutTests.test_timeoutResetByResponseData.<locals>.saveRequest½
  s    ø€ Ü$ V°FÔ;ˆCØ�O‰O˜CÔ ØˆJr&   r¬  r  r,   é
   r   s
   some bytesr  é   r­  N)r   r’   r  r+   r™   r§  rý   r°  ÚassertEqualsry   r¨   r©   rZ  rP  rª  r  r¼  ro  rp  ÚPROTOCOL_ERROR)
r"   rŠ   r¦  r‘   r¾  r   r\  rÿ   r+  r½  s
            @r#   Útest_timeoutResetByResponseDataz1HTTP2TimeoutTests.test_timeoutResetByResponseData°
  sD  ø€ ô
 $“~ˆØˆØˆä# D×$:Ñ$:¸BÀÓMˆØ"×:Ñ:Ó<ˆØ�s—x‘xÑ>°vÔ>Ó>Ñ>ˆô	ð
 $(×#<Ñ#<ØØ&ð $=ó $
Ñ ˆ��yð
 	×Ñ˜,×>Ñ>Ó@ÔAð 	ˆ�‰˜ÔØ×Ñœ#˜h›-¨Ô+ä�r“ò 	6ˆAà�Q‰K×Ñ˜mÔ,ØˆG�O‰O˜BÔØ×Ñ˜Y×4Ñ4Õ5ð		6ð 	ˆ�‰˜ÔØ×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×9Ñ9Øð	 	õ 	
r&   c                 ó¶  — t        «       }t        | j                  g |«      }|j                  «       }|dj	                  d„ |D «       «      z  }| j                  |t        ¬«      \  }}} |j                  d«       | j                  |j                  «       dt        j                  j                  j                  d¬«       | j                  |j                  «       y)	z’
        When a L{H2Connection} times out with active streams, the error code
        returned is L{h2.errors.ErrorCodes.PROTOCOL_ERROR}.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zOHTTP2TimeoutTests.test_timeoutWithProtocolErrorIfStreamsOpen.<locals>.<genexpr>ä
  rº  r˜   r¬  r  r  r,   r­  N)r   r’   r  r+   r™   r§  rÇ   r°  rª  r  r¼  ro  rp  rÂ  r  rP  )r"   rŠ   r‘   r¦  r   r\  rÿ   s          r#   Ú*test_timeoutWithProtocolErrorIfStreamsOpenz<HTTP2TimeoutTests.test_timeoutWithProtocolErrorIfStreamsOpenÜ
  sÂ   € ô
 $“~ˆÜ# D×$:Ñ$:¸BÀÓMˆØ"×:Ñ:Ó<ˆØ�s—x‘xÑ>°vÔ>Ó>Ñ>ˆà#'×#<Ñ#<ØÜ/ð $=ó $
Ñ ˆ��yð 	ˆ�‰˜Ôà×ÑØ�O‰OÓØÜ—i‘i×*Ñ*×9Ñ9Øð	 	ô 	
ð 	�‰˜	×/Ñ/Õ0r&   c                 ó
  — t        «       }t        | j                  g |«      }|j                  «       }|dj	                  d„ |D «       «      z  }| j                  |t        ¬«      \  }}}|j                  «       }t         |j                  «       «      }|j                  d«       t         |j                  «       «      }	| j                  |dz
  |	«        |j                  d«       | j                  |j                  «       |«       y)zU
        When a L{H2Connection} loses its connection it cancels its timeout.
        r&   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   r•   r—   s     r#   r‹   zCHTTP2TimeoutTests.test_noTimeoutIfConnectionLost.<locals>.<genexpr>ý
  rº  r˜   r¬  rë  r,   r  N)r   r’   r  r+   r™   r§  rÇ   r  ry   r—  ÚconnectionLostr  r°  )
r"   rŠ   r‘   r¦  r   r\  rÿ   ÚsentDataÚoldCallCountÚcurrentCallCounts
             r#   Útest_noTimeoutIfConnectionLostz0HTTP2TimeoutTests.test_noTimeoutIfConnectionLostö
  sò   € ô $“~ˆÜ# D×$:Ñ$:¸BÀÓMˆØ"×:Ñ:Ó<ˆØ�s—x‘xÑ>°vÔ>Ó>Ñ>ˆà#'×#<Ñ#<ØÜ/ð $=ó $
Ñ ˆ��yð
 —?‘?Ó$ˆÜÐ2˜7×2Ñ2Ó4Ó5ˆð 	×Ñ˜HÔ%ô Ð6˜w×6Ñ6Ó8Ó9ÐØ×Ñ˜¨Ñ)Ð+;Ô<ð 	ˆ�‰˜ÔØ×Ñ˜Ÿ™Ó*¨HÕ5r&   c                 óL  — | j                  «       \  }}} |j                  d«       | j                  |j                  «       | j	                  |j
                  «        |j                  d«       | j                  |j                  «       | j                  |j
                  «       y)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.
        é   r,   N©r²  r°  r  rP  rZ  r  ©r"   r   r\  rÿ   s       r#   Ú,test_timeoutEventuallyForcesConnectionClosedz>HTTP2TimeoutTests.test_timeoutEventuallyForcesConnectionClosed  s�   € ð
 $(×#8Ñ#8Ó#:Ñ ˆ��yð 	ˆ�‰˜ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Ô0Øˆ�‰˜ÔØ�‰˜	×/Ñ/Ô0Ø�‰˜	×.Ñ.Õ/r&   c                 ó  — | j                  «       \  }}} |j                  d«       |j                  d«        |j                  d«       | j                  |j                  «       | j                  |j                  «       y)zœ
        When a L{H2Connection} has timed the connection out, getting
        C{connectionLost} called on it cancels the forcible connection close.
        rÏ  Nr,   )r²  r°  rÉ  r  rP  rZ  r  rÑ  s       r#   Ú$test_losingConnectionCancelsTheAbortz6HTTP2TimeoutTests.test_losingConnectionCancelsTheAbort!  sm   € ð
 $(×#8Ñ#8Ó#:Ñ ˆ��yð 	ˆ�‰˜ÔØ×Ñ˜DÔ!ð 	ˆ�‰˜ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Õ0r&   c                 óÀ   — | j                  d¬«      \  }}} |j                  d«       | j                  |j                  «       | j	                  |j
                  «       y)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)r¯  l        rÐ  rÑ  s       r#   Ú'test_losingConnectionWithNoAbortTimeOutz9HTTP2TimeoutTests.test_losingConnectionWithNoAbortTimeOut1  sT   € ð
 $(×#8Ñ#8ÀdÐ#8Ó#KÑ ˆ��yð 	ˆ�‰˜ÔØ�‰˜	×/Ñ/Ô0Ø×Ñ˜×/Ñ/Õ0r&   c                 óú   — | j                  «       \  }}} |j                  d«       | j                  |j                  «       | j                  |j                  «       |j                  t        j                  «       y)z}
        If a timed out transport doesn't close after 15 seconds, the
        L{HTTPChannel} will forcibly close it.
        é   N)r²  r°  r  rP  r  rÉ  r   ÚConnectionDonerÑ  s       r#   Ú"test_connectionLostAfterForceClosez4HTTP2TimeoutTests.test_connectionLostAfterForceClose>  sc   € ð
 $(×#8Ñ#8Ó#:Ñ ˆ��yð 	ˆ�‰˜ÔØ�‰˜	×/Ñ/Ô0Ø�‰˜	×.Ñ.Ô/ð
 	×ÑœE×0Ñ0Õ1r&   c                 óì  — t        «       }t        |«      }|j                  |_        d|_        t	        «       }t        «       }|j                  «       }|j                  |«       |j                  |«       t        |j                  |j                  z   «      D ]A  }|j                  |j                  d«      j                  «       «       |j                  d«       ŒC | j                  |j                  «       y)zR
        A client that sends only invalid frames is eventually timed out.
        é<   r,   N)r
   r   r©  r¥  r   r   r+   rü   rý   r¨   r¯  rZ   r–   r°  r  r  )r"   r  rÛ   rŠ   rÿ   r+   r­   s          r#   Ú,test_timeOutClientThatSendsOnlyInvalidFramesz>HTTP2TimeoutTests.test_timeOutClientThatSendsOnlyInvalidFramesO  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Ø×!Ñ! !Õ$ð	%ð 	�‰˜	×.Ñ.Õ/r&   N)ri   rj   rk   rl   r  rÓ  r®  r£  r§  rª  r²  rµ  r·  rÃ  rÆ  rÍ  rÒ  rÔ  rÖ  rÚ  rÝ  r*   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¡  rh   )Drl   r8  Úzope.interfacer   r   Útwisted.internetr   r   r   r   Útwisted.internet.addressr	   Útwisted.internet.testingr
   r   Útwisted.pythonr   Útwisted.python.compatr   Útwisted.test.test_internetr   Útwisted.trialr   Útwisted.webr   Útwisted.web.test.test_httpr   r   r   r   r   r   r   rÝ   r¼  Ú	h2.errorsÚh2.exceptionsr/   rÙ   Úhpack.hpackr   r   Útwisted.web._http2r   ÚImportErrorr   rn   r’   rš   rž   r²   r    rK  r°   rV  rÃ   ra  rÇ   rk  rË   ÚNotifyingRequestFactoryProxyrÖ   ÚTestCaserà   r$  r~  r”  r¡  r*   r&   r#   ú<module>rï     s±  ðñó
 ç 7ç 8Ó 8Ý 0ß HÝ "Ý +Ý 4Ý "Ý ÷÷ ñ ð 
€ð*ó ÛÛÛÛß,å/÷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øðaN ò *Ø)ƒFð*ús   Á"F ÆFÆF