§
    ÈtºfýÞ ã                  óä  — d Z ddlmZ ddl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 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mZ ddlmZmZ ddlmZm Z m!Z! ddl"m#Z#m$Z$ ddl%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l0m1Z1 ddl2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z> ddl?m@Z@mAZA ddlBmCZC ddlDmEZEmFZF ddlGmHZHmIZImJZJ ddlKmLZLmMZMmNZNmOZOmPZPmQZQmRZR ddlSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[ ddl\m]Z] dd l^m_Z_ dd!l`maZambZbmcZcmdZdmeZemfZf dd"lgmhZhmiZi e	reFZjekZlnekZjeFZl	 dd#lmmZn enZmd$Zodd%lpmqZqmrZr dd&lsmtZt dd'lumvZv dd(lwmxZxmyZy  eer¦  «         G d)„ d*¦  «        ¦   «         Zzn# e{$ r dZmd+ZoY nw xY w G d,„ d-e-¦  «        Z| G d.„ d/¦  «        Z} G d0„ d1eF¦  «        Z~d2Zd3Z€d4Z�d5Z‚d6Zƒd7Z„ G d8„ d9¦  «        Z… G d:„ d;¦  «        Z† G d<„ d=¦  «        Z‡ G d>„ d?e,¦  «        Zˆ G d@„ dAeFe…¦  «        Z‰ G dB„ dC¦  «        ZŠ G dD„ dE¦  «        Z‹ eec¦  «         G dF„ dG¦  «        ¦   «         ZŒ G dH„ dIeFe…eŠe‹¦  «        Z� G dJ„ dKe…eheE¦  «        ZŽ G dL„ dMe…eieE¦  «        Z� eeo dN¦  «         G dO„ dPeFe…e‹¦  «        ¦   «         Z� G dQ„ dReF¦  «        Z‘ G dS„ dTeFe…¦  «        Z’ G dU„ dV¦  «        Z“ G dW„ dXeFe“¦  «        Z” G dY„ dZeFe“e…eŠ¦  «        Z• G d[„ d\ e:ef¦  «        ¦  «        Z– G d]„ d^e–¦  «        Z— G d_„ d`eFe…eŠ¦  «        Z˜ G da„ dbe-¦  «        Z™ G dc„ ddeFe…¦  «        Zš G de„ dfeFe…eŠ¦  «        Z›g dg¢Zœ G dh„ diej¦  «        Z� G dj„ dke…e�eŠel¦  «        Zž G dl„ dme…e�eŠel¦  «        ZŸ G dn„ doe6¦  «        Z  G dp„ dq¦  «        Z¡ G dr„ dse¡¦  «        Z¢ G dt„ dueF¦  «        Z£ eeo dN¦  «         G dv„ dweF¦  «        ¦   «         Z¤ G dx„ dyeheE¦  «        Z¥ G dz„ d{eheE¦  «        Z¦ G d|„ d}eieE¦  «        Z§ G d~„ deieE¦  «        Z¨dS )€zD
Tests for L{twisted.web.client.Agent} and related new client APIs.
é    )ÚannotationsN)Ú	CookieJar)ÚBytesIO)ÚTYPE_CHECKINGÚDictÚListÚOptionalÚSequenceÚTuple)ÚSkipTestÚskipIf©Úimplementer)ÚverifyObject)ÚVersion)ÚdeferÚtask)ÚIPv4AddressÚIPv6Address)ÚCancelledErrorÚDeferredÚsucceed)ÚHostnameEndpointÚTCP4ClientEndpoint)ÚConnectionDoneÚConnectionLostÚConnectionRefusedError)ÚIOpenSSLClientConnectionCreator)ÚFactoryÚProtocol)ÚClock)ÚdeterministicResolvingReactor)ÚAccumulatingProtocolÚEventLoggingObserverÚMemoryReactorClockÚStringTransport)ÚglobalLogPublisher)ÚproxyForInterface)ÚgetDeprecationWarningString)ÚFailure)ÚFakeTransportÚIOPump)Ú!certificatesForAuthorityAndServer)ÚSynchronousTestCaseÚTestCase)ÚclientÚerrorÚhttp_headers)ÚHTTP11ClientProtocolÚPotentialDataLossÚRequestNotSentÚRequestTransmissionFailedÚResponseÚResponseFailedÚResponseNeverReceived)ÚURIÚBrowserLikePolicyForHTTPSÚFileBodyProducerÚHostnameCachingHTTPSPolicyÚHTTPConnectionPoolÚRequestÚResponseDoneÚ_HTTP11ClientFactory)ÚSchemeNotSupported)ÚHeaders)ÚUNKNOWN_LENGTHÚIAgentÚIAgentEndpointFactoryÚIBodyProducerÚIPolicyForHTTPSÚ	IResponse)ÚMethodInjectionTestsMixinÚURIInjectionTestsMixin)ÚsslT)ÚClientTLSOptionsÚIOpenSSLTrustRoot)ÚoptionsForClientTLS)Útls)ÚTLSMemoryBIOFactoryÚTLSMemoryBIOProtocolc                  ó   — e Zd ZdZdZd„ ZdS )ÚCustomOpenSSLTrustRootFNc                ó"   — d| _         || _        d S ©NT)ÚcalledÚcontext)ÚselfrX   s     úZ/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/web/test/test_agent.pyÚ_addCACertsToContextz+CustomOpenSSLTrustRoot._addCACertsToContextm   s   € ØˆDŒKØ"ˆDŒLˆLˆLó    )Ú__name__Ú
__module__Ú__qualname__rW   rX   r[   © r\   rZ   rT   rT   h   s-   € € € € € àˆØˆð	#ð 	#ð 	#ð 	#ð 	#r\   rT   Fc                  ó    — e Zd ZdZdd„Zd„ ZdS )ÚStubHTTPProtocolaR  
    A protocol like L{HTTP11ClientProtocol} but which does not actually know
    HTTP/1.1 and only collects requests in a list.

    @ivar requests: A C{list} of two-tuples.  Each time a request is made, a
        tuple consisting of the request and the L{Deferred} returned from the
        request method is appended to this list.
    ÚreturnÚNonec                ó"   — g | _         d| _        d S )NÚ	QUIESCENT)ÚrequestsÚstate©rY   s    rZ   Ú__init__zStubHTTPProtocol.__init__|   s   € ØCEˆŒØ ˆŒ
ˆ
ˆ
r\   c                óZ   — t          ¦   «         }| j                             ||f¦  «         |S )z‚
        Capture the given request for later inspection.

        @return: A L{Deferred} which this code will never fire.
        )r   rg   Úappend)rY   ÚrequestÚresults      rZ   rm   zStubHTTPProtocol.request€   s-   € õ ‘”ˆØŒ×Ò˜g vÐ.Ñ/Ô/Ð/Øˆr\   N©rc   rd   )r]   r^   r_   Ú__doc__rj   rm   r`   r\   rZ   rb   rb   r   sA   € € € € € ðð ð!ð !ð !ð !ðð ð ð ð r\   rb   c                  ó   — e Zd Zd„ Zd„ ZdS )ÚFileConsumerc                ó   — || _         d S ©N)Ú
outputFile)rY   ru   s     rZ   rj   zFileConsumer.__init__Œ   s   € Ø$ˆŒˆˆr\   c                ó:   — | j                              |¦  «         d S rt   )ru   Úwrite)rY   Úbytess     rZ   rw   zFileConsumer.write�   s   € ØŒ×Ò˜eÑ$Ô$Ð$Ð$Ð$r\   N)r]   r^   r_   rj   rw   r`   r\   rZ   rr   rr   ‹   s2   € € € € € ð%ð %ð %ð%ð %ð %ð %ð %r\   rr   c                  óf   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚFileBodyProducerTestszq
    Tests for the L{FileBodyProducer} which reads bytes from a file and writes
    them to an L{IConsumer}.
    c                ó   — d„ S )al  
        This method can be used as the C{terminationPredicateFactory} for a
        L{Cooperator}.  It returns a predicate which immediately returns
        C{False}, indicating that no more work should be done this iteration.
        This has the result of only allowing one iteration of a cooperative
        task to be run per L{Cooperator} iteration.
        c                 ó   — dS rV   r`   r`   r\   rZ   ú<lambda>z4FileBodyProducerTests._termination.<locals>.<lambda>¡   s   € �t€ r\   r`   ri   s    rZ   Ú_terminationz"FileBodyProducerTests._termination™   s   € ð ˆ|Ðr\   c                óf   — g | _         t          j        | j        | j         j        ¦  «        | _        dS )zŒ
        Create a L{Cooperator} hooked up to an easily controlled, deterministic
        scheduler to use with L{FileBodyProducer}.
        N)Ú
_scheduledr   Ú
Cooperatorr~   rl   Ú
cooperatorri   s    rZ   ÚsetUpzFileBodyProducerTests.setUp£   s*   € ð
 ˆŒÝœ/¨$Ô*;¸T¼_Ô=SÑTÔTˆŒˆˆr\   c           
     óŠ   — |                       t          t          t          t	          d¦  «        ¦  «        ¦  «        ¦  «         dS )zI
        L{FileBodyProducer} instances provide L{IBodyProducer}.
        r\   N)Ú
assertTruer   rG   r<   r   ri   s    rZ   Útest_interfacez$FileBodyProducerTests.test_interface«   s5   € ð 	�Š�¥]Õ4DÅWÈSÁ\Ä\Ñ4RÔ4RÑSÔSÑTÔTÐTÐTÐTr\   c                ó  —  G d„ d¦  «        } G d„ d¦  «        }t           |¦   «         ¦  «        }|                      t          |j        ¦  «         t           |¦   «         ¦  «        }|                      t          |j        ¦  «         dS )zÄ
        If the L{FileBodyProducer} is constructed with a file-like object
        without either a C{seek} or C{tell} method, its C{length} attribute is
        set to C{UNKNOWN_LENGTH}.
        c                  ó   — e Zd Zd„ ZdS )ú9FileBodyProducerTests.test_unknownLength.<locals>.HasSeekc                ó   — d S rt   r`   )rY   ÚoffsetÚwhences      rZ   Úseekz>FileBodyProducerTests.test_unknownLength.<locals>.HasSeek.seek¹   ó   € Ø�r\   N)r]   r^   r_   r�   r`   r\   rZ   ÚHasSeekr‰   ¸   ó#   € € € € € ðð ð ð ð r\   r�   c                  ó   — e Zd Zd„ ZdS )ú9FileBodyProducerTests.test_unknownLength.<locals>.HasTellc                ó   — d S rt   r`   ri   s    rZ   Útellz>FileBodyProducerTests.test_unknownLength.<locals>.HasTell.tell½   rŽ   r\   N)r]   r^   r_   r”   r`   r\   rZ   ÚHasTellr’   ¼   r�   r\   r•   N)r<   ÚassertEqualrD   Úlength)rY   r�   r•   Úproducers       rZ   Útest_unknownLengthz(FileBodyProducerTests.test_unknownLength±   s°   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	õ $ G G¡I¤IÑ.Ô.ˆØ×Ò�¨¬Ñ9Ô9Ð9Ý# G G¡I¤IÑ.Ô.ˆØ×Ò�¨¬Ñ9Ô9Ð9Ð9Ð9r\   c                ó  — d}t          |¦  «        }|                     d¦  «         t          |¦  «        }|                      t	          |¦  «        dz
  |j        ¦  «         |                      |                     ¦   «         d¦  «         dS )zá
        If the L{FileBodyProducer} is constructed with a file-like object with
        both C{seek} and C{tell} methods, its C{length} attribute is set to the
        size of the file as determined by those methods.
        s   here are some bytesé   N)r   r�   r<   r–   Úlenr—   r”   )rY   Ú
inputBytesÚ	inputFiler˜   s       rZ   Útest_knownLengthz&FileBodyProducerTests.test_knownLengthÅ   s~   € ð ,ˆ
Ý˜JÑ'Ô'ˆ	Ø�Š�qÑÔÐÝ# IÑ.Ô.ˆØ×Ò�˜Z™œ¨1Ñ,¨h¬oÑ>Ô>Ð>Ø×Ò˜ŸšÑ)Ô)¨1Ñ-Ô-Ð-Ð-Ð-r\   c                óˆ   — t          t          d¦  «        ¦  «        }|                      t          j        |j        ¦  «         dS )zw
        If no L{Cooperator} instance is passed to L{FileBodyProducer}, the
        global cooperator is used.
        r\   N)r<   r   r–   r   Ú	cooperateÚ
_cooperate)rY   r˜   s     rZ   Útest_defaultCooperatorz,FileBodyProducerTests.test_defaultCooperatorÒ   s8   € õ
 $¥G¨C¡L¤LÑ1Ô1ˆØ×Ò�œ¨Ô)<Ñ=Ô=Ð=Ð=Ð=r\   c                ó  — d}d}t          ¦   «         }t          |¦  «        }t          t          |¦  «        | j        |¦  «        }|                     |¦  «        }t          t          |¦  «        |z  dz   ¦  «        D ]$} | j                             d¦  «        ¦   «          Œ%|  	                    g | j        ¦  «         |  	                    || 
                    ¦   «         ¦  «         |  	                    d|                      |¦  «        ¦  «         dS )zÎ
        L{FileBodyProducer.startProducing} starts writing bytes from the input
        file to the given L{IConsumer} and returns a L{Deferred} which fires
        when they have all been written.
        ó   hello, worldé   é   r   N)r   rr   r<   r‚   ÚstartProducingÚrangerœ   r€   Úpopr–   ÚgetvalueÚsuccessResultOf)rY   ÚexpectedResultÚreadSizeÚoutputÚconsumerr˜   ÚcompleteÚis           rZ   Útest_startProducingz)FileBodyProducerTests.test_startProducingÚ   sþ   € ð )ˆØˆÝ‘”ˆÝ Ñ'Ô'ˆÝ#¥G¨NÑ$;Ô$;¸T¼_ÈhÑWÔWˆØ×*Ò*¨8Ñ4Ô4ˆÝ•s˜>Ñ*Ô*¨hÑ6¸Ñ:Ñ;Ô;ð 	%ð 	%ˆAØ"ˆDŒO×Ò Ñ"Ô"Ñ$Ô$Ð$Ð$Ø×Ò˜˜Tœ_Ñ-Ô-Ð-Ø×Ò˜¨¯ªÑ):Ô):Ñ;Ô;Ð;Ø×Ò˜˜t×3Ò3°HÑ=Ô=Ñ>Ô>Ð>Ð>Ð>r\   c                óz  — d}d}t          |¦  «        }t          || j        |¦  «        }t          t          ¦   «         ¦  «        }|                     |¦  «         t          t          |¦  «        |z  dz   ¦  «        D ]$} | j                             d¦  «        ¦   «          Œ%|  	                    |j
        ¦  «         dS )z
        When L{FileBodyProducer} reaches end-of-file on the input file given to
        it, the input file is closed.
        é   s   some friendly bytesé   r   N)r   r<   r‚   rr   r¨   r©   rœ   r€   rª   r…   Úclosed)rY   r®   r�   rž   r˜   r°   r²   s          rZ   Útest_inputClosedAtEOFz+FileBodyProducerTests.test_inputClosedAtEOFì   s¶   € ð
 ˆØ+ˆ
Ý˜JÑ'Ô'ˆ	Ý# I¨t¬ÀÑIÔIˆÝ¥¡	¤	Ñ*Ô*ˆØ×Ò Ñ)Ô)Ð)Ý•s˜:‘”¨(Ñ2°QÑ6Ñ7Ô7ð 	%ð 	%ˆAØ"ˆDŒO×Ò Ñ"Ô"Ñ$Ô$Ð$Ð$Ø�Š˜	Ô(Ñ)Ô)Ð)Ð)Ð)r\   c                óT  —  G d„ d¦  «        }t           |¦   «         | j        ¦  «        }|                     t          t	          ¦   «         ¦  «        ¦  «        } | j                             d¦  «        ¦   «          |                      |¦  «                             t          ¦  «         dS )zä
        If a read from the input file fails while producing bytes to the
        consumer, the L{Deferred} returned by
        L{FileBodyProducer.startProducing} fires with a L{Failure} wrapping
        that exception.
        c                  ó   — e Zd Zd„ ZdS )úGFileBodyProducerTests.test_failedReadWhileProducing.<locals>.BrokenFilec                ó    — t          d¦  «        ‚)NzSimulated bad thing)ÚOSError)rY   Úcounts     rZ   ÚreadzLFileBodyProducerTests.test_failedReadWhileProducing.<locals>.BrokenFile.read  s   € ÝÐ3Ñ4Ô4Ð4r\   N)r]   r^   r_   r¿   r`   r\   rZ   Ú
BrokenFiler»     s#   € € € € € ð5ð 5ð 5ð 5ð 5r\   rÀ   r   N)
r<   r‚   r¨   rr   r   r€   rª   ÚfailureResultOfÚtrapÚIOError)rY   rÀ   r˜   r±   s       rZ   Útest_failedReadWhileProducingz3FileBodyProducerTests.test_failedReadWhileProducingû   s¨   € ð	5ð 	5ð 	5ð 	5ð 	5ñ 	5ô 	5ð 	5õ $ J J¡L¤L°$´/ÑBÔBˆØ×*Ò*­<½¹	¼	Ñ+BÔ+BÑCÔCˆØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜XÑ&Ô&×+Ò+­GÑ4Ô4Ð4Ð4Ð4r\   c                óÖ  — d}d}t          ¦   «         }t          |¦  «        }t          |¦  «        }t          || j        |¦  «        }|                     |¦  «        }|                     ¦   «          |                      |j        ¦  «          | j         	                    d¦  «        ¦   «          |  
                    d|                     ¦   «         ¦  «         |                      |¦  «         dS )z�
        When the L{Deferred} returned by L{FileBodyProducer.startProducing} is
        cancelled, the input file is closed and the task is stopped.
        r¥   r¦   r   r\   N)r   rr   r<   r‚   r¨   Úcancelr…   r·   r€   rª   r–   r«   ÚassertNoResult©rY   r­   r®   r¯   r°   rž   r˜   r±   s           rZ   Útest_cancelWhileProducingz/FileBodyProducerTests.test_cancelWhileProducing  sÔ   € ð
 )ˆØˆÝ‘”ˆÝ Ñ'Ô'ˆÝ˜NÑ+Ô+ˆ	Ý# I¨t¬ÀÑIÔIˆØ×*Ò*¨8Ñ4Ô4ˆØ�ŠÑÔÐØ�Š˜	Ô(Ñ)Ô)Ð)ØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜˜fŸošoÑ/Ô/Ñ0Ô0Ð0Ø×Ò˜HÑ%Ô%Ð%Ð%Ð%r\   c                óÖ  — d}d}t          ¦   «         }t          |¦  «        }t          |¦  «        }t          || j        |¦  «        }|                     |¦  «        }|                     ¦   «          |                      |j        ¦  «          | j         	                    d¦  «        ¦   «          |  
                    d|                     ¦   «         ¦  «         |                      |¦  «         dS )a  
        L{FileBodyProducer.stopProducing} stops the underlying L{IPullProducer}
        and the cooperative task responsible for calling C{resumeProducing} and
        closes the input file but does not cause the L{Deferred} returned by
        C{startProducing} to fire.
        r¥   r¦   r   r\   N©r   rr   r<   r‚   r¨   ÚstopProducingr…   r·   r€   rª   r–   r«   rÇ   rÈ   s           rZ   Útest_stopProducingz(FileBodyProducerTests.test_stopProducing  sÖ   € ð )ˆØˆÝ‘”ˆÝ Ñ'Ô'ˆÝ˜NÑ+Ô+ˆ	Ý# I¨t¬ÀÑIÔIˆØ×*Ò*¨8Ñ4Ô4ˆØ×ÒÑ Ô Ð Ø�Š˜	Ô(Ñ)Ô)Ð)ØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜˜fŸošoÑ/Ô/Ñ0Ô0Ð0Ø×Ò˜HÑ%Ô%Ð%Ð%Ð%r\   c                óˆ  — d}d}t          ¦   «         }t          |¦  «        }t          t          |¦  «        | j        |¦  «        }|                     |¦  «        } | j                             d¦  «        ¦   «          |                      |                     ¦   «         |dd…         ¦  «         | 	                    ¦   «           | j                             d¦  «        ¦   «          |                      |                     ¦   «         |dd…         ¦  «         |                      g | j        ¦  «         |  
                    |¦  «         dS )zŽ
        L{FileBodyProducer.pauseProducing} temporarily suspends writing bytes
        from the input file to the given L{IConsumer}.
        r¥   r›   r   N)r   rr   r<   r‚   r¨   r€   rª   r–   r«   ÚpauseProducingrÇ   )rY   r­   r®   r¯   r°   r˜   r±   s          rZ   Útest_pauseProducingz)FileBodyProducerTests.test_pauseProducing2  s(  € ð
 )ˆØˆÝ‘”ˆÝ Ñ'Ô'ˆÝ#¥G¨NÑ$;Ô$;¸T¼_ÈhÑWÔWˆØ×*Ò*¨8Ñ4Ô4ˆØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜ŸšÑ*Ô*¨N¸2¸A¸2Ô,>Ñ?Ô?Ð?Ø×ÒÑ!Ô!Ð!ð 	ˆŒ×Ò˜AÑÔÑ Ô Ð ð 	×Ò˜ŸšÑ*Ô*¨N¸2¸A¸2Ô,>Ñ?Ô?Ð?Ø×Ò˜˜Tœ_Ñ-Ô-Ð-Ø×Ò˜HÑ%Ô%Ð%Ð%Ð%r\   c                óV  — d}d}t          ¦   «         }t          |¦  «        }t          t          |¦  «        | j        |¦  «        }|                     |¦  «          | j                             d¦  «        ¦   «          |                      |d|…         |                     ¦   «         ¦  «         | 	                    ¦   «          | 
                    ¦   «           | j                             d¦  «        ¦   «          |                      |d|dz  …         |                     ¦   «         ¦  «         dS )zÖ
        L{FileBodyProducer.resumeProducing} re-commences writing bytes from the
        input file to the given L{IConsumer} after it was previously paused
        with L{FileBodyProducer.pauseProducing}.
        r¥   r›   r   Nr¶   )r   rr   r<   r‚   r¨   r€   rª   r–   r«   rÏ   ÚresumeProducing)rY   r­   r®   r¯   r°   r˜   s         rZ   Útest_resumeProducingz*FileBodyProducerTests.test_resumeProducingL  s  € ð )ˆØˆÝ‘”ˆÝ Ñ'Ô'ˆÝ#¥G¨NÑ$;Ô$;¸T¼_ÈhÑWÔWˆØ×Ò Ñ)Ô)Ð)ØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜¨	¨¨	Ô2°F·O²OÑ4EÔ4EÑFÔFÐFØ×ÒÑ!Ô!Ð!Ø× Ò Ñ"Ô"Ð"ØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜¨¨(°Q©,¨Ô7¸¿ºÑ9JÔ9JÑKÔKÐKÐKÐKr\   c                óþ  — d}d}t          ¦   «         }t          |¦  «        }t          |¦  «        }t          || j        |¦  «        }|                     |¦  «        }|                     ¦   «          |                     ¦   «          |                      |j        ¦  «          | j         	                    d¦  «        ¦   «          |  
                    d|                     ¦   «         ¦  «         |                      |¦  «         dS )zv
        L{FileBodyProducer.stopProducing} can be called more than once without
        raising an exception.
        s   testr¦   r   r\   NrË   rÈ   s           rZ   Útest_multipleStopz'FileBodyProducerTests.test_multipleStop_  sè   € ð
 !ˆØˆÝ‘”ˆÝ Ñ'Ô'ˆÝ˜NÑ+Ô+ˆ	Ý# I¨t¬ÀÑIÔIˆØ×*Ò*¨8Ñ4Ô4ˆØ×ÒÑ Ô Ð Ø×ÒÑ Ô Ð Ø�Š˜	Ô(Ñ)Ô)Ð)ØˆŒ×Ò˜AÑÔÑ Ô Ð Ø×Ò˜˜fŸošoÑ/Ô/Ñ0Ô0Ð0Ø×Ò˜HÑ%Ô%Ð%Ð%Ð%r\   N)r]   r^   r_   rp   r~   rƒ   r†   r™   rŸ   r£   r³   r¸   rÄ   rÉ   rÍ   rÐ   rÓ   rÕ   r`   r\   rZ   rz   rz   “   sù   € € € € € ðð ð
ð ð ðUð Uð UðUð Uð Uð:ð :ð :ð(.ð .ð .ð>ð >ð >ð?ð ?ð ?ð$*ð *ð *ð5ð 5ð 5ð"&ð &ð &ð$&ð &ð &ð(&ð &ð &ð4Lð Lð Lð&&ð &ð &ð &ð &r\   rz   ú	127.0.0.7ú::7z	127.0.0.8z	127.0.0.9z
127.0.0.10z
127.0.0.11c                  ó>   — e Zd ZdZd„ Z G d„ d¦  «        Zd„ Zd„ ZdS )ÚFakeReactorAndConnectMixinz‘
    A test mixin providing a testable C{Reactor} class and a dummy C{connect}
    method which allows instances to pretend to be endpoints.
    c                óÒ   — t          ¦   «         }t          |t          gt          gt          gt
          gt          gt          gdgdgdœ¬¦  «        }|j        |_        |j	        |_	        |S )af  
        Create a L{MemoryReactorClock} and give it some hostnames it can
        resolve.

        @return: a L{MemoryReactorClock}-like object with a slightly limited
            interface (only C{advance} and C{tcpClients} in addition to its
            formally-declared reactor interfaces), which can resolve a fixed
            set of domains.
        rÖ   r×   )úexample.comzipv6.example.comzexample.netzexample.orgÚfoozfoo.comrÖ   r×   )ÚhostMap)
r%   r"   ÚEXAMPLE_COM_IPÚEXAMPLE_COM_V6_IPÚEXAMPLE_NET_IPÚEXAMPLE_ORG_IPÚFOO_LOCAL_IPÚ
FOO_COM_IPÚ
tcpClientsÚadvance)rY   ÚmrcÚdrrs      rZ   ÚcreateReactorz(FakeReactorAndConnectMixin.createReactor�  su   € õ !Ñ"Ô"ˆÝ+Øå .Ð/Ý%6Ð$7Ý .Ð/Ý .Ð/Ý$�~Ý&˜<Ø)˜]Ø�wð	ð 	ð
ñ 
ô 
ˆð  œˆŒØ”kˆŒØˆ
r\   c                  ó   — e Zd ZdZd„ Zd„ ZdS )ú'FakeReactorAndConnectMixin.StubEndpointz¤
        Endpoint that wraps existing endpoint, substitutes StubHTTPProtocol, and
        resulting protocol instances are attached to the given test case.
        c                ó¼   ‡ — |‰ _         |‰ _        d„ }t          |t          ‰ j         ¦  «        ¦  «        ‰ _        t          ¦   «         ‰ _        ˆ fd„‰ j        _        d S )Nc                 ó   — dS )zthis function does nothingNr`   r`   r\   rZ   ÚnothingzAFakeReactorAndConnectMixin.StubEndpoint.__init__.<locals>.nothingª  s   € € € r\   c                ó   •— ‰j         S rt   )Úprotocol)ÚaddrrY   s    €rZ   r}   zBFakeReactorAndConnectMixin.StubEndpoint.__init__.<locals>.<lambda>¯  s	   ø€ °d´m€ r\   )ÚendpointÚtestCaserA   ÚreprÚfactoryrb   rï   ÚbuildProtocol)rY   rñ   rò   rí   s   `   rZ   rj   z0FakeReactorAndConnectMixin.StubEndpoint.__init__¦  sc   ø€ Ø$ˆDŒMØ$ˆDŒMð1ð 1ð 1õ 0°½¸d¼mÑ9LÔ9LÑMÔMˆDŒLÝ,Ñ.Ô.ˆDŒMØ)CÐ)CÐ)CÐ)CˆDŒLÔ&Ð&Ð&r\   c                óŠ   — | j         | j        _         | j                             | j        ¦  «         t          | j         ¦  «        S rt   )rï   rò   rñ   Úconnectrô   r   )rY   ÚignoredFactorys     rZ   r÷   z/FakeReactorAndConnectMixin.StubEndpoint.connect±  s6   € Ø%)¤]ˆDŒMÔ"ØŒM×!Ò! $¤,Ñ/Ô/Ð/Ý˜4œ=Ñ)Ô)Ð)r\   N)r]   r^   r_   rp   rj   r÷   r`   r\   rZ   ÚStubEndpointrê      s?   € € € € € ð	ð 	ð
		Dð 		Dð 		Dð	*ð 	*ð 	*ð 	*ð 	*r\   rù   c                óV   ‡ ‡— t          j        |¦  «        }|j        Šˆˆ fd„|_        |S )zŠ
        Return an Agent suitable for use in tests that wrap the Agent and want
        both a fake reactor and StubHTTPProtocol.
        c                 ó6   •— ‰                       ‰| Ž ‰¦  «        S rt   )rù   )ÚargsÚ_oldGetEndpointrY   s    €€rZ   r}   zEFakeReactorAndConnectMixin.buildAgentForWrapperTest.<locals>.<lambda>½  s"   ø€ Ø×Ò˜o˜o¨tÐ4°dÑ;Ô;ð r\   )r0   ÚAgentÚ_getEndpoint)rY   ÚreactorÚagentrý   s   `  @rZ   ÚbuildAgentForWrapperTestz3FakeReactorAndConnectMixin.buildAgentForWrapperTest¶  sB   øø€ õ
 ”˜WÑ%Ô%ˆØÔ,ˆð
ð 
ð 
ð 
ð 
ˆÔð ˆr\   c                ót   — t          ¦   «         }|                     d¦  «         || _        t          |¦  «        S )zž
        Fake implementation of an endpoint which synchronously
        succeeds with an instance of L{StubHTTPProtocol} for ease of
        testing.
        N)rb   ÚmakeConnectionrï   r   ©rY   rô   rï   s      rZ   r÷   z"FakeReactorAndConnectMixin.connectÂ  s8   € õ $Ñ%Ô%ˆØ×Ò Ñ%Ô%Ð%Ø ˆŒÝ�xÑ Ô Ð r\   N)r]   r^   r_   rp   rè   rù   r  r÷   r`   r\   rZ   rÙ   rÙ   {  ss   € € € € € ðð ð
ð ð ð>*ð *ð *ð *ð *ñ *ô *ð *ð,
ð 
ð 
ð	!ð 	!ð 	!ð 	!ð 	!r\   rÙ   c                  ó   — e Zd ZdZd„ ZdS )ÚDummyEndpointz1
    An endpoint that uses a fake transport.
    c                óŒ   — |                      d ¦  «        }|                     t          ¦   «         ¦  «         t          |¦  «        S rt   ©rõ   r  r&   r   r  s      rZ   r÷   zDummyEndpoint.connectÓ  s=   € Ø×(Ò(¨Ñ.Ô.ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ý�xÑ Ô Ð r\   N©r]   r^   r_   rp   r÷   r`   r\   rZ   r  r  Î  s-   € € € € € ðð ð!ð !ð !ð !ð !r\   r  c                  ó   — e Zd ZdZd„ ZdS )ÚBadEndpointz/
    An endpoint that shouldn't be called.
    c                ó    — t          d¦  «        ‚)Nz(This endpoint should not have been used.)ÚRuntimeError)rY   rô   s     rZ   r÷   zBadEndpoint.connectÞ  s   € ÝÐEÑFÔFÐFr\   Nr
  r`   r\   rZ   r  r  Ù  s2   € € € € € ðð ðGð Gð Gð Gð Gr\   r  c                  ó   — e Zd ZdZd„ ZeZdS )ÚDummyFactoryz/
    Create C{StubHTTPProtocol} instances.
    c                ó   — d S rt   r`   )rY   ÚquiescentCallbackÚmetadatas      rZ   rj   zDummyFactory.__init__ç  s   € Øˆr\   N)r]   r^   r_   rp   rj   rb   rï   r`   r\   rZ   r  r  â  s.   € € € € € ðð ðð ð ð  €H€H€Hr\   r  c                  óZ   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ ZdS )ÚHTTPConnectionPoolTestsz4
    Tests for the L{HTTPConnectionPool} class.
    c                ó¤   — |                       ¦   «         | _        t          | j        ¦  «        | _        t          | j        _        d| j        _        d S ©NF)rè   ÚfakeReactorr>   Úpoolr  Ú_factoryÚretryAutomaticallyri   s    rZ   rƒ   zHTTPConnectionPoolTests.setUpò  sB   € Ø×-Ò-Ñ/Ô/ˆÔÝ& tÔ'7Ñ8Ô8ˆŒ	Ý)ˆŒ	Ôà',ˆŒ	Ô$Ð$Ð$r\   c                óÊ   ‡ — ‰                       ‰ j        j        i ¦  «         ˆ fd„}d}‰ j                             |t	          ¦   «         ¦  «        }|                     |¦  «        S )z{
        If there are no cached connections,
        L{HTTPConnectionPool.getConnection} returns a new connection.
        c                ó¢   •— ‰                      | t          ¦  «         ‰                     | ‰j        j                             ¦   «         ¦  «         d S rt   )ÚassertIsInstancerb   ÚassertNotInr  Ú_connectionsÚvalues)ÚconnrY   s    €rZ   ÚgotConnectionzMHTTPConnectionPoolTests.test_getReturnsNewIfCacheEmpty.<locals>.gotConnection   sG   ø€ Ø×!Ò! $Õ(8Ñ9Ô9Ð9à×Ò˜T 4¤9Ô#9×#@Ò#@Ñ#BÔ#BÑCÔCÐCÐCÐCr\   éÕ/  )r–   r  r   ÚgetConnectionr  ÚaddCallback)rY   r#  Ú
unknownKeyÚds   `   rZ   Útest_getReturnsNewIfCacheEmptyz6HTTPConnectionPoolTests.test_getReturnsNewIfCacheEmptyù  sr   ø€ ð
 	×Ò˜œÔ/°Ñ4Ô4Ð4ð	Dð 	Dð 	Dð 	Dð 	Dð
 ˆ
ØŒI×#Ò# Jµ±´Ñ@Ô@ˆØ�}Š}˜]Ñ+Ô+Ð+r\   c                ó&  — t          ¦   «         }|                     t          ¦   «         ¦  «         | j                             d|¦  «         |                      |j        j        d¦  «         |                      || j        j	        d         ¦  «         | j
                             d¦  «         |                      |j        j        d¦  «         |                      || j        j	        d         ¦  «         |                      || j        j        ¦  «         | j
                             d¦  «         |                      |j        j        d¦  «         |                      || j        j	        d         ¦  «         |                      || j        j        ¦  «         dS )z´
        If a connection is put back to the pool, a 240-sec timeout is started.

        When the timeout hits, the connection is closed and removed from the
        pool.
        ©Úhttpó   example.coméP   Féï   gš™™™™™ñ?TN)rb   r  r&   r  Ú_putConnectionr–   Ú	transportÚdisconnectingÚassertInr   r  rå   Ú	_timeoutsr  ©rY   rï   s     rZ   Útest_putStartsTimeoutz-HTTPConnectionPoolTests.test_putStartsTimeout	  sc  € õ $Ñ%Ô%ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2ØŒ	× Ò Ð!=¸xÑHÔHÐHð 	×Ò˜Ô+Ô9¸5ÑAÔAÐAØ�Š�h ¤	Ô 6Ð7SÔ TÑUÔUÐUð 	Ô× Ò  Ñ%Ô%Ð%Ø×Ò˜Ô+Ô9¸5ÑAÔAÐAØ�Š�h ¤	Ô 6Ð7SÔ TÑUÔUÐUØ�Š�h ¤	Ô 3Ñ4Ô4Ð4ð 	Ô× Ò  Ñ%Ô%Ð%Ø×Ò˜Ô+Ô9¸4Ñ@Ô@Ð@Ø×Ò˜ 4¤9Ô#9Ð:VÔ#WÑXÔXÐXØ×Ò˜ 4¤9Ô#6Ñ7Ô7Ð7Ð7Ð7r\   c                ó|  — | j         }t          ¦   «         t          ¦   «         g}|D ]9}|                     t          ¦   «         ¦  «         |                     d|¦  «         Œ:|                      |j        d         |¦  «         |j                             ¦   «         }t          ¦   «         }|                     t          ¦   «         ¦  «         |                     d|¦  «         |j        d         }|                      t          |¦  «        d¦  «         |                      ||d         |g¦  «         |                      d„ |D ¦   «         ddg¦  «         |                      |d         j
        j        d¦  «         |                      ||d                  j        ¦  «         |                      |d         |j        ¦  «         dS )	zÍ
        If an idle connection is put back in the cache and the max number of
        persistent connections has been exceeded, one of the connections is
        closed and removed from the cache.
        r+  r¶   r§   c                ó&   — g | ]}|j         j        ‘ŒS r`   )r1  r2  )Ú.0Úps     rZ   ú
<listcomp>zHHTTPConnectionPoolTests.test_putExceedsMaxPersistent.<locals>.<listcomp>>  s   € ÐGÐGÐG¸˜!œ+Ô3ÐGÐGÐGr\   Fr   TN)r  rb   r  r&   r0  r–   r   r4  Úcopyrœ   r1  r2  r…   Ú	cancelledr  )rY   r  Ú
origCachedr:  ÚtimeoutsÚnewProtocolÚ	newCacheds          rZ   Útest_putExceedsMaxPersistentz4HTTPConnectionPoolTests.test_putExceedsMaxPersistent%  s®  € ð Œyˆõ 'Ñ(Ô(Õ*:Ñ*<Ô*<Ð=ˆ
Øð 	Að 	AˆAØ×Ò�_Ñ.Ô.Ñ/Ô/Ð/Ø×ÒÐ <¸aÑ@Ô@Ð@Ð@Ø×Ò˜Ô*Ð+GÔHÈ*ÑUÔUÐUØ”>×&Ò&Ñ(Ô(ˆõ 'Ñ(Ô(ˆØ×"Ò"¥?Ñ#4Ô#4Ñ5Ô5Ð5Ø×ÒÐ8¸+ÑFÔFÐFð Ô%Ð&BÔCˆ	Ø×Ò�˜Y™œ¨Ñ+Ô+Ð+Ø×Ò˜ Z°¤]°KÐ$@ÑAÔAÐAØ×ÒÐGÐG¸YÐGÑGÔGÈ%ÐQVÈÑXÔXÐXØ×Ò˜ AœÔ0Ô>ÀÑEÔEÐEØ�Š˜ ¨A¤Ô/Ô9Ñ:Ô:Ð:Ø×Ò˜ Aœ¨¬Ñ7Ô7Ð7Ð7Ð7r\   c                óâ  ‡ — ˆ fd„}g }|                       |ddd¦  «        ¦  «         |                       |ddd¦  «        ¦  «          |ddd¦  «          |ddd¦  «         ‰                      ‰ j        j        d         |¦  «         ‰                      t	          ‰ j        j        d	         ¦  «        d
¦  «         ‰                      t	          ‰ j        j        d         ¦  «        d
¦  «         dS )z‰
        C{maxPersistentPerHost} is enforced per C{(scheme, host, port)}:
        different keys have different max connections.
        c                ó¢   •— t          ¦   «         }|                     t          ¦   «         ¦  «         ‰j                             | ||f|¦  «         |S rt   )rb   r  r&   r  r0  )ÚschemeÚhostÚportr:  rY   s       €rZ   ÚaddProtocolzFHTTPConnectionPoolTests.test_maxPersistentPerHost.<locals>.addProtocolI  sL   ø€ Ý Ñ"Ô"ˆAØ×Ò�_Ñ.Ô.Ñ/Ô/Ð/ØŒI×$Ò$ f¨d°DÐ%9¸1Ñ=Ô=Ð=ØˆHr\   r,  r-  r.  Úhttpsé»  ó   www2.example.comr+  )rI  r-  rJ  r§   )r,  rK  r.  N)rl   r–   r  r   rœ   )rY   rH  Ú
persistents   `  rZ   Útest_maxPersistentPerHostz1HTTPConnectionPoolTests.test_maxPersistentPerHostC  s  ø€ ð	ð 	ð 	ð 	ð 	ð ˆ
Ø×Ò˜+˜+ f¨n¸bÑAÔAÑBÔBÐBØ×Ò˜+˜+ f¨n¸bÑAÔAÑBÔBÐBØˆ�G˜^¨SÑ1Ô1Ð1Øˆ�FÐ/°Ñ4Ô4Ð4à×ÒØŒIÔ"Ð#?Ô@À*ñ	
ô 	
ð 	
ð 	×Ò�˜TœYÔ3Ð4RÔSÑTÔTÐVWÑXÔXÐXØ×ÒÝ�”	Ô&Ð'HÔIÑJÔJÈAñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó  ‡ ‡— t          ¦   «         Š‰                     t          ¦   «         ¦  «         ‰ j                             d‰¦  «         ˆˆ fd„}‰ j                             dt          ¦   «         ¦  «                             |¦  «        S )zœ
        Getting an address which has a cached connection returns the cached
        connection, removes it from the cache and cancels its timeout.
        r+  c                ó4  •— ‰                      ‰| ¦  «         ‰                     | ‰j        j        d         ¦  «         ‰j                             d¦  «         ‰                     | j        j        d¦  «         ‰                     | ‰j        j	        ¦  «         d S )Nr+  éñ   F)
ÚassertIdenticalr  r  r   r  rå   r–   r1  r2  r4  )r"  rï   rY   s    €€rZ   r#  zGHTTPConnectionPoolTests.test_getCachedConnection.<locals>.gotConnectiong  s�   ø€ à× Ò  ¨4Ñ0Ô0Ð0Ø×Ò˜T 4¤9Ô#9Ð:VÔ#WÑXÔXÐXàÔ×$Ò$ SÑ)Ô)Ð)Ø×Ò˜Tœ^Ô9¸5ÑAÔAÐAØ×Ò˜T 4¤9Ô#6Ñ7Ô7Ð7Ð7Ð7r\   )rb   r  r&   r  r0  r%  r  r&  )rY   r#  rï   s   ` @rZ   Útest_getCachedConnectionz0HTTPConnectionPoolTests.test_getCachedConnection]  s—   øø€ õ $Ñ%Ô%ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2ØŒ	× Ò Ð!=¸xÑHÔHÐHð	8ð 	8ð 	8ð 	8ð 	8ð 	8ð Œy×&Ò&Ø(Ý‰MŒMñ
ô 
÷ Š+�mÑ
$Ô
$ð	%r\   c                ó&  ‡ ‡‡— t          ¦   «         Š‰                     t          ¦   «         ¦  «         dŠ‰ j                             ‰‰¦  «         ˆˆˆ fd„}‰ j                             ‰t          ¦   «         ¦  «        }|                     |¦  «        S )zR
        The pool's C{_newConnection} method constructs a new connection.
        r$  c                óä   •— ‰                      ‰| ¦  «         ‰                     ‰‰j        j        ‰         ¦  «         ‰                     | ‰j        j                             ¦   «         ¦  «         d S rt   )ÚassertNotIdenticalr3  r  r   r  r!  )ÚnewConnectionÚkeyrï   rY   s    €€€rZ   r#  zAHTTPConnectionPoolTests.test_newConnection.<locals>.gotConnection  sd   ø€ à×#Ò# H¨mÑ<Ô<Ð<à�MŠM˜( D¤IÔ$:¸3Ô$?Ñ@Ô@Ð@à×Ò˜]¨D¬IÔ,B×,IÒ,IÑ,KÔ,KÑLÔLÐLÐLÐLr\   )rb   r  r&   r  r0  Ú_newConnectionr  r&  )rY   r#  r(  rW  rï   s   `  @@rZ   Útest_newConnectionz*HTTPConnectionPoolTests.test_newConnectionu  s¢   øøø€ õ
 $Ñ%Ô%ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2ØˆØŒ	× Ò   hÑ/Ô/Ð/ð	Mð 	Mð 	Mð 	Mð 	Mð 	Mð 	Mð ŒI×$Ò$ S­-©/¬/Ñ:Ô:ˆØ�}Š}˜]Ñ+Ô+Ð+r\   c                ób  — | j         }d}t          ¦   «         t          ¦   «         g}|D ]9}|                     t          ¦   «         ¦  «         |                     ||¦  «         Œ:|                      |j        |         |¦  «         d|d         _        g }| j                              |t          ¦   «         ¦  «         
                    |j        ¦  «         |                      |d         |d         ¦  «         |                      |j        |         g ¦  «         |                      |j        i ¦  «         dS )z{
        When getting connections out of the cache, disconnected connections
        are removed and not returned.
        r+  ÚDISCONNECTEDr   r§   N)r  rb   r  r&   r0  r–   r   rh   r%  r  r&  rl   rQ  r4  )rY   r  rW  r>  r:  rn   s         rZ   Útest_getSkipsDisconnectedz1HTTPConnectionPoolTests.test_getSkipsDisconnectedŠ  s&  € ð
 ŒyˆØ*ˆõ 'Ñ(Ô(Õ*:Ñ*<Ô*<Ð=ˆ
Øð 	(ð 	(ˆAØ×Ò�_Ñ.Ô.Ñ/Ô/Ð/Ø×Ò  QÑ'Ô'Ð'Ð'Ø×Ò˜Ô*¨3Ô/°Ñ<Ô<Ð<ð -ˆ
�1ŒÔð ˆØŒ	×Ò ¥[¡]¤]Ñ3Ô3×?Ò?ÀÄÑNÔNÐNØ×Ò˜V AœY¨
°1¬Ñ6Ô6Ð6ð 	×Ò˜Ô*¨3Ô/°Ñ4Ô4Ð4Ø×Ò˜œ¨Ñ,Ô,Ð,Ð,Ð,r\   c                ó`  — t          ¦   «         }|                      |j        d¦  «         t          j        | t
          ¦  «        }d|_        | j                             d|¦  «         |                      dt          |¦  «        ¦  «         |d         }|d         }|  
                    |j        t          ¦  «         |                      |                     ¦   «         d¦  «         |                      d| j        j                             d¦  «        ¦  «         |                      t          ¦  «         dS )	ze
        If a non-quiescent connection is put back in the cache, an error is
        logged.
        rf   ÚNOTQUIESCENTr+  r§   r   Úlog_failurez5BUG: Non-quiescent protocol added to connection pool.N)rb   r–   rh   r$   ÚcreateWithCleanupr'   r  r0  ÚassertEqualsrœ   r  Úvaluer  ÚgetErrorMessagerQ  r   ÚgetÚflushLoggedErrors)rY   rï   ÚlogObserverÚeventÚfs        rZ   Útest_putNotQuiescentz,HTTPConnectionPoolTests.test_putNotQuiescent¦  s  € õ
 $Ñ%Ô%ˆà×Ò˜œ¨Ñ5Ô5Ð5å*Ô<¸TÕCUÑVÔVˆà'ˆŒØŒ	× Ò Ð!=¸xÑHÔHÐHØ×Ò˜!�S Ñ-Ô-Ñ.Ô.Ð.à˜A”ˆØ�-Ô ˆà×Ò˜aœg¥|Ñ4Ô4Ð4Ø×ÒØ×ÒÑÔÐ!Xñ	
ô 	
ð 	
ð 	×ÒØ�$”)Ô(×,Ò,Ð-IÑJÔJñ	
ô 	
ð 	
ð 	×Ò�|Ñ,Ô,Ð,Ð,Ð,r\   c                óò  —  G d„ d¦  «        }t          | j        d¦  «        }d|_        g }d}|                     | |¦   «         ¦  «                             |j        ¦  «         |d         }|                      |t          ¦  «         d|_        | 	                    |¦  «         g }|                     | |¦   «         ¦  «                             |j        ¦  «         |  
                    |d         |¦  «         dS )	aI  
        When L{HTTPConnectionPool.getConnection} connects, it returns a
        C{Deferred} that fires with an instance of L{HTTP11ClientProtocol}
        that has the correct quiescent callback attached. When this callback
        is called the protocol is returned to the cache correctly, using the
        right key.
        c                  ó   — e Zd Zd„ ZdS )úMHTTPConnectionPoolTests.test_getUsesQuiescentCallback.<locals>.StringEndpointc                óŒ   — |                      d ¦  «        }|                     t          ¦   «         ¦  «         t          |¦  «        S rt   r	  )rY   rô   r:  s      rZ   r÷   zUHTTPConnectionPoolTests.test_getUsesQuiescentCallback.<locals>.StringEndpoint.connectË  s;   € Ø×)Ò)¨$Ñ/Ô/�Ø× Ò ¥Ñ!2Ô!2Ñ3Ô3Ð3Ý˜q‘z”zÐ!r\   N©r]   r^   r_   r÷   r`   r\   rZ   ÚStringEndpointrl  Ê  s#   € € € € € ð"ð "ð "ð "ð "r\   ro  TFza keyr   rf   N)r>   r  r  r%  r&  rl   r  r3   Ú_stateÚ_quiescentCallbackrQ  )rY   ro  r  rn   rW  rï   Úresult2s          rZ   Útest_getUsesQuiescentCallbackz5HTTPConnectionPoolTests.test_getUsesQuiescentCallbackÁ  s  € ð	"ð 	"ð 	"ð 	"ð 	"ñ 	"ô 	"ð 	"õ " $Ô"2°DÑ9Ô9ˆØ"'ˆÔØˆØˆØ×Ò˜3  Ñ 0Ô 0Ñ1Ô1×=Ò=¸f¼mÑLÔLÐLØ˜!”9ˆØ×Ò˜hÕ(<Ñ=Ô=Ð=ð &ˆŒØ×#Ò# HÑ-Ô-Ð-ð
 ˆØ×Ò˜3  Ñ 0Ô 0Ñ1Ô1×=Ò=¸g¼nÑMÔMÐMØ×Ò˜W QœZ¨Ñ2Ô2Ð2Ð2Ð2r\   c                óF  ‡ ‡— g Šˆˆ fd„} |ddd¦  «          |ddd¦  «         ‰ j                              ¦   «         }‰D ]"}‰                      |j        j        d¦  «         Œ#‰                      ‰ j         j        i ¦  «         ‰ j                             ¦   «         D ]}‰                      |j        d¦  «         Œ‰                      ‰ j         j	        i ¦  «         g }| 
                    |j        ¦  «         ‰                      |g ¦  «         ‰d                              t          t          ¦   «         ¦  «        ¦  «         ‰                      |g ¦  «         ‰d                              t          t          ¦   «         ¦  «        ¦  «         ‰                      |d	g¦  «         d	S )
zÙ
        L{HTTPConnectionPool.closeCachedConnections} closes all cached
        connections and removes them from the cache. It returns a Deferred
        that fires when they have all lost their connections.
        c                óÌ   •— t          ¦   «         }|                     t          ¦   «         ¦  «         ‰j                             | ||f|¦  «         ‰                     |¦  «         d S rt   )r3   r  r&   r  r0  rl   )rE  rF  rG  r:  rL  rY   s       €€rZ   rH  zHHTTPConnectionPoolTests.test_closeCachedConnections.<locals>.addProtocolì  sa   ø€ Ý$Ñ&Ô&ˆAØ×Ò�_Ñ.Ô.Ñ/Ô/Ð/ØŒI×$Ò$ f¨d°DÐ%9¸1Ñ=Ô=Ð=Ø×Ò˜aÑ Ô Ð Ð Ð r\   r,  r-  r.  rK  Tr   r§   N)r  ÚcloseCachedConnectionsr–   r1  r2  r   r  ÚgetDelayedCallsr=  r4  r&  rl   ÚconnectionLostr*   r   )rY   rH  ÚdoneDeferredr:  Údcrn   rL  s   `     @rZ   Útest_closeCachedConnectionsz3HTTPConnectionPoolTests.test_closeCachedConnectionsä  s¸  øø€ ð ˆ
ð	!ð 	!ð 	!ð 	!ð 	!ð 	!ð 	ˆ�F˜N¨BÑ/Ô/Ð/Øˆ�FÐ/°Ñ4Ô4Ð4Ø”y×7Ò7Ñ9Ô9ˆð ð 	>ð 	>ˆAØ×Ò˜Qœ[Ô6¸Ñ=Ô=Ð=Ð=Ø×Ò˜œÔ/°Ñ4Ô4Ð4àÔ"×2Ò2Ñ4Ô4ð 	1ð 	1ˆBØ×Ò˜Rœ\¨4Ñ0Ô0Ð0Ð0Ø×Ò˜œÔ,¨bÑ1Ô1Ð1ð ˆØ× Ò  ¤Ñ/Ô/Ð/Ø×Ò˜ Ñ$Ô$Ð$Ø�1Œ×$Ò$¥W­^Ñ-=Ô-=Ñ%>Ô%>Ñ?Ô?Ð?Ø×Ò˜ Ñ$Ô$Ð$Ø�1Œ×$Ò$¥W­^Ñ-=Ô-=Ñ%>Ô%>Ñ?Ô?Ð?Ø×Ò˜ $ Ñ(Ô(Ð(Ð(Ð(r\   c                óV  ‡— |                       | j        j        i ¦  «         t          ¦   «         Š G ˆfd„d¦  «        }| j                             d |¦   «         ¦  «        }|                     ¦   «          |                       |                      ‰¦  «        j        t          ¦  «         dS )zÄ
        Cancelling the C{Deferred} returned from
        L{HTTPConnectionPool.getConnection} cancels the C{Deferred} returned
        by opening a new connection with the given endpoint.
        c                  ó   •— e Zd Zˆ fd„ZdS )úXHTTPConnectionPoolTests.test_cancelGetConnectionCancelsEndpointConnect.<locals>.Endpointc                ó   •— ‰S rt   r`   )rY   rô   ÚconnectionResults     €rZ   r÷   z`HTTPConnectionPoolTests.test_cancelGetConnectionCancelsEndpointConnect.<locals>.Endpoint.connect  s	   ø€ Ø'Ð'r\   Nrn  )r€  s   €rZ   ÚEndpointr~    s.   ø€ € € € € ð(ð (ð (ð (ð (ð (ð (r\   r�  i90  N)	r–   r  r   r   r%  rÆ   rÁ   Útyper   )rY   r�  r(  r€  s      @rZ   Ú.test_cancelGetConnectionCancelsEndpointConnectzFHTTPConnectionPoolTests.test_cancelGetConnectionCancelsEndpointConnect  s¶   ø€ ð 	×Ò˜œÔ/°Ñ4Ô4Ð4Ý#™:œ:Ðð	(ð 	(ð 	(ð 	(ð 	(ð 	(ð 	(ñ 	(ô 	(ð 	(ð ŒI×#Ò# E¨8¨8©:¬:Ñ6Ô6ˆØ	�Š‰
Œ
ˆ
Ø×Ò˜×-Ò-Ð.>Ñ?Ô?ÔDÅnÑUÔUÐUÐUÐUr\   N)r]   r^   r_   rp   rƒ   r)  r6  rB  rM  rR  rY  r\  ri  rs  r{  rƒ  r`   r\   rZ   r  r  í  sÙ   € € € € € ðð ð-ð -ð -ð,ð ,ð ,ð 8ð 8ð 8ð88ð 8ð 8ð<
ð 
ð 
ð4%ð %ð %ð0,ð ,ð ,ð*-ð -ð -ð8-ð -ð -ð6!3ð !3ð !3ðF")ð ")ð ")ðHVð Vð Vð Vð Vr\   r  c                  ó   — e Zd ZdZd„ ZdS )ÚAgentTestsMixinz1
    Tests for any L{IAgent} implementation.
    c                óz   — |                       t          t          |                      ¦   «         ¦  «        ¦  «         dS )z6
        The agent object provides L{IAgent}.
        N)r…   r   rE   Ú	makeAgentri   s    rZ   r†   zAgentTestsMixin.test_interface  s0   € ð 	�Š�¥V¨T¯^ª^Ñ-=Ô-=Ñ>Ô>Ñ?Ô?Ð?Ð?Ð?r\   N)r]   r^   r_   rp   r†   r`   r\   rZ   r…  r…    s2   € € € € € ðð ð@ð @ð @ð @ð @r\   r…  c                  óD   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ej	        dfd„Z
d	S )
ÚIntegrationTestingMixinzG
    Transport-to-Agent integration tests for both HTTP and HTTPS.
    c                óH   — |                       dt          t          ¦  «         dS )z+
        L{Agent} works over IPv4.
        r-  N)ÚintegrationTestrÞ   r   ri   s    rZ   Útest_integrationTestIPv4z0IntegrationTestingMixin.test_integrationTestIPv4+  s"   € ð 	×Ò˜^­^½[ÑIÔIÐIÐIÐIr\   c                ó>   — |                       ddt          ¦  «         dS )zL
        L{Agent} works over IPv4 when hostname is an IPv4 address.
        s	   127.0.0.7rÖ   N)r‹  r   ri   s    rZ   Útest_integrationTestIPv4Addressz7IntegrationTestingMixin.test_integrationTestIPv4Address1  s"   € ð 	×Ò˜\¨;½ÑDÔDÐDÐDÐDr\   c                óH   — |                       dt          t          ¦  «         dS )z+
        L{Agent} works over IPv6.
        s   ipv6.example.comN)r‹  rß   r   ri   s    rZ   Útest_integrationTestIPv6z0IntegrationTestingMixin.test_integrationTestIPv67  s$   € ð 	×ÒÐ0Õ2CÅ[ÑQÔQÐQÐQÐQr\   c                ó>   — |                       ddt          ¦  «         dS )zL
        L{Agent} works over IPv6 when hostname is an IPv6 address.
        s   [::7]r×   N)r‹  r   ri   s    rZ   Útest_integrationTestIPv6Addressz7IntegrationTestingMixin.test_integrationTestIPv6Address=  s"   € ð 	×Ò˜X u­kÑ:Ô:Ð:Ð:Ð:r\   c                ó   — | S rt   r`   )ÚserverÚ_s     rZ   r}   z IntegrationTestingMixin.<lambda>H  s   € ¨€ r\   ó   httpc                óH  ‡‡— |                       ¦   «         Št          r|                      t          dˆfd„¦  «          |‰¦  «        }|                     d|dz   |z   dz   ¦  «        }‰j        d         \  }	}
}}}|                      |	|¦  «          |d|	|
¦  «        }|                     |¦  «        }t          |d|¬	¦  «        }| 	                    |¦  «         t          j        ˆfd
„¦   «         Šd‰_        d‰_         |‰‰¦  «                             d¦  «        }t          |d¦  «        }| 	                    |¦  «         t          ||||d‰¬¦  «        }|                     ¦   «          |                      |¦  «         ‰j        j                             d¦  «        }|                      |d                              d¦  «        |d         ¦  «         t+          d„ |dd…         D ¦   «         ¦  «        }|                      |d         |¦  «         |                      |¦  «         ‰j        j                             d¦  «         |                     ¦   «          |                      |¦  «        }|                      |j                             d¦  «        d         d¦  «         dS )a®  
        L{Agent} will make a TCP connection, send an HTTP request, and return a
        L{Deferred} that fires when the response has been received.

        @param hostName: The hostname to interpolate into the URL to be
            requested.
        @type hostName: L{bytes}

        @param expectedAddress: The expected address string.
        @type expectedAddress: L{bytes}

        @param addressType: The class to construct an address out of.
        @type addressType: L{type}

        @param serverWrapper: A callable that takes a protocol factory and a
            ``Clock`` and returns a protocol factory; used to wrap the server /
            responder side in a TLS server.
        @type serverWrapper:
            serverWrapper(L{twisted.internet.interfaces.IProtocolFactory}) ->
            L{twisted.internet.interfaces.IProtocolFactory}

        @param createAgent: A callable that takes a reactor and produces an
            L{IAgent}; used to construct an agent with an appropriate trust
            root for TLS.
        @type createAgent: createAgent(reactor) -> L{IAgent}

        @param scheme: The scheme to test, C{http} or C{https}
        @type scheme: L{bytes}
        Ú_get_default_clockc                 ó   •— ‰ S rt   r`   )r   s   €rZ   r}   z9IntegrationTestingMixin.integrationTest.<locals>.<lambda>m  s   ø€ ¸'€ r\   ó   GETó   ://ó   /r   ÚTCPF)ÚpeerAddressc                 ó2   •— t          ¦   «         } | ‰_        | S rt   )r#   ÚcurrentProtocol)ÚapÚaccumulators    €rZ   r¢  z<IntegrationTestingMixin.integrationTest.<locals>.accumulatorw  s   ø€ å%Ñ'Ô'ˆBØ*,ˆKÔ'ØˆIr\   NT)Úclocks   
s
   GET / HTTPc                ó>   — g | ]}|¯|                      d d¦  «        ‘ŒS )s   : r§   )Úsplit)r9  Úlines     rZ   r;  z;IntegrationTestingMixin.integrationTest.<locals>.<listcomp>Ž  s+   € ÐKÐKÐK°ÀdÐK˜Ÿ
š
 5¨!Ñ,Ô,ÐKÐKÐKr\   r§   ó   HostsL   HTTP/1.1 200 OK
X-An-Header: an-value

Content-length: 12

hello world!s   x-an-headers   an-value)rè   Ú
sslPresentÚpatchrP   rm   rä   r–   rõ   r+   r  r   ÚforProtocolr   ÚprotocolConnectionMader,   ÚflushrÇ   Údatar¥  r…   Ú
startswithÚdictr1  rw   r¬   ra  ÚheadersÚgetRawHeaders)rY   ÚhostNameÚexpectedAddressÚaddressTypeÚserverWrapperÚcreateAgentrE  r  ÚdeferredrF  rG  rô   ÚtimeoutÚbindrž  ÚclientProtocolÚclientTransportÚwrapperÚserverTransportÚpumpÚlinesr°  Úresponser¢  r   s                          @@rZ   r‹  z'IntegrationTestingMixin.integrationTestC  sÈ  øø€ ðL ×$Ò$Ñ&Ô&ˆÝð 	Cð �JŠJ•sÐ0°/°/°/°/ÑBÔBÐBØ�˜GÑ$Ô$ˆØ—=’= ¨°&©¸8Ñ)CÀdÑ)JÑKÔKˆØ-4Ô-?ÀÔ-BÑ*ˆˆd�G˜W dØ×Ò˜˜Ñ/Ô/Ð/Ø!�k %¨¨tÑ4Ô4ˆØ ×.Ò.¨{Ñ;Ô;ˆÝ'¨¸È;ÐWÑWÔWˆØ×%Ò% oÑ6Ô6Ð6å	Ô	ð	ð 	ð 	ð 	ñ 
Ô	ð	ð
 '+ˆÔ#Ø-1ˆÔ*Ø�- ¨WÑ5Ô5×CÒCÀDÑIÔIˆÝ'¨°Ñ6Ô6ˆØ×Ò˜Ñ/Ô/Ð/ÝØØØØØØð
ñ 
ô 
ˆð 	�
Š
‰ŒˆØ×Ò˜HÑ%Ô%Ð%ØÔ+Ô0×6Ò6°wÑ?Ô?ˆØ�Š˜˜aœ×+Ò+¨MÑ:Ô:¸EÀ!¼HÑEÔEÐEÝÐKÐK¸¸q¸r¸r¼ÐKÑKÔKÑLÔLˆØ×Ò˜ Ô)¨8Ñ4Ô4Ð4Ø×Ò˜HÑ%Ô%Ð%ØÔ#Ô-×3Ò3ðñ	
ô 	
ð 	
ð 	�
Š
‰ŒˆØ×'Ò'¨Ñ1Ô1ˆØ×ÒØÔ×*Ò*¨>Ñ:Ô:¸1Ô=¸{ñ	
ô 	
ð 	
ð 	
ð 	
r\   N)r]   r^   r_   rp   rŒ  rŽ  r�  r’  r0   rþ   r‹  r`   r\   rZ   r‰  r‰  &  s�   € € € € € ðð ðJð Jð JðEð Eð EðRð Rð Rð;ð ;ð ;ð /Ð.Ø”LØðX
ð X
ð X
ð X
ð X
ð X
r\   r‰  c                  ó   — e Zd ZdZd„ ZdS )ÚStubEndpointFactoryz=
    A stub L{IAgentEndpointFactory} for use in testing.
    c                ó*   — |j         |j        |j        fS )zØ
        Testing implementation.

        @param uri: A L{URI}.

        @return: C{(scheme, host, port)} of passed in URI; violation of
            interface but useful for testing.
        @rtype: L{tuple}
        )rE  rF  rG  ©rY   Úuris     rZ   ÚendpointForURIz"StubEndpointFactory.endpointForURI¤  s   € ð ”
˜CœH c¤hÐ/Ð/r\   N)r]   r^   r_   rp   rÆ  r`   r\   rZ   rÂ  rÂ  ž  s-   € € € € € ðð ð
0ð 
0ð 
0ð 
0ð 
0r\   rÂ  c                  ó  — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z ee d¦  «        d„ ¦   «         Zd„ Z ee d¦  «        d„ ¦   «         Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d „ Z#d!S )"Ú
AgentTestszA
    Tests for the new HTTP client API provided by L{Agent}.
    c                ó4   — t          j        | j        ¦  «        S )zE
        @return: a new L{twisted.web.client.Agent} instance
        )r0   rþ   r   ri   s    rZ   r‡  zAgentTests.makeAgent¸  s   € õ Œ|˜DœLÑ)Ô)Ð)r\   c                ój   — |                       ¦   «         | _        |                      ¦   «         | _        dS ©úC
        Create an L{Agent} wrapped around a fake reactor.
        N©rè   r   r‡  r  ri   s    rZ   rƒ   zAgentTests.setUp¾  s,   € ð ×)Ò)Ñ+Ô+ˆŒØ—^’^Ñ%Ô%ˆŒ
ˆ
ˆ
r\   c                ó  — t          j        | j        ¦  «        }|                      |j        t
          ¦  «         |                      |j        j        d¦  «         |                      |j	        |j        j	        ¦  «         dS )zV
        If no pool is passed in, the L{Agent} creates a non-persistent pool.
        FN)
r0   rþ   r   r  Ú_poolr>   r–   rL  rQ  Ú_reactor©rY   r  s     rZ   Útest_defaultPoolzAgentTests.test_defaultPoolÅ  sl   € õ ”˜Tœ\Ñ*Ô*ˆØ×Ò˜eœkÕ+=Ñ>Ô>Ð>Ø×Ò˜œÔ/°Ñ7Ô7Ð7Ø×Ò˜Uœ^¨U¬[Ô-AÑBÔBÐBÐBÐBr\   c                ó  ‡ — t          ‰ j        ¦  «        }t          j        ‰ j        |¬¦  «        }ˆ fd„|_        |                     dd¦  «         ‰                      ‰ j        j        d         d         j	        d¦  «         dS )z¶
        If C{persistent} is set to C{True} on the L{HTTPConnectionPool} (the
        default), C{Request}s are created with their C{persistent} flag set to
        C{True}.
        ©r  c                 ó   •— ‰S rt   r`   ©rü   rY   s    €rZ   r}   z,AgentTests.test_persistent.<locals>.<lambda>Ö  ó   ø€ ¨4€ r\   rš  ó   http://127.0.0.1r   TN©
r>   r   r0   rþ   rÿ   rm   r–   rï   rg   rL  ©rY   r  r  s   `  rZ   Útest_persistentzAgentTests.test_persistentÎ  s~   ø€ õ " $¤,Ñ/Ô/ˆÝ”˜Tœ\°Ð5Ñ5Ô5ˆØ/Ð/Ð/Ð/ˆÔØ�Š�fÐ1Ñ2Ô2Ð2Ø×Ò˜œÔ/°Ô2°1Ô5Ô@À$ÑGÔGÐGÐGÐGr\   c                ó  ‡ — t          ‰ j        d¬¦  «        }t          j        ‰ j        |¬¦  «        }ˆ fd„|_        |                     dd¦  «         ‰                      ‰ j        j        d         d         j	        d¦  «         dS )	a§  
        If C{persistent} is set to C{False} when creating the
        L{HTTPConnectionPool}, C{Request}s are created with their
        C{persistent} flag set to C{False}.

        Elsewhere in the tests for the underlying HTTP code we ensure that
        this will result in the disconnection of the HTTP protocol once the
        request is done, so that the connection will not be returned to the
        pool.
        F©rL  rÔ  c                 ó   •— ‰S rt   r`   rÖ  s    €rZ   r}   z/AgentTests.test_nonPersistent.<locals>.<lambda>ç  r×  r\   rš  rØ  r   NrÙ  rÚ  s   `  rZ   Útest_nonPersistentzAgentTests.test_nonPersistentÚ  sƒ   ø€ õ " $¤,¸5ÐAÑAÔAˆÝ”˜Tœ\°Ð5Ñ5Ô5ˆØ/Ð/Ð/Ð/ˆÔØ�Š�fÐ1Ñ2Ô2Ð2Ø×Ò˜œÔ/°Ô2°1Ô5Ô@À%ÑHÔHÐHÐHÐHr\   c                óÊ  ‡ ‡— t          ¦   «         Š G ˆˆ fd„dt          j        ¦  «        } G ˆˆ fd„d¦  «        } |¦   «         } |‰ j        |¬¦  «        }‰                      ||j        ¦  «         t          j        ¦   «         }|                     dd¦  «         t          ¦   «         }| 
                    dd	||¬
¦  «         ‰                      |j        j        d¦  «         dS )zÛ
        When a connection is made by the Agent, it uses its pool's
        C{getConnection} method to do so, with the endpoint returned by
        C{self._getEndpoint}. The key used is C{(scheme, host, port)}.
        c                  ó   •— e Zd Zˆ ˆfd„ZdS )ú:AgentTests.test_connectUsesConnectionPool.<locals>.MyAgentc                óX   •— ‰                      |j        |j        |j        fd¦  «         ‰S )N©r–  ó   foor.  )r–   rE  rF  rG  )ÚthisrÅ  rñ   rY   s     €€rZ   rÿ   zGAgentTests.test_connectUsesConnectionPool.<locals>.MyAgent._getEndpointô  s5   ø€ Ø× Ò Ø”Z ¤¨3¬8Ð4Ð6Kñô ð ð  �r\   N)r]   r^   r_   rÿ   ©rñ   rY   s   €€rZ   ÚMyAgentrâ  ó  s3   ø€ € € € € ð ð  ð  ð  ð  ð  ð  ð  r\   rè  c                  ó$   •— e Zd ZdZdZˆ ˆfd„ZdS )ú<AgentTests.test_connectUsesConnectionPool.<locals>.DummyPoolFc                óª   •— d| _         ‰                     |‰¦  «         ‰                     |d¦  «         t          j        t	          ¦   «         ¦  «        S )NTrä  )Ú	connectedr–   r   r   rb   ©ræ  rW  Úeprñ   rY   s      €€rZ   r%  zJAgentTests.test_connectUsesConnectionPool.<locals>.DummyPool.getConnectionþ  sP   ø€ Ø!%�”Ø× Ò   XÑ.Ô.Ð.ð × Ò  Ð&;Ñ<Ô<Ð<Ý”}Õ%5Ñ%7Ô%7Ñ8Ô8Ð8r\   N©r]   r^   r_   rì  rL  r%  rç  s   €€rZ   Ú	DummyPoolrê  ú  s=   ø€ € € € € ØˆIØˆJð9ð 9ð 9ð 9ð 9ð 9ð 9ð 9r\   rð  rÔ  ó   hostrå  rš  ó   http://foo/)ÚbodyProducerr°  TN)r  r0   rþ   r   rQ  rÏ  r2   rC   ÚaddRawHeaderÚobjectrm   r–   rì  )rY   rè  rð  r  r  r°  ró  rñ   s   `      @rZ   Útest_connectUsesConnectionPoolz)AgentTests.test_connectUsesConnectionPoolë  s0  øø€ õ !‘?”?ˆð	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 •f”lñ 	 ô 	 ð 	 ð
	9ð 
	9ð 
	9ð 
	9ð 
	9ð 
	9ð 
	9ð 
	9ñ 
	9ô 
	9ð 
	9ð ˆy‰{Œ{ˆØ�˜œ¨4Ð0Ñ0Ô0ˆØ×Ò˜T 5¤;Ñ/Ô/Ð/åÔ&Ñ(Ô(ˆØ×Ò˜W fÑ-Ô-Ð-Ý‘x”xˆØ�ŠØ�N°Àwð 	ñ 	
ô 	
ð 	
ð 	×Ò˜œÔ.°Ñ5Ô5Ð5Ð5Ð5r\   c                óT   — |                       t          | j        j        dd¦  «         dS )zj
        L{Agent.request} raises L{TypeError} when the C{method} argument isn't
        L{bytes}.
        ÚGETó   http://foo.example/N©ÚassertRaisesÚ	TypeErrorr  rm   ri   s    rZ   Útest_nonBytesMethodzAgentTests.test_nonBytesMethod  ó*   € ð
 	×Ò�) T¤ZÔ%7¸Ð@VÑWÔWÐWÐWÐWr\   c                ój   — |                       | j                             dd¦  «        t          ¦  «        S )z§
        L{Agent.request} returns a L{Deferred} which fails with
        L{SchemeNotSupported} if the scheme of the URI passed to it is not
        C{'http'}.
        rš  s   mailto:alice@example.com)ÚassertFailurer  rm   rB   ri   s    rZ   Útest_unsupportedSchemez!AgentTests.test_unsupportedScheme  s5   € ð ×!Ò!ØŒJ×Ò˜vÐ'BÑCÔCÕEWñ
ô 
ð 	
r\   c                óX  — | j                              dd¦  «        }| j        j                             ¦   «         dd…         \  }}}|                     dt          t          ¦   «         ¦  «        ¦  «         | j                             d¦  «         |  	                    |t          ¦  «         dS )zƒ
        The L{Deferred} returned by L{Agent.request} fires with a L{Failure} if
        the TCP connection attempt fails.
        rš  rò  Nr¦   é
   )
r  rm   r   rä   rª   ÚclientConnectionFailedr*   r   rå   rÁ   )rY   rn   rF  rG  rô   s        rZ   Útest_connectionFailedz AgentTests.test_connectionFailed#  s™   € ð
 ”×#Ò# F¨NÑ;Ô;ˆà"œlÔ5×9Ò9Ñ;Ô;¸B¸Q¸BÔ?Ñˆˆd�GØ×&Ò& t­WÕ5KÑ5MÔ5MÑ-NÔ-NÑOÔOÐOØŒ×Ò˜RÑ Ô Ð à×Ò˜VÕ%;Ñ<Ô<Ð<Ð<Ð<r\   c                ó  — d}d}| j                              t          j        d||fz  ¦  «        ¦  «        }|                      |j        d¦  «         |                      |j        |¦  «         |                      |t          ¦  «         dS )zo
        L{Agent._getEndpoint} return a C{HostnameEndpoint} when passed a scheme
        of C{'http'}.
        r-  éÒ  s   http://%b:%drÛ   N)	r  rÿ   r:   Ú	fromBytesr–   Ú_hostStrÚ_portr  r   )rY   ÚexpectedHostÚexpectedPortrñ   s       rZ   Útest_connectHTTPzAgentTests.test_connectHTTP0  sŒ   € ð
 &ˆØˆØ”:×*Ò*ÝŒM˜/¨\¸<Ð,HÑHÑIÔIñ
ô 
ˆð 	×Ò˜Ô*¨MÑ:Ô:Ð:Ø×Ò˜œ¨Ñ6Ô6Ð6Ø×Ò˜hÕ(8Ñ9Ô9Ð9Ð9Ð9r\   c                ó�  — t          j        d¦  «        }d                     ¦   «         |_        |                      t
          ¦  «        5 }| j                             |¦  «         ddd¦  «         n# 1 swxY w Y   |                      |j	        j
        d         d                     t          |j        ¦  «        ¬¦  «        ¦  «         dS )z|
        L{Agent._getEndpoint} when given a non-ASCII decodable URI will raise a
        L{ValueError} saying such.
        s   http://example.com:80u   â˜ƒ.comNr   zaThe host of the provided URI ({reprout}) contains non-ASCII octets, it should be ASCII decodable.)Úreprout)r:   r  ÚencoderF  rû  Ú
ValueErrorr  rÿ   r–   Ú	exceptionrü   Úformatró   )rY   rÅ  Úes      rZ   Útest_nonDecodableURIzAgentTests.test_nonDecodableURI>  sò   € õ
 ŒmÐ4Ñ5Ô5ˆØ×&Ò&Ñ(Ô(ˆŒà×Ò�zÑ*Ô*ð 	)¨aØŒJ×#Ò# CÑ(Ô(Ð(ð	)ð 	)ð 	)ñ 	)ô 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)øøøð 	)ð 	)ð 	)ð 	)ð 	×ÒØŒKÔ˜QÔð÷ Šf�T #¤(™^œ^ˆfÑ,Ô,ñ	
ô 	
ð 	
ð 	
ð 	
s   ÁA/Á/A3Á6A3c                óü   ‡ — ˆ fd„‰ j         _        ‰ j                              dd¦  «         ‰ j        j                             ¦   «         \  }}‰                      |j                             d¦  «        dg¦  «         dS )z»
        If L{None} is passed to L{Agent.request} for the C{headers} parameter,
        a L{Headers} instance is created for the request and a I{Host} header
        added to it.
        c                 ó   •— ‰S rt   r`   rÖ  s    €rZ   r}   z.AgentTests.test_hostProvided.<locals>.<lambda>X  ó   ø€ °€ r\   rš  ó   http://example.com/foo?barrñ  r-  N©	r  rÿ   rm   rï   rg   rª   r–   r°  r±  ©rY   ÚreqÚress   `  rZ   Útest_hostProvidedzAgentTests.test_hostProvidedR  sz   ø€ ð #5Ð"4Ð"4Ð"4ˆŒ
ÔØŒ
×Ò˜6Ð#@ÑAÔAÐAà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°7Ñ;Ô;¸nÐ=MÑNÔNÐNÐNÐNr\   c                óü   ‡ — ˆ fd„‰ j         _        ‰ j                              dd¦  «         ‰ j        j                             ¦   «         \  }}‰                      |j                             d¦  «        dg¦  «         dS )z‘
        If an IPv6 address is used in the C{uri} passed to L{Agent.request},
        the computed I{Host} header needs to be bracketed.
        c                 ó   •— ‰S rt   r`   rÖ  s    €rZ   r}   z3AgentTests.test_hostIPv6Bracketed.<locals>.<lambda>c  r  r\   rš  s   http://[::1]/rñ  s   [::1]Nr  r  s   `  rZ   Útest_hostIPv6Bracketedz!AgentTests.test_hostIPv6Bracketed^  sy   ø€ ð
 #5Ð"4Ð"4Ð"4ˆŒ
ÔØŒ
×Ò˜6Ð#3Ñ4Ô4Ð4à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°7Ñ;Ô;¸h¸ZÑHÔHÐHÐHÐHr\   c                ó0  ‡ — t          j        dgdgdœ¦  «        }ˆ fd„‰ j        _        ‰ j                             dd|¦  «         ‰ j        j                             ¦   «         \  }}‰                      |j	         
                    d¦  «        dg¦  «         dS )	zÎ
        If the headers passed to L{Agent.request} includes a value for the
        I{Host} header, that value takes precedence over the one which would
        otherwise be automatically provided.
        ó   bars   quux©rå  rñ  c                 ó   •— ‰S rt   r`   rÖ  s    €rZ   r}   z.AgentTests.test_hostOverride.<locals>.<lambda>p  r  r\   rš  r  rñ  N)r2   rC   r  rÿ   rm   rï   rg   rª   r–   r°  r±  )rY   r°  r  r  s   `   rZ   Útest_hostOverridezAgentTests.test_hostOverridei  s—   ø€ õ Ô&°°ÀGÀ9Ð'MÐ'MÑNÔNˆØ"4Ð"4Ð"4Ð"4ˆŒ
ÔØŒ
×Ò˜6Ð#@À'ÑJÔJÐJà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°7Ñ;Ô;¸g¸YÑGÔGÐGÐGÐGr\   c                ó0  ‡ — t          j        ¦   «         }ˆ fd„‰ j        _        ‰ j                             dd|¦  «         ‰ j        }‰                      t          |j        ¦  «        d¦  «         ‰                      |t          j        ¦   «         ¦  «         dS )z�
        If a I{Host} header must be added to the request, the L{Headers}
        instance passed to L{Agent.request} is not modified.
        c                 ó   •— ‰S rt   r`   rÖ  s    €rZ   r}   z3AgentTests.test_headersUnmodified.<locals>.<lambda>|  r  r\   rš  ó   http://example.com/foor§   N)	r2   rC   r  rÿ   rm   rï   r–   rœ   rg   )rY   r°  rï   s   `  rZ   Útest_headersUnmodifiedz!AgentTests.test_headersUnmodifiedv  s�   ø€ õ
 Ô&Ñ(Ô(ˆØ"4Ð"4Ð"4Ð"4ˆŒ
ÔØŒ
×Ò˜6Ð#<¸gÑFÔFÐFà”=ˆð 	×Ò�˜XÔ.Ñ/Ô/°Ñ3Ô3Ð3à×Ò˜¥,Ô"6Ñ"8Ô"8Ñ9Ô9Ð9Ð9Ð9r\   c                óf   — |                       | j                             ddd¦  «        d¦  «         dS )z¬
        When passed a scheme of C{'http'} and a port of C{80},
        L{Agent._computeHostValue} returns a string giving just
        the host name passed to it.
        r–  r-  r.  N©r–   r  Ú_computeHostValueri   s    rZ   Útest_hostValueStandardHTTPz%AgentTests.test_hostValueStandardHTTP†  s?   € ð 	×ÒØŒJ×(Ò(¨°.À"ÑEÔEÀ~ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                óf   — |                       | j                             ddd¦  «        d¦  «         dS )zÙ
        When passed a scheme of C{'http'} and a port other than C{80},
        L{Agent._computeHostValue} returns a string giving the
        host passed to it joined together with the port number by C{":"}.
        r–  r-  é1Ô  ó   example.com:54321Nr,  ri   s    rZ   Útest_hostValueNonStandardHTTPz(AgentTests.test_hostValueNonStandardHTTP�  s@   € ð 	×ÒØŒJ×(Ò(¨°.À%ÑHÔHØ ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                óf   — |                       | j                             ddd¦  «        d¦  «         dS )z®
        When passed a scheme of C{'https'} and a port of C{443},
        L{Agent._computeHostValue} returns a string giving just
        the host name passed to it.
        ó   httpsr-  rJ  Nr,  ri   s    rZ   Útest_hostValueStandardHTTPSz&AgentTests.test_hostValueStandardHTTPS›  s?   € ð 	×ÒØŒJ×(Ò(¨°>À3ÑGÔGÈñ	
ô 	
ð 	
ð 	
ð 	
r\   c                óf   — |                       | j                             ddd¦  «        d¦  «         dS )zÛ
        When passed a scheme of C{'https'} and a port other than C{443},
        L{Agent._computeHostValue} returns a string giving the
        host passed to it joined together with the port number by C{":"}.
        r4  r-  r0  r1  Nr,  ri   s    rZ   Útest_hostValueNonStandardHTTPSz)AgentTests.test_hostValueNonStandardHTTPS¥  s@   € ð 	×ÒØŒJ×(Ò(¨°>À5ÑIÔIØ ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó|  ‡ — ˆ fd„‰ j         _        t          j        ddgi¦  «        }t	          ¦   «         }‰ j                              dd||¦  «         ‰ j        }‰                      t          |j	        ¦  «        d¦  «         |j	         
                    ¦   «         \  }}‰                      |t          ¦  «         ‰                      |j        d¦  «         ‰                      |j        d¦  «         ‰                      |j        t          j        dgdgd	œ¦  «        ¦  «         ‰                      |j        |¦  «         d
S )a_  
        L{Agent.request} establishes a new connection to the host indicated by
        the host part of the URI passed to it and issues a request using the
        method, the path portion of the URI, the headers, and the body producer
        passed to it.  It returns a L{Deferred} which fires with an
        L{IResponse} from the server.
        c                 ó   •— ‰S rt   r`   rÖ  s    €rZ   r}   z)AgentTests.test_request.<locals>.<lambda>¸  r  r\   rå  r#  rš  ó   http://example.com:1234/foo?barr§   s   /foo?baró   example.com:1234r$  N)r  rÿ   r2   rC   rõ  rm   rï   r–   rœ   rg   rª   r  r?   ÚmethodrÅ  r°  rQ  ró  )rY   r°  Úbodyrï   r  r  s   `     rZ   Útest_requestzAgentTests.test_request°  s:  ø€ ð #5Ð"4Ð"4Ð"4ˆŒ
ÔåÔ&¨°°Ð'9Ñ:Ô:ˆõ ‰xŒxˆØŒ
×Ò˜6Ð#EÀwÐPTÑUÔUÐUà”=ˆð 	×Ò�˜XÔ.Ñ/Ô/°Ñ3Ô3Ð3ØÔ$×(Ò(Ñ*Ô*‰ˆˆSØ×Ò˜c¥7Ñ+Ô+Ð+Ø×Ò˜œ VÑ,Ô,Ð,Ø×Ò˜œ +Ñ.Ô.Ð.Ø×ÒØŒKÝÔ ¨6¨(Ð>QÐ=RÐ!SÐ!SÑTÔTñ	
ô 	
ð 	
ð 	×Ò˜SÔ-¨tÑ4Ô4Ð4Ð4Ð4r\   c                óÜ   — t          j        | j        d¬¦  «        }|                     dd¦  «         | j        j                             ¦   «         d         }|                      d|¦  «         dS )z~
        L{Agent} takes a C{connectTimeout} argument which is forwarded to the
        following C{connectTCP} agent.
        r›   ©ÚconnectTimeoutrš  rò  r¦   N©r0   rþ   r   rm   rä   rª   r–   ©rY   r  r¸  s      rZ   Útest_connectTimeoutzAgentTests.test_connectTimeoutÎ  se   € õ
 ”˜Tœ\¸!Ð<Ñ<Ô<ˆØ�Š�f˜nÑ-Ô-Ð-Ø”,Ô)×-Ò-Ñ/Ô/°Ô2ˆØ×Ò˜˜GÑ$Ô$Ð$Ð$Ð$r\   ú&SSL not present, cannot run SSL tests.c                óÜ   — t          j        | j        d¬¦  «        }|                     dd¦  «         | j        j                             ¦   «         d         }|                      d|¦  «         dS )z}
        L{Agent} takes a C{connectTimeout} argument which is forwarded to the
        following C{connectTCP} call.
        r›   r@  rš  ó   https://foo/r¦   NrB  rC  s      rZ   Útest_connectTimeoutHTTPSz#AgentTests.test_connectTimeoutHTTPSØ  se   € õ ”˜Tœ\¸!Ð<Ñ<Ô<ˆØ�Š�f˜oÑ.Ô.Ð.Ø”,Ô)×-Ò-Ñ/Ô/°Ô2ˆØ×Ò˜˜GÑ$Ô$Ð$Ð$Ð$r\   c                óÜ   — t          j        | j        d¬¦  «        }|                     dd¦  «         | j        j                             ¦   «         d         }|                      d|¦  «         dS )zz
        L{Agent} takes a C{bindAddress} argument which is forwarded to the
        following C{connectTCP} call.
        ú192.168.0.1©ÚbindAddressrš  rò  rµ   NrB  ©rY   r  Úaddresss      rZ   Útest_bindAddresszAgentTests.test_bindAddressã  se   € õ
 ”˜Tœ\°}ÐEÑEÔEˆØ�Š�f˜nÑ-Ô-Ð-Ø”,Ô)×-Ò-Ñ/Ô/°Ô2ˆØ×Ò˜¨Ñ0Ô0Ð0Ð0Ð0r\   c                óÜ   — t          j        | j        d¬¦  «        }|                     dd¦  «         | j        j                             ¦   «         d         }|                      d|¦  «         dS )zz
        L{Agent} takes a C{bindAddress} argument which is forwarded to the
        following C{connectSSL} call.
        rJ  rK  rš  rG  rµ   NrB  rM  s      rZ   Útest_bindAddressSSLzAgentTests.test_bindAddressSSLí  se   € õ ”˜Tœ\°}ÐEÑEÔEˆØ�Š�f˜oÑ.Ô.Ð.Ø”,Ô)×-Ò-Ñ/Ô/°Ô2ˆØ×Ò˜¨Ñ0Ô0Ð0Ð0Ð0r\   c                ó„  — d}|                       | j        ¦  «        }|                     d|¦  «        }|                      t	          | j        j        ¦  «        d¦  «         | j        j                             ¦   «         \  }}|                      |t          ¦  «         t          j                             dddt          i ¦  «        d|¦  «        }|                     |¦  «         |                      |¦  «        }|                      |j        j        |j        j        |j        j        f|j        |j        |j        f¦  «         dS )z‚
        L{Response}s returned by L{Agent.request} have a reference to the
        L{Request} that was originally issued.
        ó   http://example.com/rš  r§   ©s   HTTPr§   r§   éÈ   ó   OKN)r  r   rm   r–   rœ   rï   rg   rª   r  r?   r0   r7   Ú
_constructrC   Úcallbackr¬   r<  ÚabsoluteURIr°  )rY   rÅ  r  r(  r  r  ÚresprÀ  s           rZ   Útest_responseIncludesRequestz'AgentTests.test_responseIncludesRequestø  s+  € ð
 %ˆØ×-Ò-¨d¬lÑ;Ô;ˆØ�MŠM˜& #Ñ&Ô&ˆð 	×Ò�˜Tœ]Ô3Ñ4Ô4°aÑ8Ô8Ð8Ø”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜c¥7Ñ+Ô+Ð+åŒ×)Ò)Ø˜S %­°©¬°d¸Cñ
ô 
ˆð 	�Š�TÑÔÐà×'Ò'¨Ñ*Ô*ˆØ×ÒàÔ Ô'ØÔ Ô,ØÔ Ô(ðð
 ŒZ˜œ¨#¬+Ð6ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ór  — d}|                       | j        ¦  «        }|                     d|¦  «         |                      t	          | j        j        ¦  «        d¦  «         | j        j                             ¦   «         \  }}|                      |t          ¦  «         |                      |j
        |¦  «         dS )zL
        L{Request.absoluteURI} is the absolute URI of the request.
        s$   http://example.com/foo;1234?bar#fragrš  r§   N)r  r   rm   r–   rœ   rï   rg   rª   r  r?   rY  )rY   rÅ  r  r  r  s        rZ   Útest_requestAbsoluteURIz"AgentTests.test_requestAbsoluteURI  s¥   € ð 6ˆØ×-Ò-¨d¬lÑ;Ô;ˆØ�Š�f˜cÑ"Ô"Ð"ð 	×Ò�˜Tœ]Ô3Ñ4Ô4°aÑ8Ô8Ð8Ø”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜c¥7Ñ+Ô+Ð+Ø×Ò˜œ¨#Ñ.Ô.Ð.Ð.Ð.r\   c                ó‚   — t          j        ddt          ¦   «         d¦  «        }|                      |j        d¦  «         dS )zX
        L{Request.absoluteURI} is L{None} if L{Request._parsedURI} is L{None}.
        ó   FOOrœ  N)r0   r?   rC   rQ  rY  )rY   rm   s     rZ   Útest_requestMissingAbsoluteURIz)AgentTests.test_requestMissingAbsoluteURI#  s<   € õ ”. ¨­w©y¬y¸$Ñ?Ô?ˆØ×Ò˜WÔ0°$Ñ7Ô7Ð7Ð7Ð7r\   c                óâ   — t          ¦   «         }t          j                             d|¬¦  «        }t	          j        d¦  «        }|                     |¦  «        }|                      |d¦  «         dS )z|
        L{Agent.usingEndpointFactory} creates an L{Agent} that uses the given
        factory to create endpoints.
        N)ÚendpointFactoryrS  )r–  r-  r.  )rÂ  r0   rþ   ÚusingEndpointFactoryr:   r  rÿ   r–   )rY   rô   r  rÅ  ÚreturnedEndpoints        rZ   Útest_endpointFactoryzAgentTests.test_endpointFactory*  sk   € õ
 &Ñ'Ô'ˆÝ”×1Ò1°$ÈÐ1ÑPÔPˆÝŒmÐ2Ñ3Ô3ˆØ ×-Ò-¨cÑ2Ô2ÐØ×ÒÐ)Ð+HÑIÔIÐIÐIÐIr\   c                óà   — t           j                             | j        t	          ¦   «         ¦  «        }|j        }|                      |j        |j        |j	        ft          d|j	        f¦  «         dS )z‘
        If no pool is passed in to L{Agent.usingEndpointFactory}, a default
        pool is constructed with no persistent connections.
        FN)r0   rþ   rc  r   rÂ  rÏ  r–   Ú	__class__rL  rÐ  r>   )rY   r  r  s      rZ   Útest_endpointFactoryDefaultPoolz*AgentTests.test_endpointFactoryDefaultPool5  si   € õ
 ”×1Ò1°$´,Õ@SÑ@UÔ@UÑVÔVˆØŒ{ˆØ×ÒØŒ^˜Tœ_¨d¬mÐ<Ý ¨¬Ð7ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó¼   — t          ¦   «         }t          j                             | j        t          ¦   «         |¦  «        }|                      ||j        ¦  «         dS )zr
        If a pool is passed in to L{Agent.usingEndpointFactory} it is used as
        the L{Agent} pool.
        N)rõ  r0   rþ   rc  r   rÂ  ÚassertIsrÏ  rÚ  s      rZ   Útest_endpointFactoryPoolz#AgentTests.test_endpointFactoryPoolA  sR   € õ
 ‰xŒxˆÝ”×1Ò1ØŒLÕ-Ñ/Ô/°ñ
ô 
ˆð 	�Š�d˜EœKÑ(Ô(Ð(Ð(Ð(r\   N)$r]   r^   r_   rp   r‡  rƒ   rÒ  rÛ  rß  rö  rý  r  r  r  r  r  r!  r&  r*  r.  r2  r5  r7  r>  rD  r   r¨  rH  rO  rQ  r[  r]  r`  re  rh  rk  r`   r\   rZ   rÈ  rÈ  ±  s3  € € € € € ðð ð*ð *ð *ð&ð &ð &ðCð Cð Cð
Hð 
Hð 
HðIð Ið Ið"%6ð %6ð %6ðNXð Xð Xð
ð 
ð 
ð=ð =ð =ð:ð :ð :ð
ð 
ð 
ð(
Oð 
Oð 
Oð	Ið 	Ið 	IðHð Hð Hð:ð :ð :ð 
ð 
ð 
ð	
ð 	
ð 	
ð
ð 
ð 
ð	
ð 	
ð 	
ð5ð 5ð 5ð<%ð %ð %ð €V�
ˆNÐDÑEÔEð%ð %ñ FÔEð%ð1ð 1ð 1ð €V�
ˆNÐDÑEÔEð1ð 1ñ FÔEð1ð
ð 
ð 
ð:/ð /ð /ð8ð 8ð 8ð	Jð 	Jð 	Jð

ð 

ð 

ð	)ð 	)ð 	)ð 	)ð 	)r\   rÈ  c                  ó   — e Zd ZdZd„ ZdS )ÚAgentMethodInjectionTestsz>
    Test L{client.Agent} against HTTP method injections.
    c                óž   — t          j        |                      ¦   «         ¦  «        }d}|                     ||t	          ¦   «         d¦  «         dS )úv
        Attempt a request with the provided method.

        @param method: see L{MethodInjectionTestsMixin}
        ó   http://twisted.invalidN©r0   rþ   rè   rm   rC   )rY   r<  r  rÅ  s       rZ   Ú!attemptRequestWithMaliciousMethodz;AgentMethodInjectionTests.attemptRequestWithMaliciousMethodV  sF   € õ ”˜T×/Ò/Ñ1Ô1Ñ2Ô2ˆØ'ˆØ�Š�f˜c¥7¡9¤9¨dÑ3Ô3Ð3Ð3Ð3r\   N©r]   r^   r_   rp   rr  r`   r\   rZ   rm  rm  M  ó-   € € € € € ð
ð ð4ð 4ð 4ð 4ð 4r\   rm  c                  ó   — e Zd ZdZd„ ZdS )ÚAgentURIInjectionTestsz6
    Test L{client.Agent} against URI injections.
    c                óž   — t          j        |                      ¦   «         ¦  «        }d}|                     ||t	          ¦   «         d¦  «         dS )zp
        Attempt a request with the provided method.

        @param uri: see L{URIInjectionTestsMixin}
        rš  Nrq  )rY   rÅ  r  r<  s       rZ   ÚattemptRequestWithMaliciousURIz5AgentURIInjectionTests.attemptRequestWithMaliciousURIj  sF   € õ ”˜T×/Ò/Ñ1Ô1Ñ2Ô2ˆØˆØ�Š�f˜c¥7¡9¤9¨dÑ3Ô3Ð3Ð3Ð3r\   N©r]   r^   r_   rp   rx  r`   r\   rZ   rv  rv  a  rt  r\   rv  rE  c                  óT   ‡ — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zˆ fd„Zˆ xZS )ÚAgentHTTPSTestsz@
    Tests for the new HTTP client API that depends on SSL.
    r-  rJ  c                ó¢   — t          j        |                      ¦   «         ¦  «                             t	          j        d||fz  ¦  «        ¦  «        S )a‰  
        Create an L{Agent} with an https scheme and return its endpoint
        created according to the arguments.

        @param host: The host for the endpoint.
        @type host: L{bytes}

        @param port: The port for the endpoint.
        @type port: L{int}

        @return: An endpoint of an L{Agent} constructed according to args.
        @rtype: L{SSL4ClientEndpoint}
        s   https://%b:%d/)r0   rþ   rè   rÿ   r:   r  )rY   rF  rG  s      rZ   ÚmakeEndpointzAgentHTTPSTests.makeEndpoint{  sI   € õ Œ|˜D×.Ò.Ñ0Ô0Ñ1Ô1×>Ò>ÝŒMÐ+¨t°T¨lÑ:Ñ;Ô;ñ
ô 
ð 	
r\   c                ó¦   — ddl m} |                      ¦   «         }|                      ||¦  «         |                      |j        t
          ¦  «         dS )zr
        L{Agent._getEndpoint} return a L{SSL4ClientEndpoint} when passed a
        scheme of C{'https'}.
        r   )Ú_WrapperEndpointN)Útwisted.internet.endpointsr  r}  r  Ú_wrappedEndpointr   )rY   r  rñ   s      rZ   Útest_endpointTypez!AgentHTTPSTests.test_endpointType�  s_   € ð
 	@Ð?Ð?Ð?Ð?Ð?à×$Ò$Ñ&Ô&ˆØ×Ò˜hÐ(8Ñ9Ô9Ð9Ø×Ò˜hÔ7Õ9IÑJÔJÐJÐJÐJr\   c                ór   — |                       d¬¦  «        }|                      |j        j        d¦  «         dS )z@
        If a host is passed, the endpoint respects it.
        r-  )rF  rÛ   N)r}  r–   r�  r	  )rY   rñ   s     rZ   Útest_hostArgumentIsRespectedz,AgentHTTPSTests.test_hostArgumentIsRespected˜  s<   € ð ×$Ò$¨.Ð$Ñ9Ô9ˆØ×Ò˜Ô2Ô;¸]ÑKÔKÐKÐKÐKr\   c                óv   — d}|                       |¬¦  «        }|                      |j        j        |¦  «         dS )z@
        If a port is passed, the endpoint respects it.
        éá  )rG  N)r}  r–   r�  r
  )rY   r  rñ   s      rZ   Útest_portArgumentIsRespectedz,AgentHTTPSTests.test_portArgumentIsRespectedŸ  sA   € ð ˆØ×$Ò$¨,Ð$Ñ7Ô7ˆØ×Ò˜Ô2Ô8¸,ÑGÔGÐGÐGÐGr\   c                óÎ   — |                       ¦   «         }|                     d¦  «        j        }|                      |t          ¦  «         |                      |j        d¦  «         dS )zY
        L{Agent} wraps its connection creator creator and uses modern TLS APIs.
        NrÛ   )r}  Ú_wrapperFactoryÚ_connectionCreatorr  rM   r–   Ú	_hostname)rY   rñ   ÚcontextFactorys      rZ   Útest_contextFactoryTypez'AgentHTTPSTests.test_contextFactoryType§  sa   € ð ×$Ò$Ñ&Ô&ˆØ!×1Ò1°$Ñ7Ô7ÔJˆØ×Ò˜nÕ.>Ñ?Ô?Ð?Ø×Ò˜Ô1°=ÑAÔAÐAÐAÐAr\   c                óš  ‡‡‡— d}d} G d„ d¦  «        }g Št          t          ¦  «         G ˆˆfd„d¦  «        ¦   «         Š |¦   «         Št          t          ¦  «         G ˆfd„d¦  «        ¦   «         } |¦   «         }|                      ¦   «         }t	          j        ||¦  «        }|                     t          j        d	||fz  ¦  «        ¦  «        }| 	                    t          j        t          ¦  «        ¦  «         |j        d
         d         }	|	                     d¦  «        }
|
                     t!          ¦   «         ¦  «         ‰d         d         }|                      |t$          ¦  «         |                      ‰d         dd…         ||f¦  «         |                      ‰j        ¦  «         |                      ‰j        ¦  «         dS )aµ  
        If a custom L{WebClientConnectionCreator}-like object is passed to
        L{Agent.__init__} it will be used to determine the SSL parameters for
        HTTPS requests.  When an HTTPS request is made, the hostname and port
        number of the request URL will be passed to the connection creator's
        C{creatorForNetloc} method.  The resulting context object will be used
        to establish the SSL connection.
        s   example.orgiÛO  c                  ó"   — e Zd ZdZdZd„ Zd„ ZdS )úVAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughConnectionFc                ó   — d| _         dS )zK
                The handshake started.  Record that fact.
                TN)ÚhandshakeStartedri   s    rZ   Údo_handshakezcAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughConnection.do_handshakeÀ  s   € ð )-�Ô%Ð%Ð%r\   c                ó   — d| _         dS )zL
                The connection started.  Record that fact.
                TN)ÚconnectStateri   s    rZ   Úset_connect_statezhAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughConnection.set_connect_stateÆ  s   € ð %)�Ô!Ð!Ð!r\   N)r]   r^   r_   r’  r•  r“  r–  r`   r\   rZ   ÚJustEnoughConnectionr�  ¼  s=   € € € € € Ø$ÐØ ˆLð-ð -ð -ð)ð )ð )ð )ð )r\   r—  c                  ó"   •— e Zd Zd„ Zˆ ˆfd„ZdS )úSAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughCreatorc                ó"   — || _         || _        d S rt   )ÚhostnamerG  )rY   r›  rG  s      rZ   rj   z\AgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughCreator.__init__Ð  s   € Ø (�”Ø �”	�	�	r\   c                óL   •— ‰                      || j        | j        f¦  «         ‰S )zñ
                Implement L{IOpenSSLClientConnectionCreator}.

                @param tlsProtocol: The TLS protocol.
                @type tlsProtocol: L{TLSMemoryBIOProtocol}

                @return: C{expectedConnection}
                )rl   r›  rG  )rY   ÚtlsProtocolÚcontextArgsÚexpectedConnections     €€rZ   ÚclientConnectionForTLSzjAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughCreator.clientConnectionForTLSÔ  s*   ø€ ð ×"Ò" K°´ÀÄ	Ð#JÑKÔKÐKØ)Ð)r\   N)r]   r^   r_   rj   r   )rž  rŸ  s   €€rZ   ÚJustEnoughCreatorr™  Î  sB   ø€ € € € € ð!ð !ð !ð
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*ð 
*r\   r¡  c                  ó   •— e Zd Zˆ fd„ZdS )ú_AgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.StubBrowserLikePolicyForHTTPSc                ó   •—  ‰||¦  «        S )am  
                Emulate L{BrowserLikePolicyForHTTPS}.

                @param hostname: The hostname to verify.
                @type hostname: L{bytes}

                @param port: The port number.
                @type port: L{int}

                @return: a stub L{IOpenSSLClientConnectionCreator}
                @rtype: L{JustEnoughCreator}
                r`   )rY   r›  rG  r¡  s      €rZ   ÚcreatorForNetloczpAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.StubBrowserLikePolicyForHTTPS.creatorForNetlocä  s   ø€ ð )Ð(¨°4Ñ8Ô8Ð8r\   N©r]   r^   r_   r¥  )r¡  s   €rZ   ÚStubBrowserLikePolicyForHTTPSr£  â  s.   ø€ € € € € ð9ð 9ð 9ð 9ð 9ð 9ð 9r\   r§  s   https://%b:%déÿÿÿÿr¶   Nr   r§   )r   r   rH   rè   r0   rþ   rÿ   r:   r  r÷   r   rª  r    rä   rõ   r  r&   r  rR   r–   r…   r’  r•  )rY   r  r  r—  r§  ÚexpectedCreatorCreatorr   r  rñ   Ú
tlsFactoryr�  rP   r¡  rž  rŸ  s               @@@rZ   Ú(test_connectHTTPSCustomConnectionCreatorz8AgentHTTPSTests.test_connectHTTPSCustomConnectionCreator°  s!  øøø€ ð &ˆØˆð	)ð 	)ð 	)ð 	)ð 	)ñ 	)ô 	)ð 	)ð  ˆå	Õ4Ñ	5Ô	5ð	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ð 	*ñ 	*ô 	*ñ 
6Ô	5ð	*ð" 2Ð1Ñ3Ô3Ðå	•_Ñ	%Ô	%ð	9ð 	9ð 	9ð 	9ð 	9ð 	9ð 	9ñ 	9ô 	9ñ 
&Ô	%ð	9ð  "?Ð!>Ñ!@Ô!@ÐØ×$Ò$Ñ&Ô&ˆÝ”˜WÐ&<Ñ=Ô=ˆØ×%Ò%ÝŒMÐ*¨l¸LÐ-IÑIÑJÔJñ
ô 
ˆð 	×Ò�Ô,­XÑ6Ô6Ñ7Ô7Ð7ØÔ'¨Ô+¨AÔ.ˆ
Ø ×.Ò.¨tÑ4Ô4ˆØ×"Ò"¥?Ñ#4Ô#4Ñ5Ô5Ð5Ø˜!Œn˜QÔˆØ×Ò˜cÕ#7Ñ8Ô8Ð8Ø×Ò˜ Qœ¨¨¨Ô+¨l¸LÐ-IÑJÔJÐJØ�ŠÐ*Ô;Ñ<Ô<Ð<Ø�ŠÐ*Ô7Ñ8Ô8Ð8Ð8Ð8r\   c                ó  — d„ } |¦   «          |                       |g¦  «        }|                      t          |¦  «        d¦  «         |\  }|                      |d         t          ¦  «         |                      |d         d¦  «         dS )aP  
        Passing something that duck-types I{like} a L{web client context
        factory <twisted.web.client.WebClientContextFactory>} - something that
        does not provide L{IPolicyForHTTPS} - to L{Agent} emits a
        L{DeprecationWarning} even if you don't actually C{import
        WebClientContextFactory} to do it.
        c                 ób   — t          j        t          t          ¦   «         ¦  «        d¦  «         d S )Nz does-not-provide-IPolicyForHTTPS)r0   rþ   r"   r%   r`   r\   rZ   ÚwarnMez9AgentHTTPSTests.test_deprecatedDuckPolicy.<locals>.warnMe  s5   € ÝŒLÝ-Õ.@Ñ.BÔ.BÑCÔCØ2ñô ð ð ð r\   r§   ÚcategoryÚmessagezº'does-not-provide-IPolicyForHTTPS' was passed as the HTTPS policy for an Agent, but it does not provide IPolicyForHTTPS.  Since Twisted 14.0, you must pass a provider of IPolicyForHTTPS.N)ÚflushWarningsr–   rœ   ÚDeprecationWarning)rY   r®  ÚwarningsÚwarnings       rZ   Útest_deprecatedDuckPolicyz)AgentHTTPSTests.test_deprecatedDuckPolicy  s¢   € ð	ð 	ð 	ð 	ˆ‰ŒˆØ×%Ò% v hÑ/Ô/ˆØ×Ò�˜X™œ¨Ñ*Ô*Ð*Ø‰	ˆØ×Ò˜ Ô,Õ.@ÑAÔAÐAØ×ÒØ�IÔðOñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó&  — t          ¦   «         }t          |¬¦  «        }|                     dd¦  «        }|                      |j        ¦  «         |                     d¦  «        }|                      |j        |                     ¦   «         ¦  «         dS )z½
        L{BrowserLikePolicyForHTTPS.creatorForNetloc} returns an
        L{IOpenSSLClientConnectionCreator} provider which will add certificates
        from the given trust root.
        ©Ú	trustRoots   thingyr†  N)	rT   r;   r¥  r…   rW   r   rj  rX   Úget_context)rY   r¸  ÚpolicyÚcreatorÚ
connections        rZ   Útest_alternateTrustRootz'AgentHTTPSTests.test_alternateTrustRoot  s…   € õ +Ñ,Ô,ˆ	Ý*°YÐ?Ñ?Ô?ˆØ×)Ò)¨)°TÑ:Ô:ˆØ�Š˜	Ô(Ñ)Ô)Ð)Ø×3Ò3°DÑ9Ô9ˆ
Ø�Š�iÔ'¨×)?Ò)?Ñ)AÔ)AÑBÔBÐBÐBÐBr\   c                óâ   •‡‡— |                      d¦  «        }t          |                     d¦  «        ¦  «        \  ŠŠˆfd„}ˆfd„}t          ¦   «                              |||||d¬¦  «         dS )zC
        Wrap L{AgentTestsMixin.integrationTest} with TLS.
        s   []Úasciic                óL   •— t          ‰                     ¦   «         d| |¦  «        S r  )rQ   Úoptions)ÚserverFactoryr   r”  s     €rZ   Útlsifyz/AgentHTTPSTests.integrationTest.<locals>.tlsify4  s!   ø€ Ý& v§~¢~Ñ'7Ô'7¸ÀÈwÑWÔWÐWr\   c                ó˜   •— ddl m} ddlm}  ||¦  «         G ˆfd„d¦  «        ¦   «         }t	          j        |  |¦   «         ¬¦  «        S )Nr   r   )rH   c                  ó   •— e Zd Zˆ fd„ZdS )úAAgentHTTPSTests.integrationTest.<locals>.tlsagent.<locals>.Policyc                óL   •— t          |                     d¦  «        ‰¬¦  «        S )Nr¿  r·  )rO   Údecode)rY   r›  rG  Ú	authoritys      €rZ   r¥  zRAgentHTTPSTests.integrationTest.<locals>.tlsagent.<locals>.Policy.creatorForNetloc>  s+   ø€ Ý.Ø Ÿš¨Ñ0Ô0¸Iðñ ô ð r\   Nr¦  )rÉ  s   €rZ   ÚPolicyrÆ  <  s.   ø€ € € € € ðð ð ð ð ð ð r\   rÊ  )rŒ  )Úzope.interfacer   Útwisted.web.iwebrH   r0   rþ   )r   r   rH   rÊ  rÉ  s       €rZ   Útlsagentz1AgentHTTPSTests.integrationTest.<locals>.tlsagent7  s‹   ø€ Ø2Ð2Ð2Ð2Ð2Ð2à8Ð8Ð8Ð8Ð8Ð8àˆ[˜Ñ)Ô)ðð ð ð ð ð ð ñ ô ñ *Ô)ðõ ”< ¸¸¹¼ÐAÑAÔAÐAr\   r4  )rµ  r¶  rE  N)Ústripr-   rÈ  Úsuperr‹  )
rY   r²  r³  r´  ÚcertHostNamerÃ  rÍ  rÉ  r”  rg  s
          @@€rZ   r‹  zAgentHTTPSTests.integrationTest+  s¸   øøø€ ð  —~’~ eÑ,Ô,ˆÝ=Ø×Ò Ñ(Ô(ñ
ô 
Ñˆ	�6ð	Xð 	Xð 	Xð 	Xð 	Xð	Bð 	Bð 	Bð 	Bð 	Bõ ‰GŒG×#Ò#ØØØØ$Ø$Øð $ñ ô ð ð ð r\   )r-  rJ  )r]   r^   r_   rp   r}  r‚  r„  r‡  r�  r«  rµ  r½  r‹  Ú__classcell__)rg  s   @rZ   r{  r{  u  sÒ   ø€ € € € € ðð ð
ð 
ð 
ð 
ð$	Kð 	Kð 	KðLð Lð LðHð Hð HðBð Bð BðQ9ð Q9ð Q9ðf
ð 
ð 
ð6Cð Cð Cð#
ð #
ð #
ð #
ð #
ð #
ð #
ð #
ð #
r\   r{  c                  ó    — e Zd ZdZd„ Zd„ Z eed¦  «        d„ ¦   «         Z ee d¦  «        d„ ¦   «         Z	 ee d¦  «        d„ ¦   «         Z
d	S )
ÚWebClientContextFactoryTestszr
    Tests for the context factory wrapper for web clients
    L{twisted.web.client.WebClientContextFactory}.
    c                ój   — ddl m} |                      t          j        g¦  «        | _        || _        dS )zU
        Get WebClientContextFactory while quashing its deprecation warning.
        r   )ÚWebClientContextFactoryN)Útwisted.web.clientrÕ  r±  rÓ  rƒ   ÚwarnedÚwebClientContextFactory)rY   rÕ  s     rZ   rƒ   z"WebClientContextFactoryTests.setUpW  s@   € ð 	?Ð>Ð>Ð>Ð>Ð>à×(Ò(Õ*FÔ*LÐ)MÑNÔNˆŒØ'>ˆÔ$Ð$Ð$r\   c                ó^  — |                       t          | j        ¦  «        d¦  «         | j        \  }|                       |d         t          ¦  «         |                       |d         t	          | j        t          dddd¦  «        t          ¬¦  «                             dd	¦  «        ¦  «         d
S )zx
        L{twisted.web.client.WebClientContextFactory} is deprecated.  Importing
        it displays a warning.
        r§   r¯  r°  ÚTwistedé   r   )Úreplacementú;ú:N)	r–   rœ   r×  r²  r)   rØ  r   r;   Úreplace)rY   r´  s     rZ   Útest_deprecatedz,WebClientContextFactoryTests.test_deprecated`  s°   € ð
 	×Ò�˜Tœ[Ñ)Ô)¨1Ñ-Ô-Ð-Ø”K‰	ˆØ×Ò˜ Ô,Õ.@ÑAÔAÐAØ×ÒØ�IÔÝ'ØÔ,Ý˜	 2 q¨!Ñ,Ô,Ý5ðñ ô ÷ ŠW�S˜#ÑÔñ		
ô 		
ð 		
ð 		
ð 		
r\   zSSL Present.c                ón   — |                       t          |                      ¦   «         j        dd¦  «         dS )zl
        If C{getContext} is called and SSL is not available, raise
        L{NotImplementedError}.
        r-  rJ  N)rû  ÚNotImplementedErrorrØ  Ú
getContextri   s    rZ   Útest_missingSSLz,WebClientContextFactoryTests.test_missingSSLs  sA   € ð 	×ÒÝØ×(Ò(Ñ*Ô*Ô5ØØñ		
ô 	
ð 	
ð 	
ð 	
r\   rE  c                ó    — |                       ¦   «                              dd¦  «        }|                      |t          j        j        ¦  «         dS )zT
        If SSL is present, C{getContext} returns a L{OpenSSL.SSL.Context}.
        rÛ   rJ  N)rØ  rã  r  rL   ÚSSLÚContext)rY   Úctxs     rZ   Útest_returnsContextz0WebClientContextFactoryTests.test_returnsContext€  sE   € ð
 ×*Ò*Ñ,Ô,×7Ò7¸ÀsÑKÔKˆØ×Ò˜c¥3¤7¤?Ñ3Ô3Ð3Ð3Ð3r\   c                ó¤   — |                       ¦   «         }|                     dd¦  «        }|                      |j        t          j        ¦  «         dS )zd
        The L{CertificateOptions} has C{trustRoot} set to the default trust
        roots.
        rÛ   rJ  N)rØ  Ú_getCertificateOptionsr  r¸  rL   ÚOpenSSLDefaultPaths)rY   rè  ÚcertificateOptionss      rZ   Ú-test_setsTrustRootOnContextToDefaultTrustRootzJWebClientContextFactoryTests.test_setsTrustRootOnContextToDefaultTrustRootˆ  sN   € ð ×*Ò*Ñ,Ô,ˆØ ×7Ò7¸ÀsÑKÔKÐØ×ÒÐ0Ô:½CÔ<SÑTÔTÐTÐTÐTr\   N)r]   r^   r_   rp   rƒ   rà  r   r¨  rä  ré  rî  r`   r\   rZ   rÓ  rÓ  Q  sÁ   € € € € € ðð ð
?ð ?ð ?ð
ð 
ð 
ð& €VˆJ˜Ñ'Ô'ð

ð 

ñ (Ô'ð

ð €V�
ˆNÐDÑEÔEð4ð 4ñ FÔEð4ð €V�
ˆNÐDÑEÔEðUð Uñ FÔEðUð Uð Ur\   rÓ  c                  ó`   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚHTTPConnectionPoolRetryTestsz¨
    L{client.HTTPConnectionPool}, by using
    L{client._RetryingHTTP11ClientProtocol}, supports retrying requests done
    against previously cached connections.
    c                óL  — t          j        d¦  «        }t          j        d|¦  «        }|                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         dS )	zO
        Only GET, HEAD, OPTIONS, TRACE, DELETE methods cause a retry.
        Nrš  s   HEADs   OPTIONSs   TRACEs   DELETEó   POSTs   MYMETHOD)r0   r>   Ú_RetryingHTTP11ClientProtocolr…   Ú_shouldRetryr5   ÚassertFalse©rY   r  r¼  s      rZ   Útest_onlyRetryIdempotentMethodsz<HTTPConnectionPoolRetryTests.test_onlyRetryIdempotentMethodsš  sW  € õ Ô(¨Ñ.Ô.ˆÝÔ9¸$ÀÑEÔEˆ
Ø�Š˜
×/Ò/°½Ñ8HÔ8HÈ$ÑOÔOÑPÔPÐPØ�Š˜
×/Ò/°½Ñ9IÔ9IÈ4ÑPÔPÑQÔQÐQØ�Š˜
×/Ò/°
½NÑ<LÔ<LÈdÑSÔSÑTÔTÐTØ�Š˜
×/Ò/°½.Ñ:JÔ:JÈDÑQÔQÑRÔRÐRØ�Š˜
×/Ò/°	½>Ñ;KÔ;KÈTÑRÔRÑSÔSÐSØ×Ò˜×0Ò0°½.Ñ:JÔ:JÈDÑQÔQÑRÔRÐRØ×Ò˜×0Ò0°½nÑ>NÔ>NÐPTÑUÔUÑVÔVÐVÐVÐVr\   c                óz  — t          j        d¦  «        }t          j        d|¦  «        }|                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          g ¦  «        d¦  «        ¦  «         |                      |                     dt          g ¦  «        d¦  «        ¦  «         |                      |                     dt          g ¦  «        d¦  «        ¦  «         |                      |                     dt          ¦   «         d¦  «        ¦  «         dS )z…
        Only L{RequestNotSent}, L{RequestTransmissionFailed} and
        L{ResponseNeverReceived} exceptions cause a retry.
        Nrš  )r0   r>   ró  r…   rô  r5   r6   r9   rõ  r8   r   rö  s      rZ   Ú"test_onlyRetryIfNoResponseReceivedz?HTTPConnectionPoolRetryTests.test_onlyRetryIfNoResponseReceived«  s(  € õ
 Ô(¨Ñ.Ô.ˆÝÔ9¸$ÀÑEÔEˆ
Ø�Š˜
×/Ò/°½Ñ8HÔ8HÈ$ÑOÔOÑPÔPÐPØ�ŠØ×#Ò# FÕ,EÀbÑ,IÔ,IÈ4ÑPÔPñ	
ô 	
ð 	
ð 	�ŠØ×#Ò# FÕ,AÀ"Ñ,EÔ,EÀtÑLÔLñ	
ô 	
ð 	
ð 	×Ò˜×0Ò0°½ÈÑ9KÔ9KÈTÑRÔRÑSÔSÐSØ×ÒØ×#Ò# FÕ,BÑ,DÔ,DÀdÑKÔKñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó  — t          j        d¦  «        }t          j        d|¦  «        }t          t	          t          j        ¦   «         ¦  «        g¦  «        }|                      |                     d|d¦  «        ¦  «         dS )z«
        If a request failed due to the operation being cancelled,
        C{_shouldRetry} returns C{False} to indicate the request should not be
        retried.
        Nrš  )	r0   r>   ró  r9   r*   r   r   rõ  rô  )rY   r  r¼  r  s       rZ   Ú!test_dontRetryIfFailedDueToCancelz>HTTPConnectionPoolRetryTests.test_dontRetryIfFailedDueToCancel¾  ss   € õ Ô(¨Ñ.Ô.ˆÝÔ9¸$ÀÑEÔEˆ
Ý)­7µ5Ô3GÑ3IÔ3IÑ+JÔ+JÐ*KÑLÔLˆ	Ø×Ò˜×0Ò0°¸ÀDÑIÔIÑJÔJÐJÐJÐJr\   c                óú   — t          j        d¦  «        }t          j        d|¦  «        }|                      |                     dt          t          t          ¦   «         ¦  «        g¦  «        d¦  «        ¦  «         dS )z¿
        If a request failed with L{ResponseNeverReceived} due to some
        arbitrary exception, C{_shouldRetry} returns C{True} to indicate the
        request should be retried.
        Nrš  )r0   r>   ró  r…   rô  r9   r*   Ú	Exceptionrö  s      rZ   Ú)test_retryIfFailedDueToNonCancelExceptionzFHTTPConnectionPoolRetryTests.test_retryIfFailedDueToNonCancelExceptionÉ  sx   € õ Ô(¨Ñ.Ô.ˆÝÔ9¸$ÀÑEÔEˆ
Ø�ŠØ×#Ò#ØÕ-­wµy±{´{Ñ/CÔ/CÐ.DÑEÔEÀtñô ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                óJ  ‡ ‡— t          j        t          ¦   «         ¦  «        }t          ¦   «         Š‰                     t          ¦   «         ¦  «         |                     d‰¦  «         |                     dt          ¦   «         ¦  «        }ˆˆ fd„}| 	                    |¦  «        S )z¹
        If L{client.HTTPConnectionPool.getConnection} returns a previously
        cached connection, it will get wrapped in a
        L{client._RetryingHTTP11ClientProtocol}.
        é{   c                ó~   •— ‰                      | t          j        ¦  «         ‰                     | j        ‰¦  «         d S rt   )r  r0   ró  rQ  Ú_clientProtocol©r¼  rï   rY   s    €€rZ   r#  zTHTTPConnectionPoolRetryTests.test_wrappedOnPersistentReturned.<locals>.gotConnectionè  s;   ø€ Ø×!Ò! *­fÔ.RÑSÔSÐSØ× Ò  Ô!;¸XÑFÔFÐFÐFÐFr\   )
r0   r>   r!   rb   r  r&   r0  r%  r  r&  ©rY   r  r(  r#  rï   s   `   @rZ   Ú test_wrappedOnPersistentReturnedz=HTTPConnectionPoolRetryTests.test_wrappedOnPersistentReturned×  sª   øø€ õ Ô(­©¬Ñ1Ô1ˆõ $Ñ%Ô%ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Ò˜C Ñ*Ô*Ð*ð ×Ò˜s¥M¡O¤OÑ4Ô4ˆð	Gð 	Gð 	Gð 	Gð 	Gð 	Gð �}Š}˜]Ñ+Ô+Ð+r\   c                ó¤   ‡ — t          j        d¦  «        }|                     dt          ¦   «         ¦  «        }ˆ fd„}|                     |¦  «        S )z|
        If L{client.HTTPConnectionPool.getConnection} returns a new
        connection, it will be returned as is.
        Nr   c                óH   •— ‰                      | j        t          ¦  «         d S rt   )rQ  rg  r3   )r¼  rY   s    €rZ   r#  zPHTTPConnectionPoolRetryTests.test_notWrappedOnNewReturned.<locals>.gotConnectionö  s%   ø€ ð × Ò  Ô!5Õ7KÑLÔLÐLÐLÐLr\   )r0   r>   r%  r  r&  )rY   r  r(  r#  s   `   rZ   Útest_notWrappedOnNewReturnedz9HTTPConnectionPoolRetryTests.test_notWrappedOnNewReturnedî  s`   ø€ õ
 Ô(¨Ñ.Ô.ˆØ×Ò˜s¥M¡O¤OÑ4Ô4ˆð	Mð 	Mð 	Mð 	Mð 	Mð
 �}Š}˜]Ñ+Ô+Ð+r\   c                ó   ‡ ‡‡‡	— g Š	ˆ	fd„}t          ¦   «         Št          j        ddt          ¦   «         ‰d¬¦  «        } |¦   «          ‰	d         }t          j        ||¦  «        }ˆˆ ˆfd„}||_        |                     |¦  «        }‰                      t          ‰	¦  «        d¦  «         ‰                      t          ‰	d         j	        ¦  «        d¦  «         |j	        d         d          
                    t          ¦   «         ¦  «         |‰	fS )	zP
        Fail a first request, possibly retrying depending on argument.
        c                 ór   •— t          ¦   «         } ‰                     | ¦  «         t          j        | ¦  «        S rt   )rb   rl   r   r   )rï   Ú	protocolss    €rZ   r@  z>HTTPConnectionPoolRetryTests.retryAttempt.<locals>.newProtocol  s2   ø€ Ý'Ñ)Ô)ˆHØ×Ò˜XÑ&Ô&Ð&Ý”= Ñ*Ô*Ð*r\   r_  rœ  TrÝ  r   c                ó¤   •— ‰                      | d¦  «         ‰                     |‰¦  «         ‰                     |t          t          f¦  «         ‰S )Nr_  )r–   rQ  r  r5   r9   )Úmr  Úbpró  rY   ÚwillWeRetrys      €€€rZ   rô  z?HTTPConnectionPoolRetryTests.retryAttempt.<locals>._shouldRetry  sQ   ø€ Ø×Ò˜Q Ñ'Ô'Ð'Ø× Ò   \Ñ2Ô2Ð2Ø×!Ò! !¥nÕ6KÐ%LÑMÔMÐMØÐr\   r§   )rõ  r0   r?   rC   ró  rô  rm   r–   rœ   rg   Úerrbackr5   )
rY   r  r@  rm   rï   Úretrierrô  r(  ró  r  s
   ``      @@rZ   ÚretryAttemptz)HTTPConnectionPoolRetryTests.retryAttemptý  s*  øøøø€ ð ˆ	ð	+ð 	+ð 	+ð 	+ð 	+õ
 ‘x”xˆÝ”. ¨­w©y¬y¸,ÐSWÐXÑXÔXˆØˆ‰ŒˆØ˜Q”<ˆÝÔ6°xÀÑMÔMˆð	ð 	ð 	ð 	ð 	ð 	ð 	ð  ,ˆÔà�OŠO˜GÑ$Ô$ˆð 	×Ò�˜Y™œ¨Ñ+Ô+Ð+Ø×Ò�˜Y qœ\Ô2Ñ3Ô3°QÑ7Ô7Ð7ð 	Ô˜!Ô˜QÔ×'Ò'­Ñ(8Ô(8Ñ9Ô9Ð9Ø�)ˆ|Ðr\   c                ó"  — |                       d¦  «        \  }}|                      t          |¦  «        d¦  «         t          ¦   «         }|d         j        d         d                              |¦  «         |                     | j        |¦  «        S )z”
        L{client._RetryingHTTP11ClientProtocol} retries when
        L{client._RetryingHTTP11ClientProtocol._shouldRetry} returns C{True}.
        Tr¶   r§   r   )r  r–   rœ   rõ  rg   rX  r&  rQ  )rY   r(  r  rÀ  s       rZ   Ú"test_retryIfShouldRetryReturnsTruez?HTTPConnectionPoolRetryTests.test_retryIfShouldRetryReturnsTrue   s|   € ð
 ×(Ò(¨Ñ.Ô.‰ˆˆ9à×Ò�˜Y™œ¨Ñ+Ô+Ð+Ý‘8”8ˆØ�!ŒÔ˜aÔ  Ô#×,Ò,¨XÑ6Ô6Ð6Ø�}Š}˜TÔ1°8Ñ<Ô<Ð<r\   c                ó®   — |                       d¦  «        \  }}|                      t          |¦  «        d¦  «         |                      |t          ¦  «        S )zœ
        L{client._RetryingHTTP11ClientProtocol} does not retry when
        L{client._RetryingHTTP11ClientProtocol._shouldRetry} returns C{False}.
        Fr§   )r  r–   rœ   r   r5   ©rY   r(  r  s      rZ   Ú'test_dontRetryIfShouldRetryReturnsFalsezDHTTPConnectionPoolRetryTests.test_dontRetryIfShouldRetryReturnsFalse,  sM   € ð
 ×(Ò(¨Ñ/Ô/‰ˆˆ9à×Ò�˜Y™œ¨Ñ+Ô+Ð+Ø×!Ò! !¥^Ñ4Ô4Ð4r\   c                óH  — t          j        d¦  «        }t          j        d|¦  «        }|                      |                     dt          ¦   «         d¦  «        ¦  «         |                      |                     dt          ¦   «         t          ¦   «         ¦  «        ¦  «         dS )a  
        L{_RetryingHTTP11ClientProtocol} only retries queries that don't have
        a body.

        This is an implementation restriction; if the restriction is fixed,
        this test should be removed and PUT added to list of methods that
        support retries.
        Nrš  )r0   r>   ró  r…   rô  r5   rõ  rõ  rö  s      rZ   Útest_onlyRetryWithoutBodyz6HTTPConnectionPoolRetryTests.test_onlyRetryWithoutBody6  s†   € õ Ô(¨Ñ.Ô.ˆÝÔ9¸$ÀÑEÔEˆ
Ø�Š˜
×/Ò/°½Ñ8HÔ8HÈ$ÑOÔOÑPÔPÐPØ×Ò˜×0Ò0°½Ñ9IÔ9IÍ6É8Ì8ÑTÔTÑUÔUÐUÐUÐUr\   c                óf  — |                       d¦  «        \  }}|                      t          |¦  «        d¦  «         |d         j        d         d                              t          g ¦  «        ¦  «         |                      t          |¦  «        d¦  «         |                      |t
          ¦  «        S )z¤
        If a L{client._RetryingHTTP11ClientProtocol} fails more than once on
        an idempotent query before a response is received, it will not retry.
        Tr¶   r§   r   )r  r–   rœ   rg   r  r9   r   r  s      rZ   Útest_onlyRetryOncez/HTTPConnectionPoolRetryTests.test_onlyRetryOnceD  s˜   € ð
 ×(Ò(¨Ñ.Ô.‰ˆˆ9Ø×Ò�˜Y™œ¨Ñ+Ô+Ð+à�!ŒÔ˜aÔ  Ô#×+Ò+Õ,AÀ"Ñ,EÔ,EÑFÔFÐFà×Ò�˜Y™œ¨Ñ+Ô+Ð+Ø×!Ò! !Õ%:Ñ;Ô;Ð;r\   c                óX  ‡ ‡— t          j        t          ¦   «         ¦  «        }d|_        t	          ¦   «         Š‰                     t          ¦   «         ¦  «         |                     d‰¦  «         |                     dt          ¦   «         ¦  «        }ˆˆ fd„}| 
                    |¦  «        S )z…
        If L{HTTPConnectionPool.retryAutomatically} is set to C{False}, don't
        wrap connections with retrying logic.
        Fr   c                ó4   •— ‰                      | ‰¦  «         d S rt   )rQ  r  s    €€rZ   r#  z[HTTPConnectionPoolRetryTests.test_dontRetryIfRetryAutomaticallyFalse.<locals>.gotConnectiona  s   ø€ Ø× Ò  ¨XÑ6Ô6Ð6Ð6Ð6r\   )r0   r>   r!   r  rb   r  r&   r0  r%  r  r&  r  s   `   @rZ   Ú'test_dontRetryIfRetryAutomaticallyFalsezDHTTPConnectionPoolRetryTests.test_dontRetryIfRetryAutomaticallyFalseQ  s¬   øø€ õ
 Ô(­©¬Ñ1Ô1ˆØ"'ˆÔõ $Ñ%Ô%ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Ò˜C Ñ*Ô*Ð*ð ×Ò˜s¥M¡O¤OÑ4Ô4ˆð	7ð 	7ð 	7ð 	7ð 	7ð 	7ð �}Š}˜]Ñ+Ô+Ð+r\   c                óz  ‡ ‡‡‡‡— t          j        t          ¦   «         ¦  «        }dŠt          ¦   «         Šg Šˆfd„}||_        t          ¦   «         Š‰                     t          ¦   «         ¦  «         |                     ‰‰¦  «         | 	                    ‰‰¦  «        }ˆˆˆˆˆ fd„}| 
                    |¦  «        S )zó
        L{client.HTTPConnectionPool} creates
        {client._RetryingHTTP11ClientProtocol} with a new connection factory
        method that creates a new connection using the same key and endpoint
        as the wrapped connection.
        r   c                ó6   •— ‰                      | |f¦  «         d S rt   )rl   )Úkr  ÚnewConnectionss     €rZ   rV  zOHTTPConnectionPoolRetryTests.test_retryWithNewConnection.<locals>.newConnections  s!   ø€ Ø×!Ò! 1 a &Ñ)Ô)Ð)Ð)Ð)r\   c                ó   •— ‰                      | t          j        ¦  «         ‰                     | j        ‰¦  «         ‰                     ‰g ¦  «         |                      ¦   «          ‰                     t          ‰¦  «        d¦  «         ‰                     ‰d         d         ‰¦  «         ‰                     ‰d         d         ‰¦  «         d S )Nr§   r   )r  r0   ró  rQ  r  r–   rX  rœ   )r¼  rñ   rW  r"  rï   rY   s    €€€€€rZ   r#  zOHTTPConnectionPoolRetryTests.test_retryWithNewConnection.<locals>.gotConnection�  sÃ   ø€ Ø×!Ò! *­fÔ.RÑSÔSÐSØ× Ò  Ô!;¸XÑFÔFÐFð ×Ò˜^¨RÑ0Ô0Ð0Ø×%Ò%Ñ'Ô'Ð'Ø×Ò�S Ñ0Ô0°!Ñ4Ô4Ð4Ø×Ò˜^¨AÔ.¨qÔ1°3Ñ7Ô7Ð7Ø× Ò  °Ô!2°1Ô!5°xÑ@Ô@Ð@Ð@Ð@r\   )r0   r>   r!   r  rX  rb   r  r&   r0  r%  r&  )	rY   r  rV  r(  r#  rñ   rW  r"  rï   s	   `    @@@@rZ   Útest_retryWithNewConnectionz8HTTPConnectionPoolRetryTests.test_retryWithNewConnectionf  sñ   øøøøø€ õ Ô(­©¬Ñ1Ô1ˆØˆÝ ‘?”?ˆØˆð	*ð 	*ð 	*ð 	*ð 	*ð ,ˆÔõ $Ñ%Ô%ˆØ×Ò¥Ñ 1Ô 1Ñ2Ô2Ð2Ø×Ò˜C Ñ*Ô*Ð*ð ×Ò˜s HÑ-Ô-ˆð		Að 		Að 		Að 		Að 		Að 		Að 		Að 		Að 		Að �}Š}˜]Ñ+Ô+Ð+r\   N)r]   r^   r_   rp   r÷  rù  rû  rþ  r  r  r  r  r  r  r  r  r$  r`   r\   rZ   rð  rð  “  së   € € € € € ðð ðWð Wð Wð"
ð 
ð 
ð&	Kð 	Kð 	Kð
ð 
ð 
ð,ð ,ð ,ð.,ð ,ð ,ð!ð !ð !ðF
=ð 
=ð 
=ð5ð 5ð 5ðVð Vð Vð<ð <ð <ð,ð ,ð ,ð*&,ð &,ð &,ð &,ð &,r\   rð  c                  ó   — e Zd ZdZdd
„ZdS )ÚCookieTestsMixinz4
    Mixin for unit tests dealing with cookies.
    Ú	cookieJarr   rÅ  rx   Úcookiesúlist[bytes]rc   ú<tuple[client._FakeStdlibRequest, client._FakeStdlibResponse]c                óÐ   — t          j        t          j        dddt          d|i¦  «        d¦  «        ¦  «        }t          j        |¦  «        }|                     ||¦  «         ||fS )z/
        Add a cookie to a cookie jar.
        rT  rU  rV  ó
   Set-CookieN)r0   Ú_FakeStdlibResponser7   rC   Ú_FakeStdlibRequestÚextract_cookies)rY   r'  rÅ  r(  rÀ  rm   s         rZ   Ú
addCookieszCookieTestsMixin.addCookies”  st   € õ Ô-ÝŒOØØØÝ˜¨Ð0Ñ1Ô1Øñô ñ
ô 
ˆõ Ô+¨CÑ0Ô0ˆØ×!Ò! (¨GÑ4Ô4Ð4Ø˜Ð Ð r\   N)r'  r   rÅ  rx   r(  r)  rc   r*  )r]   r^   r_   rp   r0  r`   r\   rZ   r&  r&  �  s2   € € € € € ðð ð!ð !ð !ð !ð !ð !r\   r&  c                  ó*   — e Zd ZdZd	d„Zd
d„Zd
d„ZdS )ÚCookieJarTestszž
    Tests for L{twisted.web.client._FakeStdlibResponse} and
    L{twisted.web.client._FakeStdlibRequest}'s interactions with L{CookieJar}
    instances.
    rc   úNtuple[CookieJar, tuple[client._FakeStdlibRequest, client._FakeStdlibResponse]]c                óX   — t          ¦   «         }|                      |dddg¦  «        }||fS )zB
        @return: a L{CookieJar} with some sample cookies
        r:  s(   foo=1; cow=moo; Path=/foo; Comment=hellos   bar=2; Comment=goodbye)r   r0  )rY   r'  Úreqress      rZ   ÚmakeCookieJarzCookieJarTests.makeCookieJar¯  s<   € õ ‘K”Kˆ	Ø—’ØØ.Ø8Ð:SÐTñ
ô 
ˆð
 ˜&Ð Ð r\   rd   c                ó2  — |                       ¦   «         d         }d„ |D ¦   «         }|d         }|                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      |                     d¦  «        d¦  «         |d	         }|                      |j        d¦  «         |                      |j        d	¦  «         |                      |j        d
¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      |                     d¦  «        d¦  «         dS )zÂ
        L{CookieJar.extract_cookies} extracts cookie information from our
        stdlib-compatibility wrappers, L{client._FakeStdlibRequest} and
        L{client._FakeStdlibResponse}.
        r   c                ó   — i | ]
}|j         |“ŒS r`   )Úname)r9  Úcs     rZ   ú
<dictcomp>z6CookieJarTests.test_extractCookies.<locals>.<dictcomp>Ä  s   € Ð*Ð*Ð* �1”6˜1Ð*Ð*Ð*r\   rÜ   Ú1z/fooÚhelloÚcowÚmooÚbarÚ2ú/ÚgoodbyeN)	r6  r–   Úversionr9  rb  ÚpathÚcommentÚget_nonstandard_attrrQ  )rY   Újarr(  Úcookies       rZ   Útest_extractCookiesz"CookieJarTests.test_extractCookies½  s}  € ð × Ò Ñ"Ô" 1Ô%ˆØ*Ð* cÐ*Ñ*Ô*ˆà˜”ˆØ×Ò˜œ¨Ñ+Ô+Ð+Ø×Ò˜œ eÑ,Ô,Ð,Ø×Ò˜œ sÑ+Ô+Ð+Ø×Ò˜œ fÑ-Ô-Ð-Ø×Ò˜œ¨Ñ1Ô1Ð1Ø×Ò˜×4Ò4°UÑ;Ô;¸UÑCÔCÐCà˜”ˆØ×Ò˜œ¨Ñ+Ô+Ð+Ø×Ò˜œ eÑ,Ô,Ð,Ø×Ò˜œ sÑ+Ô+Ð+Ø×Ò˜œ cÑ*Ô*Ð*Ø×Ò˜œ¨Ñ3Ô3Ð3Ø×Ò˜V×8Ò8¸Ñ?Ô?ÀÑFÔFÐFÐFÐFr\   c                ó4  — |                       ¦   «         \  }\  }}|                      |                     dd¦  «        d¦  «         |                     |¦  «         |                      t          |j                             ¦   «         ¦  «        ddgfg¦  «         dS )z�
        L{CookieJar.add_cookie_header} adds a cookie header to a Twisted
        request via our L{client._FakeStdlibRequest} wrapper.
        ÚCookieNs   Cookies   foo=1; bar=2)r6  rQ  Ú
get_headerÚadd_cookie_headerr–   ÚlistÚ_twistedHeadersÚgetAllRawHeaders)rY   rH  rm   rÀ  s       rZ   Útest_sendCookiezCookieJarTests.test_sendCookieÖ  s£   € ð
 $(×#5Ò#5Ñ#7Ô#7Ñ ˆÑ ˆg�xà×Ò˜W×/Ò/°¸$Ñ?Ô?ÀÑFÔFÐFà×Ò˜gÑ&Ô&Ð&Ø×ÒÝ�Ô(×9Ò9Ñ;Ô;Ñ<Ô<Ø˜/Ð*Ð+Ð,ñ	
ô 	
ð 	
ð 	
ð 	
r\   N)rc   r3  ro   )r]   r^   r_   rp   r6  rJ  rR  r`   r\   rZ   r2  r2  ¨  s^   € € € € € ðð ð!ð !ð !ð !ðGð Gð Gð Gð2
ð 
ð 
ð 
ð 
ð 
r\   r2  c                  óp   — e Zd ZdZd„ Zd„ Zd„ Zdd„Zd„ Z e	e
 d	¦  «        d
„ ¦   «         Zd„ Zd„ Zd„ ZdS )ÚCookieAgentTestsz6
    Tests for L{twisted.web.client.CookieAgent}.
    c                ót   — t          j        |                      | j        ¦  «        t	          ¦   «         ¦  «        S )zB
        @return: a new L{twisted.web.client.CookieAgent}
        )r0   ÚCookieAgentr  r   r   ri   s    rZ   r‡  zCookieAgentTests.makeAgentí  s2   € õ Ô!Ø×)Ò)¨$¬,Ñ7Ô7½¹¼ñ
ô 
ð 	
r\   c                ó8   — |                       ¦   «         | _        d S rt   )rè   r   ri   s    rZ   rƒ   zCookieAgentTests.setUpõ  s   € Ø×)Ò)Ñ+Ô+ˆŒˆˆr\   c           	     óD  ‡ ‡— t          ¦   «         Š‰                      t          ‰¦  «        g ¦  «         ‰                      ‰ j        ¦  «        }t          j        |‰¦  «        }|                     dd¦  «        }ˆˆ fd„}|                     |¦  «         ‰ j	        j
                             ¦   «         \  }}‰                      |j                             d¦  «        d¦  «         t          j        dddt!          d	d
gi¦  «        d¦  «        }|                     |¦  «         |S )a  
        L{CookieAgent.request} does not insert any C{'Cookie'} header into the
        L{Request} object if there is no cookie in the cookie jar for the URI
        being requested. Cookies are extracted from the response and stored in
        the cookie jar.
        rš  r:  c                óð   •— t          ‰¦  «        }‰                     t          |¦  «        d¦  «         ‰                     |d         j        d¦  «         ‰                     |d         j        d¦  «         d S )Nr§   r   rÜ   r<  )rO  r–   rœ   r9  rb  )Úignoredr(  r'  rY   s     €€rZ   Ú_checkCookiezACookieAgentTests.test_emptyCookieJarRequest.<locals>._checkCookie  si   ø€ Ý˜9‘o”oˆGØ×Ò�S ™\œ\¨1Ñ-Ô-Ð-Ø×Ò˜W QœZœ_¨eÑ4Ô4Ð4Ø×Ò˜W QœZÔ-¨sÑ3Ô3Ð3Ð3Ð3r\   ó   cookieNrT  rU  rV  r,  ó   foo=1)r   r–   rO  r  r   r0   rV  rm   r&  rï   rg   rª   rQ  r°  r±  r7   rC   rX  )	rY   r  ÚcookieAgentr(  r[  r  r  rZ  r'  s	   `       @rZ   Útest_emptyCookieJarRequestz+CookieAgentTests.test_emptyCookieJarRequestø  s/  øø€ õ ‘K”Kˆ	Ø×Ò�˜i™œ¨"Ñ-Ô-Ð-à×-Ò-¨d¬lÑ;Ô;ˆÝÔ(¨°	Ñ:Ô:ˆØ×Ò Ð(JÑKÔKˆð	4ð 	4ð 	4ð 	4ð 	4ð 	4ð 	
�Š�lÑ#Ô#Ð#à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜Sœ[×6Ò6°yÑAÔAÀ4ÑHÔHÐHåŒØØØÝà!Ø ð$ðñô ð ñ
ô 
ˆð 	�Š�TÑÔÐàˆr\   rc   rd   c                ó  — d}d}t          ¦   «         }|                      |||g¦  «         |                      t          t	          |¦  «        ¦  «        d¦  «         |                      | j        ¦  «        }t          j        ||¦  «        }| 	                    d|t          ddgi¦  «        ¦  «         | j        j                             ¦   «         \  }}|                      |j                             d¦  «        dg¦  «         d	S )
zÅ
        L{CookieAgent.request} will not insert a C{'Cookie'} header into the
        L{Request} object when there is already a C{'Cookie'} header in the
        request headers parameter.
        r:  r]  r§   rš  rI  zalready-setr\  s   already-setN)r   r0  r–   rœ   rO  r  r   r0   rV  rm   rC   rï   rg   rª   r°  r±  ©rY   rÅ  rI  r'  r  r^  r  r  s           rZ   Útest_leaveExistingCookieHeaderz/CookieAgentTests.test_leaveExistingCookieHeader"  sê   € ð 1ˆØˆå‘K”Kˆ	Ø�Š˜	 3¨¨Ñ1Ô1Ð1Ø×Ò��T )™_œ_Ñ-Ô-¨qÑ1Ô1Ð1à×-Ò-¨d¬lÑ;Ô;ˆÝÔ(¨°	Ñ:Ô:ˆØ×Ò˜F C­°(¸]¸OÐ1LÑ)MÔ)MÑNÔNÐNà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°9Ñ=Ô=ÀÐ?OÑPÔPÐPÐPÐPr\   c                óä  — d}d}t          ¦   «         }|                      |||g¦  «         |                      t          t	          |¦  «        ¦  «        d¦  «         |                      | j        ¦  «        }t          j        ||¦  «        }| 	                    d|¦  «         | j
        j                             ¦   «         \  }}|                      |j                             d¦  «        |g¦  «         dS )z³
        L{CookieAgent.request} inserts a C{'Cookie'} header into the L{Request}
        object when there is a cookie matching the request URI in the cookie
        jar.
        r:  r]  r§   rš  r\  N©r   r0  r–   rœ   rO  r  r   r0   rV  rm   rï   rg   rª   r°  r±  ra  s           rZ   Útest_requestWithCookiez'CookieAgentTests.test_requestWithCookie6  sØ   € ð 1ˆØˆå‘K”Kˆ	Ø�Š˜	 3¨¨Ñ1Ô1Ð1Ø×Ò��T )™_œ_Ñ-Ô-¨qÑ1Ô1Ð1à×-Ò-¨d¬lÑ;Ô;ˆÝÔ(¨°	Ñ:Ô:ˆØ×Ò˜F CÑ(Ô(Ð(à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°9Ñ=Ô=À¸xÑHÔHÐHÐHÐHr\   rE  c                óä  — d}d}t          ¦   «         }|                      |||g¦  «         |                      t          t	          |¦  «        ¦  «        d¦  «         |                      | j        ¦  «        }t          j        ||¦  «        }| 	                    d|¦  «         | j
        j                             ¦   «         \  }}|                      |j                             d¦  «        dg¦  «         dS )z~
        L{CookieAgent} is able to handle secure cookies, ie cookies which
        should only be handled over https.
        s    https://example.com:1234/foo?baró   foo=1;securer§   rš  r\  r]  Nrd  ra  s           rZ   Útest_secureCookiez"CookieAgentTests.test_secureCookieJ  sØ   € ð 2ˆØ ˆå‘K”Kˆ	Ø�Š˜	 3¨¨Ñ1Ô1Ð1Ø×Ò��T )™_œ_Ñ-Ô-¨qÑ1Ô1Ð1à×-Ò-¨d¬lÑ;Ô;ˆÝÔ(¨°	Ñ:Ô:ˆØ×Ò˜F CÑ(Ô(Ð(à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°9Ñ=Ô=À¸zÑJÔJÐJÐJÐJr\   c                óâ  — d}d}t          ¦   «         }|                      |||g¦  «         |                      t          t	          |¦  «        ¦  «        d¦  «         |                      | j        ¦  «        }t          j        ||¦  «        }| 	                    d|¦  «         | j
        j                             ¦   «         \  }}|                      d|j                             d¦  «        ¦  «         dS )zs
        If a cookie is setup as secure, it won't be sent with the request if
        it's not over HTTPS.
        r  rg  r§   rš  Nr\  )r   r0  r–   rœ   rO  r  r   r0   rV  rm   rï   rg   rª   rQ  r°  r±  ra  s           rZ   Ú%test_secureCookieOnInsecureConnectionz6CookieAgentTests.test_secureCookieOnInsecureConnection^  sÖ   € ð
 ,ˆØ ˆå‘K”Kˆ	Ø�Š˜	 3¨¨Ñ1Ô1Ð1Ø×Ò��T )™_œ_Ñ-Ô-¨qÑ1Ô1Ð1à×-Ò-¨d¬lÑ;Ô;ˆÝÔ(¨°	Ñ:Ô:ˆØ×Ò˜F CÑ(Ô(Ð(à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜T 3¤;×#<Ò#<¸YÑ#GÔ#GÑHÔHÐHÐHÐHr\   c                óä  — d}d}t          ¦   «         }|                      |||g¦  «         |                      t          t	          |¦  «        ¦  «        d¦  «         |                      | j        ¦  «        }t          j        ||¦  «        }| 	                    d|¦  «         | j
        j                             ¦   «         \  }}|                      |j                             d¦  «        dg¦  «         dS )zz
        L{CookieAgent} supports cookies which enforces the port number they
        need to be transferred upon.
        r:  ó   foo=1;port=1234r§   rš  r\  r]  Nrd  ra  s           rZ   Útest_portCookiez CookieAgentTests.test_portCookieq  sØ   € ð
 1ˆØ#ˆå‘K”Kˆ	Ø�Š˜	 3¨¨Ñ1Ô1Ð1Ø×Ò��T )™_œ_Ñ-Ô-¨qÑ1Ô1Ð1à×-Ò-¨d¬lÑ;Ô;ˆÝÔ(¨°	Ñ:Ô:ˆØ×Ò˜F CÑ(Ô(Ð(à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSØ×Ò˜œ×2Ò2°9Ñ=Ô=À¸zÑJÔJÐJÐJÐJr\   c                óº   — d}d}t          ¦   «         }|                      |||g¦  «         |                      t          t	          |¦  «        ¦  «        d¦  «         dS )z—
        When creating a cookie with a port directive, it won't be added to the
        L{cookie.CookieJar} if the URI is on a different port.
        s   http://example.com:4567/foo?barrl  r   N)r   r0  r–   rœ   rO  )rY   rÅ  rI  r'  s       rZ   Útest_portCookieOnWrongPortz+CookieAgentTests.test_portCookieOnWrongPort„  sY   € ð
 1ˆØ#ˆå‘K”Kˆ	Ø�Š˜	 3¨¨Ñ1Ô1Ð1Ø×Ò��T )™_œ_Ñ-Ô-¨qÑ1Ô1Ð1Ð1Ð1r\   Nro   )r]   r^   r_   rp   r‡  rƒ   r_  rb  re  r   r¨  rh  rj  rm  ro  r`   r\   rZ   rT  rT  æ  sØ   € € € € € ðð ð
ð 
ð 
ð,ð ,ð ,ð(ð (ð (ðTQð Qð Qð Qð(Ið Ið Ið( €V�
ˆNÐDÑEÔEðKð Kñ FÔEðKð&Ið Ið Ið&Kð Kð Kð&
2ð 
2ð 
2ð 
2ð 
2r\   rT  c                  ó   — e Zd ZdZdS )ÚDecoder1úK
    A test decoder to be used by L{client.ContentDecoderAgent} tests.
    N©r]   r^   r_   rp   r`   r\   rZ   rq  rq  ‘  ó   € € € € € ðð ð ð r\   rq  c                  ó   — e Zd ZdZdS )ÚDecoder2rr  Nrs  r`   r\   rZ   rv  rv  —  rt  r\   rv  c                  ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚContentDecoderAgentTestsz2
    Tests for L{client.ContentDecoderAgent}.
    c                ó6   — t          j        | j        g ¦  «        S )zJ
        @return: a new L{twisted.web.client.ContentDecoderAgent}
        )r0   ÚContentDecoderAgentr  ri   s    rZ   r‡  z"ContentDecoderAgentTests.makeAgent¢  s   € õ Ô)¨$¬*°bÑ9Ô9Ð9r\   c                óv   — |                       ¦   «         | _        |                      | j        ¦  «        | _        dS rË  )rè   r   r  r  ri   s    rZ   rƒ   zContentDecoderAgentTests.setUp¨  s2   € ð ×)Ò)Ñ+Ô+ˆŒØ×2Ò2°4´<Ñ@Ô@ˆŒ
ˆ
ˆ
r\   c                óz  — t          j        | j        dt          fdt          fg¦  «        }|                     dd¦  «         | j        }|                      t          |j	        ¦  «        d¦  «         |j	         
                    ¦   «         \  }}|                      |j                             d¦  «        dg¦  «         dS )	z‰
        L{client.ContentDecoderAgent} sets the I{Accept-Encoding} header to the
        names of the available decoder objects.
        ó   decoder1ó   decoder2rš  r)  r§   ó   accept-encodingó   decoder1,decoder2N)r0   rz  r  rq  rv  rm   rï   r–   rœ   rg   rª   r°  r±  )rY   r  rï   r  r  s        rZ   Útest_acceptHeadersz+ContentDecoderAgentTests.test_acceptHeaders¯  s¿   € õ
 Ô*ØŒJ˜+¥xÐ0°;ÅÐ2IÐJñ
ô 
ˆð 	�Š�fÐ7Ñ8Ô8Ð8à”=ˆà×Ò�˜XÔ.Ñ/Ô/°Ñ3Ô3Ð3ØÔ$×(Ò(Ñ*Ô*‰ˆˆSØ×ÒØŒK×%Ò%Ð&8Ñ9Ô9Ð<PÐ;Qñ	
ô 	
ð 	
ð 	
ð 	
r\   c                óú  — t          j        dgdgdœ¦  «        }t          j        | j        dt
          fdt          fg¦  «        }|                     dd|¬¦  «         | j        }|  	                    t          |j        ¦  «        d	¦  «         |j                             ¦   «         \  }}|  	                    t          t          |j                             ¦   «         ¦  «        ¦  «        d
ddgfddgfddgfg¦  «         dS )z¥
        If there are existing I{Accept-Encoding} fields,
        L{client.ContentDecoderAgent} creates a new field for the decoders it
        knows about.
        r#  ó   fizz)rå  r  r}  r~  rš  r)  ©r°  r§   s   Accept-Encodingr€  ó   Foor§  r-  N)r2   rC   r0   rz  r  rq  rv  rm   rï   r–   rœ   rg   rª   rO  Úsortedr°  rQ  )rY   r°  r  rï   r  r  s         rZ   Útest_existingHeadersz-ContentDecoderAgentTests.test_existingHeadersÂ  s  € õ Ô&Ø�X°G°9Ð=Ð=ñ
ô 
ˆõ Ô*ØŒJ˜+¥xÐ0°;ÅÐ2IÐJñ
ô 
ˆð 	�Š�fÐ7ÀˆÑIÔIÐIà”=ˆà×Ò�˜XÔ.Ñ/Ô/°Ñ3Ô3Ð3ØÔ$×(Ò(Ñ*Ô*‰ˆˆSØ×ÒÝ•˜œ×4Ò4Ñ6Ô6Ñ7Ô7Ñ8Ô8à# gÐ/CÐ%DÐEØ˜&˜Ð"Ø˜>Ð*Ð+ðñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ól  — t          j        | j        dt          fdt          fg¦  «        }|                     dd¦  «        }| j        j                             ¦   «         \  }}t          dddt          j        ¦   «         d¦  «        }|                     |¦  «         |                     | j        |¦  «        S )	z¥
        If the response is not encoded despited the request I{Accept-Encoding}
        headers, L{client.ContentDecoderAgent} simply forwards the response.
        r}  r~  rš  r)  rT  rU  rV  N)r0   rz  r  rq  rv  rm   rï   rg   rª   r7   r2   rC   rX  r&  rQ  )rY   r  r·  r  r  rÀ  s         rZ   Útest_plainEncodingResponsez3ContentDecoderAgentTests.test_plainEncodingResponseÝ  s¦   € õ
 Ô*ØŒJ˜+¥xÐ0°;ÅÐ2IÐJñ
ô 
ˆð —=’= Ð)BÑCÔCˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSå˜O¨S°%½Ô9MÑ9OÔ9OÐQUÑVÔVˆØ�Š�XÑÔÐà×#Ò# DÔ$8¸(ÑCÔCÐCr\   c                ó|  — t          j        | j        dt          fdt          fg¦  «        }|                     dd¦  «        }| j        j                             ¦   «         \  }}t          j
        dgdgdœ¦  «        }t          dd	d
|d¦  «        }|                     |¦  «         |                     | j        |¦  «        S )zz
        If an encoding unknown to the L{client.ContentDecoderAgent} is found,
        the response is unchanged.
        r}  r~  rš  r)  r#  rƒ  ©rå  ó   content-encodingrT  rU  rV  N)r0   rz  r  rq  rv  rm   rï   rg   rª   r2   rC   r7   rX  r&  rQ  )rY   r  r·  r  r  r°  rÀ  s          rZ   Útest_unsupportedEncodingz1ContentDecoderAgentTests.test_unsupportedEncodingî  s¿   € õ
 Ô*ØŒJ˜+¥xÐ0°;ÅÐ2IÐJñ
ô 
ˆð —=’= Ð)BÑCÔCˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ø�X°W°IÐ>Ð>ñ
ô 
ˆõ ˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐà×#Ò# DÔ$8¸(ÑCÔCÐCr\   c                ó€  ‡ ‡— t          j        ‰ j        dt          fdt          fg¦  «        }|                     dd¦  «        }‰ j        j                             ¦   «         \  }}t          j
        dgdgdœ¦  «        }t          dd	d
|d¦  «        Š|                     ‰¦  «         ˆˆ fd„}|                     |¦  «        S )z¨
        When L{client.ContentDecoderAgent} encounters a decoder it doesn't know
        about, it stops decoding even if another encoding is known afterwards.
        r}  r~  rš  r)  r#  s   decoder1,fizz,decoder2r‹  rT  rU  rV  Nc                óÈ   •— ‰                      ‰| ¦  «         ‰                     | t          ¦  «         ‰                     dg| j                             d¦  «        ¦  «         d S )Ns   decoder1,fizzrŒ  )rU  r  rv  r–   r°  r±  )rn   rÀ  rY   s    €€rZ   Úcheckz<ContentDecoderAgentTests.test_unknownEncoding.<locals>.check	  sj   ø€ Ø×#Ò# H¨fÑ5Ô5Ð5Ø×!Ò! &­(Ñ3Ô3Ð3Ø×ÒØ!Ð" F¤N×$@Ò$@ÐATÑ$UÔ$Uñô ð ð ð r\   )r0   rz  r  rq  rv  rm   rï   rg   rª   r2   rC   r7   rX  r&  )rY   r  r·  r  r  r°  r�  rÀ  s   `      @rZ   Útest_unknownEncodingz-ContentDecoderAgentTests.test_unknownEncoding	  sÞ   øø€ õ
 Ô*ØŒJ˜+¥xÐ0°;ÅÐ2IÐJñ
ô 
ˆð —=’= Ð)BÑCÔCˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ø�XÐ5NÐ4OÐPÐPñ
ô 
ˆõ ˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐð	ð 	ð 	ð 	ð 	ð 	ð ×#Ò# EÑ*Ô*Ð*r\   N)r]   r^   r_   rp   r‡  rƒ   r�  r‡  r‰  r�  r‘  r`   r\   rZ   rx  rx  �  s�   € € € € € ðð ð:ð :ð :ðAð Að Að
ð 
ð 
ð&
ð 
ð 
ð6Dð Dð Dð"Dð Dð Dð(+ð +ð +ð +ð +r\   rx  c                  ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚSimpleAgentProtocola
  
    A L{Protocol} to be used with an L{client.Agent} to receive data.

    @ivar finished: L{Deferred} firing when C{connectionLost} is called.

    @ivar made: L{Deferred} firing when C{connectionMade} is called.

    @ivar received: C{list} of received data.
    c                ó`   — t          ¦   «         | _        t          ¦   «         | _        g | _        d S rt   )r   ÚmadeÚfinishedÚreceivedri   s    rZ   rj   zSimpleAgentProtocol.__init__)	  s#   € Ý‘J”JˆŒ	Ý ™
œ
ˆŒØˆŒˆˆr\   c                ó:   — | j                              d ¦  «         d S rt   )r•  rX  ri   s    rZ   ÚconnectionMadez"SimpleAgentProtocol.connectionMade.	  s   € ØŒ	×Ò˜4Ñ Ô Ð Ð Ð r\   c                ó:   — | j                              d ¦  «         d S rt   )r–  rX  )rY   Úreasons     rZ   rx  z"SimpleAgentProtocol.connectionLost1	  s   € ØŒ×Ò˜tÑ$Ô$Ð$Ð$Ð$r\   c                ó:   — | j                              |¦  «         d S rt   )r—  rl   ©rY   r­  s     rZ   ÚdataReceivedz SimpleAgentProtocol.dataReceived4	  s   € ØŒ×Ò˜TÑ"Ô"Ð"Ð"Ð"r\   N)r]   r^   r_   rp   rj   r™  rx  rž  r`   r\   rZ   r“  r“  	  sZ   € € € € € ðð ðð ð ð
!ð !ð !ð%ð %ð %ð#ð #ð #ð #ð #r\   r“  c                  ó,   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )Ú ContentDecoderAgentWithGzipTestsc                óº   — |                       ¦   «         | _        |                      | j        ¦  «        }t          j        |dt          j        fg¦  «        | _        dS )rÌ  ó   gzipN)rè   r   r  r0   rz  ÚGzipDecoderr  rÑ  s     rZ   rƒ   z&ContentDecoderAgentWithGzipTests.setUp9	  sO   € ð ×)Ò)Ñ+Ô+ˆŒØ×-Ò-¨d¬lÑ;Ô;ˆÝÔ/°¸Å&ÔBTÐ8UÐ7VÑWÔWˆŒ
ˆ
ˆ
r\   c                óB  ‡ ‡‡	— ‰ j                              dd¦  «        }‰ j        j                             ¦   «         \  }}t          j        dgdgdœ¦  «        }t          ¦   «         }t          ddd||¦  «        Š	d	‰	_	        | 
                    ‰	¦  «         t          j        d
t          j        dt          j        z   ¦  «        }|                     d¦  «        |                     d¦  «        z   |                     ¦   «         z   Šˆˆ	ˆ fd„}|                     |¦  «         |S )z¦
        If the response has a C{gzip} I{Content-Encoding} header,
        L{GzipDecoder} wraps the response to return uncompressed data to the
        user.
        rš  r)  r#  r¢  r‹  rT  rU  rV  é   r¶   é   s   xxxxxxs   yyyyc                ó,  •— ‰                      | ‰¦  «         ‰                     | j        d¦  «         ‰                     | j        d¦  «         ‰                     | j        d¦  «         ‰                     t          | j                             ¦   «         ¦  «        ddgfg¦  «         ‰                     | j        t          ¦  «         ‰ 
                    t          t          | d¦  «         ‰                     ‰d d…         ¦  «         ‰                     ‰dd …         ¦  «         ‰                     ¦   «          t          ¦   «         }|                      |¦  «         ‰                     |j        dg¦  «         t%          j        |j        |j        g¦  «        S )	NrT  rU  rV  r…  r#  Úunknownr›   s
   xxxxxxyyyy)rU  r–   rD  ÚcodeÚphraserO  r°  rQ  r—   rD   rû  ÚAttributeErrorÚgetattrÚ_bodyDataReceivedÚ_bodyDataFinishedr“  ÚdeliverBodyr—  r   ÚgatherResultsr•  r–  )rn   rï   r­  rÀ  rY   s     €€€rZ   ÚcheckResponsezQContentDecoderAgentWithGzipTests.test_gzipEncodingResponse.<locals>.checkResponseZ	  ss  ø€ Ø×#Ò# F¨HÑ5Ô5Ð5Ø×Ò˜Vœ^¨_Ñ=Ô=Ð=Ø×Ò˜Vœ[¨#Ñ.Ô.Ð.Ø×Ò˜Vœ]¨EÑ2Ô2Ð2Ø×ÒÝ�V”^×4Ò4Ñ6Ô6Ñ7Ô7¸6ÀFÀ8Ð:LÐ9Mñô ð ð ×Ò˜Vœ]­NÑ;Ô;Ð;Ø×Ò�n­g°v¸yÑIÔIÐIà×&Ò& t¨B¨Q¨B¤xÑ0Ô0Ð0Ø×&Ò& t¨A¨B¨B¤xÑ0Ô0Ð0Ø×&Ò&Ñ(Ô(Ð(å*Ñ,Ô,ˆHØ×Ò˜xÑ(Ô(Ð(à×Ò˜XÔ.Ð1DÐ0EÑFÔFÐFÝÔ&¨¬°xÔ7HÐ'IÑJÔJÐJr\   )r  rm   rï   rg   rª   r2   rC   r&   r7   r—   rX  ÚzlibÚcompressobjÚDEFLATEDÚ	MAX_WBITSÚcompressr¬  r&  )
rY   r·  r  r  r°  r1  Ú
compressorr±  r­  rÀ  s
   `       @@rZ   Útest_gzipEncodingResponsez:ContentDecoderAgentWithGzipTests.test_gzipEncodingResponseA	  s7  øøø€ ð ”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ø�X°W°IÐ>Ð>ñ
ô 
ˆõ $Ñ%Ô%ˆ	Ý˜O¨S°%¸À)ÑLÔLˆØˆŒØ�Š�XÑÔÐåÔ% a­¬¸½T¼^Ñ8KÑLÔLˆ
à×Ò Ñ)Ô)Ø×!Ò! (Ñ+Ô+ñ,à×ÒÑ Ô ñ!ð 	ð	Kð 	Kð 	Kð 	Kð 	Kð 	Kð 	Kð* 	×Ò˜]Ñ+Ô+Ð+àˆr\   c                óÚ  ‡ ‡‡	— ‰ j                              dd¦  «        }‰ j        j                             ¦   «         \  }}t          j        dgdgdœ¦  «        }t          ¦   «         }t          ddd||¦  «        Š	d	‰	_	        | 
                    ‰	¦  «         d
Šˆˆ	fd„}|                     |¦  «         ‰                      |t          j        ¦  «         ˆ fd„}|                     |¦  «        S )z�
        If the data received by the L{GzipDecoder} isn't valid gzip-compressed
        data, the call to C{deliverBody} fails with a C{zlib.error}.
        rš  r)  r#  r¢  r‹  rT  rU  rV  r¥  s   not gzipped contentc                ót   •— ‰                      ‰¦  «         |                      t          ¦   «         ¦  «         d S rt   )r­  r¯  r    )rn   r­  rÀ  s    €€rZ   r±  zJContentDecoderAgentWithGzipTests.test_brokenContent.<locals>.checkResponse†	  s5   ø€ Ø×&Ò& tÑ,Ô,Ð,à×Ò�x™zœzÑ*Ô*Ð*Ð*Ð*r\   c                óœ   •— | j         d                              t          j        ¦  «         ‰                     | j        t          ¦  «         d S )Nr   ©ÚreasonsrÂ   r²  r1   r  rÀ  r7   ©r1   rY   s    €rZ   ÚcheckFailurezIContentDecoderAgentWithGzipTests.test_brokenContent.<locals>.checkFailureŽ	  ó>   ø€ ØŒM˜!Ô×!Ò!¥$¤*Ñ-Ô-Ð-Ø×!Ò! %¤.µ(Ñ;Ô;Ð;Ð;Ð;r\   )r  rm   rï   rg   rª   r2   rC   r&   r7   r—   rX  r&  r   r0   r8   )
rY   r·  r  r  r°  r1  r±  r¿  r­  rÀ  s
   `       @@rZ   Útest_brokenContentz3ContentDecoderAgentWithGzipTests.test_brokenContents	  s  øøø€ ð
 ”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ø�X°W°IÐ>Ð>ñ
ô 
ˆõ $Ñ%Ô%ˆ	Ý˜O¨S°%¸À)ÑLÔLˆØˆŒØ�Š�XÑÔÐà%ˆð	+ð 	+ð 	+ð 	+ð 	+ð 	+ð
 	×Ò˜]Ñ+Ô+Ð+Ø×Ò˜8¥VÔ%:Ñ;Ô;Ð;ð	<ð 	<ð 	<ð 	<ð 	<ð ×#Ò# LÑ1Ô1Ð1r\   c                óà  ‡ ‡	—  G d„ d¦  «        }t           j        }|t           _        ‰                      t          t           d|¦  «         ‰ j                             dd¦  «        }‰ j        j                             ¦   «         \  }}t          j
        ddgi¦  «        }t          ¦   «         }t          ddd	||¦  «        Š	|                     ‰	¦  «         ˆ	ˆ fd
„}|                     |¦  «         |S )zÆ
        When the connection with the server is lost, the gzip protocol calls
        C{flush} on the zlib decompressor object to get uncompressed data which
        may have been buffered.
        c                  ó    — e Zd Zd„ Zd„ Zd„ ZdS )úFContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobjc                ó   — d S rt   r`   ©rY   Úwbitss     rZ   rj   zOContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobj.__init__œ	  rŽ   r\   c                ó   — dS ©Nó   xr`   r�  s     rZ   Ú
decompresszQContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobj.decompressŸ	  ó   € Ø�tr\   c                ó   — dS )Nó   yr`   ri   s    rZ   r¬  zLContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobj.flush¢	  rÌ  r\   N©r]   r^   r_   rj   rË  r¬  r`   r\   rZ   ÚdecompressobjrÄ  ›	  sA   € € € € € ðð ð ðð ð ðð ð ð ð r\   rÐ  rš  r)  rŒ  r¢  rT  rU  rV  c                ó  •— ‰                      d¦  «         ‰                     ¦   «          t          ¦   «         }|                      |¦  «         ‰                     |j        ddg¦  «         t          j        |j        |j	        g¦  «        S ©Ns   datarÊ  rÎ  ©
r­  r®  r“  r¯  r–   r—  r   r°  r•  r–  ©rn   rï   rÀ  rY   s     €€rZ   r±  zFContentDecoderAgentWithGzipTests.test_flushData.<locals>.checkResponse²	  ó€   ø€ Ø×&Ò& wÑ/Ô/Ð/Ø×&Ò&Ñ(Ô(Ð(å*Ñ,Ô,ˆHØ×Ò˜xÑ(Ô(Ð(à×Ò˜XÔ.°°t°Ñ=Ô=Ð=ÝÔ&¨¬°xÔ7HÐ'IÑJÔJÐJr\   )r²  rÐ  Ú
addCleanupÚsetattrr  rm   rï   rg   rª   r2   rC   r&   r7   rX  r&  )
rY   rÐ  ÚoldDecompressObjr·  r  r  r°  r1  r±  rÀ  s
   `        @rZ   Útest_flushDataz/ContentDecoderAgentWithGzipTests.test_flushData”	  s  øø€ ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	õ  Ô-ÐØ*�ÔØ�Š�¥ Ð8HÑIÔIÐIà”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ð(;¸g¸YÐ'GÑHÔHˆÝ#Ñ%Ô%ˆ	Ý˜O¨S°%¸À)ÑLÔLˆØ�Š�XÑÔÐð	Kð 	Kð 	Kð 	Kð 	Kð 	Kð 	×Ò˜]Ñ+Ô+Ð+àˆr\   c                óP  ‡ ‡
—  G d„ d¦  «        }t           j        }|t           _        ‰                      t          t           d|¦  «         ‰ j                             dd¦  «        }‰ j        j                             ¦   «         \  }}t          j
        ddgi¦  «        }t          ¦   «         }t          ddd	||¦  «        Š
|                     ‰
¦  «         ˆ
ˆ fd
„}|                     |¦  «         ‰                      |t           j        ¦  «         ˆ fd„}	|                     |	¦  «        S )z•
        If the C{flush} call in C{connectionLost} fails, the C{zlib.error}
        exception is caught and turned into a L{ResponseFailed}.
        c                  ó    — e Zd Zd„ Zd„ Zd„ ZdS )úGContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobjc                ó   — d S rt   r`   rÆ  s     rZ   rj   zPContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobj.__init__Ç	  rŽ   r\   c                ó   — dS rÉ  r`   r�  s     rZ   rË  zRContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobj.decompressÊ	  rÌ  r\   c                ó(   — t          j        ¦   «         ‚rt   )r²  r1   ri   s    rZ   r¬  zMContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobj.flushÍ	  s   € Ý”j‘l”lÐ"r\   NrÏ  r`   r\   rZ   rÐ  rÜ  Æ	  sA   € € € € € ðð ð ðð ð ð#ð #ð #ð #ð #r\   rÐ  rš  r)  rŒ  r¢  rT  rU  rV  c                ó  •— ‰                      d¦  «         ‰                     ¦   «          t          ¦   «         }|                      |¦  «         ‰                     |j        ddg¦  «         t          j        |j        |j	        g¦  «        S rÒ  rÓ  rÔ  s     €€rZ   r±  zGContentDecoderAgentWithGzipTests.test_flushError.<locals>.checkResponseÝ	  rÕ  r\   c                óœ   •— | j         d                              t          j        ¦  «         ‰                     | j        t          ¦  «         d S )Nr§   r¼  r¾  s    €rZ   r¿  zFContentDecoderAgentWithGzipTests.test_flushError.<locals>.checkFailureë	  rÀ  r\   )r²  rÐ  rÖ  r×  r  rm   rï   rg   rª   r2   rC   r&   r7   rX  r&  r   r0   r8   )rY   rÐ  rØ  r·  r  r  r°  r1  r±  r¿  rÀ  s   `         @rZ   Útest_flushErrorz0ContentDecoderAgentWithGzipTests.test_flushErrorÀ	  sV  øø€ ð	#ð 	#ð 	#ð 	#ð 	#ñ 	#ô 	#ð 	#õ  Ô-ÐØ*�ÔØ�Š�¥ Ð8HÑIÔIÐIà”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ð(;¸g¸YÐ'GÑHÔHˆÝ#Ñ%Ô%ˆ	Ý˜O¨S°%¸À)ÑLÔLˆØ�Š�XÑÔÐð	Kð 	Kð 	Kð 	Kð 	Kð 	Kð 	×Ò˜]Ñ+Ô+Ð+à×Ò˜8¥VÔ%:Ñ;Ô;Ð;ð	<ð 	<ð 	<ð 	<ð 	<ð ×#Ò# LÑ1Ô1Ð1r\   N)r]   r^   r_   rƒ   r¸  rÁ  rÙ  râ  r`   r\   rZ   r   r   8	  se   € € € € € ðXð Xð Xð0ð 0ð 0ðd2ð 2ð 2ðB*ð *ð *ðX/2ð /2ð /2ð /2ð /2r\   r   c                  ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚProxyAgentTestsz)
    Tests for L{client.ProxyAgent}.
    c                ó^   — t          j        t          | j        dd¦  «        | j        ¦  «        S )zA
        @return: a new L{twisted.web.client.ProxyAgent}
        z	127.0.0.1r  )r0   Ú
ProxyAgentr   r   ri   s    rZ   r‡  zProxyAgentTests.makeAgent÷	  s.   € õ Ô Ý˜tœ|¨[¸$Ñ?Ô?ÀÄñ
ô 
ð 	
r\   c                óö   — |                       ¦   «         | _        t          j        t	          | j        dd¦  «        | j        ¦  «        | _        | j        j        }|                      || ¦  «        | j        _        d S )Nr@  é.  )rè   r   r0   ræ  r   r  Ú_proxyEndpointrù   )rY   ÚoldEndpoints     rZ   rƒ   zProxyAgentTests.setUpÿ	  sj   € Ø×)Ò)Ñ+Ô+ˆŒÝÔ&Ý˜tœ|¨U°DÑ9Ô9¸4¼<ñ
ô 
ˆŒ
ð ”jÔ/ˆØ$(×$5Ò$5°kÀ4Ñ$HÔ$HˆŒ
Ô!Ð!Ð!r\   c                óT   — |                       t          | j        j        dd¦  «         dS )zo
        L{ProxyAgent.request} raises L{TypeError} when the C{method} argument
        isn't L{bytes}.
        rø  rù  Nrú  ri   s    rZ   rý  z#ProxyAgentTests.test_nonBytesMethod
  rþ  r\   c                óR  — t          j        ddgi¦  «        }t          ¦   «         }| j                             dd||¦  «         | j        j                             ¦   «         dd…         \  }}}|                      |d¦  «         |                      |d¦  «         |  	                    |j
        t          j        ¦  «         | j        }|                      t          |j        ¦  «        d	¦  «         |j                             ¦   «         \  }}|  	                    |t           ¦  «         |                      |j        d¦  «         |                      |j        d¦  «         |                      |j        t          j        dgd
gdœ¦  «        ¦  «         |                      |j        |¦  «         dS )zŽ
        L{client.ProxyAgent} issues an HTTP request against the proxy, with the
        full URI as path, when C{request} is called.
        rå  r#  rš  r:  Nr¦   r@  rè  r§   r;  r$  )r2   rC   rõ  r  rm   r   rä   rª   r–   r  Ú_wrappedFactoryr0   rA   rï   rœ   rg   r?   r<  rÅ  r°  rQ  ró  )	rY   r°  r=  rF  rG  rô   rï   r  r  s	            rZ   Útest_proxyRequestz!ProxyAgentTests.test_proxyRequest
  s•  € õ
 Ô&¨°°Ð'9Ñ:Ô:ˆõ ‰xŒxˆØŒ
×Ò˜6Ð#EÀwÐPTÑUÔUÐUà"œlÔ5×9Ò9Ñ;Ô;¸B¸Q¸BÔ?Ñˆˆd�GØ×Ò˜˜uÑ%Ô%Ð%Ø×Ò˜˜tÑ$Ô$Ð$à×Ò˜gÔ5µvÔ7RÑSÔSÐSà”=ˆð 	×Ò�˜XÔ.Ñ/Ô/°Ñ3Ô3Ð3ØÔ$×(Ò(Ñ*Ô*‰ˆˆSØ×Ò˜c¥7Ñ+Ô+Ð+Ø×Ò˜œ VÑ,Ô,Ð,Ø×Ò˜œÐ"DÑEÔEÐEØ×ÒØŒKÝÔ ¨6¨(Ð>QÐ=RÐ!SÐ!SÑTÔTñ	
ô 	
ð 	
ð 	×Ò˜SÔ-¨tÑ4Ô4Ð4Ð4Ð4r\   c                óP   — |                       | j        j        j        d¦  «         dS )zJ
        C{ProxyAgent} connections are not persistent by default.
        FN)r–   r  rÏ  rL  ri   s    rZ   rß  z"ProxyAgentTests.test_nonPersistent-
  s(   € ð 	×Ò˜œÔ)Ô4°eÑ<Ô<Ð<Ð<Ð<r\   c                ó4  ‡ ‡— t          ¦   «         Š G ˆˆ fd„d¦  «        } |¦   «         }t          j        ‰‰ j        |¬¦  «        }‰                      ||j        ¦  «         |                     dd¦  «         ‰                      |j        j        d¦  «         dS )zÚ
        When a connection is made by the C{ProxyAgent}, it uses its pool's
        C{getConnection} method to do so, with the endpoint it was constructed
        with and a key of C{("http-proxy", endpoint)}.
        c                  ó$   •— e Zd ZdZdZˆ ˆfd„ZdS )úAProxyAgentTests.test_connectUsesConnectionPool.<locals>.DummyPoolFc                ó®   •— d| _         ‰                     |‰¦  «         ‰                     |d‰f¦  «         t          j        t          ¦   «         ¦  «        S )NTz
http-proxy)rì  rQ  r–   r   r   rb   rí  s      €€rZ   r%  zOProxyAgentTests.test_connectUsesConnectionPool.<locals>.DummyPool.getConnection?
  sT   ø€ Ø!%�”Ø×$Ò$ R¨Ñ2Ô2Ð2ð × Ò   |°XÐ&>Ñ?Ô?Ð?Ý”}Õ%5Ñ%7Ô%7Ñ8Ô8Ð8r\   Nrï  rç  s   €€rZ   rð  rò  ;
  s=   ø€ € € € € ØˆIØˆJð9ð 9ð 9ð 9ð 9ð 9ð 9ð 9r\   rð  rÔ  rš  rò  TN)	r  r0   ræ  r   rQ  rÏ  rm   r–   rì  )rY   rð  r  r  rñ   s   `   @rZ   rö  z.ProxyAgentTests.test_connectUsesConnectionPool3
  s¹   øø€ õ !‘?”?ˆð	9ð 	9ð 	9ð 	9ð 	9ð 	9ð 	9ð 	9ñ 	9ô 	9ð 	9ð ˆy‰{Œ{ˆÝÔ! (¨D¬L¸tÐDÑDÔDˆØ×Ò˜T 5¤;Ñ/Ô/Ð/à�Š�f˜nÑ-Ô-Ð-Ø×Ò˜œÔ.°Ñ5Ô5Ð5Ð5Ð5r\   N)
r]   r^   r_   rp   r‡  rƒ   rý  rî  rß  rö  r`   r\   rZ   rä  rä  ò	  s~   € € € € € ðð ð
ð 
ð 
ðIð Ið IðXð Xð Xð5ð 5ð 5ð>=ð =ð =ð6ð 6ð 6ð 6ð 6r\   rä  )ó   authorizationr\  ó   cookie2ó   proxy-authorizations   www-authenticatec                  óÎ   — e Zd ZU dZded<   ded<   ded<   d„ Z	 	 	 	 d/d0d„Zd„ Zd„ Zd„ Z	d„ Z
d„ Z	 d1d2d „Zd3d!„Zd3d"„Zd3d#„Zd$„ Zd%„ Zd&„ Zd'„ Zd(„ Zd)„ Zd*„ Zd+„ Zd,„ Zd-„ Zd.„ Zd
S )4Ú_RedirectAgentTestsMixinz^
    Test cases mixin for L{RedirectAgentTests} and
    L{BrowserLikeRedirectAgentTests}.
    rE   r  r%   r   rb   rï   c                óÚ  — | j                              dd¦  «        }| j        j                             ¦   «         \  }}t          j        ¦   «         }t          ddd|d¦  «        }|                     |¦  «         |  	                    dt          | j        j        ¦  «        ¦  «         |                      |¦  «        }|                      ||¦  «         |                      |j        d¦  «         dS )zz
        L{client.RedirectAgent} behaves like L{client.Agent} if the response
        doesn't contain a redirect.
        rš  r)  rT  rU  rV  Nr   )r  rm   rï   rg   rª   r2   rC   r7   rX  r–   rœ   r¬   rQ  ÚpreviousResponse)rY   r·  r  r  r°  rÀ  rn   s          rZ   Útest_noRedirectz(_RedirectAgentTestsMixin.test_noRedirectc
  sÖ   € ð
 ”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ñ(Ô(ˆÝ˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐà×Ò˜�C ¤Ô 6Ñ7Ô7Ñ8Ô8Ð8Ø×%Ò% hÑ/Ô/ˆØ×Ò˜X vÑ.Ô.Ð.Ø×Ò˜VÔ4°dÑ;Ô;Ð;Ð;Ð;r\   FNr©  ÚintÚcrossSchemeÚboolÚcrossDomainÚ	crossPortÚrequestHeadersúOptional[Headers]rc   r?   c                ó  — d}t           �dnd}|dk    rdnd}| j                             d|dz   |z   d	z   |¬
¦  «         | j        j                             ¦   «         dd…         \  }	}
|                      t          |	¦  «         |                      ||
¦  «         | j        j	                             ¦   «         \  }}|}|}|}|r*t           €t          d¦  «        ‚|dk    rdnd}|dk    rdnd}d}|rd}d}|rdn|}|dz   |z   |z   dz   }t          j        d|gi¦  «        }t          d|d|d¦  «        }|                     |¦  «         | j        j	                             ¦   «         \  }}|                      d|j        ¦  «         |                      d|j        ¦  «         | j        j                             ¦   «         dd…         \  }	}
|                      |rt"          nt          |	¦  «         |                      ||
¦  «         |S )zÄ
        When getting a redirect, L{client.RedirectAgent} follows the URL
        specified in the L{Location} header field and make a new request.

        @param code: HTTP status code.
        r-  Nr4  r–  r.  rJ  rš  r›  s   /foor„  r¶   z;Cross-scheme redirects can't be tested without TLS support.r\   iû   s   :8443ó   example.netó   /baró   locationrT  rV  )rL   r  rm   r   rä   rª   r–   rÞ   rï   rg   r   r2   rC   r7   rX  r<  rÅ  rà   )rY   r©  rý  rÿ  r   r  ÚstartDomainÚstartSchemeÚ	startPortrF  rG  r  r  ÚtargetSchemeÚtargetDomainÚ
targetPortÚ
portSyntaxÚlocationValuer°  rÀ  Úreq2Úres2s                         rZ   Ú_testRedirectDefaultz-_RedirectAgentTestsMixin._testRedirectDefaultu
  sE  € ð %ˆÝ"% /�h�h°wˆØ%¨Ò0Ð0�B�B°cˆ	ØŒ
×ÒØ�K &Ñ(¨;Ñ6¸Ñ@È.ð 	ñ 	
ô 	
ð 	
ð ”\Ô,×0Ò0Ñ2Ô2°2°A°2Ô6‰
ˆˆdØ×Ò�¨Ñ.Ô.Ð.Ø×Ò˜ DÑ)Ô)Ð)à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSð #ˆØ"ˆØˆ
àð 	8Ýˆ{ÝØQñô ð ð (3°gÒ'=Ð'=˜8˜8À7ˆLØ )¨R¢ ˜˜°RˆJàˆ
Øð 	"ØˆJØ!ˆJØ)4ÐE�~�~¸+ˆØ$ vÑ-°Ñ<¸zÑIÈGÑSˆÝÔ&¨°m°_Ð'EÑFÔFˆÝ˜O¨T°5¸'À4ÑHÔHˆØ�Š�XÑÔÐà”]Ô+×/Ò/Ñ1Ô1‰
ˆˆdØ×Ò˜ ¤Ñ-Ô-Ð-Ø×Ò˜ $¤(Ñ+Ô+Ð+à”\Ô,×0Ò0Ñ2Ô2°2°A°2Ô6‰
ˆˆdØ×Ò¨;ÐJ�˜½NÈDÑQÔQÐQØ×Ò˜ TÑ*Ô*Ð*Øˆr\   c                ó0   — |                       d¦  «         dS )zO
        L{client.RedirectAgent} follows redirects on status code 301.
        é-  N©r  ri   s    rZ   Útest_redirect301z)_RedirectAgentTestsMixin.test_redirect301³
  ó   € ð 	×!Ò! #Ñ&Ô&Ð&Ð&Ð&r\   c                ó4   — |                       dd¬¦  «         dS )zI
        L{client.RedirectAgent} follows cross-scheme redirects.
        r  T©rý  Nr  ri   s    rZ   Útest_redirect301Schemez/_RedirectAgentTestsMixin.test_redirect301Scheme¹
  s1   € ð 	×!Ò!ØØð 	"ñ 	
ô 	
ð 	
ð 	
ð 	
r\   c                ó0   — |                       d¦  «         dS )zO
        L{client.RedirectAgent} follows redirects on status code 302.
        é.  Nr  ri   s    rZ   Útest_redirect302z)_RedirectAgentTestsMixin.test_redirect302Â
  r  r\   c                ó0   — |                       d¦  «         dS )zO
        L{client.RedirectAgent} follows redirects on status code 307.
        é3  Nr  ri   s    rZ   Útest_redirect307z)_RedirectAgentTestsMixin.test_redirect307È
  r  r\   c                ó0   — |                       d¦  «         dS )zO
        L{client.RedirectAgent} follows redirects on status code 308.
        i4  Nr  ri   s    rZ   Útest_redirect308z)_RedirectAgentTestsMixin.test_redirect308Î
  r  r\   r-  ÚexpectedHostHeaderrx   ÚcrossKwargsrd   c           	     óº  — dgdgdgdgdgdgdœ}dd	gi}t          i |¥|¥¦  «        }|                      d
|¬¦  «        }dd„} ||j        ¦  «        }|                      |ddgi ||¦  «        ¥¦  «          | j        	 di |¤dt          i |¥|¥¦  «        i¤Ž}	 ||	j        ¦  «        }
|                      |
d|gi |t          |¦  «        ¦  «        ¥¦  «         dS )zv
        L{client.RedirectAgent} scrubs sensitive headers when redirecting
        between differing origins.
        s   sensitive-authnzs   sensitive-cookie-datas   sensitive-cookie2-datas   sensitive-proxy-auths   sensitive-authns   sensitive-custom)rô  r\  rõ  rö  s   wWw-auThentiCates   x-custom-sensitives   x-random-headers   x-random-valuer  )r  r°  rC   rc   úDict[bytes, Sequence[bytes]]c                ó>   — d„ |                       ¦   «         D ¦   «         S )Nc                ó>   — i | ]\  }}|                      ¦   «         |“ŒS r`   )Úlower)r9  r!  Úvs      rZ   r;  zW_RedirectAgentTestsMixin._sensitiveHeadersTest.<locals>.normHeaders.<locals>.<dictcomp>è
  s&   € ÐJÐJÐJ¡V a¨�A—G’G‘I”I˜qÐJÐJÐJr\   )rQ  r„  s    rZ   ÚnormHeaderszC_RedirectAgentTestsMixin._sensitiveHeadersTest.<locals>.normHeadersç
  s"   € ØJÐJ¨w×/GÒ/GÑ/IÔ/IÐJÑJÔJÐJr\   rñ  r-  r  N)r°  rC   rc   r%  )r  )rC   r  r°  ra  )rY   r"  r#  ÚsensitiveHeaderValuesÚotherHeaderValuesÚ
allHeadersÚ
redirectedr*  ÚsameOriginHeadersÚredirectedElsewhereÚotherOriginHeaderss              rZ   Ú_sensitiveHeadersTestz._RedirectAgentTestsMixin._sensitiveHeadersTestÔ
  s“  € ð  3Ð3Ø0Ð1Ø2Ð3Ø%<Ð$=Ø"4Ð!5Ø$7Ð#8ð!
ð !
Ðð 0Ð2CÐ1DÐEÐÝÐKÐ 5ÐKÐ9JÐKÑLÔLˆ
Ø×.Ò.¨sÀ:Ð.ÑNÔNˆ
ð	Kð 	Kð 	Kð 	Kð (˜K¨
Ô(:Ñ;Ô;ÐØ×ÒØà˜.Ð)ðà�+˜jÑ)Ô)ðñ	
ô 	
ð 	
ð 8˜dÔ7Øð
ð 
àð
ð 
õ #Ð#QÐ&;Ð#QÐ?PÐ#QÑRÔRð
ð 
ð 
Ðð
 )˜[Ð)<Ô)DÑEÔEÐØ×ÒØàÐ,Ð-ðà�+�gÐ&7Ñ8Ô8Ñ9Ô9ðñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó4   — |                       dd¬¦  «         dS )zv
        L{client.RedirectAgent} scrubs sensitive headers when redirecting
        between differing domains.
        Tr  )rÿ  r"  N©r2  ri   s    rZ   Útest_crossDomainHeadersz0_RedirectAgentTestsMixin.test_crossDomainHeaders  s#   € ð
 	×"Ò"¨tÈÐ"ÑWÔWÐWÐWÐWr\   c                ó4   — |                       dd¬¦  «         dS )zt
        L{client.RedirectAgent} scrubs sensitive headers when redirecting
        between differing ports.
        Ts   example.com:8443)r   r"  Nr4  ri   s    rZ   Útest_crossPortHeadersz._RedirectAgentTestsMixin.test_crossPortHeaders  s1   € ð
 	×"Ò"ØÐ/Bð 	#ñ 	
ô 	
ð 	
ð 	
ð 	
r\   c                ó2   — |                       d¬¦  «         dS )zv
        L{client.RedirectAgent} scrubs sensitive headers when redirecting
        between differing schemes.
        Tr  Nr4  ri   s    rZ   Útest_crossSchemeHeadersz0_RedirectAgentTestsMixin.test_crossSchemeHeaders  s!   € ð
 	×"Ò"¨tÐ"Ñ4Ô4Ð4Ð4Ð4r\   c                óª  — | j                              |d¦  «         | j        j                             ¦   «         \  }}t          j        ddgi¦  «        }t          d|d|d¦  «        }|                     |¦  «         | j        j                             ¦   «         \  }}|  	                    d|j
        ¦  «         |  	                    d|j        ¦  «         dS )	zÔ
        L{client.RedirectAgent} changes the method to I{GET} when getting
        a redirect on a non-I{GET} request.

        @param code: HTTP status code.

        @param method: HTTP request method.
        r)  r  ó   http://example.com/barrT  rV  Nrš  r  )r  rm   rï   rg   rª   r2   rC   r7   rX  r–   r<  rÅ  )	rY   r©  r<  r  r  r°  rÀ  r  r  s	            rZ   Ú_testRedirectToGetz+_RedirectAgentTestsMixin._testRedirectToGet  sÇ   € ð 	Œ
×Ò˜6Ð#<Ñ=Ô=Ð=à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&¨Ð6OÐ5PÐ'QÑRÔRˆÝ˜O¨T°5¸'À4ÑHÔHˆØ�Š�XÑÔÐà”]Ô+×/Ò/Ñ1Ô1‰
ˆˆdØ×Ò˜ ¤Ñ-Ô-Ð-Ø×Ò˜ $¤(Ñ+Ô+Ð+Ð+Ð+r\   c                ó2   — |                       dd¦  «         dS )z€
        L{client.RedirectAgent} changes the method to I{GET} when getting a 303
        redirect on a I{POST} request.
        i/  rò  N©r<  ri   s    rZ   Útest_redirect303z)_RedirectAgentTestsMixin.test_redirect303-  ó    € ð
 	×Ò  WÑ-Ô-Ð-Ð-Ð-r\   c                ó<  — | j                              dd¦  «        }| j        j                             ¦   «         \  }}t          j        ¦   «         }t          ddd|d¦  «        }|                     |¦  «         |  	                    |t          j        ¦  «        }|j        j        d                              t          j        ¦  «         |                      d|j        j        d         j        j        ¦  «         |                      d|j        j        j        ¦  «         dS )zÕ
        If no L{Location} header field is found when getting a redirect,
        L{client.RedirectAgent} fails with a L{ResponseFailed} error wrapping a
        L{error.RedirectWithNoLocation} exception.
        rš  r)  rT  r  rV  Nr   )r  rm   rï   rg   rª   r2   rC   r7   rX  rÁ   r0   r8   rb  r½  rÂ   r1   ÚRedirectWithNoLocationr–   rÅ  rÀ  r©  )rY   r·  r  r  r°  rÀ  Úfails          rZ   Útest_noLocationFieldz-_RedirectAgentTestsMixin.test_noLocationField4  sï   € ð ”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ñ(Ô(ˆÝ˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐà×#Ò# H­fÔ.CÑDÔDˆØŒ
Ô˜1Ô×"Ò"¥5Ô#?Ñ@Ô@Ð@Ø×ÒÐ2°D´JÔ4FÀqÔ4IÔ4OÔ4SÑTÔTÐTØ×Ò˜˜dœjÔ1Ô6Ñ7Ô7Ð7Ð7Ð7r\   c                ó<  — | j                              |d¦  «        }| j        j                             ¦   «         \  }}t          j        ¦   «         }t          d|d|d¦  «        }|                     |¦  «         |  	                    |t          j        ¦  «        }|j        j        d                              t          j        ¦  «         |                      d|j        j        d         j        j        ¦  «         |                      ||j        j        j        ¦  «         dS )a  
        When getting a redirect on an unsupported request method,
        L{client.RedirectAgent} fails with a L{ResponseFailed} error wrapping
        a L{error.PageRedirect} exception.

        @param code: HTTP status code.

        @param method: HTTP request method.
        r)  rT  rV  Nr   )r  rm   rï   rg   rª   r2   rC   r7   rX  rÁ   r0   r8   rb  r½  rÂ   r1   ÚPageRedirectr–   ÚlocationrÀ  r©  )	rY   r©  r<  r·  r  r  r°  rÀ  rC  s	            rZ   Ú_testPageRedirectFailurez1_RedirectAgentTestsMixin._testPageRedirectFailureG  s÷   € ð ”:×%Ò% fÐ.GÑHÔHˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&Ñ(Ô(ˆÝ˜O¨T°5¸'À4ÑHÔHˆØ�Š�XÑÔÐà×#Ò# H­fÔ.CÑDÔDˆØŒ
Ô˜1Ô×"Ò"¥5Ô#5Ñ6Ô6Ð6Ø×ÒØ% t¤zÔ'9¸!Ô'<Ô'BÔ'Kñ	
ô 	
ð 	
ð 	×Ò˜˜tœzÔ2Ô7Ñ8Ô8Ð8Ð8Ð8r\   c                ó2   — |                       dd¦  «         dS )z¼
        When getting a 307 redirect on a I{POST} request,
        L{client.RedirectAgent} fails with a L{ResponseFailed} error wrapping
        a L{error.PageRedirect} exception.
        r  rò  N©rH  ri   s    rZ   Útest_307OnPostz'_RedirectAgentTestsMixin.test_307OnPost`  ó    € ð 	×%Ò% c¨7Ñ3Ô3Ð3Ð3Ð3r\   c                ó*  — |                       | j        ¦  «        }t          j        |d¦  «        }|                     dd¦  «        }| j        j                             ¦   «         \  }}t          j	        ddgi¦  «        }t          ddd|d	¦  «        }|                     |¦  «         | j        j                             ¦   «         \  }}	t          ddd|d	¦  «        }
|	                     |
¦  «         |                      |t          j        ¦  «        }|j        j        d
                              t"          j        ¦  «         |                      d|j        j        d
         j        j        ¦  «         |                      d|j        j        j        ¦  «         d	S )zÉ
        If the limit of redirects specified to L{client.RedirectAgent} is
        reached, the deferred fires with L{ResponseFailed} error wrapping
        a L{InfiniteRedirection} exception.
        r§   rš  r)  r  r;  rT  r  rV  Nr   )r  r   r0   ÚRedirectAgentrm   rï   rg   rª   r2   rC   r7   rX  rÁ   r8   rb  r½  rÂ   r1   ÚInfiniteRedirectionr–   rG  rÀ  r©  )rY   r  ÚredirectAgentr·  r  r  r°  rÀ  r  r  Ú	response2rC  s               rZ   Útest_redirectLimitz+_RedirectAgentTestsMixin.test_redirectLimith  sh  € ð ×-Ò-¨d¬lÑ;Ô;ˆÝÔ,¨U°AÑ6Ô6ˆà ×(Ò(¨Ð1JÑKÔKˆà”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&¨Ð6OÐ5PÐ'QÑRÔRˆÝ˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐà”]Ô+×/Ò/Ñ1Ô1‰
ˆˆdå˜_¨c°5¸'À4ÑHÔHˆ	Ø�Š�iÑ Ô Ð à×#Ò# H­fÔ.CÑDÔDˆàŒ
Ô˜1Ô×"Ò"¥5Ô#<Ñ=Ô=Ð=Ø×ÒØ% t¤zÔ'9¸!Ô'<Ô'BÔ'Kñ	
ô 	
ð 	
ð 	×Ò˜˜dœjÔ1Ô6Ñ7Ô7Ð7Ð7Ð7r\   c                óª  — | j                              d|¦  «         | j        j                             ¦   «         \  }}t          j        d|gi¦  «        }t          ddd|d¦  «        }|                     |¦  «         | j        j                             ¦   «         \  }}	|  	                    d|j
        ¦  «         |  	                    ||j        ¦  «         dS )a1  
        When L{client.RedirectAgent} encounters a relative redirect I{URI}, it
        is resolved against the request I{URI} before following the redirect.

        @param uri: Request URI.

        @param location: I{Location} header redirect URI.

        @param finalURI: Expected final URI.
        rš  r  rT  r  rV  N)r  rm   rï   rg   rª   r2   rC   r7   rX  r–   r<  rY  )
rY   rÅ  rG  ÚfinalURIr  r  r°  rÀ  r  r  s
             rZ   Ú_testRedirectURIz)_RedirectAgentTestsMixin._testRedirectURI†  sÅ   € ð 	Œ
×Ò˜6 3Ñ'Ô'Ð'à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSåÔ&¨°h°ZÐ'@ÑAÔAˆÝ˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐà”]Ô+×/Ò/Ñ1Ô1‰
ˆˆdØ×Ò˜ ¤Ñ-Ô-Ð-Ø×Ò˜ 4Ô#3Ñ4Ô4Ð4Ð4Ð4r\   c                ó�   — |                       ddd¦  «         |                       ddd¦  «         |                       ddd¦  «         dS )	z
        L{client.RedirectAgent} resolves and follows relative I{URI}s in
        redirects, preserving query strings.
        ó   http://example.com/foo/bars   bazs   http://example.com/foo/bazs   /bazs   http://example.com/bazó   /baz?as   http://example.com/baz?aN©rU  ri   s    rZ   Útest_relativeURIz)_RedirectAgentTestsMixin.test_relativeURI�  sr   € ð
 	×ÒØ)¨6Ð3Pñ	
ô 	
ð 	
ð 	×ÒØ)¨7Ð4Mñ	
ô 	
ð 	
ð 	×ÒØ)¨9Ð6Qñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ób   — |                       ddd¦  «         |                       ddd¦  «         dS )a  
        L{client.RedirectAgent} resolves and follows relative I{URI}s in
        redirects, preserving fragments in way that complies with the HTTP 1.1
        bis draft.

        @see: U{https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-7.1.2}
        s   http://example.com/foo/bar#fragrX  s   http://example.com/baz?a#fragrW  s   /baz?a#frag2s   http://example.com/baz?a#frag2NrY  ri   s    rZ   Ú!test_relativeURIPreserveFragmentsz:_RedirectAgentTestsMixin.test_relativeURIPreserveFragments¬  sR   € ð 	×ÒØ.ØØ,ñ	
ô 	
ð 	
ð
 	×ÒØ)ØØ-ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ób   — |                       ddd¦  «         |                       ddd¦  «         dS )z›
        L{client.RedirectAgent} resolves and follows scheme relative I{URI}s in
        redirects, replacing the hostname and port when required.
        rW  s   //foo.com/bazs   http://foo.com/bazs   //foo.com:81/bazs   http://foo.com:81/bazNrY  ri   s    rZ   Útest_relativeURISchemeRelativez7_RedirectAgentTestsMixin.test_relativeURISchemeRelative¿  sR   € ð
 	×ÒØ)Ð+;Ð=Rñ	
ô 	
ð 	
ð 	×ÒØ)Ð+>Ð@Xñ	
ô 	
ð 	
ð 	
ð 	
r\   c                óv  — |                       | j        ¦  «        }t          j        |¦  «        }|                     dd¦  «        }| j        j                             ¦   «         \  }}t          j	        ddgi¦  «        }t          ddd|d¦  «        }|                     |¦  «         | j        j                             ¦   «         \  }}	t          dd	d|d¦  «        }
|	                     |
¦  «         |                      |¦  «        }|                      |j        |¦  «         |                      |j        d¦  «         dS )
z‘
        L{Response.response} references the previous L{Response} from
        a redirect, or L{None} if there was no previous response.
        rš  r)  r  r;  rT  r  rV  NrU  )r  r   r0   rN  rm   rï   rg   rª   r2   rC   r7   rX  r¬   rQ  rú  )rY   r  rP  r·  ÚredirectReqÚredirectResr°  ÚredirectResponser  r  rÀ  ÚfinalResponses               rZ   Útest_responseHistoryz-_RedirectAgentTestsMixin.test_responseHistoryË  s,  € ð
 ×-Ò-¨d¬lÑ;Ô;ˆÝÔ,¨UÑ3Ô3ˆà ×(Ò(¨Ð1JÑKÔKˆà#'¤=Ô#9×#=Ò#=Ñ#?Ô#?Ñ ˆ�[åÔ&¨Ð6OÐ5PÐ'QÑRÔRˆÝ# O°S¸%ÀÈ$ÑOÔOÐØ×ÒÐ-Ñ.Ô.Ð.à”=Ô)×-Ò-Ñ/Ô/‰ˆˆSå˜O¨S°%¸À$ÑGÔGˆØ�Š�XÑÔÐà×,Ò,¨XÑ6Ô6ˆØ×Ò˜]Ô;Ð=MÑNÔNÐNØ×ÒÐ-Ô>ÀÑEÔEÐEÐEÐEr\   )FFFN)r©  rü  rý  rþ  rÿ  rþ  r   rþ  r  r  rc   r?   )r-  )r"  rx   r#  rþ  rc   rd   ro   )r]   r^   r_   rp   Ú__annotations__rû  r  r  r  r  r  r!  r2  r5  r7  r9  r<  r?  rD  rH  rK  rR  rU  rZ  r\  r^  rd  r`   r\   rZ   rø  rø  Y
  sÎ  € € € € € € ðð ð
 €M€M�MØÐÐÑØÐÐÑð<ð <ð <ð* "Ø!ØØ,0ð<ð <ð <ð <ð <ð|'ð 'ð 'ð
ð 
ð 
ð'ð 'ð 'ð'ð 'ð 'ð'ð 'ð 'ð +9ð+
ð +
ð +
ð +
ð +
ðZXð Xð Xð Xð
ð 
ð 
ð 
ð5ð 5ð 5ð 5ð,ð ,ð ,ð*.ð .ð .ð8ð 8ð 8ð&9ð 9ð 9ð24ð 4ð 4ð8ð 8ð 8ð<5ð 5ð 5ð.
ð 
ð 
ð
ð 
ð 
ð&

ð 

ð 

ðFð Fð Fð Fð Fr\   rø  c                  ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚRedirectAgentTestsz,
    Tests for L{client.RedirectAgent}.
    c                ó`   — t          j        |                      | j        ¦  «        dg¬¦  «        S )zD
        @return: a new L{twisted.web.client.RedirectAgent}
        s   X-Custom-sensitive©ÚsensitiveHeaderNames)r0   rN  r  r   ri   s    rZ   r‡  zRedirectAgentTests.makeAgentï  s7   € õ Ô#Ø×)Ò)¨$¬,Ñ7Ô7Ø"7Ð!8ð
ñ 
ô 
ð 	
r\   c                ój   — |                       ¦   «         | _        |                      ¦   «         | _        d S rt   rÍ  ri   s    rZ   rƒ   zRedirectAgentTests.setUpø  ó*   € Ø×)Ò)Ñ+Ô+ˆŒØ—^’^Ñ%Ô%ˆŒ
ˆ
ˆ
r\   c                ó2   — |                       dd¦  «         dS )z¼
        When getting a 301 redirect on a I{POST} request,
        L{client.RedirectAgent} fails with a L{ResponseFailed} error wrapping
        a L{error.PageRedirect} exception.
        r  rò  NrJ  ri   s    rZ   Útest_301OnPostz!RedirectAgentTests.test_301OnPostü  rL  r\   c                ó2   — |                       dd¦  «         dS )z¼
        When getting a 302 redirect on a I{POST} request,
        L{client.RedirectAgent} fails with a L{ResponseFailed} error wrapping
        a L{error.PageRedirect} exception.
        r  rò  NrJ  ri   s    rZ   Útest_302OnPostz!RedirectAgentTests.test_302OnPost  rL  r\   N)r]   r^   r_   rp   r‡  rƒ   rn  rp  r`   r\   rZ   rg  rg  å  sZ   € € € € € ðð ð
ð 
ð 
ð&ð &ð &ð4ð 4ð 4ð4ð 4ð 4ð 4ð 4r\   rg  c                  ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚBrowserLikeRedirectAgentTestsz7
    Tests for L{client.BrowserLikeRedirectAgent}.
    c                ó`   — t          j        |                      | j        ¦  «        dg¬¦  «        S )zO
        @return: a new L{twisted.web.client.BrowserLikeRedirectAgent}
        s   x-Custom-sensitiveri  )r0   ÚBrowserLikeRedirectAgentr  r   ri   s    rZ   r‡  z'BrowserLikeRedirectAgentTests.makeAgent  s7   € õ Ô.Ø×)Ò)¨$¬,Ñ7Ô7Ø"7Ð!8ð
ñ 
ô 
ð 	
r\   c                ój   — |                       ¦   «         | _        |                      ¦   «         | _        d S rt   rÍ  ri   s    rZ   rƒ   z#BrowserLikeRedirectAgentTests.setUp   rl  r\   c                ó2   — |                       dd¦  «         dS )ú‹
        L{client.BrowserLikeRedirectAgent} changes the method to I{GET} when
        getting a 302 redirect on a I{POST} request.
        r  rò  Nr>  ri   s    rZ   Útest_redirectToGet301z3BrowserLikeRedirectAgentTests.test_redirectToGet301$  r@  r\   c                ó2   — |                       dd¦  «         dS )rw  r  rò  Nr>  ri   s    rZ   Útest_redirectToGet302z3BrowserLikeRedirectAgentTests.test_redirectToGet302+  r@  r\   N)r]   r^   r_   rp   r‡  rƒ   rx  rz  r`   r\   rZ   rr  rr    sZ   € € € € € ðð ð
ð 
ð 
ð&ð &ð &ð.ð .ð .ð.ð .ð .ð .ð .r\   rr  c                  ó   — e Zd ZdZdZd„ ZdS )ÚAbortableStringTransportzK
    A version of L{StringTransport} that supports C{abortConnection}.
    Fc                ó<   — d| _         |                      ¦   «          dS )z¿
        A testable version of the C{ITCPTransport.abortConnection} method.

        Since this is a special case of closing the connection,
        C{loseConnection} is also called.
        TN)ÚabortingÚloseConnectionri   s    rZ   ÚabortConnectionz(AbortableStringTransport.abortConnection;  s#   € ð ˆŒØ×ÒÑÔÐÐÐr\   N)r]   r^   r_   rp   r~  r€  r`   r\   rZ   r|  r|  3  s4   € € € € € ðð ð
 €Hðð ð ð ð r\   r|  c                  ó,   — e Zd ZdZdZdZdefd„Zd„ ZdS )ÚDummyResponseaˆ  
    Fake L{IResponse} for testing readBody that captures the protocol passed to
    deliverBody and uses it to make a connection with a transport.

    @ivar protocol: After C{deliverBody} is called, the protocol it was called
        with.

    @ivar transport: An instance created by calling C{transportFactory} which
        is used by L{DummyResponse.protocol} to make a connection.
    rU  rV  Nc                óR   — |€t          ¦   «         }|| _         |¦   «         | _        dS )zô
        @param headers: The headers for this response.  If L{None}, an empty
            L{Headers} instance will be used.
        @type headers: L{Headers}

        @param transportFactory: A callable used to construct the transport.
        N)rC   r°  r1  )rY   r°  ÚtransportFactorys      rZ   rj   zDummyResponse.__init__U  s-   € ð ˆ?Ý‘i”iˆGØˆŒØ)Ð)Ñ+Ô+ˆŒˆˆr\   c                óR   — || _         | j                              | j        ¦  «         dS )zt
        Record the given protocol and use it to make a connection with
        L{DummyResponse.transport}.
        N©rï   r  r1  r5  s     rZ   r¯  zDummyResponse.deliverBodyb  s)   € ð
 !ˆŒØŒ×$Ò$ T¤^Ñ4Ô4Ð4Ð4Ð4r\   )	r]   r^   r_   rp   r©  rª  r|  rj   r¯  r`   r\   rZ   r‚  r‚  F  sS   € € € € € ð	ð 	ð €DØ€Fà#Ð6Nð ,ð ,ð ,ð ,ð5ð 5ð 5ð 5ð 5r\   r‚  c                  ó   — e Zd ZdZd„ ZdS )ÚAlreadyCompletedDummyResponsezE
    A dummy response that has already had its transport closed.
    c                ój   — || _         | j                              | j        ¦  «         d| j         _        dS )zA
        Make the connection, then remove the transport.
        Nr†  r5  s     rZ   r¯  z)AlreadyCompletedDummyResponse.deliverBodyp  s3   € ð !ˆŒØŒ×$Ò$ T¤^Ñ4Ô4Ð4Ø"&ˆŒÔÐÐr\   N)r]   r^   r_   rp   r¯  r`   r\   rZ   rˆ  rˆ  k  s-   € € € € € ðð ð'ð 'ð 'ð 'ð 'r\   rˆ  c                  ó6   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	ÚReadBodyTestsz&
    Tests for L{client.readBody}
    c                ój  — t          ¦   «         }t          j        |¦  «        }|j                             d¦  «         |j                             d¦  «         |j                             t          t          ¦   «         ¦  «        ¦  «         |                      |  	                    |¦  «        d¦  «         dS )z�
        L{client.readBody} returns a L{Deferred} which fires with the complete
        body of the L{IResponse} provider passed to it.
        ó   firstó   secondó   firstsecondN)
r‚  r0   ÚreadBodyrï   rž  rx  r*   r@   r–   r¬   )rY   rÀ  r(  s      rZ   Útest_successzReadBodyTests.test_success~  s—   € õ
 !‘?”?ˆÝŒO˜HÑ%Ô%ˆØÔ×&Ò& xÑ0Ô0Ð0ØÔ×&Ò& yÑ1Ô1Ð1ØÔ×(Ò(­µ±´Ñ)@Ô)@ÑAÔAÐAØ×Ò˜×-Ò-¨aÑ0Ô0°.ÑAÔAÐAÐAÐAr\   c                óð   — t          ¦   «         }t          j        |¦  «        }|                     ¦   «          |                      |t
          j        ¦  «         |                      |j        j	        ¦  «         dS )z‡
        When cancelling the L{Deferred} returned by L{client.readBody}, the
        connection to the server will be aborted.
        N)
r‚  r0   r�  rÆ   rÁ   r   r   r…   r1  r~  )rY   rÀ  r·  s      rZ   Útest_cancelzReadBodyTests.test_cancelŠ  sc   € õ
 !‘?”?ˆÝ”? 8Ñ,Ô,ˆØ�ŠÑÔÐØ×Ò˜X¥uÔ';Ñ<Ô<Ð<Ø�Š˜Ô*Ô3Ñ4Ô4Ð4Ð4Ð4r\   c                óø  — t          ¦   «         }t          j        |¦  «        }|j                             d¦  «         |j                             d¦  «         |j                             t          t          ¦   «         ¦  «        ¦  «         |                      |¦  «        }| 	                    t          j
        ¦  «         |                      |j        j        |j        j        |j        j        dœddddœ¦  «         dS )a  
        If the full body of the L{IResponse} passed to L{client.readBody} is
        not definitely received, the L{Deferred} returned by L{client.readBody}
        fires with a L{Failure} wrapping L{client.PartialDownloadError} with
        the content that was received.
        r�  rŽ  )Ústatusr°  r=  s   200rV  r�  N)r‚  r0   r�  rï   rž  rx  r*   r4   rÁ   rÂ   ÚPartialDownloadErrorr–   rb  r•  r°  rÀ  )rY   rÀ  r(  Úfailures       rZ   Útest_withPotentialDataLossz(ReadBodyTests.test_withPotentialDataLoss•  sñ   € õ !‘?”?ˆÝŒO˜HÑ%Ô%ˆØÔ×&Ò& xÑ0Ô0Ð0ØÔ×&Ò& yÑ1Ô1Ð1ØÔ×(Ò(­Õ1BÑ1DÔ1DÑ)EÔ)EÑFÔFÐFØ×&Ò& qÑ)Ô)ˆØ�Š•VÔ0Ñ1Ô1Ð1Ø×Òà!œ-Ô.Ø"œ=Ô0ØœÔ.ðð ð !Ø Ø&ðð ñ	
ô 	
ð 	
ð 	
ð 	
r\   c                ó„  — t          ¦   «         }t          j        |¦  «        }|j                             d¦  «         |j                             t          t          d¦  «        ¦  «        ¦  «         |                      |¦  «        }| 	                    t          ¦  «         |  
                    |j        j        d¦  «         dS )zä
        If there is an exception other than L{client.PotentialDataLoss} while
        L{client.readBody} is collecting the response body, the L{Deferred}
        returned by {client.readBody} fires with that exception.
        r�  úmystery problem)rš  N)r‚  r0   r�  rï   rž  rx  r*   r   rÁ   rÂ   r–   rb  rü   )rY   rÀ  r(  r›  s       rZ   Útest_otherErrorszReadBodyTests.test_otherErrors°  s¢   € õ !‘?”?ˆÝŒO˜HÑ%Ô%ˆØÔ×&Ò& xÑ0Ô0Ð0ØÔ×(Ò(­µÐ@QÑ1RÔ1RÑ)SÔ)SÑTÔTÐTØ×%Ò% aÑ(Ô(ˆØ�Š•NÑ#Ô#Ð#Ø×Ò˜œÔ*Ð,@ÑAÔAÐAÐAÐAr\   c                óü   ‡— t          t          ¬¦  «        Šd‰j        _        |                      t
          dt          ˆfd„¦  «        }|                     ¦   «          |                      |t          j
        ¦  «         dS )zÔ
        Calling L{client.readBody} with a transport that does not implement
        L{twisted.internet.interfaces.ITCPTransport} produces a deprecation
        warning, but no exception when cancelling.
        )r„  NzLUsing readBody with a transport that does not have an abortConnection methodc                 ó,   •— t          j        ‰ ¦  «        S rt   )r0   r�  )rÀ  s   €rZ   r}   z8ReadBodyTests.test_deprecatedTransport.<locals>.<lambda>Ë  s   ø€ •F”O HÑ-Ô-€ r\   )r‚  r&   r1  r€  ÚassertWarnsr²  Ú__file__rÆ   rÁ   r   r   )rY   r(  rÀ  s     @rZ   Útest_deprecatedTransportz&ReadBodyTests.test_deprecatedTransport¾  sz   ø€ õ !µ/ÐBÑBÔBˆØ-1ˆÔÔ*Ø×ÒÝð%åØ-Ð-Ð-Ð-ñ
ô 
ˆð 	
�Š‰
Œ
ˆ
Ø×Ò˜Q¥Ô 4Ñ5Ô5Ð5Ð5Ð5r\   c                ó¸   — t          ¦   «         }t          j        |¦  «         |                      ¦   «         }|                      t          |¦  «        d¦  «         dS )z½
        Calling L{client.readBody} with a response that has already had its
        transport closed (eg. for a very small request) will not trigger a
        deprecation warning.
        r   N)rˆ  r0   r�  r±  r–   rœ   )rY   rÀ  r³  s      rZ   Ú!test_deprecatedTransportNoWarningz/ReadBodyTests.test_deprecatedTransportNoWarningÐ  sR   € õ 1Ñ2Ô2ˆÝŒ˜Ñ!Ô!Ð!à×%Ò%Ñ'Ô'ˆØ×Ò�˜X™œ¨Ñ*Ô*Ð*Ð*Ð*r\   N)
r]   r^   r_   rp   r‘  r“  r˜  r›  r   r¢  r`   r\   rZ   r‹  r‹  y  s~   € € € € € ðð ð
Bð 
Bð 
Bð	5ð 	5ð 	5ð
ð 
ð 
ð6Bð Bð Bð6ð 6ð 6ð$
+ð 
+ð 
+ð 
+ð 
+r\   r‹  c                  ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚHostnameCachingHTTPSPolicyTestsc                ó  — t          ¦   «         }t          |¬¦  «        }t          |¦  «        }|                     dd¦  «        }|                      |j        ¦  «         d|_        |                      dt          |j        ¦  «        ¦  «         | 	                    d¦  «        }|  
                    |j        |                     ¦   «         ¦  «         |                     dd¦  «         |                      |j        ¦  «         dS )z¤
        Verify that the connection creator is added to the
        policy's cache, and that it is reused on subsequent calls
        to creatorForNetLoc.

        r·  rå  i5  Fr§   N)rT   r;   r=   r¥  r…   rW   ra  rœ   Ú_cacher   rj  rX   r¹  rõ  )rY   r¸  ÚwrappedPolicyrº  r»  r¼  s         rZ   Útest_cacheIsUsedz0HostnameCachingHTTPSPolicyTests.test_cacheIsUsedß  sç   € õ +Ñ,Ô,ˆ	Ý1¸IÐFÑFÔFˆÝ+¨MÑ:Ô:ˆØ×)Ò)¨&°$Ñ7Ô7ˆØ�Š˜	Ô(Ñ)Ô)Ð)Ø ˆ	ÔØ×Ò˜!�S ¤Ñ/Ô/Ñ0Ô0Ð0Ø×3Ò3°DÑ9Ô9ˆ
Ø�Š�iÔ'¨×)?Ò)?Ñ)AÔ)AÑBÔBÐBà×Ò ¨Ñ-Ô-Ð-Ø×Ò˜Ô)Ñ*Ô*Ð*Ð*Ð*r\   c                ó  — t          ¦   «         }t          |¬¦  «        }t          |¦  «        }t          dd¦  «        D ]=}dt	          |¦  «        z   }|                     |                     d¦  «        d¦  «         Œ>d}|                     |                     d¦  «        d¦  «         |                      ||j        ¦  «         |  	                    dt          |j        ¦  «        ¦  «         d	}|                     |                     d¦  «        d¦  «         d
}|                      ||j        ¦  «         |  	                    dt          |j        ¦  «        ¦  «         |                      ||j        ¦  «         |                      ||j        ¦  «         t          d¦  «        D ]+}	|                     |                     d¦  «        d¦  «         Œ,d}
|                     |
                     d¦  «        d¦  «         |                      d|j        ¦  «         |  	                    dt          |j        ¦  «        ¦  «         |                      |
|j        ¦  «         |                      ||j        ¦  «         |                      ||j        ¦  «         dS )zt
        Verify that when the cache is full, and a new entry is added,
        the oldest entry is removed.
        r·  r   é   rF  r¿  éã!  Úhost0é5  ÚnewÚhost1Únew1i   Úhost2N©rT   r;   r=   r©   Ústrr¥  r  r3  r¦  ra  rœ   r  )rY   r¸  r§  rº  r²   r›  r¬  Úhostnr¯  r•  Ú
hostNPlus1s              rZ   Útest_cacheRemovesOldestz7HostnameCachingHTTPSPolicyTests.test_cacheRemovesOldestó  sO  € õ
 +Ñ,Ô,ˆ	Ý1¸IÐFÑFÔFˆÝ+¨MÑ:Ô:ˆÝ�q˜"‘”ð 	Dð 	DˆAØ¥ A¡¤‘ˆHØ×#Ò# H§O¢O°GÑ$<Ô$<¸dÑCÔCÐCÐCð ˆØ×Ò §¢¨WÑ 5Ô 5°sÑ;Ô;Ð;Ø�Š�e˜Vœ]Ñ+Ô+Ð+Ø×Ò˜"�c &¤-Ñ0Ô0Ñ1Ô1Ð1àˆØ×Ò §¢¨WÑ 5Ô 5°sÑ;Ô;Ð;àˆØ×Ò˜ ¤Ñ.Ô.Ð.Ø×Ò˜"�c &¤-Ñ0Ô0Ñ1Ô1Ð1à�Š�e˜Vœ]Ñ+Ô+Ð+Ø�Š�e˜Vœ]Ñ+Ô+Ð+õ �r‘”ð 	Að 	AˆAØ×#Ò# E§L¢L°Ñ$9Ô$9¸4Ñ@Ô@Ð@Ð@àˆ
à×Ò 
× 1Ò 1°'Ñ :Ô :¸CÑ@Ô@Ð@à×Ò˜ &¤-Ñ0Ô0Ð0Ø×Ò˜"�c &¤-Ñ0Ô0Ñ1Ô1Ð1à�Š�j &¤-Ñ0Ô0Ð0Ø�Š�e˜Vœ]Ñ+Ô+Ð+Ø�Š�e˜Vœ]Ñ+Ô+Ð+Ð+Ð+r\   c                óœ  — t          ¦   «         }t          |¬¦  «        }t          |d¬¦  «        }t          dd¦  «        D ]=}dt	          |¦  «        z   }|                     |                     d¦  «        d¦  «         Œ>d}|                      ||j        ¦  «         |  	                    dt          |j        ¦  «        ¦  «         d	}|                     |                     d¦  «        d
¦  «         |                      ||j        ¦  «         |  	                    dt          |j        ¦  «        ¦  «         |                      ||j        ¦  «         dS )zˆ
        Verify that changing the cache size results in a policy that
        respects the new cache size and not the default.

        r·  r›   )Ú	cacheSizer   rF  r¿  r«  r¬  r®  r­  Nr²  )rY   r¸  r§  rº  r²   r›  Úfirstr´  s           rZ   Útest_changeCacheSizez4HostnameCachingHTTPSPolicyTests.test_changeCacheSize  s4  € õ +Ñ,Ô,ˆ	Ý1¸IÐFÑFÔFˆÝ+¨MÀQÐGÑGÔGˆÝ�q˜!‘”ð 	Dð 	DˆAØ¥ A¡¤‘ˆHØ×#Ò# H§O¢O°GÑ$<Ô$<¸dÑCÔCÐCÐCàˆØ�Š�e˜Vœ]Ñ+Ô+Ð+Ø×Ò˜!�S ¤Ñ/Ô/Ñ0Ô0Ð0àˆØ×Ò §¢¨WÑ 5Ô 5°sÑ;Ô;Ð;Ø×Ò˜ ¤Ñ.Ô.Ð.Ø×Ò˜!�S ¤Ñ/Ô/Ñ0Ô0Ð0à�Š�e˜Vœ]Ñ+Ô+Ð+Ð+Ð+r\   N)r]   r^   r_   r¨  r¶  rº  r`   r\   rZ   r¤  r¤  Ý  sB   € € € € € ð+ð +ð +ð(),ð ),ð ),ðV,ð ,ð ,ð ,ð ,r\   r¤  c                  ó   — e Zd ZdZd„ ZdS )ÚRequestMethodInjectionTestsz@
    Test L{client.Request} against HTTP method injections.
    c                óX   — t          j        |dt          j        ¦   «         d¬¦  «         dS )ro  rp  N©r<  rÅ  r°  ró  ©r0   r?   r2   rC   )rY   r<  s     rZ   rr  z=RequestMethodInjectionTests.attemptRequestWithMaliciousMethod?  s<   € õ 	ŒØØ)Ý Ô(Ñ*Ô*Øð		
ñ 	
ô 	
ð 	
ð 	
ð 	
r\   Nrs  r`   r\   rZ   r¼  r¼  7  ó-   € € € € € ðð ð
ð 
ð 
ð 
ð 
r\   r¼  c                  ó   — e Zd ZdZd„ ZdS )Ú"RequestWriteToMethodInjectionTestsúH
    Test L{client.Request.writeTo} against HTTP method injections.
    c                ó´   — t          j        ddgi¦  «        }t          j        dd|d¬¦  «        }||_        |                     t          ¦   «         ¦  «         dS )ro  r§  ó   twisted.invalidrš  rp  Nr¾  )r2   rC   r0   r?   r<  ÚwriteTor&   )rY   r<  r°  r  s       rZ   rr  zDRequestWriteToMethodInjectionTests.attemptRequestWithMaliciousMethodU  sf   € õ Ô&¨Ð2DÐ1EÐ'FÑGÔGˆÝŒnØØ)ØØð	
ñ 
ô 
ˆð ˆŒ
Ø�Š•OÑ%Ô%Ñ&Ô&Ð&Ð&Ð&r\   Nrs  r`   r\   rZ   rÂ  rÂ  M  ó-   € € € € € ðð ð'ð 'ð 'ð 'ð 'r\   rÂ  c                  ó   — e Zd ZdZd„ ZdS )ÚRequestURIInjectionTestsz=
    Test L{client.Request} against HTTP URI injections.
    c                óX   — t          j        d|t          j        ¦   «         d¬¦  «         dS )zp
        Attempt a request with the provided URI.

        @param method: see L{URIInjectionTestsMixin}
        rš  Nr¾  r¿  rÄ  s     rZ   rx  z7RequestURIInjectionTests.attemptRequestWithMaliciousURIn  s<   € õ 	ŒØØÝ Ô(Ñ*Ô*Øð		
ñ 	
ô 	
ð 	
ð 	
ð 	
r\   Nry  r`   r\   rZ   rÉ  rÉ  f  rÀ  r\   rÉ  c                  ó   — e Zd ZdZd„ ZdS )ÚRequestWriteToURIInjectionTestsrÃ  c                ó´   — t          j        ddgi¦  «        }t          j        dd|d¬¦  «        }||_        |                     t          ¦   «         ¦  «         dS )zs
        Attempt a request with the provided method.

        @param method: see L{URIInjectionTestsMixin}
        r§  rÅ  rš  rp  Nr¾  )r2   rC   r0   r?   rÅ  rÆ  r&   )rY   rÅ  r°  r  s       rZ   rx  z>RequestWriteToURIInjectionTests.attemptRequestWithMaliciousURI„  sf   € õ Ô&¨Ð2DÐ1EÐ'FÑGÔGˆÝŒnØØ)ØØð	
ñ 
ô 
ˆð ˆŒØ�Š•OÑ%Ô%Ñ&Ô&Ð&Ð&Ð&r\   Nry  r`   r\   rZ   rÌ  rÌ  |  rÇ  r\   rÌ  )©rp   Ú
__future__r   r²  Úhttp.cookiejarr   Úior   Útypingr   r   r   r	   r
   r   Úunittestr   r   Úzope.interface.declarationsr   Úzope.interface.verifyr   Úincrementalr   Útwisted.internetr   r   Útwisted.internet.addressr   r   Útwisted.internet.deferr   r   r   r€  r   r   Útwisted.internet.errorr   r   r   Útwisted.internet.interfacesr   Útwisted.internet.protocolr   r    Útwisted.internet.taskr!   Ú$twisted.internet.test.test_endpointsr"   Útwisted.internet.testingr#   r$   r%   r&   Útwisted.loggerr'   Útwisted.python.componentsr(   Útwisted.python.deprecater)   Útwisted.python.failurer*   Útwisted.test.iosimr+   r,   Útwisted.test.test_sslverifyr-   Útwisted.trial.unittestr.   r/   Útwisted.webr0   r1   r2   Útwisted.web._newclientr3   r4   r5   r6   r7   r8   r9   rÖ  r:   r;   r<   r=   r>   r?   r@   rA   Útwisted.web.errorrB   Útwisted.web.http_headersrC   rÌ  rD   rE   rF   rG   rH   rI   Ú!twisted.web.test.injectionhelpersrJ   rK   ÚtestMixinClassrõ  ÚruntimeTestCaserL   Ú_sslr¨  Útwisted.internet._sslverifyrM   rN   Útwisted.internet.sslrO   Útwisted.protocolsrP   Útwisted.protocols.tlsrQ   rR   rT   ÚImportErrorrb   rr   rz   rÞ   rß   rà   rá   râ   rã   rÙ   r  r  r  r  r…  r‰  rÂ  rÈ  rm  rv  r{  rÓ  rð  r&  r2  rT  rq  rv  rx  r“  r   rä  ÚSENSITIVE_HEADERSrø  rg  rr  r|  r‚  rˆ  r‹  r¤  r¼  rÂ  rÉ  rÌ  r`   r\   rZ   ú<module>rô     sÎ  ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GÐ GØ %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø .Ð .Ð .Ð .Ð .Ð .à Ð Ð Ð Ð Ð à (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DØ KÐ KÐ KÐ KÐ KÐ KÐ KÐ Kðð ð ð ð ð ð ð ð ð ð
 HÐ GÐ GÐ GÐ GÐ GØ 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø NÐ NÐ NÐ NÐ NÐ Nðð ð ð ð ð ð ð ð ð ð ð ð .Ð -Ð -Ð -Ð -Ð -Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø @Ð @Ð @Ð @Ð @Ð @Ø *Ð *Ð *Ð *Ð *Ð *Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø IÐ IÐ IÐ IÐ IÐ IØ @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 1Ð 0Ð 0Ð 0Ð 0Ð 0Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð Ø€NØ€O€Oà€NØ€Oð#Ø,Ð,Ð,Ð,Ð,Ð,ð
 €CØ€JØOÐOÐOÐOÐOÐOÐOÐOØ8Ð8Ð8Ð8Ð8Ð8Ø%Ð%Ð%Ð%Ð%Ð%ØOÐOÐOÐOÐOÐOÐOÐOà€[Ð"Ñ#Ô#ð#ð #ð #ð #ð #ñ #ô #ñ $Ô#ð#ð #øð ð ð ð Ø
€CØ€J€J€Jðøøøð*ð ð ð ð �xñ ô ð ð2%ð %ð %ð %ð %ñ %ô %ð %ð]&ð ]&ð ]&ð ]&ð ]&˜Hñ ]&ô ]&ð ]&ð@ €ØÐ Ø€Ø€Ø€Ø€
ðP!ð P!ð P!ð P!ð P!ñ P!ô P!ð P!ðf!ð !ð !ð !ð !ñ !ô !ð !ðGð Gð Gð Gð Gñ Gô Gð Gð ð  ð  ð  ð  �7ñ  ô  ð  ðjVð jVð jVð jVð jV˜hÐ(Bñ jVô jVð jVðZ		@ð 	@ð 	@ð 	@ð 	@ñ 	@ô 	@ð 	@ðu
ð u
ð u
ð u
ð u
ñ u
ô u
ð u
ðp €Ð"Ñ#Ô#ð0ð 0ð 0ð 0ð 0ñ 0ô 0ñ $Ô#ð0ð$Y)ð Y)ð Y)ð Y)ð Y)ØÐ(¨/Ð;RñY)ô Y)ð Y)ðx4ð 4ð 4ð 4ð 4ØØØñ4ô 4ð 4ð(4ð 4ð 4ð 4ð 4ØØØñ4ô 4ð 4ð( €ˆJˆÐ@ÑAÔAðX
ð X
ð X
ð X
ð X
�hÐ :Ð<Sñ X
ô X
ñ BÔAðX
ðv?Uð ?Uð ?Uð ?Uð ?U 8ñ ?Uô ?Uð ?UðDy,ð y,ð y,ð y,ð y, 8Ð-Gñ y,ô y,ð y,ðx!ð !ð !ð !ð !ñ !ô !ð !ð2;
ð ;
ð ;
ð ;
ð ;
�XÐ/ñ ;
ô ;
ð ;
ð|h2ð h2ð h2ð h2ð h2ØÐÐ :¸Oñh2ô h2ð h2ðVð ð ð ð Ð Ð  Ñ+Ô+ñ ô ð ðð ð ð ð ˆxñ ô ð ð~+ð ~+ð ~+ð ~+ð ~+˜xÐ)CÀ_ñ ~+ô ~+ð ~+ðB#ð #ð #ð #ð #˜(ñ #ô #ð #ð4w2ð w2ð w2ð w2ð w2 xÐ1Kñ w2ô w2ð w2ðt[6ð [6ð [6ð [6ð [6�hÐ :¸Oñ [6ô [6ð [6ð|ð ð Ð ðIFð IFð IFð IFð IF˜~ñ IFô IFð IFðX%4ð %4ð %4ð %4ð %4ØØØØñ	%4ô %4ð %4ðP#.ð #.ð #.ð #.ð #.ØØØØñ	#.ô #.ð #.ðLð ð ð ð ˜ñ ô ð ð&"5ð "5ð "5ð "5ð "5ñ "5ô "5ð "5ðJ'ð 'ð 'ð 'ð ' Mñ 'ô 'ð 'ða+ð a+ð a+ð a+ð a+�Hñ a+ô a+ð a+ðH €ˆJˆÐ@ÑAÔAðV,ð V,ð V,ð V,ð V, hñ V,ô V,ñ BÔAðV,ðr
ð 
ð 
ð 
ð 
ØØñ
ô 
ð 
ð,'ð 'ð 'ð 'ð 'ØØñ'ô 'ð 'ð2
ð 
ð 
ð 
ð 
ØØñ
ô 
ð 
ð,'ð 'ð 'ð 'ð 'ØØñ'ô 'ð 'ð 'ð 's   Ä#E( Å(	E4Å3E4