Current File : //proc/self/root/lib/python3/dist-packages/twisted/web/test/__pycache__/test_http2.cpython-312.pyc
�

Ϫ�f����@�dZddlZddlmZmZddlmZmZmZm	Z	ddl
mZddlm
Z
mZddlmZddlmZdd	lmZdd
lmZddlmZddlmZmZmZmZmZmZm Z dZ!	ddl"Z"ddl#Z"ddl$Z"ddl%Z%ddl&Z&dd
l'm(Z(m)Z)ddl*m+Z+Gd�d�Z-Gd�d�Z.d-d�Z/d-d�Z0d�Z1Gd�dejd�Z3e e3�Z4Gd�dejd�Z5e e5�Z6Gd�de5�Z7e e7�Z8Gd�dejd�Z9e e9�Z:Gd�d �Z;e e;�Z<Gd!�d"�Z=Gd#�d$ej|e=�Z?Gd%�d&ej|e=�Z@Gd'�d(ej|e=�ZAGd)�d*ej|e=�ZBGd+�d,ej|e=�ZCy#e,$rdZ!Y��wxYw).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)�H2ConnectionzHTTP/2 support not enabledc�f�eZdZdZd�Zd�Zd�Zgdfd�Zdd�Zdd	�Z	d
�Z
dd�Zdd�Zdd
�Z
gfd�Zy)�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__zFrameFactory.__init__8����y���c�"�t�|_yrrr!s r#�refreshEncoderzFrameFactory.refreshEncoder;r%r&c��y)NsPRI * HTTP/2.0

SM

�r!s r#�clientConnectionPrefacez$FrameFactory.clientConnectionPreface>s��2r&�c�H�tjj|�}|jj	|�|_|jjd�|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#�buildHeadersFramezFrameFactory.buildHeadersFrameAs���
���)�)�(�3�����$�$�W�-���	�����M�"��	�D�
�G�G�K�K���	�#�(�(�*�	�D�A�q��A�q�!��	��r&Nc��|�t|�n	t�}tjj|�}||_||_|S)zD
        Builds a single data frame out of a chunk of data.
        )�setr/r0�	DataFramer3r4)r"r3r4r9r;s     r#�buildDataFramezFrameFactory.buildDataFramePs?��$�/��E�
�S�U�����&�&�x�0���������r&c��tjjd�}|r|jj	d�||_|S)z1
        Builds a single settings frame.
        r�ACK)r/r0�
SettingsFramer4r5�settings)r"rG�ackr;s    r#�buildSettingsFramezFrameFactory.buildSettingsFrameZs9��
���*�*�1�-���
�G�G�K�K�����
��r&c�R�tjj|�}||_|S)z5
        Builds a single WindowUpdate frame.
        )r/r0�WindowUpdateFrame�window_increment)r"r9�	incrementr;s    r#�buildWindowUpdateFramez#FrameFactory.buildWindowUpdateFramees'��
���.�.�x�8��&����r&c�n�tjjd�}||_||_||_|S)z/
        Builds a single GOAWAY frame.
        r)r/r0�GoAwayFrame�
error_code�last_stream_id�additional_data)r"�lastStreamID�	errorCode�additionalDatar;s     r#�buildGoAwayFramezFrameFactory.buildGoAwayFramems6��
���(�(��+�� ���'���*����r&c�R�tjj|�}||_|S)z3
        Builds a single RST_STREAM frame.
        )r/r0�RstStreamFramerQ)r"r9rUr;s    r#�buildRstStreamFramez FrameFactory.buildRstStreamFramews&��
���+�+�H�5�� ����r&c�n�tjj|�}||_||_||_|S)z1
        Builds a single priority frame.
        )r/r0�
PriorityFrame�
depends_on�
stream_weight�	exclusive)r"r9�weight�	dependsOnr_r;s      r#�buildPriorityFramezFrameFactory.buildPriorityFrames4��
���*�*�8�4�� ��� �������r&c���tjj|�}||_|jj|�|_t|�|_|jjd�|S)z5
        Builds a single Push Promise frame.
        r.)
r/r0�PushPromiseFrame�promised_stream_idr r2r3rAr4r5)r"r9�promisedStreamIDr8r4r;s      r#�buildPushPromiseFramez"FrameFactory.buildPushPromiseFrame�sX��
���-�-�h�7��/������$�$�W�-����e�*���	�����M�"��r&�Nr,)F)rr&)r)rF)�__name__�
__module__�__qualname__�__doc__r$r(r+r?rCrIrNrWrZrbrgr*r&r#rr1sL���!�!�3�02�A�
��	�����PR�	r&rc�,�eZdZdZd�Zd�Zd�Zd�ZeZy)�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$zFrameBuffer.__init__�s���y�����
r&c�.�|xj|z
c_yr)rq)r"r3s  r#�receiveDatazFrameBuffer.receiveData�s���
�
�d��
r&c��|Srr*r!s r#�__iter__zFrameBuffer.__iter__�s���r&c�(�t|j�dkr
t��tjj
j
|jdd�\}}t|j�|dzkr
t��|jt|jdd|z��|jd|zd|_t|tjj�r,|jj|jd��|_
|S)N�	T)�raw)�lenrq�
StopIterationr/r0�Frame�parse_frame_header�
parse_body�
memoryview�
isinstancer1rp�decoder3)r"r0�lengths   r#�nextzFrameBuffer.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)	rirjrkrlr$rsrur��__next__r*r&r#rnrn�s"��
����� �Hr&rnc�������
t��g}|j�j|����|j��fd�|D��|djjd�|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}
    �r8r9c3�D�K�|]}�j|������y�w)�r9N)rC)�.0�chunk�frameFactoryr9s  ��r#�	<genexpr>z%buildRequestFrames.<locals>.<genexpr>�s&������BG��#�#�E�H�#�=��s� ����
END_STREAM)r�appendr?�extendr4r5�r8r3r�r9�framess  `` r#�buildRequestFramesr��sk���*��#�~��
�F�
�M�M�,�0�0��8�0�T�U�
�M�M��KO����2�J������&��Mr&c�N�t||||�}djd�|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&c3�<K�|]}|j����y�wr��	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.
    )rnrs�list)r3�buffers  r#�framesFromBytesr��s#���]�F�
���t����<�r&c��eZdZdZdZd�Zy)�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|jjd�d�}|jd�t	|�D]}|j|j��|j�y)N�/r���)�int�uri�split�setResponseCode�range�write�	chunkData�finish)r"�chunks�_s   r#�processzChunkedHTTPHandler.processsZ���T�X�X�^�^�D�)�"�-�.�����S�!��v��	'�A��J�J�t�~�~�&�	'�	
���
r&N)rirjrkrlr�r�r*r&r#r�r�s��� �I�r&r�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�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��tjj|g|��i|��|jj	�d|_d|_y)NF)r�Requestr$�channel�pauseProducing�_requestReceivedrq�r"�args�kwargss   r#r$zConsumerDummyHandler.__init__*s?�������d�4�T�4�V�4�	
���#�#�%� %�����
r&c�8�|jj�y)z&
        Start the data pipe.
        N)r��resumeProducingr!s r#�
acceptDatazConsumerDummyHandler.acceptData2s��	
���$�$�&r&c�V�d|_tjj|g|��i|��S)NT)r�rr��requestReceivedr�s   r#r�z$ConsumerDummyHandler.requestReceived8s)�� $����|�|�+�+�D�B�4�B�6�B�Br&c��|jd�|jj�|_d}|j	|�|j�y)Nr�s0this is a response from a consumer dummy handler)r��content�readrqr�r�)r"�
returnDatas  r#r�zConsumerDummyHandler.process<s>�����S�!��\�\�&�&�(��
�H�
��
�
�:�����
r&N)rirjrkrlr$r�r�r�r*r&r#r�r�"s����'�C�r&r�c��eZdZdZd�Zy)�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�|jj�|jj�y)z@
        Start and then immediately stop the data pipe.
        N)r�r��
stopProducingr!s r#r�z'AbortingConsumerDummyHandler.acceptDataOs$��	
���$�$�&����"�"�$r&N)rirjrkrlr�r*r&r#r�r�Gs���%r&r�c��eZdZdZd�Zy)�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�|jd�|jt�d�y)Nr�T)r��registerProducerrr!s r#r�zDummyProducerHandler.processcs"�����S�!����m�o�t�4r&N)rirjrkrlr�r*r&r#r�r�\s���5r&r�c��eZdZdZd�Zd�Zy)�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||��yr)�results�_wrappedFactoryrr)r"�wrappedFactory�	interfaces   r#r$z NotifyingRequestFactory.__init__ss7�����-���
$�D�$8�$8�9�	.�I��T�9�-�	.r&c��|j|i|��}|jj|j��t	|�Sr)r�r�r��notifyFinishr)r"r�r��reqs    r#�__call__z NotifyingRequestFactory.__call__}s?��"�d�"�"�D�3�F�3�������C�,�,�.�/�=�c�B�Br&N)rirjrkrlr$r�r*r&r#r�r�ks���.�Cr&r�c��eZdZdZereZd�Zy)�HTTP2TestHelpersz]
    A superclass that contains no tests but provides test helpers for HTTP/2
    tests.
    c�b�|jtjt|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)rirjrkrl�skipH2�skipr�r*r&r#r�r��s���
���Mr&r�c��eZdZgd�Zgd�Zgd�Zgd�ZdZgd�ZdZ	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�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:schemeshttps�s
user-agentstwisted-test-code)�
custom-header�1)r��2�)r��POSTr�)r��/post_endpointr�r�)�content-lengths25�shello sworld, sit's shttp/2!)��:statuss200)�requestr�)�commandr��sversionsHTTP/2)r�s13�
'''
None
'''
)r��r�r��r�r�r�)r�s36�$'''
25
hello world, it's http/2!'''
c���t�}t�}|j�}|t|||�z
}|j	|�t|�D]}|j
|��||fS)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}
        )rrr+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|�jg�\}���fd�}|j
dj
|�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��}�jt|�d��j	td�|ddD����j	t
|dtjj���j	t
|dtjj���j	t
|dtjj���jt|dj�t�j���j|dj�j��j|djd��j	d|djv�y)N�c3�:K�|]}|jdk(���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�allrr/r0r1rB�dictr3�getResponseHeaders�getResponseDatar4�r9r�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,)rr�requestFactoryr�getRequestHeaders�_streamCleanupCallbacks�addCallback�r"r�r�rr�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
�\}���fd�}|jdj|�S)zV
        Send a POST request and confirm that the data is safely transferred.
        c�@��t�j��}�jt|�d��j	td�|ddD����j	t
|dtjj���j	t
|dtjj���j	t
|dtjj���jt|dj�t�j���j|dj�j��j|djd��j	d|djv�y)Nrc3�:K�|]}|jdk(���y�wrrr�s  r#r�zFHTTP2ServerTests.test_postRequest.<locals>.validate.<locals>.<genexpr>	�����F�Q����q� 0�F�r������r�r&r�)r�rrryrrrr/r0r1rBrr3�postResponseHeaders�postResponseDatar4rs  ��r#rz3HTTP2ServerTests.test_postRequest.<locals>.validates)���$�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,)rrrr�postRequestHeaders�postRequestDatarrrs`   @r#�test_postRequestz!HTTP2ServerTests.test_postRequest�s^���"�^�
�$9�
�!��-�-���/�/��1E�1E�
���9�	>� �1�1�!�4�@�@��J�Jr&c�$����	�gd��d��jD��cgc]\}}|dk7s�||f��}}}t�}t|_�j	||�j
�\}�	����	fd�}|jdj|�Scc}}w)zm
        Send a POST request without length and confirm that the data is safely
        transferred.
        )r�r�r�r�)r�s38s&'''
None
hello world, it's http/2!'''
r�c���t�j��}�jt|�d��j	td�|ddD����j	t
|dtjj���j	t
|dtjj���j	t
|dtjj���jt|dj�t����j|dj���j|djd��j	d|djv�y)Nrc3�:K�|]}|jdk(���y�wrrr�s  r#r�zNHTTP2ServerTests.test_postRequestNoLength.<locals>.validate.<locals>.<genexpr>4r rr!r"r�r&r�)r�rrryrrrr/r0r1rBrr3r4)r9r�r$r#r"r�s  ����r#rz;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%rrrrr&rr)
r"�x�yr%r�r�rr$r#r�s
`      @@@r#�test_postRequestNoLengthz)HTTP2ServerTests.test_postRequestNoLengths����

��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|_tt
d|dzd���
�
D�cgc]$}t�j�j||���&}}|j�}tjjt|��}|djd�|D��z
}|j!�	�t#|�D]}|j%|���	��
fd�}t'j(t|j*j-���j/|�Scc}w)zi
        Many interleaved POST requests all get received and responded to
        appropriately.
        �(r,rr&c3�<K�|]}|j����y�wrr��r�r0s  r#r�z<HTTP2ServerTests.test_interleavedRequests.<locals>.<genexpr>\����� G�u����!2� G�r�c���t�j��}�jt|�d��D�]}|D�cgc]7}|j|k(r&t|tjj�s|��9}}�jt|�d��jt|dj�t�j���j|dj�j��j|djd��jd|djv���ycc}w)N�yr
rr,rr&r�)r�rrryr	rr/r0rKrr3r#r$rr4)r�r�r9r;�streamFrames�br"�	streamIDss     ���r#rz;HTTP2ServerTests.test_interleavedRequests.<locals>.validatebs���$�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)rrrrrr�r�r�r%r&r+�	itertools�chain�
from_iterable�zipr�r�r
r�r�DeferredListr�valuesr)r"�
REQUEST_COUNTr;�ar9r�rrrr6r7s`        @@r#�test_interleavedRequestsz)HTTP2ServerTests.test_interleavedRequestsAs1����
��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�)Ec	�T��
�t�}t��
t�}t|_�j
}d|d<dD�cgc]}t
|g||���}}|ddjjd�d|dd_	|ddjjd�d|dd_	|jd	d
dd��}|djd|�tjj|�}|j�}|d
j!d�|D��z
}|j#�
�t%|�D]}|j'|���
�fd�}	t)j*t-|j.j1���j3|	�Scc}w)zR
        Data in responses is interleaved according to HTTP/2 priorities.
        )z:pathz
/chunked/4r)r,r
�r�PRIORITY�@r,� rB�T)r9r`rar_r&c3�<K�|]}|j����y�wrr�r1s  r#r�z@HTTP2ServerTests.test_sendAccordingToPriority.<locals>.<genexpr>�r2r�c� ��t�j��}�jt|�d�|D�cgc]3}t	|t
jj�s�(|j��5}}gd�}�j||�ycc}w)N�)r,r
r,r,r
r,r,r
rBr
rBr
rBrBrB)	r�rrryrr/r0rBr	)r�r�r;r7�
expectedOrderr6r"s     ��r#rz?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)rrr�ChunkedHTTPHandlerProxyrrr�r4r5r^rb�insertr8r9r:r+r�r�r
r�rr<r�rr=r)r"r;r?rr9r��
priorityFramerrrr6s`         @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
|jg|�z
}||jdd|jdg��j�z
}|j|�t|�D]!}|j|�|js�!nt|j��}|j!t#|�d�|j%t'|dt(j*j,��|j%|j�y)zR
        A protocol error from the remote peer terminates the connection.
        r,rr.)r9rfr8r4r
r�N)rrrrrr+r�rrgr�r�r
r��
disconnectingr�rrryrrr/r0rP)r"r;r6r?rrr�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djj}�j|j�t�j��}�jt|�d�|j��j!|j��j!|j"d�t�j��}�jt|�d���fd�}|j$dj'|�S)z�
        The H2Stream data implements IPushProducer, and can have its data
        production controlled by the Request if the Request chooses to.
        r,shello world, it's http/2!rc���t�j��}�jt|�d��j	d|dj
v�y�Nrr�r��r�rrryrr4rs  ��r#rz;HTTP2ServerTests.test_streamProducingData.<locals>.validatesE���$�Y�_�_�%6�7�F�
���S��[�!�,��O�O�L�F�2�J�,<�,<�<�=r&)r�ConsumerDummyHandlerProxyrrr%r&�streams�_request�original�assertFalser�r�rrryr�rrqrr)r"r�r��requestr�rr�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�}|djd�|D��z
}|j�	�t|�D]}|j|��|jdj j"}�j%|j&�|j(d}|j+��	�fd�}|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&c3�<K�|]}|j����y�wrr�r�s  r#r�zAHTTP2ServerTests.test_abortStreamProducingData.<locals>.<genexpr>,����� ?�1����� ?�r�r,c���t�j��}�jt|�d��j	t|dtjj���j|djd�y)Nrr�r,)
r�rrryrrr/r0rYr	)r9r�r6r"s  ��r#rz@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&)rrr�!AbortingConsumerDummyHandlerProxyrr�r%r&rAr4r+r�r�r
r�rWrXrYrZr�rr�r)
r"r;r?r�rrr[�cleanupCallbackrr6s
`        @r#�test_abortStreamProducingDataz.HTTP2ServerTests.test_abortStreamProducingDatas
���
�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|�jg�\}�|j
djj}|jd�|jd�|jd}|j|jdd��j���j|j��j|jdu�|jd���fd�}|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)rUNsthird chunkc���t�j��}�jt|�d��j|djd��jt
|dtjj��y�Nrr,�
r�rrryr	rrr/r0r1rs  ��r#rz9HTTP2ServerTests.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�DummyProducerHandlerProxyrrrrWrXrYr�rr�rZr�r�
_disconnectedr�r�r"r�r�r[rbrr�s`     @r#�test_terminatedRequestz'HTTP2ServerTests.test_terminatedRequestJs����"�^�
�$=�
�!�"&�"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|�jg�\}�|j
djj}|jd�|jd�|jd}|j|jd��j���j|j��j|jdu��j!|j"���fd�}|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,rerfr�rTNc���t�j��}�jt|�d��j|djd��jt
|dtjj��yrhrirs  ��r#rz<HTTP2ServerTests.test_terminatedConnection.<locals>.validate�rjr&)rrkrrrrWrXrYr�rr�rWr�rrlr�rZ�_stillProducingrrms`     @r#�test_terminatedConnectionz*HTTP2ServerTests.test_terminatedConnections���"�^�
�$=�
�!�"&�"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|_�jdgz}�j	||g�\}���fd�}|j
dj
|�S)zq
        Requests containing Expect: 100-continue cause provisional 100
        responses to be emitted.
        )sexpects100-continuec���t�j��}�jt|�d��j	td�|ddD����j	t
|dtjj���j|djdg��j	d|djv�y)NrBc3�:K�|]}|jdk(���y�wrrr�s  r#r�zQHTTP2ServerTests.test_respondWith100Continue.<locals>.validate.<locals>.<genexpr>�r
rr,)r�s100r�r�)r�rrryrrrr/r0r1r3r4rs  ��r#rz>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,)rrrrrrr)r"r�r8r�rr�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|�jg�\}�|j
d}|jj}|jd}|j��j|j��j|jdu���fd�}|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��}�jt|�d��j	t|dtjj���j|djdg��j	d|djv�y)Nrr,)r�s400r�r�)r�rrryrrr/r0r1r3r4rs  ��r#rz6HTTP2ServerTests.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&)rrkrrrrWrXrYr�!_respondToBadRequestAndDisconnectrrlr�r)r"r�r��streamr[rbrr�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|�jg�\}�|j
d}|jj}gd���D]}|j|��|j����fd�}|jdj|�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��}�jt|�d��j	td�|ddD����j	t
|dtjj���j	d|djv�|D�cgc]3}t
|tjj�s�(|j��5}}�j|�dgz�ycc}w)Nrwc3�:K�|]}|jdk(���y�wrrr�s  r#r�zQHTTP2ServerTests.test_loseH2StreamConnection.<locals>.validate.<locals>.<genexpr>r
rr,r�r�r&�
r�rrryrrrr/r0r1r4rBr3)r9r�r;�receivedDataChunks�
dataChunksr"r�s    ���r#rz>HTTP2ServerTests.test_loseH2StreamConnection.<locals>.validates����$�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)rrkrrrrWrXrYr��loseConnectionrr)	r"r�r�r{r[r�rr�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||jg�|j
d}|jj}|jt|j|d�y)zK
        The L{H2Stream} object forbids registering two producers.
        r,TN)rrkrrrrWrXrYr��
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|�jg�\}�|j
d}|jj��jj}|j�fd����fd�}|jdj|�S)z�
        L{Request} objects that have registered pull producers get blocked and
        unblocked according to HTTP/2 flow control.
        r,c�$���j�Sr)r�)r+r[s �r#�<lambda>z;HTTP2ServerTests.test_handlesPullProducer.<locals>.<lambda>?s���w�~�~�/?�r&c�&��t�j��}�jd|djv�|D�cgc]3}t	|t
jj�s�(|j��5}}�j|gd��ycc}w)Nr�r�)�0r�r��3�4�5�6�7�8�9r&�
r�rrr4rr/r0rBr3r�r9r�r;r�r"r�s    ��r#rz;HTTP2ServerTests.test_handlesPullProducer.<locals>.validateBs����$�Y�_�_�%6�7�F�
�O�O�L�F�2�J�,<�,<�<�=�!'���*�Q�
�8H�8H�8R�8R�*S�����J��
����Q�
����)B�)B)rrrrrrWrXrY�_actualProducer�resultrr)r"r�r�r{�producerCompleterr[r�s`     @@r#�test_handlesPullProducerz)HTTP2ServerTests.test_handlesPullProducer1s����
"�^�
�$A�
�!��-�-�j�$�:P�:P�RT�U���9��#�#�A�&���/�/�*�*��"�2�2�9�9���$�$�%?�@�
	��1�1�!�4�@�@��J�Jr&c�&�t�}t|_|j||jg�|j
djj}|j|j��|j
dj�y)zJ
        L{Request} objects can correctly ask isSecure on HTTP/2.
        r,N)rrrrrrWrXrYrZ�isSecure�abortConnection)r"r�r[s   r#�test_isSecureWorksProperlyz+HTTP2ServerTests.test_isSecureWorksProperlySsu��"�^�
�$;�
�!����z�4�+A�+A�2�F��$�$�Q�'�0�0�9�9������)�)�+�,����1��-�-�/r&c�>���t�}t|_�j|�jg�\}�|j
djj}tjd|j���fd�}|jdj|�S)zL
        L{H2Connection} correctly unblocks when a stream is ended.
        r,�{�G�z�?c���t�j��}�jt|�d��j	d|dj
v�y)Nr
r�r�rU)r�r�r"r�s  ��r#�validateCompletezCHTTP2ServerTests.test_lateCompletionWorks.<locals>.validateCompletelsE���$�Y�_�_�%6�7�F�
���S��[�!�,��O�O�L�F�2�J�,<�,<�<�=r&)
rrrrrrWrXrYr�	callLaterr�rr)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|�jg�\}�|j
d}|jj}|jd�|jgd��|j�|jd}��fd�}|j|�S)zW
        L{H2Stream} objects can send a series of frames via C{writeSequence}.
        r,r�)�Hello�,�world!c�&��t�j��}�jd|djv�|D�cgc]3}t	|t
jj�s�(|j��5}}�j|gd��ycc}w)Nr�r�)r�r�r�r&r�r�s    ��r#rz@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�)
rrrrrrWrXrYr��
writeSequencer�rr)r"r�r�r{r[�completionDeferredrr�s`      @r#�test_writeSequenceForChannelsz.HTTP2ServerTests.test_writeSequenceForChannelsus����"�^�
�$;�
�!��-�-�j�$�:P�:P�RT�U���9��#�#�A�&���/�/�*�*������$����8�9�����'�?�?��B��
	K�"�-�-�h�7�7r&c������	�
��t��
t��t��t�_�
j�}|�
j
tjjjdi�j�z
}|t�jg�
�z
}�j��t|�D]}�j!|���j"d}|j$j&��j)d�gd��	�	�fd�}t+j,t.d|�}|j1��
fd����	�fd�}�j2dj1|�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.
        rBr,�fiver)r�r�r�r�c�V���D]}�j|���j�yr)r�r�)r�r�r[s ��r#�write_chunksz7HTTP2ServerTests.test_delayWrites.<locals>.write_chunks�s(���#�
%���
�
�e�$�
%��N�N�r&r�c�d���j�jdd��j��S)Nr,�2�r9rM)r�rNr�)r�r?r;s ��r#r�z3HTTP2ServerTests.test_delayWrites.<locals>.<lambda>�s,���!�.�.��(�(�!�r�(�B�L�L�N��r&c���t�j��}�jt|�d��j	td�|ddD����j	t
|dtjj���j	d|djv�|D�cgc]3}t
|tjj�s�(|j��5}}�j|dg�zdgz�ycc}w)Nrwc3�:K�|]}|jdk(���y�wrrr�s  r#r�zFHTTP2ServerTests.test_delayWrites.<locals>.validate.<locals>.<genexpr>�r
rrr�r�r�r&r�)r9r�r;r�r6r�r"s    ���r#rz3HTTP2ServerTests.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	)rrrrrr+rI�h2rG�SettingCodes�INITIAL_WINDOW_SIZEr�r�rr�r
r�rWrXrYr�r�
deferLaterrrr)r"rrr{r��drr?r6r�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
|jg|��z
}||jd��j�z
}|j|�|j|�t|j��}|jt|�d�|j!d|j"�y)zu
        A client that immediately resets after sending the body causes Twisted
        to send no response.
        �r8r3r�r,r�N)rrrrrr+r�rrZr�r�r�r�rrry�assertNotInr)r"r�r�r?rr�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�����tj��G�fd�dt�}t��t	j
�}t
|��_|�_t��_
�j��jg���fd�}�j|��jd}tj�|g�S)z�
        A custom L{Request} subclass that requires the site and factory in the
        constructor is able to get them.
        c���eZdZ�fd�Zy)�THTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.SuperRequestc���tj|g|��i|���j|jj|jj
f�yr)rr$�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)rirjrkr$)r�s�r#�SuperRequestr��s	���
Fr&r�c���|\}}�j|�j��j|�j�yr)�assertIsr�r�)r�r�r�r�r"s   ��r#�validateFactoryAndSitez^HTTP2ServerTests.test_RequestRequiringFactorySiteInConstructor.<locals>.validateFactoryAndSites2��� �M�D�'��M�M�$�
���0��M�M�'�:�#5�#5�6r&r,)r�Deferredrrr�HTTPFactoryrrr��objectr�rrrr�
gatherResults)r"r��httpFactoryr�rbr�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�}tt�|_�j	|�j
g�\}}|jj}�jt|�d��fd�}|d}|j|�|jd}tj||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|�yr)�assertIsNone)r�r"s �r#rz?HTTP2ServerTests.test_notifyOnCompleteRequest.<locals>.validates������f�%r&r)
rr�rrrrr�rryrrrr�)r"r�r�r��	deferredsrr�rbs`       r#�test_notifyOnCompleteRequestz-HTTP2ServerTests.test_notifyOnCompleteRequests����
"�^�
�$;�<L�$M�
�!��-�-�j�$�:P�:P�RT�U���9��-�-�5�5�	�����Y���+�	&�
�a�L��	�
�
�h��%�<�<�Q�?���"�"�A��#7�8�8r&c���t�}tt�|_�j	|�j
g�\}}|jj}�jt|�d��fd�}�fd�}|d}|j||�|jd��j�}|j|�|S)zw
        A HTTP/2 reset stream fires the L{http.Request.notifyFinish} deferred
        with L{ConnectionLost}.
        r,c�(���jd�y�Nz#Didn't errback, called back instead��fail��ignr"s �r#r�z;HTTP2ServerTests.test_notifyOnResetStream.<locals>.callback6�����I�I�;�<r&c����j|tj��j|jt
j�yr��assertIsInstancer�Failurer��typer�ConnectionLost��reasonr"s �r#�errbackz:HTTP2ServerTests.test_notifyOnResetStream.<locals>.errback9�2����!�!�&�'�/�/�:��M�M�&�+�+�u�';�';�<�r&rr�)
rr�rrrrr�rry�addCallbacksrZr�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�}tt�|_�j	|�j
g�\}}t
�j
g|d��}|j|�|jj}�jt|�d��fd�}�fd�}|D]}|j||��|jdd��j�}	|j|	�tj|�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�r9rc�(���jd�yr�r�r�s �r#r�z=HTTP2ServerTests.test_failWithProtocolError.<locals>.callbackar�r&c����j|tj��j|jtj
j�yr)r�rr�rr��
exceptions�
ProtocolErrorr�s �r#r�z<HTTP2ServerTests.test_failWithProtocolError.<locals>.errbackds8����!�!�&�'�/�/�:��!�!�&�,�,��
�
�0K�0K�L�r&�yo���r3r9)rr�rrrrr�r�r�rryr�rCr�rr��
r"r�r�r��
secondRequestr�r�r�r�r�s
`         r#�test_failWithProtocolErrorz+HTTP2ServerTests.test_failWithProtocolErrorGs����"�^�
�$;�<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�}tt�|_�j	|�j
g�\}}t
�j
g|d��}|j|�|jj}�jt|�d��fd�}�fd�}|D]}|j||��|jd��j�}	|j|	�tj|�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�(���jd�yr�r�r�s �r#r�z4HTTP2ServerTests.test_failOnGoaway.<locals>.callback�r�r&c����j|tj��j|jt
j�yrr�r�s �r#r�z3HTTP2ServerTests.test_failOnGoaway.<locals>.errback�r�r&rp)rr�rrrrr�r�r�rryr�rWr�rr�r�s
`         r#�test_failOnGoawayz"HTTP2ServerTests.test_failOnGoawayss����"�^�
�$;�<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�}tt�|_�j	|�j
g�\}}t
�j
g|d��}|j|�|jj}�jt|�d��fd�}�fd�}|D]}|j||��|j�tj|�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�(���jd�yr�r�r�s �r#r�z;HTTP2ServerTests.test_failOnStopProducing.<locals>.callback�r�r&c����j|tj��j|jt
j�yrr�r�s �r#r�z:HTTP2ServerTests.test_failOnStopProducing.<locals>.errback�r�r&)rr�rrrrr�r�r�rryr�r�rr�)	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�}tt�|_�j	|�j
g�\}}|jj}�jt|�d��fd�}�fd�}|d}|j||�|jd}|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�(���jd�yr�r�r�s �r#r�z7HTTP2ServerTests.test_notifyOnFast400.<locals>.callback�r�r&c����j|tj��j|jt
j�yrr�r�s �r#r�z6HTTP2ServerTests.test_notifyOnFast400.<locals>.errback�r�r&r)rr�rrrrr�rryr�rWrz)	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|�|jt|jg||���|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�rN)r
rr�rrrrr+r�r�r�rr��_maxBufferedControlFrameBytesrzr�disconnected)r"�
memoryReactorr�r9r�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�tdd�D]0}|j|ji�j���2t|j��}|jt|�d�|j!�t|j��}|jt|�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�dr,�eN)rrrrrr+r�r�r�r�rIr�r�rrryr�)r"r�r�r�r+r�r�s       r#� test_bufferingAutomaticFrameDataz1HTTP2ServerTests.test_bufferingAutomaticFrameDatas���"�^�
�$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�tdd�D]0}|j|ji�j���2|j|j�|j|ji�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.
        rr�N)rrrrrr+r�r�r�r
rZrPr�rIr�rr)r"r�r�r�r+r�s      r#�2test_bufferingAutomaticFrameDataWithCircuitBreakerzCHTTP2ServerTests.test_bufferingAutomaticFrameDataWithCircuitBreaker6s���"�^�
�$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��Gd�dt�}t�}t|_t	�}|�}|j|d�|j
�}|j|�|j|�|j|j�t|j��}|jt|�d�|j|jd�t!dd�D]0}|j|j#i�j%���2t|j��}|jt|�d�|j|jd�|j'�t|j��}|jt|�d�|j|jd	�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��eZdZd�Zy)�eHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite.<locals>.AutoPausingStringTransportc�j�tj|g|��i|��|jj�yr)rr��producerr�r�s   r#r�zkHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWrite.<locals>.AutoPausingStringTransport.write_s*���%�%�d�<�T�<�V�<��
�
�,�,�.r&N)rirjrkr�r*r&r#�AutoPausingStringTransportr^s��
/r&rTr,rr�cr�ZN)rrrrrr�r+r�r��assertIsNotNone�_consumerBlockedr�rrry�_bufferedControlFrameBytesr�rIr�r�)r"rr�r�r�r+r�r�s        r#�0test_bufferingContinuesIfProducerIsPausedOnWritezAHTTP2ServerTests.test_bufferingContinuesIfProducerIsPausedOnWriteXs|��	/��	/�"�^�
�$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|_	|jdd��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.
        rr�r�r�N)r
rr�rrr+r�r�r�r
rCr�rr)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)+rirjrkrr%r&rrr#r$rrr'r-r@rNrQr\rcrnrsrwr|r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrr r"r*r&r#r�r��s������D�O���*�O���B��'�:K�8K�8)K�V>
�@E
�N%)�N+K�Z,5�\35�j25�hK�8%5�N+K�ZN� K�D
0�S�,8�>@B�D7�. 9�D9�.�B*.�X(.�T'.�R%�N(0�T+�> 0�D+H�Z0r&r�c�~�eZdZdZgd�ZdZgd�Zgd�ZdZd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�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
tjjjdi�j�z
}|t�jg|�z
}|j�	�t|�D]}|j!|��t#�j$�dz
}t'|�D]4}|j)dd��}|j!|j���6�	�fd�}|j*dj-|�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.
        rBr,r�c����t�j��}�jd|djv�dj	d�|D��}�j�j|�y)Nr�r�r&c3�~K�|]5}t|tjj�s�(|j���7y�wr�rr/r0rBr3r�s  r#r�zMH2FlowControlTests.test_bufferExcessData.<locals>.validate.<locals>.<genexpr>��.����*��*�Q�
�8H�8H�8R�8R�*S����*���)=�=)r�rrr4r�rr�r9r��actualResponseDatar6r"s   ��r#rz:H2FlowControlTests.test_bufferExcessData.<locals>.validate�sg���$�Q�W�W�Y�/�F�
�O�O�L�F�2�J�,<�,<�<�=�"%���*� &�*�"��
���T�1�1�3E�Fr&)rrrrrr+rIr�rGr�r�r�r�rr�r
r�ryrr�rNrr)
r"r;r?rr�bonusFramesr�r0rr6s
`        @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
tjjjdi�j�z
}|t�jg|�z
}|j��t|�D]}|j!|��|j"d}|j$j&}�j)|j*�|j-d��j/|j*��j1|j2j4dg�|j!|j7dd��j���j/|j*��j1|j2j4dg�|j!|j7dd��j���j/|j*��j1|j2j4dg�|j!|j7dd��j���j)|j*��j1|j2j4ddg�|j-d��j/|j*��j1|j2j4gd��|j!|j7dd	��j���j)|j*��j1|j2j4gd
��|j9�|j;���fd�}|j<dj?|�S)z�
        L{Request} objects that have registered producers get blocked and
        unblocked according to HTTP/2 flow control.
        rBr,�
helloworld�pauser�r�resume)r1r2r1r�)r1r2r1r2c�&��t�j��}�jd|djv�|D�cgc]3}t	|t
jj�s�(|j��5}}�j|gd��ycc}w)Nr�r�)r0r0r&r��r9r�r;r�r6r"s    ��r#rzDH2FlowControlTests.test_producerBlockingUnblocking.<locals>.validate3s}���$�Q�W�W�Y�/�F�
�O�O�L�F�2�J�,<�,<�<�=�!'���*�Q�
�8H�8H�8R�8R�*S�����J��
���Z�)L�M��r�) rrrrkrr+rIr�rGr�r�r�r�rr�r
r�rWrXrYr�_producerProducingr�rZrr�eventsrN�unregisterProducerr�rr�	r"r;r?rrr{r[rr6s	`       @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
tjjjdi�j�z
}|t�jg�	�z
}�j��t|�D]}�j!|���j"d��j$j&�
�j)�j*��
j-d��j/�j*��j1�
j2j4dg��
j-d���	�
��fd�}t7j8t:d|�}��fd�}�j<dj?|�}tAjB||g�S)	zQ
        Exactly filling the flow control window still blocks producers.
        rBr,r0r1�hc�,���j�jdd��j���j�j��j�jjddg��j��j�y)Nr,r�r�r1r2)
r�rNr�rr5rrr6r7r�)r?r;r[r"r{s�����r#�window_openz=H2FlowControlTests.test_flowControlExact.<locals>.window_openhsv���
�N�N��(�(�!�r�(�B�L�L�N�
�
�O�O�F�5�5�6����W�-�-�4�4�w��6I�J��&�&�(��N�N�r&rc�&��t�j��}�jd|djv�|D�cgc]3}t	|t
jj�s�(|j��5}}�j|gd��ycc}w)Nr�r�)r~rr;r&r�r4s    ��r#rz:H2FlowControlTests.test_flowControlExact.<locals>.validatets}���$�Q�W�W�Y�/�F�
�O�O�L�F�2�J�,<�,<�<�=�!'���*�Q�
�8H�8H�8R�8R�*S�����J��
���Z�)H�I��r�)"rrrrkrr+rIr�rGr�r�r�r�rr�r
r�rWrXrYrr5r�rZrrr6rr�rrrrr<)r"rrr=�windowDeferr�
validateDeferr?r6r;r[r{s`      @@@@@r#�test_flowControlExactz(H2FlowControlTests.test_flowControlExactAs����
�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
tjjjdi�j�z
}|t�jg|�z
}|j��t|�D]}|j!|��|j"d}|j$j&}�j)|j*�|j-d�|j/�|j1��j)|j2�t5j6d|j |j9dd��j����fd�}|j:dj=|�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.
        rBr,r0rr�r�c�&��t�j��}�jd|djv�|D�cgc]3}t	|t
jj�s�(|j��5}}�j|gd��ycc}w)Nr�r�)r~rr&r�r4s    ��r#rz=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�)rrrrkrr+rIr�rGr�r�r�r�rr�r
r�rWrXrYrr5r�r7r��finishedrr�rNrrr8s	`       @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
�jg|�z
}|j�	�t|�D]}|j|��|jd}|jj}|jd}|j�|j!��j#|j$��	�fd�}|j'|�S)z<
        We safely handle responses without bodies.
        r,c�Z��t�j��}�jt|�d��j	d|dj
v�|D�cgc]3}t
|tjj�s�(|j��5}}�j|dg�ycc}w�Nr
r�r�r&�r�rrryrr4rr/r0rBr3r4s    ��r#rz=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()rrrrkrr+r�rr�r
r�rWrXrYrr7r�rrDr�
r"r;r?rrr{r[rbrr6s
`        @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
�jg|�z
}|j�	�t|�D]}|j|��|jd}|jj}|jd}|j�|j!��j#|j$�|j|j'dd��j)���	�fd�}|j+|�S)zk
        WindowUpdate frames received after we've completed the stream are
        safely handled.
        r,r�r�c�Z��t�j��}�jt|�d��j	d|dj
v�|D�cgc]3}t
|tjj�s�(|j��5}}�j|dg�ycc}wrHrIr4s    ��r#rzGH2FlowControlTests.test_windowUpdateForCompleteStream.<locals>.validaterJrK)rrrrkrr+r�rr�r
r�rWrXrYrr7r�rrDrNr�rrLs
`        @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
tjjjdi�j�z
}|t�jg|�z
}|j��t|�D]}|j!|��|j"d}|j$j&}�j)|j*�|j-d��j)|j*��j/|j0j2g�|j!|j5dd��j���j)|j*��j/|j0j2g�|j7�|j9���fd�}|j:dj=|�S)z�
        L{Request} objects that have registered producers that are not blocked
        behind flow control do not have their producer notified.
        rBr,�wordr�c�&��t�j��}�jd|djv�|D�cgc]3}t	|t
jj�s�(|j��5}}�j|ddg�ycc}w)Nr�r�rRr&r�r4s    ��r#rz;H2FlowControlTests.test_producerUnblocked.<locals>.validateZs����$�Q�W�W�Y�/�F�
�O�O�L�F�2�J�,<�,<�<�=�!'���*�Q�
�8H�8H�8R�8R�*S�����J��
���Z�'�3��8��r�)rrrrkrr+rIr�rGr�r�r�r�rr�r
r�rWrXrYrr5r�rrr6rNr7r�rrr8s	`       @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|�}|jd|jdd���|j�}|djd�|D��z
}|j��t|�D]}|j|����fd�}|jdj!|�S)z�
        When a WindowUpdate frame is received for the whole connection but no
        data is currently waiting, nothing exciting happens.
        r,rrBr�r&c3�<K�|]}|j����y�wrr�r�s  r#r�zBH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.<genexpr>vr_r�c����t�j��}�jd|djv�dj	d�|D��}�j�j|�y)Nr�r�r&c3�~K�|]5}t|tjj�s�(|j���7y�wrr(r�s  r#r�zTH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.validate.<locals>.<genexpr>�r)r*)r�rrr4r�rr$r+s   ��r#rzAH2FlowControlTests.test_unnecessaryWindowUpdate.<locals>.validate}sg���$�Q�W�W�Y�/�F�
�O�O�L�F�2�J�,<�,<�<�=�"%���*� &�*�"��
���T�2�2�4F�Gr&)rrrrrr�r%r&rLrNr+r�r�r
r�rr)r"r;r?r�rrrr6s`      @r#�test_unnecessaryWindowUpdatez/H2FlowControlTests.test_unnecessaryWindowUpdatehs����

�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
|jd���|j|jdd���|j�}|djd�|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�rBr�r&c3�<K�|]}|j����y�wrr�r�s  r#r�zKH2FlowControlTests.test_unnecessaryWindowUpdateForStream.<locals>.<genexpr>�s����7�1�����7�r�N)rrrrrr�r?r%rNr+r�r�r�r�)r"r;r��connr�r3s      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�}|djd�|D��z
}|j|�t|�D]}|j|��|jdj�|jdd��}|j|j!��t#|j%��}|j't)|dt*j,j.��y)zq
        When a WindowUpdate frame is received for a stream that has been
        aborted it is ignored.
        r&c3�<K�|]}|j����y�wrr�r�s  r#r�zEH2FlowControlTests.test_windowUpdateAfterTerminate.<locals>.<genexpr>�r_r�r,rBr�r�N)rrrrrr�r%r&r+r�r�r
r�rWr�rNr�r�rrrr/r0rY)r"r;r6r?r�rr�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�}|djd�|D��z
}�j��t|�D]}�j|����	fd�}��fd�}�jdj|�}|j|�S)zs
        When a WindowUpdate frame is received for a stream that has been
        completed it is ignored.
        r&c3�<K�|]}|j����y�wrr�r�s  r#r�zDH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.<genexpr>�r_r�c�j���jdd��}�j|j��y)Nr,rBr�)rNr�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��}�jd|dj�y)Nr�r�)r�r�assertInr4�r�r�r6r"s  ��r#rzCH2FlowControlTests.test_windowUpdateAfterComplete.<locals>.validate�s-���$�Q�W�W�Y�/�F�
�M�M�,��r�
�(8�(8�9r&r,)rrrrrr�r%r&r+r�r�r
r�rr)
r"r�rrrerr�r?r6r;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|_ddzgdz}td�|D���}|jddd|fgz}t|||��}|d=|j|jd	tjjj�
��|j�}|djd�|D��z
}|j!|�|j#|�t%|j'��}|D�	cgc]2}	t)|	t*j,j.�r|	j0��4}
}	|j3d
g|
�|D�	cgc])}	t)|	t*j,j4�s�(|	��+}}	|D�	cgc])}	t)|	t*j,j6�s�(|	��+}}	|j9|�|j9|�ycc}	wcc}	wcc}	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@rc3�2K�|]}t|����y�wr)ry)r�r3s  r#r�z;H2FlowControlTests.test_dataAndRstStream.<locals>.<genexpr>�s����<�$�C��I�<�s�Nr�zcontent-lengthr�r,)r9rUr&c3�<K�|]}|j����y�wrr�r�s  r#r�z;H2FlowControlTests.test_dataAndRstStream.<locals>.<genexpr>	r_r�r)rrrrr�sumr%r�r�rZr��errors�
ErrorCodes�INTERNAL_ERRORr+r�r�r�r�rrr/r0rKr	rr1rBrZ)
r"r�r�r?�	frameData�
bodyLengthr8r�rr;�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�����'�����$�� 
��
��Vs�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�rN)r
rr�rrrrr+r�r�r?r%r�r�r
�clear�abortRequestrZrrr)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)rirjrkrlrrr%r&r$r.r9rArErMrPrTrYr]rarirwr|r*r&r#r$r$�s������*�O���D�O�A��+B�ZQB�f@@�D8B�t25�h95�v:B�x!B�F+�2Q�@ '�D5%�n)0r&r$c�,�eZdZgd�Zd�Zd�Zd�Zd�Zy)�HTTP2TransportCheckingr�c��t�}t�}t|_|j	|d�|j|j|u�y)zU
        L{H2Connection} can be registered with the transport as a producer.
        TN)rrrrr�rr)r"r6r?s   r#�"test_registerProducerWithTransportz9HTTP2TransportChecking.test_registerProducerWithTransportT	s?��
����N��0���	���1�d�#�����
�
�a��(r&c����	�
�t�}t��	t��t�_t�jg|�}|j�}|djd�|D��z
}�j�	��	j�d�t|�D]}�j|���j��jd�
��	�
�fd�}�	�fd�}tj t"d|�}|j%|�|S)z|
        L{H2Connection} can be paused by its consumer. When paused it stops
        sending data to the transport.
        r&c3�<K�|]}|j����y�wrr�r�s  r#r�zNHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.<genexpr>l	r_r�Tr,c�|��t�j��}�jt|�d��j	t|dtjj���j��j��j��j��j��S)Nrr�)
r�rrryrZrr/r0rBr�)r�r�r?r6rbr"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��}�jt|�d��j	d|dj
v�yrTrUrhs  ��r#r�zUHTTP2TransportChecking.test_pausingProducerPreventsDataSend.<locals>.validateComplete�	sD���$�Q�W�W�Y�/�F�
���S��[�!�,��O�O�L�F�2�J�,<�,<�<�=r&r�)rrrrrr�rr+r�r�r�r
r�r�rrr�rr)r"r;r�rrr�r�r�r?r6rbs`       @@@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�}|djd�|D��z
}|j|�|j|d�t|�D]}|j|��|j�t|j��}|j!t#|�d�|j%t'|dt(j*j,��|j%|j.�y)zo
        L{H2Connection} can be stopped by its producer. That causes it to lose
        its transport.
        r&c3�<K�|]}|j����y�wrr�r�s  r#r�z<HTTP2TransportChecking.test_stopProducing.<locals>.<genexpr>�	r_r�Trr�N)rrrrrr�rr+r�r�r�r
r�r�r�rrryrZrr/r0rBrr)r"r;r6r?r�rrs       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��	�
��tddd��	tddd��
t�}t�	�
��}t�}t|_|j
|�t�jg|�}|j�}|djd�|D��z
}t|�D]}|j|��|jd	��j�j��	��j�j!��
�|j"d	}�	�
��fd
�}|j%|�S)z{
        A L{H2Stream} object correctly passes through host and peer information
        from its L{H2Connection}.
        �TCPz
17.52.24.8i�z17.188.0.12i})�hostAddress�peerAddressr&c3�<K�|]}|j����y�wrr�r1s  r#r�zEHTTP2TransportChecking.test_passthroughHostAndPeer.<locals>.<genexpr>�	r2r�r,c����j�j����j�j���yr)r�getHost�getPeer)r�r�r�r"r{s ����r#rzDHTTP2TransportChecking.test_passthroughHostAndPeer.<locals>.validate�	s1������V�^�^�-�{�;����V�^�^�-�{�;r&)r	rrrrrr�r�rr+r�r
r�rWrr�r�rr)r"r�r�r�r�rrrbrr�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)rirjrkrr�r�r�r�r*r&r#r~r~I	s����	)�<�|,�>!5r&r~c��eZdZdZd�Zy)�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���tj�}t|�}|j�}|j	t|�d�|d}|j
|j��|j	|jd�|j	|j|j�|j	|jd�|j	|ji�y)z}
        When a H2Connection is established it schedules one call to be run as
        soon as the reactor has time.
        r,rr*N)
r�Clockr�getDelayedCallsrryr�active�time�func�_sendPrioritisedDatar��kw)r"rr?�calls�calls     r#�"test_initiallySchedulesOneDataCallz7HTTP2SchedulingTests.test_initiallySchedulesOneDataCall�	s���
�*�*�,����!��'��'�'�)������U��Q�'��Q�x��	
������
�&�������A�&�������A�$:�$:�;�������B�'�������"�%r&N)rirjrkrlr�r*r&r#r�r��	s���&r&r�c�~�eZdZdZgd�Ze�Zd�Zd�Zd�Z	efd�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zy)�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�rs   r#�patch_TimeoutMixin_clockz*HTTP2TimeoutTests.patch_TimeoutMixin_clock
s�� '�0�0�
�r&c��tj�}t|�}d|_|j	||�t�}t
|�|_|j|�t|�D]}|j|��|||fS)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)rr�r�timeOutr�rrrr�r
r�)r"�initialDatarrr\r�rs       r#�initiateH2Connectionz&HTTP2TimeoutTests.initiateH2Connection
s����*�*�,���G�$������%�%�d�G�4�#�%�	�6�~�F������I�&��k�*�	$�D����d�#�	$���y�)�)r&c�8�t|�}|jt|�|�|jt	|dt
jj��|j|dj|�|j|dj|�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�rryrrr/r0rPrQrR)r"r3�
frameCountrUrTr�s      r#�assertTimedOutz HTTP2TimeoutTests.assertTimedOut9
sy��!��&������V��j�1����
�6�"�:�z�/?�/?�/K�/K�L�M�������.�.�	�:�������2�2�L�Ar&c���||jurtj}t�}|j	�}|j|t��\}}}||_|jd�|j|j�dtjjjd��|j|j�|j!|j"�|||fS)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.
        �rrrr�r�rUrT)�_DEFAULTr�abortTimeoutrr+r�r�advancer�rr�rorp�NO_ERRORrrPrZr)r"r�r�r�rr\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	�dtjjjd��|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�rrrr�N)rr+r�rrr�rrZrPr�r�rorpr�r)r"r�r�rr\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�dtjjjd��|j|j�y)zM
        When a L{H2Connection} receives data, the timeout is reset.
        r&r�rrrr�N)rr�rr
r+r�r�rZrPr�rr�rorpr�r)r"r�r�rr\r�rs       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|jg|�}|j�}|dj	d�|D��z
}�	fd�}|j||��\}}}|j
|j��|jd�|jt�	�d�td�D]C}�	djd	�|jd�|j|j��E|jd
�|j|j�dt j"j$j&d��y
)zJ
        When a L{H2Connection} sends data, the timeout is reset.
        r&c3�<K�|]}|j����y�wrr�r�s  r#r�zDHTTP2TimeoutTests.test_timeoutResetByResponseData.<locals>.<genexpr>�
�����>�!����
�>�r�c�D��t||��}�j|�|S)N)�queued)rr�)r{r�r��requestss   �r#�saveRequestzFHTTP2TimeoutTests.test_timeoutResetByResponseData.<locals>.saveRequest�
s ���$�V�F�;�C��O�O�C� ��Jr&r�rr,�
rs
some bytesr�
r�N)rr�rr+r�r�r�r��assertEqualsryr�r�rZrPr�rr�rorp�PROTOCOL_ERROR)
r"r�r�r�r�rr\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|jg|�}|j�}|dj	d�|D��z
}|j|t��\}}}|jd�|j|j�dtjjjd��|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&c3�<K�|]}|j����y�wrr�r�s  r#r�zOHTTP2TimeoutTests.test_timeoutWithProtocolErrorIfStreamsOpen.<locals>.<genexpr>�
r�r�r�rrr,r�N)rr�rr+r�r�r�r�r�rr�rorpr�rrP)r"r�r�r�rr\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|jg|�}|j�}|dj	d�|D��z
}|j|t��\}}}|j�}t|j��}|jd�t|j��}	|j|dz
|	�|jd�|j|j�|�y)zU
        When a L{H2Connection} loses its connection it cancels its timeout.
        r&c3�<K�|]}|j����y�wrr�r�s  r#r�zCHTTP2TimeoutTests.test_noTimeoutIfConnectionLost.<locals>.<genexpr>�
r�r�r�r�r,rN)
rr�rr+r�r�r�rryr��connectionLostrr�)
r"r�r�r�rr\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�\}}}|jd�|j|j�|j	|j
�|jd�|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�rrPrZr�r"rr\r�s    r#�,test_timeoutEventuallyForcesConnectionClosedz>HTTP2TimeoutTests.test_timeoutEventuallyForcesConnectionCloseds���
$(�#8�#8�#:� ���y�	���������	�/�/�0�����/�/�0����������	�/�/�0����	�.�.�/r&c��|j�\}}}|jd�|jd�|jd�|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�rrPrZrr�s    r#�$test_losingConnectionCancelsTheAbortz6HTTP2TimeoutTests.test_losingConnectionCancelsTheAbort!sm��
$(�#8�#8�#:� ���y�	���������D�!�	���������	�/�/�0�����/�/�0r&c��|jd��\}}}|jd�|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�lr�r�s    r#�'test_losingConnectionWithNoAbortTimeOutz9HTTP2TimeoutTests.test_losingConnectionWithNoAbortTimeOut1sT��
$(�#8�#8�d�#8�#K� ���y�	���������	�/�/�0�����/�/�0r&c��|j�\}}}|jd�|j|j�|j|j�|jtj�y)z}
        If a timed out transport doesn't close after 15 seconds, the
        L{HTTPChannel} will forcibly close it.
        �N)r�r�rrPrr�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|jz�D]A}|j|jd�j��|jd��C|j|j�y)zR
        A client that sends only invalid frames is eventually timed out.
        �<r,N)r
rr�r�rrr+r�r�r�r�rZr�r�rr)r"rr�r�r�r+r�s       r#�,test_timeOutClientThatSendsOnlyInvalidFramesz>HTTP2TimeoutTests.test_timeOutClientThatSendsOnlyInvalidFramesOs���+�,�
�!�-�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)rirjrkrlrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r*r&r#r�r��	sh������x�H�
1�*�8B�-5�$(�L 1�D 1�D*
�X1�46�8
0�1� 1�2�"0r&r�rh)Drlr8�zope.interfacerr�twisted.internetrrrr�twisted.internet.addressr	�twisted.internet.testingr
r�twisted.pythonr�twisted.python.compatr
�twisted.test.test_internetr�
twisted.trialr�twisted.webr�twisted.web.test.test_httprrrrrrrr�r��	h2.errors�
h2.exceptionsr/r��hpack.hpackrr�twisted.web._http2r�ImportErrorrrnr�r�r�r�r�rKr�rVr�rar�rkr��NotifyingRequestFactoryProxyr��TestCaser�r$r~r�r�r*r&r#�<module>r�s����
�7�8�8�0�H�"�+�4�"�����
��*������,�/�a�a�H'�'�T�B3�.�(�����(3�3E�F���4�<�<��D5�5I�J��
%�#7�
%� %=� �%�!�
	5�4�<�<�	5�5�5I�J��C�C�0 8�8O�P��M�M�"K0�x�(�(�*:�K0�\(a
0��*�*�,<�a
0�HT5�X�.�.�0@�T5�n&�8�,�,�.>�&�8l0��)�)�+;�l0��aN�*�
)�F�*�s�"F�F�F
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!