+
    üÐj	ß ã                  óä  € R t ^ RIHt ^ RIt^ RIHt ^ RIHt ^ RIH	t	H
t
HtHtHtHt ^ RIHtHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHtHt ^ RIHtHt ^ RIHtH t H!t! ^ RI"H#t#H$t$ ^ RI%H&t&H't'H(t( ^ RI)H*t* ^ RI+H,t,H-t- ^ RI.H/t/ ^ RI0H1t1 ^ RI2H3t3H4t4H5t5H6t6 ^ RI7H8t8 ^ RI9H:t: ^ RI;H<t< ^ RI=H>t> ^ RI?H@t@HAtA ^ RIBHCtC ^ RIDHEtEHFtF ^ RIGHHtHHItIHJtJ ^ RIKHLtLHMtMHNtNHOtOHPtPHQtQHRtR ^ RISHTtTHUtUHVtVHWtWHXtXHYtYHZtZH[t[ ^ RI\H]t] ^ RI^H_t_ ^ R I`HataHbtbHctcHdtdHeteHftf ^ R!IgHhthHiti ]	'       d   ]Ftj]ktlM]ktj]Ftl ^ R"IHmtn ]ntmR#to^ R$IpHqtqHrtr ^ R%IsHttt ^ R&IuHvtv ^ R'IwHxtxHyty ]! ]r4       ! R( R)4      4       tz ! R+ R,]-4      t| ! R- R.4      t} ! R/ R0]F4      t~R1tR2t€R3t�R4t‚R5tƒR6t„ ! R7 R84      t… ! R9 R:4      t† ! R; R<4      t‡ ! R= R>],4      tˆ ! R? R@]F]…4      t‰ ! RA RB4      tŠ ! RC RD4      t‹]! ]c4       ! RE RF4      4       tŒ ! RG RH]F]…]Š]‹4      t� ! RI RJ]…]h]E4      tŽ ! RK RL]…]i]E4      t�]! ]o'       * RM4       ! RN RO]F]…]‹4      4       t� ! RP RQ]F4      t‘ ! RR RS]F]…4      t’ ! RT RU4      t“ ! RV RW]F]“4      t” ! RX RY]F]“]…]Š4      t• ! RZ R[]:! ]f4      4      t– ! R\ R]]–4      t— ! R^ R_]F]…]Š4      t˜ ! R` Ra]-4      t™ ! Rb Rc]F]…4      tš ! Rd Re]F]…]Š4      t›. R~Otœ ! Rf Rg]j4      t� ! Rh Ri]…]�]Š]l4      tž ! Rj Rk]…]�]Š]l4      tŸ ! Rl Rm]64      t  ! Rn Ro4      t¡ ! Rp Rq]¡4      t¢ ! Rr Rs]F4      t£]! ]o'       * RM4       ! Rt Ru]F4      4       t¤ ! Rv Rw]h]E4      t¥ ! Rx Ry]h]E4      t¦ ! Rz R{]i]E4      t§ ! R| R}]i]E4      t¨R#   ]{ d	    RtmR*to EL
i ; i)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                  ó$   € ] tR t^htRtRtR tRtR# )ÚCustomOpenSSLTrustRootFNc                	ó    € R V n         Wn        R# )TN©ÚcalledÚcontext)ÚselfrW   s   &&Ú=/usr/lib/python3/dist-packages/twisted/web/test/test_agent.pyÚ_addCACertsToContextÚ+CustomOpenSSLTrustRoot._addCACertsToContextm   s   € ØˆDŒKØ"ŽLó    rU   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rV   rW   rZ   Ú__static_attributes__© r\   rY   rS   rS   h   s   † àˆØˆö	#r\   rS   Fc                  ó,   € ] tR t^rtRtR R ltR tRtR# )ÚStubHTTPProtocola:  
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.
c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚNonerb   )Úformats   "rY   Ú__annotate__ÚStubHTTPProtocol.__annotate__|   s   € ÷ !ñ !˜$ñ !r\   c                	ó"   € . V n         R V n        R# )Ú	QUIESCENTN©ÚrequestsÚstate©rX   s   &rY   Ú__init__ÚStubHTTPProtocol.__init__|   s   € ØCEˆŒØ ˆŽ
r\   c                óR   € \        4       pV P                  P                  W34       V# )zj
Capture the given request for later inspection.

@return: A L{Deferred} which this code will never fire.
)r   rp   Úappend)rX   ÚrequestÚresults   && rY   rw   ÚStubHTTPProtocol.request€   s%   € ô “ˆØ�‰×Ñ˜gÐ.Ô/Øˆr\   ro   N)r]   r^   r_   r`   Ú__doc__rs   rw   ra   rb   r\   rY   rd   rd   r   s   † ñõ!ör\   rd   c                  ó"   € ] tR t^‹tR tR tRtR# )ÚFileConsumerc                	ó   € Wn         R # ©N©Ú
outputFile)rX   r€   s   &&rY   rs   ÚFileConsumer.__init__Œ   s   € Ø$Žr\   c                	ó<   € V P                   P                  V4       R # r~   )r€   Úwrite)rX   Úbytess   &&rY   rƒ   ÚFileConsumer.write�   s   € Ø�‰×Ñ˜eÖ$r\   r   N)r]   r^   r_   r`   rs   rƒ   ra   rb   r\   rY   r|   r|   ‹   s   † ò%ö%r\   r|   c                  ón   € ] tR t^“tRtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tRtR# )ÚFileBodyProducerTestsze
Tests for the L{FileBodyProducer} which reads bytes from a file and writes
them to an L{IConsumer}.
c                ó   € R # )a<  
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                 ó   € R # )Trb   rb   r\   rY   Ú<lambda>Ú4FileBodyProducerTests._termination.<locals>.<lambda>¡   s   € ‘tr\   rb   rr   s   &rY   Ú_terminationÚ"FileBodyProducerTests._termination™   s
   € ñ Ðr\   c                óˆ   € . V n         \        P                  ! V P                  V P                   P                  4      V n        R# )zt
Create a L{Cooperator} hooked up to an easily controlled, deterministic
scheduler to use with L{FileBodyProducer}.
N)Ú
_scheduledr   Ú
CooperatorrŒ   rv   Ú
cooperatorrr   s   &rY   ÚsetUpÚFileBodyProducerTests.setUp£   s-   € ð
 ˆŒÜŸ/š/¨$×*;Ñ*;¸T¿_¹_×=SÑ=SÓTˆŽr\   c           
     óh   € V P                  \        \        \        \	        R4      4      4      4       R# )z9
L{FileBodyProducer} instances provide L{IBodyProducer}.
r\   N)Ú
assertTruer   rF   r;   r   rr   s   &rY   Útest_interfaceÚ$FileBodyProducerTests.test_interface«   s!   € ð 	�‰œ¤]Ô4DÄWÈSÃ\Ó4RÓSÖTr\   c                óî   €  ! R R4      p ! R R4      p\        V! 4       4      pV P                  \        VP                  4       \        V! 4       4      pV P                  \        VP                  4       R# )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                  ó   € ] tR t^¸tR tRtR# )Ú9FileBodyProducerTests.test_unknownLength.<locals>.HasSeekc                	ó   € R # r~   rb   )rX   ÚoffsetÚwhences   &&&rY   ÚseekÚ>FileBodyProducerTests.test_unknownLength.<locals>.HasSeek.seek¹   ó   € Ùr\   rb   N)r]   r^   r_   r`   rž   ra   rb   r\   rY   ÚHasSeekrš   ¸   ó   † ör\   r¡   c                  ó   € ] tR t^¼tR tRtR# )Ú9FileBodyProducerTests.test_unknownLength.<locals>.HasTellc                	ó   € R # r~   rb   rr   s   &rY   ÚtellÚ>FileBodyProducerTests.test_unknownLength.<locals>.HasTell.tell½   r    r\   rb   N)r]   r^   r_   r`   r¦   ra   rb   r\   rY   ÚHasTellr¤   ¼   r¢   r\   r¨   N)r;   ÚassertEqualrC   Úlength)rX   r¡   r¨   Úproducers   &   rY   Útest_unknownLengthÚ(FileBodyProducerTests.test_unknownLength±   sX   € ÷	ñ 	÷	ñ 	ô $¡G£IÓ.ˆØ×Ñœ¨¯©Ô9Ü#¡G£IÓ.ˆØ×Ñœ¨¯©Ö9r\   c                óð   € Rp\        V4      pVP                  ^4       \        V4      pV P                  \	        V4      ^,
          VP
                  4       V P                  VP                  4       ^4       R# )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 bytesN)r   rž   r;   r©   Úlenrª   r¦   )rX   Ú
inputBytesÚ	inputFiler«   s   &   rY   Útest_knownLengthÚ&FileBodyProducerTests.test_knownLengthÅ   s]   € ð ,ˆ
Ü˜JÓ'ˆ	Ø�‰�qÔÜ# IÓ.ˆØ×Ñœ˜Z›¨1Õ,¨h¯o©oÔ>Ø×Ñ˜Ÿ™Ó)¨1Ö-r\   c                ó‚   € \        \        R4      4      pV P                  \        P                  VP
                  4       R# )z_
If no L{Cooperator} instance is passed to L{FileBodyProducer}, the
global cooperator is used.
r\   N)r;   r   r©   r   Ú	cooperateÚ
_cooperate)rX   r«   s   & rY   Útest_defaultCooperatorÚ,FileBodyProducerTests.test_defaultCooperatorÒ   s,   € ô
 $¤G¨C£LÓ1ˆØ×ÑœŸ™¨×)<Ñ)<Ö=r\   c                óä  € Rp^p\        4       p\        V4      p\        \        V4      V P                  V4      pVP	                  V4      p\        \        V4      V,          ^,           4       F#  pV P                  P                  ^ 4      ! 4        K%  	  V P                  . V P                  4       V P                  WP                  4       4       V P                  RV P                  V4      4       R# )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, worldN)r   r|   r;   r‘   ÚstartProducingÚranger¯   r�   Úpopr©   ÚgetvalueÚsuccessResultOf)rX   ÚexpectedResultÚreadSizeÚoutputÚconsumerr«   ÚcompleteÚis   &       rY   Útest_startProducingÚ)FileBodyProducerTests.test_startProducingÚ   s½   € ð )ˆØˆÜ“ˆÜ Ó'ˆÜ#¤G¨NÓ$;¸T¿_¹_ÈhÓWˆØ×*Ñ*¨8Ó4ˆÜ”s˜>Ó*¨hÕ6¸Õ:Ö;ˆAØ�O‰O×Ñ Ô"Ö$ñ <à×Ñ˜˜TŸ_™_Ô-Ø×Ñ˜¯©Ó):Ô;Ø×Ñ˜˜t×3Ñ3°HÓ=Ö>r\   c                ó`  € ^pRp\        V4      p\        W0P                  V4      p\        \        4       4      pVP	                  V4       \        \        V4      V,          ^,           4       F#  pV P                  P                  ^ 4      ! 4        K%  	  V P                  VP                  4       R# )zg
When L{FileBodyProducer} reaches end-of-file on the input file given to
it, the input file is closed.
s   some friendly bytesN)r   r;   r‘   r|   r»   r¼   r¯   r�   r½   r•   Úclosed)rX   rÁ   r°   r±   r«   rÃ   rÅ   s   &      rY   Útest_inputClosedAtEOFÚ+FileBodyProducerTests.test_inputClosedAtEOFì   s†   € ð
 ˆØ+ˆ
Ü˜JÓ'ˆ	Ü# I¯©ÀÓIˆÜ¤£	Ó*ˆØ×Ñ Ô)Ü”s˜:“¨(Õ2°QÕ6Ö7ˆAØ�O‰O×Ñ Ô"Ö$ñ 8à�‰˜	×(Ñ(Ö)r\   c                ó  €  ! R R4      p\        V! 4       V P                  4      pVP                  \        \	        4       4      4      pV P
                  P                  ^ 4      ! 4        V P                  V4      P                  \        4       R# )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                  ó   € ] tR tRtR tRtR# )ÚGFileBodyProducerTests.test_failedReadWhileProducing.<locals>.BrokenFilei  c                	ó   € \        R 4      h)zSimulated bad thing)ÚOSError)rX   Úcounts   &&rY   ÚreadÚLFileBodyProducerTests.test_failedReadWhileProducing.<locals>.BrokenFile.read  s   € ÜÐ3Ó4Ð4r\   rb   N)r]   r^   r_   r`   rÒ   ra   rb   r\   rY   Ú
BrokenFilerÎ     s   † ö5r\   rÔ   N)
r;   r‘   r»   r|   r   r�   r½   ÚfailureResultOfÚtrapÚIOError)rX   rÔ   r«   rÄ   s   &   rY   Útest_failedReadWhileProducingÚ3FileBodyProducerTests.test_failedReadWhileProducingû   se   € ÷	5ñ 	5ô $¡J£L°$·/±/ÓBˆØ×*Ñ*¬<¼»	Ó+BÓCˆØ�‰×Ñ˜AÔÔ Ø×Ñ˜XÓ&×+Ñ+¬GÖ4r\   c                ó”  € Rp^p\        4       p\        V4      p\        V4      p\        WPP                  V4      pVP	                  V4      pVP                  4        V P                  VP                  4       V P                  P                  ^ 4      ! 4        V P                  RVP                  4       4       V P                  V4       R# )z…
When the L{Deferred} returned by L{FileBodyProducer.startProducing} is
cancelled, the input file is closed and the task is stopped.
rº   r\   N)r   r|   r;   r‘   r»   Úcancelr•   rÉ   r�   r½   r©   r¾   ÚassertNoResult©rX   rÀ   rÁ   rÂ   rÃ   r±   r«   rÄ   s   &       rY   Útest_cancelWhileProducingÚ/FileBodyProducerTests.test_cancelWhileProducing  sŸ   € ð
 )ˆØˆÜ“ˆÜ Ó'ˆÜ˜NÓ+ˆ	Ü# I¯©ÀÓIˆØ×*Ñ*¨8Ó4ˆØ�‰ÔØ�‰˜	×(Ñ(Ô)Ø�‰×Ñ˜AÔÔ Ø×Ñ˜˜fŸo™oÓ/Ô0Ø×Ñ˜HÖ%r\   c                ó”  € Rp^p\        4       p\        V4      p\        V4      p\        WPP                  V4      pVP	                  V4      pVP                  4        V P                  VP                  4       V P                  P                  ^ 4      ! 4        V P                  RVP                  4       4       V P                  V4       R# )zñ
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\   N©r   r|   r;   r‘   r»   ÚstopProducingr•   rÉ   r�   r½   r©   r¾   rÜ   rÝ   s   &       rY   Útest_stopProducingÚ(FileBodyProducerTests.test_stopProducing  s¡   € ð )ˆØˆÜ“ˆÜ Ó'ˆÜ˜NÓ+ˆ	Ü# I¯©ÀÓIˆØ×*Ñ*¨8Ó4ˆØ×ÑÔ Ø�‰˜	×(Ñ(Ô)Ø�‰×Ñ˜AÔÔ Ø×Ñ˜˜fŸo™oÓ/Ô0Ø×Ñ˜HÖ%r\   c                ó0  € Rp^p\        4       p\        V4      p\        \        V4      V P                  V4      pVP	                  V4      pV P
                  P                  ^ 4      ! 4        V P                  VP                  4       VR,          4       VP                  4        V P
                  P                  ^ 4      ! 4        V P                  VP                  4       VR,          4       V P                  . V P
                  4       V P                  V4       R# )zv
L{FileBodyProducer.pauseProducing} temporarily suspends writing bytes
from the input file to the given L{IConsumer}.
rº   ºNé   NN)r   r|   r;   r‘   r»   r�   r½   r©   r¾   ÚpauseProducingrÜ   )rX   rÀ   rÁ   rÂ   rÃ   r«   rÄ   s   &      rY   Útest_pauseProducingÚ)FileBodyProducerTests.test_pauseProducing2  sÚ   € ð
 )ˆØˆÜ“ˆÜ Ó'ˆÜ#¤G¨NÓ$;¸T¿_¹_ÈhÓWˆØ×*Ñ*¨8Ó4ˆØ�‰×Ñ˜AÔÔ Ø×Ñ˜Ÿ™Ó*¨N¸2Õ,>Ô?Ø×ÑÔ!ð 	�‰×Ñ˜AÔÔ ð 	×Ñ˜Ÿ™Ó*¨N¸2Õ,>Ô?Ø×Ñ˜˜TŸ_™_Ô-Ø×Ñ˜HÖ%r\   c                óô  € Rp^p\        4       p\        V4      p\        \        V4      V P                  V4      pVP	                  V4       V P
                  P                  ^ 4      ! 4        V P                  VRV VP                  4       4       VP                  4        VP                  4        V P
                  P                  ^ 4      ! 4        V P                  VRV^,           VP                  4       4       R# )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º   N)r   r|   r;   r‘   r»   r�   r½   r©   r¾   rè   ÚresumeProducing)rX   rÀ   rÁ   rÂ   rÃ   r«   s   &     rY   Útest_resumeProducingÚ*FileBodyProducerTests.test_resumeProducingL  sÆ   € ð )ˆØˆÜ“ˆÜ Ó'ˆÜ#¤G¨NÓ$;¸T¿_¹_ÈhÓWˆØ×Ñ Ô)Ø�‰×Ñ˜AÔÔ Ø×Ñ˜¨	¨Ð2°F·O±OÓ4EÔFØ×ÑÔ!Ø× Ñ Ô"Ø�‰×Ñ˜AÔÔ Ø×Ñ˜¨¨(°Q­,Ð7¸¿¹Ó9JÖKr\   c                ó´  € Rp^p\        4       p\        V4      p\        V4      p\        WPP                  V4      pVP	                  V4      pVP                  4        VP                  4        V P                  VP                  4       V P                  P                  ^ 4      ! 4        V P                  RVP                  4       4       V P                  V4       R# )z^
L{FileBodyProducer.stopProducing} can be called more than once without
raising an exception.
s   testr\   Nrá   rÝ   s   &       rY   Útest_multipleStopÚ'FileBodyProducerTests.test_multipleStop_  s­   € ð
 !ˆØˆÜ“ˆÜ Ó'ˆÜ˜NÓ+ˆ	Ü# I¯©ÀÓIˆØ×*Ñ*¨8Ó4ˆØ×ÑÔ Ø×ÑÔ Ø�‰˜	×(Ñ(Ô)Ø�‰×Ñ˜AÔÔ Ø×Ñ˜˜fŸo™oÓ/Ô0Ø×Ñ˜HÖ%r\   )r�   r‘   N)r]   r^   r_   r`   rz   rŒ   r’   r–   r¬   r²   r·   rÆ   rÊ   rØ   rÞ   rã   ré   rí   rð   ra   rb   r\   rY   r‡   r‡   “   sP   † ñò
òUòUò:ò(.ò>ò?ò$*ò5ò"&ò$&ò(&ò4Lö&&r\   r‡   ú	127.0.0.7ú::7z	127.0.0.8z	127.0.0.9z
127.0.0.10z
127.0.0.11c                  ó@   € ] tR tRtRtR t ! R R4      tR tR tRt	R	# )
ÚFakeReactorAndConnectMixini{  z…
A test mixin providing a testable C{Reactor} class and a dummy C{connect}
method which allows instances to pretend to be endpoints.
c                óØ   € \        4       p\        VR\        .R\        .R\        .R\
        .R\        .R\        .RR.RR./R	7      pVP                  Vn        VP                  Vn	        V# )
a.  
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.
ú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)rX   ÚmrcÚdrrs   &  rY   ÚcreateReactorÚ(FakeReactorAndConnectMixin.createReactor�  sx   € ô !Ó"ˆÜ+Øà¤Ð/Ø"Ô%6Ð$7Ø¤Ð/Ø¤Ð/Øœ�~ØœJ˜<Ø˜k˜]Ø˜�wð	ô
ˆð  Ÿ™ˆŒØ—k‘kˆŒØˆ
r\   c                  ó&   € ] tR tRtRtR tR tRtR# )Ú'FakeReactorAndConnectMixin.StubEndpointi   zŒ
Endpoint that wraps existing endpoint, substitutes StubHTTPProtocol, and
resulting protocol instances are attached to the given test case.
c                	óº   a € VS n         VS n        R  p\        V\        S P                   4      4      S n        \        4       S n        V 3R lS P                  n        R# )c                 ó   € R# )zthis function does nothingNrb   rb   r\   rY   ÚnothingÚAFakeReactorAndConnectMixin.StubEndpoint.__init__.<locals>.nothingª  s   ‚ r\   c                ó   <€ SP                   # r~   ©Úprotocol)ÚaddrrX   s   &€rY   rŠ   ÚBFakeReactorAndConnectMixin.StubEndpoint.__init__.<locals>.<lambda>¯  s	   ø€ °d·m²mr\   N)ÚendpointÚtestCaser@   ÚreprÚfactoryrd   r  ÚbuildProtocol)rX   r  r  r
  s   f&& rY   rs   Ú0FakeReactorAndConnectMixin.StubEndpoint.__init__¦  sE   ø€ Ø$ˆDŒMØ$ˆDŒMò1ô 0°¼¸d¿m¹mÓ9LÓMˆDŒLÜ,Ó.ˆDŒMÜ)CˆD�L‰LÖ&r\   c                	ó¬   € V P                   V P                  n         V P                  P                  V P                  4       \        V P                   4      # r~   )r  r  r  Úconnectr  r   )rX   ÚignoredFactorys   &&rY   r  Ú/FakeReactorAndConnectMixin.StubEndpoint.connect±  s7   € Ø%)§]¡]ˆD�M‰MÔ"Ø�M‰M×!Ñ! $§,¡,Ô/Ü˜4Ÿ=™=Ó)Ð)r\   )r  r  r  r  N)r]   r^   r_   r`   rz   rs   r  ra   rb   r\   rY   ÚStubEndpointr     s   † ñ	ò
		Dö	*r\   r  c                óf   a a€ \         P                  ! V4      pVP                  oVV 3R lVn        V# )zr
Return an Agent suitable for use in tests that wrap the Agent and want
both a fake reactor and StubHTTPProtocol.
c                 ó0   <€ SP                  S! V !  S4      # r~   )r  )ÚargsÚ_oldGetEndpointrX   s   *€€rY   rŠ   ÚEFakeReactorAndConnectMixin.buildAgentForWrapperTest.<locals>.<lambda>½  s   ø€ Ø×Ñ™o¨tÑ4°dÔ;r\   )r/   ÚAgentÚ_getEndpoint)rX   ÚreactorÚagentr  s   f& @rY   ÚbuildAgentForWrapperTestÚ3FakeReactorAndConnectMixin.buildAgentForWrapperTest¶  s/   ù€ ô
 —’˜WÓ%ˆØ×,Ñ,ˆõ
ˆÔð ˆr\   c                óZ   € \        4       pVP                  R4       W n        \        V4      # )z~
Fake implementation of an endpoint which synchronously
succeeds with an instance of L{StubHTTPProtocol} for ease of
testing.
N)rd   ÚmakeConnectionr  r   ©rX   r  r  s   && rY   r  Ú"FakeReactorAndConnectMixin.connectÂ  s*   € ô $Ó%ˆØ×Ñ Ô%Ø ŒÜ�xÓ Ð r\   r  N)
r]   r^   r_   r`   rz   r  r  r%  r  ra   rb   r\   rY   rõ   rõ   {  s    † ñò
÷>*ñ *ò,
ö	!r\   rõ   c                  ó    € ] tR tRtRtR tRtR# )ÚDummyEndpointiÎ  z)
An endpoint that uses a fake transport.
c                	ól   € VP                  R 4      pVP                  \        4       4       \        V4      # r~   ©r  r(  r%   r   r)  s   && rY   r  ÚDummyEndpoint.connectÓ  s.   € Ø×(Ñ(¨Ó.ˆØ×Ñ¤Ó 1Ô2Ü�xÓ Ð r\   rb   N©r]   r^   r_   r`   rz   r  ra   rb   r\   rY   r,  r,  Î  s   † ñö!r\   r,  c                  ó    € ] tR tRtRtR tRtR# )ÚBadEndpointiÙ  z'
An endpoint that shouldn't be called.
c                	ó   € \        R 4      h)z(This endpoint should not have been used.)ÚRuntimeError)rX   r  s   &&rY   r  ÚBadEndpoint.connectÞ  s   € ÜÐEÓFÐFr\   rb   Nr0  rb   r\   rY   r2  r2  Ù  s   † ñöGr\   r2  c                  ó$   € ] tR tRtRtR t]tRtR# )ÚDummyFactoryiâ  z'
Create C{StubHTTPProtocol} instances.
c                	ó   € R # r~   rb   )rX   ÚquiescentCallbackÚmetadatas   &&&rY   rs   ÚDummyFactory.__init__ç  s   € Ùr\   rb   N)	r]   r^   r_   r`   rz   rs   rd   r  ra   rb   r\   rY   r7  r7  â  s   † ñòð  „Hr\   r7  c                  ób   € ] tR tRtRtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tRtR# )ÚHTTPConnectionPoolTestsií  z,
Tests for the L{HTTPConnectionPool} class.
c                	ó°   € V P                  4       V n        \        V P                  4      V n        \        V P                  n        R V P                  n        R# )FN)r  ÚfakeReactorr=   Úpoolr7  Ú_factoryÚretryAutomaticallyrr   s   &rY   r’   ÚHTTPConnectionPoolTests.setUpò  s=   € Ø×-Ñ-Ó/ˆÔÜ& t×'7Ñ'7Ó8ˆŒ	Ü)ˆ�	‰	Ôà',ˆ�	‰	Ö$r\   c                óÊ   a € S P                  S P                  P                  / 4       V 3R lpRpS P                  P                  V\	        4       4      pVP                  V4      # )zc
If there are no cached connections,
L{HTTPConnectionPool.getConnection} returns a new connection.
c                óœ   <€ SP                  V \        4       SP                  V SP                  P                  P                  4       4       R # r~   )ÚassertIsInstancerd   ÚassertNotInr@  Ú_connectionsÚvalues)ÚconnrX   s   &€rY   ÚgotConnectionÚMHTTPConnectionPoolTests.test_getReturnsNewIfCacheEmpty.<locals>.gotConnection   s7   ø€ Ø×!Ñ! $Ô(8Ô9à×Ñ˜T 4§9¡9×#9Ñ#9×#@Ñ#@Ó#BÖCr\   éÕ/  )r©   r@  rH  ÚgetConnectionr,  ÚaddCallback)rX   rK  Ú
unknownKeyÚds   f   rY   Útest_getReturnsNewIfCacheEmptyÚ6HTTPConnectionPoolTests.test_getReturnsNewIfCacheEmptyù  sS   ø€ ð
 	×Ñ˜Ÿ™×/Ñ/°Ô4õ	Dð
 ˆ
Ø�I‰I×#Ñ# J´³Ó@ˆØ�}‰}˜]Ó+Ð+r\   c                óp  € \        4       pVP                  \        4       4       V P                  P	                  RV4       V P                  VP                  P                  R4       V P                  WP                  P                  R,          4       V P                  P                  ^ï4       V P                  VP                  P                  R4       V P                  WP                  P                  R,          4       V P                  WP                  P                  4       V P                  P                  R4       V P                  VP                  P                  R4       V P                  WP                  P                  R,          4       V P                  WP                  P                  4       R# )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.
Fgš™™™™™ñ?TN©Úhttpó   example.coméP   )rd   r(  r%   r@  Ú_putConnectionr©   Ú	transportÚdisconnectingÚassertInrH  r?  r  Ú	_timeoutsrG  ©rX   r  s   & rY   Útest_putStartsTimeoutÚ-HTTPConnectionPoolTests.test_putStartsTimeout	  s8  € ô $Ó%ˆØ×Ñ¤Ó 1Ô2Ø�	‰	× Ñ Ð!=¸xÔHð 	×Ñ˜×+Ñ+×9Ñ9¸5ÔAØ�‰�h§	¡	× 6Ñ 6Ð7SÕ TÔUð 	×Ñ× Ñ  Ô%Ø×Ñ˜×+Ñ+×9Ñ9¸5ÔAØ�‰�h§	¡	× 6Ñ 6Ð7SÕ TÔUØ�‰�h§	¡	× 3Ñ 3Ô4ð 	×Ñ× Ñ  Ô%Ø×Ñ˜×+Ñ+×9Ñ9¸4Ô@Ø×Ñ˜§9¡9×#9Ñ#9Ð:VÕ#WÔXØ×Ñ˜§9¡9×#6Ñ#6Ö7r\   c                óŠ  € V P                   p\        4       \        4       .pV F.  pVP                  \        4       4       VP	                  RV4       K0  	  V P                  VP                  R,          V4       VP                  P                  4       p\        4       pVP                  \        4       4       VP	                  RV4       VP                  R,          pV P                  \        V4      ^4       V P                  Wb^,          V.4       T P                  V Uu. uF  q3P                  P                  NK  	  upRR.4       V P                  V^ ,          P                  P                  R4       V P                  WB^ ,          ,          P                  4       V P                  V^ ,          VP                  4       R# u upi )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.
FTNrU  )r@  rd   r(  r%   rY  r©   rH  r]  Úcopyr¯   rZ  r[  r•   Ú	cancelledrG  )rX   r@  Ú
origCachedÚpÚtimeoutsÚnewProtocolÚ	newCacheds   &      rY   Útest_putExceedsMaxPersistentÚ4HTTPConnectionPoolTests.test_putExceedsMaxPersistent%  si  € ð �y‰yˆô 'Ó(Ô*:Ó*<Ð=ˆ
ÛˆAØ×Ñœ_Ó.Ô/Ø×ÑÐ <¸aÖ@ñ ð 	×Ñ˜×*Ñ*Ð+GÕHÈ*ÔUØ—>‘>×&Ñ&Ó(ˆô 'Ó(ˆØ×"Ñ"¤?Ó#4Ô5Ø×ÑÐ8¸+ÔFð ×%Ñ%Ð&BÕCˆ	Ø×Ñœ˜Y›¨Ô+Ø×Ñ˜°¥]°KÐ$@ÔAØ×Ñ¹YÓG¹Y¸Ÿ+™+×3Ô3¹YÑGÈ%ÐQVÈÔXØ×Ñ˜ A�×0Ñ0×>Ñ>ÀÔEØ�‰˜¨A¥Õ/×9Ñ9Ô:Ø×Ñ˜ A�¨¯©Ö7ùò Hs   ÄG c                óÖ  a € V 3R lp. pVP                  V! RR^P4      4       VP                  V! RR^P4      4       V! RRR4       V! RR^P4       S P                  S P                  P                  R,          V4       S P                  \	        S P                  P                  R	,          4      ^4       S P                  \	        S P                  P                  R
,          4      ^4       R# )zq
C{maxPersistentPerHost} is enforced per C{(scheme, host, port)}:
different keys have different max connections.
c                óŠ   <€ \        4       pVP                  \        4       4       SP                  P	                  WV3V4       V# r~   )rd   r(  r%   r@  rY  )ÚschemeÚhostÚportre  rX   s   &&& €rY   ÚaddProtocolÚFHTTPConnectionPoolTests.test_maxPersistentPerHost.<locals>.addProtocolI  s:   ø€ Ü Ó"ˆAØ×Ñœ_Ó.Ô/Ø�I‰I×$Ñ$ f°DÐ%9¸1Ô=ØˆHr\   rV  rW  Úhttpsé»  ó   www2.example.comNrU  )rr  rW  rs  )rV  rt  rX  )rv   r©   r@  rH  r¯   )rX   rp  Ú
persistents   f  rY   Útest_maxPersistentPerHostÚ1HTTPConnectionPoolTests.test_maxPersistentPerHostC  sÉ   ø€ õ	ð ˆ
Ø×Ñ™+ f¨n¸bÓAÔBØ×Ñ™+ f¨n¸bÓAÔBÙ�G˜^¨SÔ1Ù�FÐ/°Ô4à×ÑØ�I‰I×"Ñ"Ð#?Õ@À*ô	
ð 	×Ñœ˜TŸY™Y×3Ñ3Ð4RÕSÓTÐVWÔXØ×ÑÜ�—	‘	×&Ñ&Ð'HÕIÓJÈAö	
r\   c                óø   a a€ \        4       oSP                  \        4       4       S P                  P	                  RS4       VV 3R lpS P                  P                  R\        4       4      P                  V4      # )z„
Getting an address which has a cached connection returns the cached
connection, removes it from the cache and cancels its timeout.
c                óT  <€ SP                  SV 4       SP                  V SP                  P                  R,          4       SP                  P                  ^ñ4       SP                  V P                  P                  R4       SP                  V SP                  P                  4       R# )rV  FNrU  )
ÚassertIdenticalrG  r@  rH  r?  r  r©   rZ  r[  r]  )rJ  r  rX   s   &€€rY   rK  ÚGHTTPConnectionPoolTests.test_getCachedConnection.<locals>.gotConnectiong  s{   ø€ à× Ñ  ¨4Ô0Ø×Ñ˜T 4§9¡9×#9Ñ#9Ð:VÕ#WÔXà×Ñ×$Ñ$ SÔ)Ø×Ñ˜TŸ^™^×9Ñ9¸5ÔAØ×Ñ˜T 4§9¡9×#6Ñ#6Ö7r\   rU  )rd   r(  r%   r@  rY  rN  r2  rO  )rX   rK  r  s   f @rY   Útest_getCachedConnectionÚ0HTTPConnectionPoolTests.test_getCachedConnection]  se   ù€ ô $Ó%ˆØ×Ñ¤Ó 1Ô2Ø�	‰	× Ñ Ð!=¸xÔHö	8ð �y‰y×&Ñ&Ø(Ü‹Mó
÷ ‰+�mÓ
$ð	%r\   c                ó  a aa€ \        4       oSP                  \        4       4       RoS P                  P	                  SS4       VVV 3R lpS P                  P                  S\        4       4      pVP                  V4      # )zB
The pool's C{_newConnection} method constructs a new connection.
rM  c                óî   <€ SP                  SV 4       SP                  SSP                  P                  S,          4       SP	                  V SP                  P                  P                  4       4       R # r~   )ÚassertNotIdenticalr\  r@  rH  rG  rI  )ÚnewConnectionÚkeyr  rX   s   &€€€rY   rK  ÚAHTTPConnectionPoolTests.test_newConnection.<locals>.gotConnection  sS   ø€ à×#Ñ# H¨mÔ<à�M‰M˜( D§I¡I×$:Ñ$:¸3Õ$?Ô@à×Ñ˜]¨D¯I©I×,BÑ,B×,IÑ,IÓ,KÖLr\   )rd   r(  r%   r@  rY  Ú_newConnectionr,  rO  )rX   rK  rQ  r‚  r  s   f  @@rY   Útest_newConnectionÚ*HTTPConnectionPoolTests.test_newConnectionu  sf   ú€ ô
 $Ó%ˆØ×Ñ¤Ó 1Ô2ØˆØ�	‰	× Ñ   hÔ/÷	Mð �I‰I×$Ñ$ S¬-«/Ó:ˆØ�}‰}˜]Ó+Ð+r\   c                óN  € V P                   pRp\        4       \        4       .pV F-  pVP                  \        4       4       VP	                  W$4       K/  	  V P                  VP                  V,          V4       RV^ ,          n        . pV P                   P                  V\        4       4      P                  VP                  4       V P                  V^ ,          V^,          4       V P                  VP                  V,          . 4       V P                  VP                  / 4       R# )zc
When getting connections out of the cache, disconnected connections
are removed and not returned.
ÚDISCONNECTEDNrU  )r@  rd   r(  r%   rY  r©   rH  rq   rN  r2  rO  rv   rz  r]  )rX   r@  r‚  rd  re  rx   s   &     rY   Útest_getSkipsDisconnectedÚ1HTTPConnectionPoolTests.test_getSkipsDisconnectedŠ  sî   € ð
 �y‰yˆØ*ˆô 'Ó(Ô*:Ó*<Ð=ˆ
ÛˆAØ×Ñœ_Ó.Ô/Ø×Ñ Ö'ñ ð 	×Ñ˜×*Ñ*¨3Õ/°Ô<ð -ˆ
�1�Ôð ˆØ�	‰	×Ñ ¤[£]Ó3×?Ñ?ÀÇÁÔNØ×Ñ˜V A�Y¨
°1­Ô6ð 	×Ñ˜×*Ñ*¨3Õ/°Ô4Ø×Ñ˜Ÿ™¨Ö,r\   c                ó<  € \        4       pV P                  VP                  R4       \        P                  ! V \
        4      pRVn        V P                  P                  RV4       V P                  ^\        V4      4       V^ ,          pVR,          pV P                  VP                  \        4       V P                  VP                  4       R4       V P                  RV P                  P                  P!                  R4      4       V P#                  \        4       R# )zM
If a non-quiescent connection is put back in the cache, an error is
logged.
rn   ÚNOTQUIESCENTÚlog_failurez5BUG: Non-quiescent protocol added to connection pool.NrU  )rd   r©   rq   r#   ÚcreateWithCleanupr&   r@  rY  ÚassertEqualsr¯   rF  Úvaluer4  ÚgetErrorMessagerz  rH  ÚgetÚflushLoggedErrors)rX   r  ÚlogObserverÚeventÚfs   &    rY   Útest_putNotQuiescentÚ,HTTPConnectionPoolTests.test_putNotQuiescent¦  sã   € ô
 $Ó%ˆà×Ñ˜Ÿ™¨Ô5ä*×<Ò<¸TÔCUÓVˆà'ˆŒØ�	‰	× Ñ Ð!=¸xÔHØ×Ñ˜!œS Ó-Ô.à˜A•ˆØ�-Õ ˆà×Ñ˜aŸg™g¤|Ô4Ø×ÑØ×ÑÓÐ!Xô	
ð 	×ÑØ�$—)‘)×(Ñ(×,Ñ,Ð-IÓJô	
ð 	×Ñœ|Ö,r\   c                ó¼  €  ! R R4      p\        V P                  R4      pRVn        . pRpVP                  WA! 4       4      P	                  VP
                  4       V^ ,          pV P                  V\        4       RVn        VP                  V4       . pVP                  WA! 4       4      P	                  VP
                  4       V P                  V^ ,          V4       R# )a  
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                  ó   € ] tR tRtR tRtR# )ÚMHTTPConnectionPoolTests.test_getUsesQuiescentCallback.<locals>.StringEndpointiÊ  c                	ól   € VP                  R 4      pVP                  \        4       4       \        V4      # r~   r.  )rX   r  re  s   && rY   r  ÚUHTTPConnectionPoolTests.test_getUsesQuiescentCallback.<locals>.StringEndpoint.connectË  s-   € Ø×)Ñ)¨$Ó/�Ø× Ñ ¤Ó!2Ô3Ü˜q“zÐ!r\   rb   N©r]   r^   r_   r`   r  ra   rb   r\   rY   ÚStringEndpointr›  Ê  s   † ö"r\   rŸ  TFza keyrn   N)r=   r?  rB  rN  rO  rv   rF  r2   Ú_stateÚ_quiescentCallbackrz  )rX   rŸ  r@  rx   r‚  r  Úresult2s   &      rY   Útest_getUsesQuiescentCallbackÚ5HTTPConnectionPoolTests.test_getUsesQuiescentCallbackÁ  sÂ   € ÷	"ñ 	"ô " $×"2Ñ"2°DÓ9ˆØ"'ˆÔØˆØˆØ×Ñ˜3 Ó 0Ó1×=Ñ=¸f¿m¹mÔLØ˜!•9ˆØ×Ñ˜hÔ(<Ô=ð &ˆŒØ×#Ñ# HÔ-ð
 ˆØ×Ñ˜3 Ó 0Ó1×=Ñ=¸g¿n¹nÔMØ×Ñ˜W Q�Z¨Ö2r\   c                ó4  a a€ . oVV 3R lpV! RR^P4       V! RR^P4       S P                   P                  4       pS F)  pS P                  VP                  P                  R4       K+  	  S P                  S P                   P
                  / 4       S P                  P                  4        F  pS P                  VP                  R4       K!  	  S P                  S P                   P                  / 4       . pVP                  VP                  4       S P                  V. 4       S^ ,          P                  \        \        4       4      4       S P                  V. 4       S^,          P                  \        \        4       4      4       S P                  VR.4       R# )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                ó¬   <€ \        4       pVP                  \        4       4       SP                  P	                  WV3V4       SP                  V4       R # r~   )r2   r(  r%   r@  rY  rv   )rm  rn  ro  re  ru  rX   s   &&& €€rY   rp  ÚHHTTPConnectionPoolTests.test_closeCachedConnections.<locals>.addProtocolì  sC   ø€ Ü$Ó&ˆAØ×Ñœ_Ó.Ô/Ø�I‰I×$Ñ$ f°DÐ%9¸1Ô=Ø×Ñ˜aÖ r\   rV  rW  rt  TN)r@  ÚcloseCachedConnectionsr©   rZ  r[  rH  r?  ÚgetDelayedCallsrc  r]  rO  rv   ÚconnectionLostr)   r   )rX   rp  ÚdoneDeferredre  Údcrx   ru  s   f     @rY   Útest_closeCachedConnectionsÚ3HTTPConnectionPoolTests.test_closeCachedConnectionsä  sB  ù€ ð ˆ
ö	!ñ 	�F˜N¨BÔ/Ù�FÐ/°Ô4Ø—y‘y×7Ñ7Ó9ˆó ˆAØ×Ñ˜QŸ[™[×6Ñ6¸Ö=ñ à×Ñ˜Ÿ™×/Ñ/°Ô4à×"Ñ"×2Ñ2Ö4ˆBØ×Ñ˜RŸ\™\¨4Ö0ñ 5à×Ñ˜Ÿ™×,Ñ,¨bÔ1ð ˆØ× Ñ  §¡Ô/Ø×Ñ˜ Ô$Ø�1�×$Ñ$¤W¬^Ó-=Ó%>Ô?Ø×Ñ˜ Ô$Ø�1�×$Ñ$¤W¬^Ó-=Ó%>Ô?Ø×Ñ˜ $ Ö(r\   c                óB  a€ V P                  V P                  P                  / 4       \        4       o ! V3R lR4      pV P                  P	                  RV! 4       4      pVP                  4        V P                  V P                  S4      P                  \        4       R# )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                  ó$   <€ ] tR tRtV 3R ltRtR# )ÚXHTTPConnectionPoolTests.test_cancelGetConnectionCancelsEndpointConnect.<locals>.Endpointi  c                	ó   <€ S# r~   rb   )rX   r  ÚconnectionResults   &&€rY   r  Ú`HTTPConnectionPoolTests.test_cancelGetConnectionCancelsEndpointConnect.<locals>.Endpoint.connect  s	   ø€ Ø'Ð'r\   rb   Nrž  )r³  s   €rY   ÚEndpointr±    s   ø† ÷(ñ (r\   rµ  i90  N)	r©   r@  rH  r   rN  rÛ   rÕ   Útyper   )rX   rµ  rQ  r³  s   &  @rY   Ú.test_cancelGetConnectionCancelsEndpointConnectÚFHTTPConnectionPoolTests.test_cancelGetConnectionCancelsEndpointConnect  sv   ø€ ð 	×Ñ˜Ÿ™×/Ñ/°Ô4Ü#›:Ð÷	(ô 	(ð �I‰I×#Ñ# E©8«:Ó6ˆØ	�‰Œ
Ø×Ñ˜×-Ñ-Ð.>Ó?×DÑDÄnÖUr\   )r?  r@  N)r]   r^   r_   r`   rz   r’   rR  r_  ri  rv  r|  r…  r‰  r—  r£  r­  r·  ra   rb   r\   rY   r=  r=  í  sF   † ñò-ò,ò 8ò88ò<
ò4%ò0,ò*-ò8-ò6!3òF")öHVr\   r=  c                  ó    € ] tR tRtRtR tRtR# )ÚAgentTestsMixini  z)
Tests for any L{IAgent} implementation.
c                ó`   € V P                  \        \        V P                  4       4      4       R# )z&
The agent object provides L{IAgent}.
N)r•   r   rD   Ú	makeAgentrr   s   &rY   r–   ÚAgentTestsMixin.test_interface  s   € ð 	�‰œ¤V¨T¯^©^Ó-=Ó>Ö?r\   rb   N)r]   r^   r_   r`   rz   r–   ra   rb   r\   rY   rº  rº    s   † ñö@r\   rº  c                  óX   € ] tR tRtRtR tR tR tR tR ]	P                  R3R	 ltR
tR# )ÚIntegrationTestingMixini&  z?
Transport-to-Agent integration tests for both HTTP and HTTPS.
c                ó<   € V P                  R\        \        4       R# )z
L{Agent} works over IPv4.
rW  N)ÚintegrationTestrú   r   rr   s   &rY   Útest_integrationTestIPv4Ú0IntegrationTestingMixin.test_integrationTestIPv4+  s   € ð 	×Ñ˜^¬^¼[ÖIr\   c                ó4   € V P                  RR\        4       R# )z<
L{Agent} works over IPv4 when hostname is an IPv4 address.
s	   127.0.0.7rò   N)rÁ  r   rr   s   &rY   Útest_integrationTestIPv4AddressÚ7IntegrationTestingMixin.test_integrationTestIPv4Address1  s   € ð 	×Ñ˜\¨;¼ÖDr\   c                ó<   € V P                  R\        \        4       R# )z
L{Agent} works over IPv6.
s   ipv6.example.comN)rÁ  rû   r   rr   s   &rY   Útest_integrationTestIPv6Ú0IntegrationTestingMixin.test_integrationTestIPv67  s   € ð 	×ÑÐ0Ô2CÄ[ÖQr\   c                ó4   € V P                  RR\        4       R# )z<
L{Agent} works over IPv6 when hostname is an IPv6 address.
s   [::7]ró   N)rÁ  r   rr   s   &rY   Útest_integrationTestIPv6AddressÚ7IntegrationTestingMixin.test_integrationTestIPv6Address=  s   € ð 	×Ñ˜X u¬kÖ:r\   c                	ó   € V # r~   rb   )ÚserverÚ_s   &&rY   rŠ   Ú IntegrationTestingMixin.<lambda>H  s   € ©r\   ó   httpc           	     ó"  aa€ V P                  4       o\        '       d   V P                  \        RV3R l4       V! S4      pVP	                  RVR,           V,           R,           4      pSP
                  ^ ,          w  ršr¼pV P                  W’4       V! RWš4      pVP                  V4      p\        VRVR7      pVP                  V4       \        P                  V3R	 l4       oR
Sn        R
Sn        V! SS4      P                  R
4      p\        VR4      pVP                  V4       \        VVVVRSR7      pVP                  4        V P!                  V4       SP                  P"                  P%                  R4      pV P'                  V^ ,          P)                  R4      V^ ,          4       \+        VR,           Uu. uF  pV'       g   K  VP%                  R^4      NK!  	  up4      pV P                  VR,          V4       V P!                  V4       SP                  P,                  P/                  R4       VP                  4        V P1                  V4      pV P3                  VP4                  P7                  R4      ^ ,          R4       R
# u upi )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 # r~   rb   ©r#  s   €rY   rŠ   Ú9IntegrationTestingMixin.integrationTest.<locals>.<lambda>m  s   ø€ ¹'r\   ó   GETó   ://ó   /ÚTCPF)ÚpeerAddressc                 ó*   <€ \        4       p V Sn        V # r~   )r"   ÚcurrentProtocol)ÚapÚaccumulators    €rY   rß  Ú<IntegrationTestingMixin.integrationTest.<locals>.accumulatorw  s   ø€ ä%Ó'ˆBØ*,ˆKÔ'ØˆIr\   NT)Úclocks   
s
   GET / HTTPºé   NNs   : ó   HostsL   HTTP/1.1 200 OK
X-An-Header: an-value

Content-length: 12

hello world!s   x-an-headers   an-value)r  Ú
sslPresentÚpatchrO   rw   r   r©   r  r*   r(  r   ÚforProtocolrÝ  ÚprotocolConnectionMader+   ÚflushrÜ   ÚdataÚsplitr•   Ú
startswithÚdictrZ  rƒ   r¿   r�  ÚheadersÚgetRawHeaders)rX   ÚhostNameÚexpectedAddressÚaddressTypeÚserverWrapperÚcreateAgentrm  r$  Údeferredrn  ro  r  ÚtimeoutÚbindrÛ  ÚclientProtocolÚclientTransportÚwrapperÚserverTransportÚpumpÚlinesÚlinerî  Úresponserß  r#  s   &&&&&&&                 @@rY   rÁ  Ú'IntegrationTestingMixin.integrationTestC  s7  ù€ ðL ×$Ñ$Ó&ˆß‹:ð �J‰J”sÐ0´/ÔBÙ˜GÓ$ˆØ—=‘= ¨°&­¸8Õ)CÀdÕ)JÓKˆØ-4×-?Ñ-?ÀÕ-BÑ*ˆ�G dØ×Ñ˜Ô/Ù! %¨Ó4ˆØ ×.Ñ.¨{Ó;ˆÜ'¨¸È;ÔWˆØ×%Ñ% oÔ6ä	×	Ñ	ô	ó 
ð	ð
 '+ˆÔ#Ø-1ˆÔ*Ù ¨WÓ5×CÑCÀDÓIˆÜ'¨°Ó6ˆØ×Ñ˜Ô/ÜØØØØØØô
ˆð 	�
‰
ŒØ×Ñ˜HÔ%Ø×+Ñ+×0Ñ0×6Ñ6°wÓ?ˆØ�‰˜˜a�×+Ñ+¨MÓ:¸EÀ!½HÔEÜ¸¸r¾ÓK¹°ÄdÔ,˜Ÿ
™
 5¨!Ö,¹ÑKÓLˆØ×Ñ˜ Õ)¨8Ô4Ø×Ñ˜HÔ%Ø×#Ñ#×-Ñ-×3Ñ3ðô	
ð 	�
‰
ŒØ×'Ñ'¨Ó1ˆØ×ÑØ×Ñ×*Ñ*¨>Ó:¸1Õ=¸{ö	
ùò Ls   Æ<
JÇJrb   N)r]   r^   r_   r`   rz   rÂ  rÅ  rÈ  rË  r/   r!  rÁ  ra   rb   r\   rY   r¿  r¿  &  s9   † ñòJòEòRò;ñ /Ø—L‘LØ÷X
ð X
r\   r¿  c                  ó    € ] tR tRtRtR tRtR# )ÚStubEndpointFactoryiž  z5
A stub L{IAgentEndpointFactory} for use in testing.
c                óH   € VP                   VP                  VP                  3# )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}
)rm  rn  ro  ©rX   Úuris   &&rY   ÚendpointForURIÚ"StubEndpointFactory.endpointForURI¤  s   € ð —
‘
˜CŸH™H c§h¡hÐ/Ð/r\   rb   N)r]   r^   r_   r`   rz   r  ra   rb   r\   rY   r  r  ž  s   † ñö
0r\   r  c                  ó  € ] tR tRtRtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR t]! ]'       * R4      R 4       tR t]! ]'       * R4      R 4       tR tR t R t!R t"R  t#R! t$R"t%R## )$Ú
AgentTestsi±  z9
Tests for the new HTTP client API provided by L{Agent}.
c                óB   € \         P                  ! V P                  4      # )z5
@return: a new L{twisted.web.client.Agent} instance
)r/   r!  r#  rr   s   &rY   r¼  ÚAgentTests.makeAgent¸  s   € ô �|Š|˜DŸL™LÓ)Ð)r\   c                óZ   € V P                  4       V n        V P                  4       V n        R# ©ú3
Create an L{Agent} wrapped around a fake reactor.
N©r  r#  r¼  r$  rr   s   &rY   r’   ÚAgentTests.setUp¾  s"   € ð ×)Ñ)Ó+ˆŒØ—^‘^Ó%ˆŽ
r\   c                ó2  € \         P                  ! V P                  4      pV P                  VP                  \
        4       V P                  VP                  P                  R4       V P                  VP                  VP                  P                  4       R# )zF
If no pool is passed in, the L{Agent} creates a non-persistent pool.
FN)
r/   r!  r#  rF  Ú_poolr=   r©   ru  rz  Ú_reactor©rX   r$  s   & rY   Útest_defaultPoolÚAgentTests.test_defaultPoolÅ  sc   € ô —’˜TŸ\™\Ó*ˆØ×Ñ˜eŸk™kÔ+=Ô>Ø×Ñ˜Ÿ™×/Ñ/°Ô7Ø×Ñ˜UŸ^™^¨U¯[©[×-AÑ-AÖBr\   c                ó,  a € \        S P                  4      p\        P                  ! S P                  VR7      pV 3R lVn        VP                  RR4       S P                  S P                  P                  ^ ,          ^ ,          P                  R4       R# )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# r~   rb   ©r  rX   s   *€rY   rŠ   Ú,AgentTests.test_persistent.<locals>.<lambda>Ö  ó   ø€ ©4r\   r×  ó   http://127.0.0.1TN©
r=   r#  r/   r!  r"  rw   r©   r  rp   ru  ©rX   r@  r$  s   f  rY   Útest_persistentÚAgentTests.test_persistentÎ  sh   ø€ ô " $§,¡,Ó/ˆÜ—’˜TŸ\™\°Ô5ˆÜ/ˆÔØ�‰�fÐ1Ô2Ø×Ñ˜Ÿ™×/Ñ/°Õ2°1Õ5×@Ñ@À$ÖGr\   c                ó0  a € \        S P                  RR7      p\        P                  ! S P                  VR7      pV 3R lVn        VP                  RR4       S P                  S P                  P                  ^ ,          ^ ,          P                  R4       R# )ag  
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©ru  r  c                 ó   <€ S# r~   rb   r  s   *€rY   rŠ   Ú/AgentTests.test_nonPersistent.<locals>.<lambda>ç  r  r\   r×  r  Nr  r  s   f  rY   Útest_nonPersistentÚAgentTests.test_nonPersistentÚ  sj   ø€ ô " $§,¡,¸5ÔAˆÜ—’˜TŸ\™\°Ô5ˆÜ/ˆÔØ�‰�fÐ1Ô2Ø×Ñ˜Ÿ™×/Ñ/°Õ2°1Õ5×@Ñ@À%ÖHr\   c                ó¶  a a€ \        4       o ! VV 3R lR\        P                  4      p ! VV 3R lR4      pV! 4       pV! S P                  VR7      pS P	                  W4P
                  4       \        P                  ! 4       pVP                  RR4       \        4       pVP                  RR	WeR
7       S P                  VP
                  P                  R4       R# )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                  ó&   <€ ] tR tRtV V3R ltRtR# )Ú:AgentTests.test_connectUsesConnectionPool.<locals>.MyAgentió  c                	ón   <€ SP                  VP                  VP                  VP                  3R4       S# )rÑ  ©rÑ  ó   foorX  )r©   rm  rn  ro  )Úthisr  r  rX   s   &&€€rY   r"  ÚGAgentTests.test_connectUsesConnectionPool.<locals>.MyAgent._getEndpointô  s1   ø€ Ø× Ñ Ø—Z‘Z §¡¨3¯8©8Ð4Ð6Kôð  �r\   rb   N)r]   r^   r_   r`   r"  ra   ©r  rX   s   €€rY   ÚMyAgentr*  ó  s   ø† ÷ ò  r\   r1  c                  ó.   <€ ] tR tRtRtRtV V3R ltRtR# )Ú<AgentTests.test_connectUsesConnectionPool.<locals>.DummyPooliú  Fc                	ó–   <€ R V n         SP                  VS4       SP                  VR4       \        P                  ! \	        4       4      # )Tr,  )Ú	connectedr©   r   r   rd   ©r.  r‚  Úepr  rX   s   &&&€€rY   rN  ÚJAgentTests.test_connectUsesConnectionPool.<locals>.DummyPool.getConnectionþ  s@   ø€ Ø!%�”Ø× Ñ   XÔ.ð × Ñ  Ð&;Ô<Ü—}’}Ô%5Ó%7Ó8Ð8r\   rb   N©r]   r^   r_   r`   r5  ru  rN  ra   r0  s   €€rY   Ú	DummyPoolr3  ú  s   ø† ØˆIØˆJ÷9ò 9r\   r:  r  ó   hostr-  r×  ó   http://foo/)ÚbodyProducerrî  TN)r,  r/   r!  r#  rz  r  r1   rB   ÚaddRawHeaderÚobjectrw   r©   r5  )rX   r1  r:  r@  r$  rî  r=  r  s   f      @rY   Útest_connectUsesConnectionPoolÚ)AgentTests.test_connectUsesConnectionPoolë  s¯   ù€ ô !“?ˆ÷	 ð 	 ”f—l‘lô 	 ÷
	9õ 
	9ñ ‹{ˆÙ˜Ÿ™¨4Ô0ˆØ×Ñ˜T§;¡;Ô/ä×&Ò&Ó(ˆØ×Ñ˜W fÔ-Ü“xˆØ�‰Ø�N°ð 	ô 	
ð 	×Ñ˜Ÿ™×.Ñ.°Ö5r\   c                ó^   € V P                  \        V P                  P                  RR4       R# )zR
L{Agent.request} raises L{TypeError} when the C{method} argument isn't
L{bytes}.
ÚGETó   http://foo.example/N©ÚassertRaisesÚ	TypeErrorr$  rw   rr   s   &rY   Útest_nonBytesMethodÚAgentTests.test_nonBytesMethod  ó#   € ð
 	×Ñœ) T§Z¡Z×%7Ñ%7¸Ð@VÖWr\   c                ób   € V P                  V P                  P                  RR4      \        4      # )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$  rw   rA   rr   s   &rY   Útest_unsupportedSchemeÚ!AgentTests.test_unsupportedScheme  s/   € ð ×!Ñ!Ø�J‰J×Ñ˜vÐ'BÓCÔEWó
ð 	
r\   c                óB  € V P                   P                  RR4      pV P                  P                  P	                  4       R,          w  r#pVP                  R\        \        4       4      4       V P                  P                  ^
4       V P                  V\        4       R# )zk
The L{Deferred} returned by L{Agent.request} fires with a L{Failure} if
the TCP connection attempt fails.
r×  r<  ºNé   NN)
r$  rw   r#  r   r½   ÚclientConnectionFailedr)   r   r  rÕ   )rX   rx   rn  ro  r  s   &    rY   Útest_connectionFailedÚ AgentTests.test_connectionFailed#  sx   € ð
 —‘×#Ñ# F¨NÓ;ˆà"Ÿl™l×5Ñ5×9Ñ9Ó;¸BÕ?Ñˆ�GØ×&Ñ& t¬WÔ5KÓ5MÓ-NÔOØ�‰×Ñ˜RÔ à×Ñ˜VÔ%;Ö<r\   c                ó  € RpRpV P                   P                  \        P                  ! RW3,          4      4      pV P	                  VP
                  R4       V P	                  VP                  V4       V P                  V\        4       R# )zW
L{Agent._getEndpoint} return a C{HostnameEndpoint} when passed a scheme
of C{'http'}.
rW  éÒ  s   http://%b:%dr÷   N)	r$  r"  r9   Ú	fromBytesr©   Ú	_hostTextÚ_portrF  r   )rX   ÚexpectedHostÚexpectedPortr  s   &   rY   Útest_connectHTTPÚAgentTests.test_connectHTTP0  ss   € ð
 &ˆØˆØ—:‘:×*Ñ*Ü�MŠM˜/¨\Ð,HÕHÓIó
ˆð 	×Ñ˜×+Ñ+¨]Ô;Ø×Ñ˜Ÿ™¨Ô6Ø×Ñ˜hÔ(8Ö9r\   c                ó¤  € \         P                  ! R4      pRP                  4       Vn        V P	                  \
        4      ;_uu_ 4       pV P                  P                  V4       RRR4       V P                  XP                  P                  ^ ,          RP                  \        VP                  4      R7      4       R#   + '       g   i     Lb; i)zd
L{Agent._getEndpoint} when given a non-ASCII decodable URI will raise a
L{ValueError} saying such.
s   http://example.com:80u   â˜ƒ.comNzaThe host of the provided URI ({reprout}) contains non-ASCII octets, it should be ASCII decodable.)Úreprout)r9   rW  Úencodern  rF  Ú
ValueErrorr$  r"  r©   Ú	exceptionr  rj   r  )rX   r  Úes   &  rY   Útest_nonDecodableURIÚAgentTests.test_nonDecodableURI>  s“   € ô
 �mŠmÐ4Ó5ˆØ×&Ñ&Ó(ˆŒà×Ñœz×*Ô*¨aØ�J‰J×#Ñ# CÔ(÷ +ð 	×ÑØ�K‰K×Ñ˜QÕð÷ ‰fœT #§(¡(›^ˆfÓ,ö	
÷ +×*ús   Á	B?Â?C	c                ó  a € V 3R lS P                   n        S P                   P                  RR4       S P                  P                  P                  4       w  rS P                  VP                  P                  R4      R.4       R# )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# r~   rb   r  s   *€rY   rŠ   Ú.AgentTests.test_hostProvided.<locals>.<lambda>X  ó   ø€ ±r\   r×  ó   http://example.com/foo?barr;  rW  N©	r$  r"  rw   r  rp   r½   r©   rî  rï  ©rX   ÚreqÚress   f  rY   Útest_hostProvidedÚAgentTests.test_hostProvidedR  sb   ø€ ô #5ˆ�
‰
ÔØ�
‰
×Ñ˜6Ð#@ÔAà—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°7Ó;¸nÐ=MÖNr\   c                ó  a € V 3R lS P                   n        S P                   P                  RR4       S P                  P                  P                  4       w  rS P                  VP                  P                  R4      R.4       R# )zy
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# r~   rb   r  s   *€rY   rŠ   Ú3AgentTests.test_hostIPv6Bracketed.<locals>.<lambda>c  ri  r\   r×  s   http://[::1]/r;  s   [::1]Nrk  rl  s   f  rY   Útest_hostIPv6BracketedÚ!AgentTests.test_hostIPv6Bracketed^  sa   ø€ ô
 #5ˆ�
‰
ÔØ�
‰
×Ñ˜6Ð#3Ô4à—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°7Ó;¸h¸ZÖHr\   c                óH  a € \         P                  ! RR.RR./4      pV 3R lS P                  n        S P                  P	                  RRV4       S P
                  P                  P                  4       w  r#S P                  VP                  P                  R4      R.4       R# )	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.
r-  ó   barr;  s   quuxc                 ó   <€ S# r~   rb   r  s   *€rY   rŠ   Ú.AgentTests.test_hostOverride.<locals>.<lambda>p  ri  r\   r×  rj  N)r1   rB   r$  r"  rw   r  rp   r½   r©   rî  rï  )rX   rî  rm  rn  s   f   rY   Útest_hostOverrideÚAgentTests.test_hostOverridei  s€   ø€ ô ×&Ò&¨°°¸'ÀGÀ9Ð'MÓNˆÜ"4ˆ�
‰
ÔØ�
‰
×Ñ˜6Ð#@À'ÔJà—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°7Ó;¸g¸YÖGr\   c                óB  a € \         P                  ! 4       pV 3R lS P                  n        S P                  P	                  RRV4       S P
                  pS P                  \        VP                  4      ^4       S P                  V\         P                  ! 4       4       R# )zw
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# r~   rb   r  s   *€rY   rŠ   Ú3AgentTests.test_headersUnmodified.<locals>.<lambda>|  ri  r\   r×  ó   http://example.com/fooN)	r1   rB   r$  r"  rw   r  r©   r¯   rp   )rX   rî  r  s   f  rY   Útest_headersUnmodifiedÚ!AgentTests.test_headersUnmodifiedv  su   ø€ ô
 ×&Ò&Ó(ˆÜ"4ˆ�
‰
ÔØ�
‰
×Ñ˜6Ð#<¸gÔFà—=‘=ˆð 	×Ñœ˜X×.Ñ.Ó/°Ô3à×Ñ˜¤,×"6Ò"6Ó"8Ö9r\   c                ó`   € V P                  V P                  P                  RR^P4      R4       R# )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Ñ  rW  N©r©   r$  Ú_computeHostValuerr   s   &rY   Útest_hostValueStandardHTTPÚ%AgentTests.test_hostValueStandardHTTP†  s*   € ð 	×ÑØ�J‰J×(Ñ(¨°.À"ÓEÀ~ö	
r\   c                ó`   € V P                  V P                  P                  RRR4      R4       R# )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Ñ  rW  é1Ô  ó   example.com:54321Nrƒ  rr   s   &rY   Útest_hostValueNonStandardHTTPÚ(AgentTests.test_hostValueNonStandardHTTP�  s+   € ð 	×ÑØ�J‰J×(Ñ(¨°.À%ÓHØ ö	
r\   c                ó`   € V P                  V P                  P                  RRR4      R4       R# )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.
ó   httpsrW  rs  Nrƒ  rr   s   &rY   Útest_hostValueStandardHTTPSÚ&AgentTests.test_hostValueStandardHTTPS›  s*   € ð 	×ÑØ�J‰J×(Ñ(¨°>À3ÓGÈö	
r\   c                ó`   € V P                  V P                  P                  RRR4      R4       R# )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{":"}.
r�  rW  rˆ  r‰  Nrƒ  rr   s   &rY   Útest_hostValueNonStandardHTTPSÚ)AgentTests.test_hostValueNonStandardHTTPS¥  s+   € ð 	×ÑØ�J‰J×(Ñ(¨°>À5ÓIØ ö	
r\   c           	     óŒ  a € V 3R lS P                   n        \        P                  ! RR./4      p\	        4       pS P                   P                  RRW4       S P                  pS P                  \        VP                  4      ^4       VP                  P                  4       w  rES P                  V\        4       S P                  VP                  R4       S P                  VP                  R4       S P                  VP                  \        P                  ! RR.RR./4      4       S P!                  VP"                  V4       R	# )
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# r~   rb   r  s   *€rY   rŠ   Ú)AgentTests.test_request.<locals>.<lambda>¸  ri  r\   r-  rw  r×  ó   http://example.com:1234/foo?bars   /foo?barr;  ó   example.com:1234N)r$  r"  r1   rB   r?  rw   r  r©   r¯   rp   r½   rF  r>   Úmethodr  rî  rz  r=  )rX   rî  Úbodyr  rm  rn  s   f     rY   Útest_requestÚAgentTests.test_request°  s  ø€ ô #5ˆ�
‰
Ôä×&Ò&¨°°Ð'9Ó:ˆô ‹xˆØ�
‰
×Ñ˜6Ð#EÀwÔUà—=‘=ˆð 	×Ñœ˜X×.Ñ.Ó/°Ô3Ø×$Ñ$×(Ñ(Ó*‰ˆØ×Ñ˜c¤7Ô+Ø×Ñ˜Ÿ™ VÔ,Ø×Ñ˜Ÿ™ +Ô.Ø×ÑØ�K‰KÜ× Ò  &¨6¨(°GÐ>QÐ=RÐ!SÓTô	
ð 	×Ñ˜S×-Ñ-¨tÖ4r\   c                óè   € \         P                  ! V P                  ^R7      pVP                  RR4       V P                  P                  P                  4       ^,          pV P                  ^V4       R# )zf
L{Agent} takes a C{connectTimeout} argument which is forwarded to the
following C{connectTCP} agent.
©ÚconnectTimeoutr×  r<  N©r/   r!  r#  rw   r   r½   r©   ©rX   r$  rö  s   &  rY   Útest_connectTimeoutÚAgentTests.test_connectTimeoutÎ  sS   € ô
 —’˜TŸ\™\¸!Ô<ˆØ�‰�f˜nÔ-Ø—,‘,×)Ñ)×-Ñ-Ó/°Õ2ˆØ×Ñ˜˜GÖ$r\   ú&SSL not present, cannot run SSL tests.c                óè   € \         P                  ! V P                  ^R7      pVP                  RR4       V P                  P                  P                  4       ^,          pV P                  ^V4       R# )ze
L{Agent} takes a C{connectTimeout} argument which is forwarded to the
following C{connectTCP} call.
r�  r×  ó   https://foo/NrŸ  r   s   &  rY   Útest_connectTimeoutHTTPSÚ#AgentTests.test_connectTimeoutHTTPSØ  sS   € ô —’˜TŸ\™\¸!Ô<ˆØ�‰�f˜oÔ.Ø—,‘,×)Ñ)×-Ñ-Ó/°Õ2ˆØ×Ñ˜˜GÖ$r\   c                óè   € \         P                  ! V P                  RR7      pVP                  RR4       V P                  P                  P                  4       ^,          pV P                  RV4       R# )zb
L{Agent} takes a C{bindAddress} argument which is forwarded to the
following C{connectTCP} call.
ú192.168.0.1©ÚbindAddressr×  r<  N©r©  é    rŸ  ©rX   r$  Úaddresss   &  rY   Útest_bindAddressÚAgentTests.test_bindAddressã  sT   € ô
 —’˜TŸ\™\°}ÔEˆØ�‰�f˜nÔ-Ø—,‘,×)Ñ)×-Ñ-Ó/°Õ2ˆØ×ÑÐ+¨WÖ5r\   c                óè   € \         P                  ! V P                  RR7      pVP                  RR4       V P                  P                  P                  4       ^,          pV P                  RV4       R# )zb
L{Agent} takes a C{bindAddress} argument which is forwarded to the
following C{connectSSL} call.
r©  rª  r×  r¥  Nr¬  rŸ  r®  s   &  rY   Útest_bindAddressSSLÚAgentTests.test_bindAddressSSLí  sT   € ô —’˜TŸ\™\°}ÔEˆØ�‰�f˜oÔ.Ø—,‘,×)Ñ)×-Ñ-Ó/°Õ2ˆØ×ÑÐ+¨WÖ5r\   c                ó¼  € RpV P                  V P                  4      pVP                  RV4      pV P                  \	        V P
                  P                  4      ^4       V P
                  P                  P                  4       w  rEV P                  V\        4       \        P                  P                  R^ÈR\        / 4      RV4      pVP                  V4       V P                  V4      pV P                  VP                  P                   VP                  P"                  VP                  P$                  3VP                   VP"                  VP$                  34       R# )zj
L{Response}s returned by L{Agent.request} have a reference to the
L{Request} that was originally issued.
ó   http://example.com/r×  ó   OKN©ó   HTTPrã  rã  )r%  r#  rw   r©   r¯   r  rp   r½   rF  r>   r/   r6   Ú
_constructrB   Úcallbackr¿   r˜  ÚabsoluteURIrî  )rX   r  r$  rQ  rm  rn  Úresprÿ  s   &       rY   Útest_responseIncludesRequestÚ'AgentTests.test_responseIncludesRequestø  s  € ð
 %ˆØ×-Ñ-¨d¯l©lÓ;ˆØ�M‰M˜& #Ó&ˆð 	×Ñœ˜TŸ]™]×3Ñ3Ó4°aÔ8Ø—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜c¤7Ô+ä�‰×)Ñ)Ø˜S %¬°«°d¸Có
ˆð 	�‰�TÔà×'Ñ'¨Ó*ˆØ×Ñà× Ñ ×'Ñ'Ø× Ñ ×,Ñ,Ø× Ñ ×(Ñ(ðð
 �Z‰Z˜Ÿ™¨#¯+©+Ð6ö	
r\   c                ór  € RpV P                  V P                  4      pVP                  RV4       V P                  \	        V P
                  P                  4      ^4       V P
                  P                  P                  4       w  r4V P                  V\        4       V P                  VP                  V4       R# )z<
L{Request.absoluteURI} is the absolute URI of the request.
s$   http://example.com/foo;1234?bar#fragr×  N)r%  r#  rw   r©   r¯   r  rp   r½   rF  r>   r¼  )rX   r  r$  rm  rn  s   &    rY   Útest_requestAbsoluteURIÚ"AgentTests.test_requestAbsoluteURI  sŠ   € ð 6ˆØ×-Ñ-¨d¯l©lÓ;ˆØ�‰�f˜cÔ"ð 	×Ñœ˜TŸ]™]×3Ñ3Ó4°aÔ8Ø—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜c¤7Ô+Ø×Ñ˜Ÿ™¨#Ö.r\   c                ó€   € \         P                  ! RR\        4       R4      pV P                  VP                  R4       R# )zH
L{Request.absoluteURI} is L{None} if L{Request._parsedURI} is L{None}.
ó   FOOrÙ  N)r/   r>   rB   rz  r¼  )rX   rw   s   & rY   Útest_requestMissingAbsoluteURIÚ)AgentTests.test_requestMissingAbsoluteURI#  s0   € ô —.’. ¨¬w«y¸$Ó?ˆØ×Ñ˜W×0Ñ0°$Ö7r\   c                óÎ   € \        4       p\        P                  P                  RVR7      p\        P
                  ! R4      pVP                  V4      pV P                  VR4       R# )zd
L{Agent.usingEndpointFactory} creates an L{Agent} that uses the given
factory to create endpoints.
N)ÚendpointFactoryr¶  )rÑ  rW  rX  )r  r/   r!  ÚusingEndpointFactoryr9   rW  r"  r©   )rX   r  r$  r  ÚreturnedEndpoints   &    rY   Útest_endpointFactoryÚAgentTests.test_endpointFactory*  sW   € ô
 &Ó'ˆÜ—‘×1Ñ1°$ÈÐ1ÓPˆÜ�mŠmÐ2Ó3ˆØ ×-Ñ-¨cÓ2ÐØ×ÑÐ)Ð+HÖIr\   c                ó
  € \         P                  P                  V P                  \	        4       4      pVP
                  pV P                  VP                  VP                  VP                  3\        RVP                  34       R# )zy
If no pool is passed in to L{Agent.usingEndpointFactory}, a default
pool is constructed with no persistent connections.
FN)r/   r!  rÉ  r#  r  r  r©   Ú	__class__ru  r  r=   )rX   r$  r@  s   &  rY   Útest_endpointFactoryDefaultPoolÚ*AgentTests.test_endpointFactoryDefaultPool5  s]   € ô
 —‘×1Ñ1°$·,±,Ô@SÓ@UÓVˆØ�{‰{ˆØ×ÑØ�^‰^˜TŸ_™_¨d¯m©mÐ<Ü ¨¯©Ð7ö	
r\   c                ó¶   € \        4       p\        P                  P                  V P                  \        4       V4      pV P                  WP                  4       R# )zZ
If a pool is passed in to L{Agent.usingEndpointFactory} it is used as
the L{Agent} pool.
N)r?  r/   r!  rÉ  r#  r  ÚassertIsr  r  s   &  rY   Útest_endpointFactoryPoolÚ#AgentTests.test_endpointFactoryPoolA  s@   € ô
 ‹xˆÜ—‘×1Ñ1Ø�L‰LÔ-Ó/°ó
ˆð 	�‰�dŸK™KÖ(r\   ©r$  r#  N)&r]   r^   r_   r`   rz   r¼  r’   r  r   r&  r@  rH  rM  rS  r\  rd  ro  rt  rz  r€  r…  rŠ  rŽ  r‘  rš  r¡  r   rå  r¦  r°  r³  r¾  rÁ  rÅ  rË  rÏ  rÓ  ra   rb   r\   rY   r	  r	  ±  sÚ   † ñò*ò&òCò
HòIò"%6òNXò
ò=ò:ò
ò(
Oò	IòHò:ò 
ò	
ò
ò	
ò5ò<%ñ �
ŒNÐDÓEñ%ó Fð%ò6ñ �
ŒNÐDÓEñ6ó Fð6ò
ò:/ò8ò	Jò

ö	)r\   r	  c                  ó    € ] tR tRtRtR tRtR# )ÚAgentMethodInjectionTestsiM  z6
Test L{client.Agent} against HTTP method injections.
c                óˆ   € \         P                  ! V P                  4       4      pRpVP                  W\	        4       R4       R# )ú^
Attempt a request with the provided method.

@param method: see L{MethodInjectionTestsMixin}
ó   http://twisted.invalidN©r/   r!  r  rw   rB   )rX   r˜  r$  r  s   &&  rY   Ú!attemptRequestWithMaliciousMethodÚ;AgentMethodInjectionTests.attemptRequestWithMaliciousMethodV  s2   € ô —’˜T×/Ñ/Ó1Ó2ˆØ'ˆØ�‰�f¤7£9¨dÖ3r\   rb   N©r]   r^   r_   r`   rz   rÜ  ra   rb   r\   rY   r×  r×  M  ó   † ñ
ö4r\   r×  c                  ó    € ] tR tRtRtR tRtR# )ÚAgentURIInjectionTestsia  z.
Test L{client.Agent} against URI injections.
c                óˆ   € \         P                  ! V P                  4       4      pRpVP                  W1\	        4       R4       R# )zX
Attempt a request with the provided method.

@param uri: see L{URIInjectionTestsMixin}
r×  NrÛ  )rX   r  r$  r˜  s   &&  rY   ÚattemptRequestWithMaliciousURIÚ5AgentURIInjectionTests.attemptRequestWithMaliciousURIj  s2   € ô —’˜T×/Ñ/Ó1Ó2ˆØˆØ�‰�f¤7£9¨dÖ3r\   rb   N©r]   r^   r_   r`   rz   rã  ra   rb   r\   rY   rá  rá  a  rß  r\   rá  r£  c                  ó`   a € ] tR tRtRtRR ltR tR tR tR t	R t
R	 tR
 tV 3R ltRtV ;t# )ÚAgentHTTPSTestsiu  z8
Tests for the new HTTP client API that depends on SSL.
c                ó    € \         P                  ! V P                  4       4      P                  \        P
                  ! RW3,          4      4      # )aA  
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/)r/   r!  r  r"  r9   rW  )rX   rn  ro  s   &&&rY   ÚmakeEndpointÚAgentHTTPSTests.makeEndpoint{  s=   € ô �|Š|˜D×.Ñ.Ó0Ó1×>Ñ>Ü�MŠMÐ+¨t¨lÕ:Ó;ó
ð 	
r\   c                ó”   € ^ RI Hp V P                  4       pV P                  W!4       V P                  VP                  \
        4       R# )zZ
L{Agent._getEndpoint} return a L{SSL4ClientEndpoint} when passed a
scheme of C{'https'}.
)Ú_WrapperEndpointN)Útwisted.internet.endpointsrì  ré  rF  Ú_wrappedEndpointr   )rX   rì  r  s   &  rY   Útest_endpointTypeÚ!AgentHTTPSTests.test_endpointType�  s;   € õ
 	@à×$Ñ$Ó&ˆØ×Ñ˜hÔ9Ø×Ñ˜h×7Ñ7Ô9IÖJr\   c                óv   € V P                  RR7      pV P                  VP                  P                  R4       R# )z0
If a host is passed, the endpoint respects it.
rW  )rn  r÷   N)ré  r©   rî  rX  )rX   r  s   & rY   Útest_hostArgumentIsRespectedÚ,AgentHTTPSTests.test_hostArgumentIsRespected˜  s3   € ð ×$Ñ$¨.Ð$Ó9ˆØ×Ñ˜×2Ñ2×<Ñ<¸mÖLr\   c                óz   € RpV P                  VR7      pV P                  VP                  P                  V4       R# )z0
If a port is passed, the endpoint respects it.
éá  )ro  N)ré  r©   rî  rY  )rX   r[  r  s   &  rY   Útest_portArgumentIsRespectedÚ,AgentHTTPSTests.test_portArgumentIsRespectedŸ  s8   € ð ˆØ×$Ñ$¨,Ð$Ó7ˆØ×Ñ˜×2Ñ2×8Ñ8¸,ÖGr\   c                óÀ   € V P                  4       pVP                  R4      P                  pV P                  V\        4       V P                  VP                  R4       R# )zI
L{Agent} wraps its connection creator creator and uses modern TLS APIs.
Nr÷   )ré  Ú_wrapperFactoryÚ_connectionCreatorrF  rL   r©   Ú	_hostname)rX   r  ÚcontextFactorys   &  rY   Útest_contextFactoryTypeÚ'AgentHTTPSTests.test_contextFactoryType§  sO   € ð ×$Ñ$Ó&ˆØ!×1Ñ1°$Ó7×JÑJˆØ×Ñ˜nÔ.>Ô?Ø×Ñ˜×1Ñ1°=ÖAr\   c                ó@  aaa€ RpRp ! R R4      p. o\        \        4       ! VV3R lR4      4       oV! 4       o\        \        4       ! V3R lR4      4       pV! 4       pV P                  4       p\        P
                  ! We4      pVP                  \        P                  ! R	W3,          4      4      pVP                  \        P                  ! \        4      4       VP                  R,          ^,          p	V	P                  R
4      p
V
P                  \!        4       4       S^ ,          ^ ,          pV P#                  V\$        4       V P'                  S^ ,          R,          W34       V P)                  SP*                  4       V P)                  SP,                  4       R
# )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                  ó*   € ] tR tRtRtRtR tR tRtR# )ÚVAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughConnectioni¼  Fc                ó   € RV n         R# )z+
The handshake started.  Record that fact.
TN)ÚhandshakeStartedrr   s   &rY   Údo_handshakeÚcAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughConnection.do_handshakeÀ  s   € ð )-�Ö%r\   c                ó   € RV n         R# )z,
The connection started.  Record that fact.
TN)ÚconnectStaterr   s   &rY   Úset_connect_stateÚhAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughConnection.set_connect_stateÆ  s   € ð %)�Ö!r\   )r  r  N)	r]   r^   r_   r`   r  r  r  r  ra   rb   r\   rY   ÚJustEnoughConnectionr  ¼  s   † Ø$ÐØ ˆLò-ö)r\   r
  c                  ó,   <€ ] tR tRtR tV V3R ltRtR# )ÚSAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughCreatoriÎ  c                	ó   € Wn         W n        R # r~   ©Úhostnamero  )rX   r  ro  s   &&&rY   rs   Ú\AgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughCreator.__init__Ð  s   € Ø (”Ø –	r\   c                óV   <€ SP                  WP                  V P                  34       S# )z¡
Implement L{IOpenSSLClientConnectionCreator}.

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

@return: C{expectedConnection}
)rv   r  ro  )rX   ÚtlsProtocolÚcontextArgsÚexpectedConnections   &&€€rY   ÚclientConnectionForTLSÚjAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.JustEnoughCreator.clientConnectionForTLSÔ  s&   ø€ ð ×"Ñ" K·±ÀÇ	Á	Ð#JÔKØ)Ð)r\   r  N)r]   r^   r_   r`   rs   r  ra   )r  r  s   €€rY   ÚJustEnoughCreatorr  Î  s   ø† ò!÷
*ò 
*r\   r  c                  ó$   <€ ] tR tRtV 3R ltRtR# )Ú_AgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.StubBrowserLikePolicyForHTTPSiâ  c                ó   <€ S! W4      # )zí
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}
rb   )rX   r  ro  r  s   &&&€rY   ÚcreatorForNetlocÚpAgentHTTPSTests.test_connectHTTPSCustomConnectionCreator.<locals>.StubBrowserLikePolicyForHTTPS.creatorForNetlocä  s   ø€ ñ )¨Ó8Ð8r\   rb   N©r]   r^   r_   r`   r  ra   )r  s   €rY   ÚStubBrowserLikePolicyForHTTPSr  â  s   ø† ÷9ñ 9r\   r  s   https://%b:%dNrâ  éÿÿÿÿ)r   r   rG   r  r/   r!  r"  r9   rW  r  r   rç  r   r   r  r(  r%   rF  rQ   r©   r•   r  r  )rX   rZ  r[  r
  r  ÚexpectedCreatorCreatorr#  r$  r  Ú
tlsFactoryr  rO   r  r  r  s   &           @@@rY   Ú(test_connectHTTPSCustomConnectionCreatorÚ8AgentHTTPSTests.test_connectHTTPSCustomConnectionCreator°  sb  ú€ ð &ˆØˆ÷	)ñ 	)ð  ˆä	Ô4Ó	5÷	*ô 	*ó 
6ð	*ñ" 2Ó3Ðä	”_Ó	%÷	9ó 	9ó 
&ð	9ñ  "?Ó!@ÐØ×$Ñ$Ó&ˆÜ—’˜WÓ=ˆØ×%Ñ%Ü�MŠMÐ*¨lÐ-IÕIÓJó
ˆð 	×Ñœ×,Ò,¬XÓ6Ô7Ø×'Ñ'¨Õ+¨AÕ.ˆ
Ø ×.Ñ.¨tÓ4ˆØ×"Ñ"¤?Ó#4Ô5Ø˜!�n˜QÕˆØ×Ñ˜cÔ#7Ô8Ø×Ñ˜ Q�¨Õ+¨lÐ-IÔJØ�‰Ð*×;Ñ;Ô<Ø�‰Ð*×7Ñ7Ö8r\   c                óè   € R pV! 4        V P                  V.4      pV P                  \        V4      ^4       Vw  pV P                  VR,          \        4       V P                  VR,          R4       R# )a   
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                 óV   € \         P                  ! \        \        4       4      R 4       R# )z does-not-provide-IPolicyForHTTPSN)r/   r!  r!   r$   rb   r\   rY   ÚwarnMeÚ9AgentHTTPSTests.test_deprecatedDuckPolicy.<locals>.warnMe  s   € Ü�LŠLÜ-Ô.@Ó.BÓCØ2ö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)rX   r&  ÚwarningsÚwarnings   &   rY   Útest_deprecatedDuckPolicyÚ)AgentHTTPSTests.test_deprecatedDuckPolicy  sm   € ò	ñ 	ŒØ×%Ñ% v hÓ/ˆØ×Ñœ˜X›¨Ô*Ø‰	ˆØ×Ñ˜ Õ,Ô.@ÔAØ×ÑØ�IÕðOö	
r\   c                ó  € \        4       p\        VR7      pVP                  RR4      pV P                  VP                  4       VP                  R4      pV P                  VP                  VP                  4       4       R# )z�
L{BrowserLikePolicyForHTTPS.creatorForNetloc} returns an
L{IOpenSSLClientConnectionCreator} provider which will add certificates
from the given trust root.
©Ú	trustRoots   thingyrõ  N)	rS   r:   r  r•   rV   r  rÒ  rW   Úget_context)rX   r2  ÚpolicyÚcreatorÚ
connections   &    rY   Útest_alternateTrustRootÚ'AgentHTTPSTests.test_alternateTrustRoot  sg   € ô +Ó,ˆ	Ü*°YÔ?ˆØ×)Ñ)¨)°TÓ:ˆØ�‰˜	×(Ñ(Ô)Ø×3Ñ3°DÓ9ˆ
Ø�‰�i×'Ñ'¨×)?Ñ)?Ó)AÖBr\   c           	     óª   <aa€ VP                  R4      p\        VP                  R4      4      w  ooV3R lpV3R lp\        S	V `  VVVVVRR7       R# )z3
Wrap L{AgentTestsMixin.integrationTest} with TLS.
s   []Úasciic                ó:   <€ \        SP                  4       R W4      # )F)rP   Úoptions)ÚserverFactoryr#  rÎ  s   &&€rY   ÚtlsifyÚ/AgentHTTPSTests.integrationTest.<locals>.tlsify4  s   ø€ Ü& v§~¡~Ó'7¸ÀÓWÐWr\   c                ó„   <€ ^ RI Hp ^ RIHp V! V4       ! V3R lR4      4       p\        P
                  ! W! 4       R7      # )r­  r   )rG   c                  ó$   <€ ] tR tRtV 3R ltRtR# )ÚAAgentHTTPSTests.integrationTest.<locals>.tlsagent.<locals>.Policyi<  c                	ó<   <€ \        VP                  R 4      SR7      # )r:  r1  )rN   Údecode)rX   r  ro  Ú	authoritys   &&&€rY   r  ÚRAgentHTTPSTests.integrationTest.<locals>.tlsagent.<locals>.Policy.creatorForNetloc>  s   ø€ Ü.Ø Ÿ™¨Ó0¸Iôð r\   rb   Nr  )rE  s   €rY   ÚPolicyrB  <  s   ø† ÷ñ r\   rG  )rü  )Úzope.interfacer   Útwisted.web.iwebrG   r/   r!  )r#  r   rG   rG  rE  s   &   €rY   ÚtlsagentÚ1AgentHTTPSTests.integrationTest.<locals>.tlsagent7  s:   ø€ Ý2å8á˜Ó)÷ó ó *ðô —<’< ¸»ÔAÐAr\   r�  )ró  rô  rm  N)Ústripr,   rD  ÚsuperrÁ  )
rX   rð  rñ  rò  ÚcertHostNamer>  rJ  rE  rÎ  rÎ  s
   &&&&   @@€rY   rÁ  ÚAgentHTTPSTests.integrationTest+  sb   ú€ ð  —~‘~ eÓ,ˆÜ=Ø×Ñ Ó(ó
Ñˆ	�6õ	Xõ	Bô ‰GÑ#ØØØØ$Ø$Øð $ö r\   rb   )rW  rs  )r]   r^   r_   r`   rz   ré  rï  rò  rö  rý  r"  r.  r7  rÁ  ra   Ú__classcell__)rÎ  s   @rY   rç  rç  u  sA   ø† ñô
ò$	KòMòHòBòQ9òf
ò6C÷#
ó #
r\   rç  c                  ó”   € ] tR tRtRtR tR t]! ]R4      R 4       t	]! ]'       * R4      R 4       t
]! ]'       * R4      R	 4       tR
tR# )ÚWebClientContextFactoryTestsiQ  zf
Tests for the context factory wrapper for web clients
L{twisted.web.client.WebClientContextFactory}.
c                óh   € ^ RI Hp V P                  \        P                  .4      V n        Wn        R# )zE
Get WebClientContextFactory while quashing its deprecation warning.
)ÚWebClientContextFactoryN)Útwisted.web.clientrT  r*  rR  r’   ÚwarnedÚwebClientContextFactory)rX   rT  s   & rY   r’   Ú"WebClientContextFactoryTests.setUpW  s)   € õ 	?à×(Ñ(Ô*F×*LÑ*LÐ)MÓNˆŒØ'>Ö$r\   c                óD  € V P                  \        V P                  4      ^4       V P                  w  pV P                  VR,          \        4       V P                  VR,          \	        V P
                  \        R^^ ^ 4      \        R7      P                  RR4      4       R# )z`
L{twisted.web.client.WebClientContextFactory} is deprecated.  Importing
it displays a warning.
r(  r)  ÚTwisted)ÚreplacementÚ;Ú:N)	r©   r¯   rV  r+  r(   rW  r   r:   Úreplace)rX   r-  s   & rY   Útest_deprecatedÚ,WebClientContextFactoryTests.test_deprecated`  s„   € ð
 	×Ñœ˜TŸ[™[Ó)¨1Ô-Ø—K‘K‰	ˆØ×Ñ˜ Õ,Ô.@ÔAØ×ÑØ�IÕÜ'Ø×,Ñ,Ü˜	 2 q¨!Ó,Ü5ô÷ ‰W�S˜#Óö		
r\   zSSL Present.c                óf   € V P                  \        V P                  4       P                  RR4       R# )zT
If C{getContext} is called and SSL is not available, raise
L{NotImplementedError}.
rW  rs  N)rF  ÚNotImplementedErrorrW  Ú
getContextrr   s   &rY   Útest_missingSSLÚ,WebClientContextFactoryTests.test_missingSSLs  s-   € ð 	×ÑÜØ×(Ñ(Ó*×5Ñ5ØØö		
r\   r£  c                óš   € V P                  4       P                  RR4      pV P                  V\        P                  P
                  4       R# )zD
If SSL is present, C{getContext} returns a L{OpenSSL.SSL.Context}.
r÷   rs  N)rW  rc  rF  rK   ÚSSLÚContext)rX   Úctxs   & rY   Útest_returnsContextÚ0WebClientContextFactoryTests.test_returnsContext€  s7   € ð
 ×*Ñ*Ó,×7Ñ7¸ÀsÓKˆØ×Ñ˜c¤3§7¡7§?¡?Ö3r\   c                óž   € V P                  4       pVP                  RR4      pV P                  VP                  \        P
                  4       R# )zL
The L{CertificateOptions} has C{trustRoot} set to the default trust
roots.
r÷   rs  N)rW  Ú_getCertificateOptionsrF  r2  rK   ÚOpenSSLDefaultPaths)rX   ri  ÚcertificateOptionss   &  rY   Ú-test_setsTrustRootOnContextToDefaultTrustRootÚJWebClientContextFactoryTests.test_setsTrustRootOnContextToDefaultTrustRootˆ  sB   € ð ×*Ñ*Ó,ˆØ ×7Ñ7¸ÀsÓKÐØ×ÑÐ0×:Ñ:¼C×<SÑ<SÖTr\   )rV  rW  N)r]   r^   r_   r`   rz   r’   r_  r   rå  rd  rj  rp  ra   rb   r\   rY   rR  rR  Q  sl   † ñò
?ò
ñ& ˆJ˜Ó'ñ

ó (ð

ñ �
ŒNÐDÓEñ4ó Fð4ñ �
ŒNÐDÓEñUó FôUr\   rR  c                  óh   € ] tR tRtRtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tRtR# )ÚHTTPConnectionPoolRetryTestsi“  z˜
L{client.HTTPConnectionPool}, by using
L{client._RetryingHTTP11ClientProtocol}, supports retrying requests done
against previously cached connections.
c                ó¬  € \         P                  ! R4      p\         P                  ! RV4      pV P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       R4      4       R# )	z?
Only GET, HEAD, OPTIONS, TRACE, DELETE methods cause a retry.
Nr×  s   HEADs   OPTIONSs   TRACEs   DELETEó   POSTs   MYMETHOD)r/   r=   Ú_RetryingHTTP11ClientProtocolr•   Ú_shouldRetryr4   ÚassertFalse©rX   r@  r6  s   &  rY   Útest_onlyRetryIdempotentMethodsÚ<HTTPConnectionPoolRetryTests.test_onlyRetryIdempotentMethodsš  sý   € ô ×(Ò(¨Ó.ˆÜ×9Ò9¸$ÀÓEˆ
Ø�‰˜
×/Ñ/°¼Ó8HÈ$ÓOÔPØ�‰˜
×/Ñ/°¼Ó9IÈ4ÓPÔQØ�‰˜
×/Ñ/°
¼NÓ<LÈdÓSÔTØ�‰˜
×/Ñ/°¼.Ó:JÈDÓQÔRØ�‰˜
×/Ñ/°	¼>Ó;KÈTÓRÔSØ×Ñ˜×0Ñ0°¼.Ó:JÈDÓQÔRØ×Ñ˜×0Ñ0°¼nÓ>NÐPTÓUÖVr\   c                ó
  € \         P                  ! R4      p\         P                  ! RV4      pV P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        . 4      R4      4       V P                  VP	                  R\        . 4      R4      4       V P                  VP	                  R\        . 4      R4      4       V P                  VP	                  R\        4       R4      4       R# )zm
Only L{RequestNotSent}, L{RequestTransmissionFailed} and
L{ResponseNeverReceived} exceptions cause a retry.
Nr×  )r/   r=   rv  r•   rw  r4   r5   r8   rx  r7   r   ry  s   &  rY   Ú"test_onlyRetryIfNoResponseReceivedÚ?HTTPConnectionPoolRetryTests.test_onlyRetryIfNoResponseReceived«  sÖ   € ô
 ×(Ò(¨Ó.ˆÜ×9Ò9¸$ÀÓEˆ
Ø�‰˜
×/Ñ/°¼Ó8HÈ$ÓOÔPØ�‰Ø×#Ñ# FÔ,EÀbÓ,IÈ4ÓPô	
ð 	�‰Ø×#Ñ# FÔ,AÀ"Ó,EÀtÓLô	
ð 	×Ñ˜×0Ñ0°¼ÈÓ9KÈTÓRÔSØ×ÑØ×#Ñ# FÔ,BÓ,DÀdÓKö	
r\   c                óô   € \         P                  ! R4      p\         P                  ! RV4      p\        \	        \
        P                  ! 4       4      .4      pV P                  VP                  RVR4      4       R# )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×  )	r/   r=   rv  r8   r)   r   r   rx  rw  )rX   r@  r6  rb  s   &   rY   Ú!test_dontRetryIfFailedDueToCancelÚ>HTTPConnectionPoolRetryTests.test_dontRetryIfFailedDueToCancel¾  s^   € ô ×(Ò(¨Ó.ˆÜ×9Ò9¸$ÀÓEˆ
Ü)¬7´5×3GÒ3GÓ3IÓ+JÐ*KÓLˆ	Ø×Ñ˜×0Ñ0°¸ÀDÓIÖJr\   c                óÚ   € \         P                  ! R4      p\         P                  ! RV4      pV P                  VP	                  R\        \        \        4       4      .4      R4      4       R# )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×  )r/   r=   rv  r•   rw  r8   r)   Ú	Exceptionry  s   &  rY   Ú)test_retryIfFailedDueToNonCancelExceptionÚFHTTPConnectionPoolRetryTests.test_retryIfFailedDueToNonCancelExceptionÉ  sW   € ô ×(Ò(¨Ó.ˆÜ×9Ò9¸$ÀÓEˆ
Ø�‰Ø×#Ñ#ØÔ-¬w´y³{Ó/CÐ.DÓEÀtóö	
r\   c                ó  a a€ \         P                  ! \        4       4      p\        4       oSP	                  \        4       4       VP                  ^{S4       VP                  ^{\        4       4      pVV 3R lpVP                  V4      # )z™
If L{client.HTTPConnectionPool.getConnection} returns a previously
cached connection, it will get wrapped in a
L{client._RetryingHTTP11ClientProtocol}.
c                ó€   <€ SP                  V \        P                  4       SP                  V P                  S4       R # r~   )rF  r/   rv  rz  Ú_clientProtocol©r6  r  rX   s   &€€rY   rK  ÚTHTTPConnectionPoolRetryTests.test_wrappedOnPersistentReturned.<locals>.gotConnectionè  s/   ø€ Ø×!Ñ! *¬f×.RÑ.RÔSØ× Ñ  ×!;Ñ!;¸XÖFr\   )
r/   r=   r    rd   r(  r%   rY  rN  r,  rO  ©rX   r@  rQ  rK  r  s   f   @rY   Ú test_wrappedOnPersistentReturnedÚ=HTTPConnectionPoolRetryTests.test_wrappedOnPersistentReturned×  so   ù€ ô ×(Ò(¬«Ó1ˆô $Ó%ˆØ×Ñ¤Ó 1Ô2Ø×Ñ˜C Ô*ð ×Ñ˜s¤M£OÓ4ˆö	Gð �}‰}˜]Ó+Ð+r\   c                ó’   a € \         P                  ! R4      pVP                  ^{\        4       4      pV 3R lpVP	                  V4      # )zd
If L{client.HTTPConnectionPool.getConnection} returns a new
connection, it will be returned as is.
Nc                óH   <€ SP                  V P                  \        4       R # r~   )rz  rÎ  r2   )r6  rX   s   &€rY   rK  ÚPHTTPConnectionPoolRetryTests.test_notWrappedOnNewReturned.<locals>.gotConnectionö  s   ø€ ð × Ñ  ×!5Ñ!5Ô7KÖLr\   )r/   r=   rN  r,  rO  )rX   r@  rQ  rK  s   f   rY   Útest_notWrappedOnNewReturnedÚ9HTTPConnectionPoolRetryTests.test_notWrappedOnNewReturnedî  s@   ø€ ô
 ×(Ò(¨Ó.ˆØ×Ñ˜s¤M£OÓ4ˆõ	Mð
 �}‰}˜]Ó+Ð+r\   c                óö  a aaa	€ . o	V	3R lp\        4       o\        P                  ! RR\        4       SRR7      pV! 4        S	^ ,          p\        P                  ! WB4      pVV V3R lpWen        VP                  V4      pS P                  \        S	4      ^4       S P                  \        S	^ ,          P                  4      ^4       VP                  ^ ,          ^,          P                  \        4       4       VS	3# )z@
Fail a first request, possibly retrying depending on argument.
c                 óf   <€ \        4       p SP                  V 4       \        P                  ! V 4      # r~   )rd   rv   r   r   )r  Ú	protocolss    €rY   rg  Ú>HTTPConnectionPoolRetryTests.retryAttempt.<locals>.newProtocol  s(   ø€ Ü'Ó)ˆHØ×Ñ˜XÔ&Ü—=’= Ó*Ð*r\   rÄ  rÙ  Tr#  c                óˆ   <€ SP                  V R 4       SP                  VS4       SP                  V\        \        34       S# )rÄ  )r©   rz  rF  r4   r8   )Úmrc  Úbpr=  rX   ÚwillWeRetrys   &&&€€€rY   rw  Ú?HTTPConnectionPoolRetryTests.retryAttempt.<locals>._shouldRetry  s?   ø€ Ø×Ñ˜Q Ô'Ø× Ñ   \Ô2Ø×!Ñ! !¤nÔ6KÐ%LÔMØÐr\   )r?  r/   r>   rB   rv  rw  rw   r©   r¯   rp   Úerrbackr4   )
rX   rš  rg  rw   r  Úretrierrw  rQ  r=  r•  s
   ff      @@rY   ÚretryAttemptÚ)HTTPConnectionPoolRetryTests.retryAttemptý  sÌ   û€ ð ˆ	õ	+ô
 “xˆÜ—.’. ¨¬w«y¸,ÐSWÔXˆÙŒØ˜Q•<ˆÜ×6Ò6°xÓMˆ÷	ð  ,Ôà�O‰O˜GÓ$ˆð 	×Ñœ˜Y›¨Ô+Ø×Ñœ˜Y q�\×2Ñ2Ó3°QÔ7ð 	×Ñ˜!Õ˜QÕ×'Ñ'¬Ó(8Ô9Ø�)ˆ|Ðr\   c                ó
  € V P                  R4      w  rV P                  \        V4      ^4       \        4       pV^,          P                  ^ ,          ^,          P                  V4       VP                  V P                  V4      # )z|
L{client._RetryingHTTP11ClientProtocol} retries when
L{client._RetryingHTTP11ClientProtocol._shouldRetry} returns C{True}.
T)rž  r©   r¯   r?  rp   r»  rO  rz  )rX   rQ  r•  rÿ  s   &   rY   Ú"test_retryIfShouldRetryReturnsTrueÚ?HTTPConnectionPoolRetryTests.test_retryIfShouldRetryReturnsTrue   sj   € ð
 ×(Ñ(¨Ó.‰ˆà×Ñœ˜Y›¨Ô+Ü“8ˆØ�!�×Ñ˜aÕ  Õ#×,Ñ,¨XÔ6Ø�}‰}˜T×1Ñ1°8Ó<Ð<r\   c                óŠ   € V P                  R4      w  rV P                  \        V4      ^4       V P                  V\        4      # )z„
L{client._RetryingHTTP11ClientProtocol} does not retry when
L{client._RetryingHTTP11ClientProtocol._shouldRetry} returns C{False}.
F)rž  r©   r¯   rL  r4   ©rX   rQ  r•  s   &  rY   Ú'test_dontRetryIfShouldRetryReturnsFalseÚDHTTPConnectionPoolRetryTests.test_dontRetryIfShouldRetryReturnsFalse,  s=   € ð
 ×(Ñ(¨Ó/‰ˆà×Ñœ˜Y›¨Ô+Ø×!Ñ! !¤^Ó4Ð4r\   c                ó  € \         P                  ! R4      p\         P                  ! RV4      pV P                  VP	                  R\        4       R4      4       V P                  VP	                  R\        4       \        4       4      4       R# )zç
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×  )r/   r=   rv  r•   rw  r4   rx  r?  ry  s   &  rY   Útest_onlyRetryWithoutBodyÚ6HTTPConnectionPoolRetryTests.test_onlyRetryWithoutBody6  sf   € ô ×(Ò(¨Ó.ˆÜ×9Ò9¸$ÀÓEˆ
Ø�‰˜
×/Ñ/°¼Ó8HÈ$ÓOÔPØ×Ñ˜×0Ñ0°¼Ó9IÌ6Ë8ÓTÖUr\   c                ó2  € V P                  R4      w  rV P                  \        V4      ^4       V^,          P                  ^ ,          ^,          P	                  \        . 4      4       V P                  \        V4      ^4       V P                  V\
        4      # )zŒ
If a L{client._RetryingHTTP11ClientProtocol} fails more than once on
an idempotent query before a response is received, it will not retry.
T)rž  r©   r¯   rp   rœ  r8   rL  r¤  s   &  rY   Útest_onlyRetryOnceÚ/HTTPConnectionPoolRetryTests.test_onlyRetryOnceD  sz   € ð
 ×(Ñ(¨Ó.‰ˆØ×Ñœ˜Y›¨Ô+à�!�×Ñ˜aÕ  Õ#×+Ñ+Ô,AÀ"Ó,EÔFà×Ñœ˜Y›¨Ô+Ø×!Ñ! !Ô%:Ó;Ð;r\   c                ó  a a€ \         P                  ! \        4       4      pRVn        \	        4       oSP                  \        4       4       VP                  ^{S4       VP                  ^{\        4       4      pVV 3R lpVP                  V4      # )zm
If L{HTTPConnectionPool.retryAutomatically} is set to C{False}, don't
wrap connections with retrying logic.
Fc                ó,   <€ SP                  V S4       R # r~   )rz  r‰  s   &€€rY   rK  Ú[HTTPConnectionPoolRetryTests.test_dontRetryIfRetryAutomaticallyFalse.<locals>.gotConnectiona  s   ø€ Ø× Ñ  ¨XÖ6r\   )r/   r=   r    rB  rd   r(  r%   rY  rN  r,  rO  r‹  s   f   @rY   Ú'test_dontRetryIfRetryAutomaticallyFalseÚDHTTPConnectionPoolRetryTests.test_dontRetryIfRetryAutomaticallyFalseQ  sv   ù€ ô
 ×(Ò(¬«Ó1ˆØ"'ˆÔô $Ó%ˆØ×Ñ¤Ó 1Ô2Ø×Ñ˜C Ô*ð ×Ñ˜s¤M£OÓ4ˆö	7ð �}‰}˜]Ó+Ð+r\   c                ó@  a aaaa€ \         P                  ! \        4       4      p^{o\        4       o. oV3R lpW!n        \        4       oSP                  \        4       4       VP                  SS4       VP                  SS4      pVVVVV 3R lpVP                  V4      # )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.
c                ó,   <€ SP                  W34       R # r~   )rv   )Úkrc  ÚnewConnectionss   &&€rY   r�  ÚOHTTPConnectionPoolRetryTests.test_retryWithNewConnection.<locals>.newConnections  s   ø€ Ø×!Ñ! 1 &Ö)r\   c                óz  <€ SP                  V \        P                  4       SP                  V P                  S4       SP                  S. 4       V P                  4        SP                  \        S4      ^4       SP                  S^ ,          ^ ,          S4       SP                  S^ ,          ^,          S4       R# ©rã  N)rF  r/   rv  rz  rˆ  r©   r„  r¯   )r6  r  r‚  rµ  r  rX   s   &€€€€€rY   rK  ÚOHTTPConnectionPoolRetryTests.test_retryWithNewConnection.<locals>.gotConnection�  s–   ø€ Ø×!Ñ! *¬f×.RÑ.RÔSØ× Ñ  ×!;Ñ!;¸XÔFð ×Ñ˜^¨RÔ0Ø×%Ñ%Ô'Ø×ÑœS Ó0°!Ô4Ø×Ñ˜^¨AÕ.¨qÕ1°3Ô7Ø× Ñ  °Õ!2°1Õ!5°xÖ@r\   )r/   r=   r    r,  r„  rd   r(  r%   rY  rN  rO  )	rX   r@  r�  rQ  rK  r  r‚  rµ  r  s	   f    @@@@rY   Útest_retryWithNewConnectionÚ8HTTPConnectionPoolRetryTests.test_retryWithNewConnectionf  s‘   ü€ ô ×(Ò(¬«Ó1ˆØˆÜ “?ˆØˆõ	*ð ,Ôô $Ó%ˆØ×Ñ¤Ó 1Ô2Ø×Ñ˜C Ô*ð ×Ñ˜s HÓ-ˆ÷		Añ 		Að �}‰}˜]Ó+Ð+r\   rb   N)r]   r^   r_   r`   rz   rz  r}  r€  r„  rŒ  r‘  rž  r¡  r¥  r¨  r«  r°  rº  ra   rb   r\   rY   rs  rs  “  sL   † ñòWò"
ò&	Kò
ò,ò.,ò!òF
=ò5òVò<ò,ö*&,r\   rs  c                  ó&   € ] tR tRtRtR R ltRtR# )ÚCookieTestsMixini�  z,
Mixin for unit tests dealing with cookies.
c               ó(   € V ^8„  d   QhRRRRRRRR/# )	rg   Ú	cookieJarr   r  r„   Úcookieszlist[bytes]rh   z<tuple[client._FakeStdlibRequest, client._FakeStdlibResponse]rb   )rj   s   "rY   rk   ÚCookieTestsMixin.__annotate__”  s,   € ÷ !ñ !Ø"ð!Ø).ð!Ø9Dð!à	Eñ!r\   c                óÈ   € \         P                  ! \         P                  ! R^ÈR\        RV/4      R4      4      p\         P                  ! V4      pVP                  WE4       WT3# )z
Add a cookie to a cookie jar.
r·  ó
   Set-CookieNr¸  )r/   Ú_FakeStdlibResponser6   rB   Ú_FakeStdlibRequestÚextract_cookies)rX   r¿  r  rÀ  rÿ  rw   s   &&&&  rY   Ú
addCookiesÚCookieTestsMixin.addCookies”  sb   € ô ×-Ò-Ü�OŠOØØØÜ˜¨Ð0Ó1Øóó
ˆô ×+Ò+¨CÓ0ˆØ×!Ñ! (Ô4ØÐ Ð r\   rb   N)r]   r^   r_   r`   rz   rÇ  ra   rb   r\   rY   r½  r½  �  s   † ñ÷!ñ !r\   r½  c                  ó>   € ] tR tRtRtR R ltR R ltR R ltR	tR
# )ÚCookieJarTestsi¨  zŽ
Tests for L{twisted.web.client._FakeStdlibResponse} and
L{twisted.web.client._FakeStdlibRequest}'s interactions with L{CookieJar}
instances.
c               ó   € V ^8„  d   QhRR/# )rg   rh   zNtuple[CookieJar, tuple[client._FakeStdlibRequest, client._FakeStdlibResponse]]rb   )rj   s   "rY   rk   ÚCookieJarTests.__annotate__¯  s   € ÷ !ñ !à	Wñ!r\   c                óF   € \        4       pV P                  VRRR.4      pW3# )z2
@return: a L{CookieJar} with some sample cookies
r–  s(   foo=1; cow=moo; Path=/foo; Comment=hellos   bar=2; Comment=goodbye)r   rÇ  )rX   r¿  Úreqress   &  rY   ÚmakeCookieJarÚCookieJarTests.makeCookieJar¯  s3   € ô “Kˆ	Ø—‘ØØ.Ø8Ð:SÐTó
ˆð
 Ð Ð r\   c               ó   € V ^8„  d   QhRR/# rf   rb   )rj   s   "rY   rk   rÌ  ½  s   € ÷ Gñ G Tñ Gr\   c                óL  € V P                  4       ^ ,          pV Uu/ uF  q"P                  VbK  	  ppVR,          pV P                  VP                  ^ 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       V P                  VP                  R4       V P                  VP                  R4      R4       VR,          pV P                  VP                  ^ 4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R	4       V P                  VP                  R
4       V P                  VP                  R4      R4       R# u upi )z¢
L{CookieJar.extract_cookies} extracts cookie information from our
stdlib-compatibility wrappers, L{client._FakeStdlibRequest} and
L{client._FakeStdlibResponse}.
rø   Ú1z/fooÚhelloÚcowÚmooÚbarÚ2Ú/ÚgoodbyeN)	rÏ  Únamer©   Úversionr�  ÚpathÚcommentÚget_nonstandard_attrrz  )rX   ÚjarÚcrÀ  Úcookies   &    rY   Útest_extractCookiesÚ"CookieJarTests.test_extractCookies½  sF  € ð × Ñ Ó" 1Õ%ˆÙ&)Ó*¡c —6‘6˜1’9¡cˆÐ*à˜•ˆØ×Ñ˜Ÿ™¨Ô+Ø×Ñ˜Ÿ™ eÔ,Ø×Ñ˜Ÿ™ sÔ+Ø×Ñ˜Ÿ™ fÔ-Ø×Ñ˜Ÿ™¨Ô1Ø×Ñ˜×4Ñ4°UÓ;¸UÔCà˜•ˆØ×Ñ˜Ÿ™¨Ô+Ø×Ñ˜Ÿ™ eÔ,Ø×Ñ˜Ÿ™ sÔ+Ø×Ñ˜Ÿ™ cÔ*Ø×Ñ˜Ÿ™¨Ô3Ø×Ñ˜V×8Ñ8¸Ó?ÀÖFùò! +s   œF!c               ó   € V ^8„  d   QhRR/# rf   rb   )rj   s   "rY   rk   rÌ  Ö  s   € ÷ 
ñ 
 ñ 
r\   c                ó  € V P                  4       w  pw  r#V P                  VP                  RR4      R4       VP                  V4       V P	                  \        VP                  P                  4       4      RR.3.4       R# )zx
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)rÏ  rz  Ú
get_headerÚadd_cookie_headerr©   ÚlistÚ_twistedHeadersÚgetAllRawHeaders)rX   rà  rw   rÿ  s   &   rY   Útest_sendCookieÚCookieJarTests.test_sendCookieÖ  sx   € ð
 $(×#5Ñ#5Ó#7Ñ ˆÑ ˆgà×Ñ˜W×/Ñ/°¸$Ó?ÀÔFà×Ñ˜gÔ&Ø×ÑÜ�×(Ñ(×9Ñ9Ó;Ó<Ø˜/Ð*Ð+Ð,ö	
r\   rb   N)	r]   r^   r_   r`   rz   rÏ  rã  rí  ra   rb   r\   rY   rÊ  rÊ  ¨  s   † ñõ!õG÷2
ñ 
r\   rÊ  c                  óx   € ] tR tRtRtR tR tR tR R ltR t	]
! ]'       * R	4      R
 4       tR tR tR tRtR# )ÚCookieAgentTestsiæ  z.
Tests for L{twisted.web.client.CookieAgent}.
c                ór   € \         P                  ! V P                  V P                  4      \	        4       4      # )z2
@return: a new L{twisted.web.client.CookieAgent}
)r/   ÚCookieAgentr%  r#  r   rr   s   &rY   r¼  ÚCookieAgentTests.makeAgentí  s-   € ô ×!Ò!Ø×)Ñ)¨$¯,©,Ó7¼»ó
ð 	
r\   c                	ó0   € V P                  4       V n        R # r~   )r  r#  rr   s   &rY   r’   ÚCookieAgentTests.setUpõ  s   € Ø×)Ñ)Ó+ˆŽr\   c           	     ó  a a€ \        4       oS P                  \        S4      . 4       S P                  S P                  4      p\
        P                  ! VS4      pVP                  RR4      pVV 3R lpVP                  V4       S P                  P                  P                  4       w  rVS P                  VP                  P                  R4      R4       \
        P                  ! R	^ÈR\!        RR./4      R4      pVP#                  V4       V# )
zå
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                óà   <€ \        S4      pSP                  \        V4      ^4       SP                  V^ ,          P                  R4       SP                  V^ ,          P                  R4       R# )rã  rø   rÓ  N)rê  r©   r¯   rÛ  r�  )ÚignoredrÀ  r¿  rX   s   & €€rY   Ú_checkCookieÚACookieAgentTests.test_emptyCookieJarRequest.<locals>._checkCookie  sR   ø€ Ü˜9“oˆGØ×ÑœS ›\¨1Ô-Ø×Ñ˜W Q�ZŸ_™_¨eÔ4Ø×Ñ˜W Q�Z×-Ñ-¨sÖ3r\   ó   cookieNr·  rÃ  ó   foo=1r¸  )r   r©   rê  r%  r#  r/   rò  rw   rO  r  rp   r½   rz  rî  rï  r6   rB   r»  )	rX   r$  ÚcookieAgentrQ  rù  rm  rn  r½  r¿  s	   f       @rY   Útest_emptyCookieJarRequestÚ+CookieAgentTests.test_emptyCookieJarRequestø  sì   ù€ ô “Kˆ	Ø×Ñœ˜i›¨"Ô-à×-Ñ-¨d¯l©lÓ;ˆÜ×(Ò(¨°	Ó:ˆØ×Ñ Ð(JÓKˆö	4ð 	
�‰�lÔ#à—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜SŸ[™[×6Ñ6°yÓAÀ4ÔHä�ŠØØØÜà!Ø ð$ðóð ó
ˆð 	�‰�TÔàˆr\   c               ó   € V ^8„  d   QhRR/# rf   rb   )rj   s   "rY   rk   ÚCookieAgentTests.__annotate__"  s   € ÷ Qñ Q°ñ Qr\   c                óÔ  € RpRp\        4       pV P                  W1V.4       V P                  \        \	        V4      4      ^4       V P                  V P                  4      p\        P                  ! WC4      pVP                  RV\        RR./4      4       V P                  P                  P                  4       w  rgV P                  VP                  P                  R4      R.4       R# )	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â  zalready-setrû  s   already-setN)r   rÇ  r©   r¯   rê  r%  r#  r/   rò  rw   rB   r  rp   r½   rî  rï  ©rX   r  râ  r¿  r$  rý  rm  rn  s   &       rY   Útest_leaveExistingCookieHeaderÚ/CookieAgentTests.test_leaveExistingCookieHeader"  s¼   € ð 1ˆØˆä“Kˆ	Ø�‰˜	¨¨Ô1Ø×ÑœœT )›_Ó-¨qÔ1à×-Ñ-¨d¯l©lÓ;ˆÜ×(Ò(¨Ó:ˆØ×Ñ˜F C¬°(¸]¸OÐ1LÓ)MÔNà—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°9Ó=ÀÐ?OÖPr\   c                óº  € RpRp\        4       pV P                  W1V.4       V P                  \        \	        V4      4      ^4       V P                  V P                  4      p\        P                  ! WC4      pVP                  RV4       V P                  P                  P                  4       w  rgV P                  VP                  P                  R4      V.4       R# )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û  N©r   rÇ  r©   r¯   rê  r%  r#  r/   rò  rw   r  rp   r½   rî  rï  r  s   &       rY   Útest_requestWithCookieÚ'CookieAgentTests.test_requestWithCookie6  s­   € ð 1ˆØˆä“Kˆ	Ø�‰˜	¨¨Ô1Ø×ÑœœT )›_Ó-¨qÔ1à×-Ñ-¨d¯l©lÓ;ˆÜ×(Ò(¨Ó:ˆØ×Ñ˜F CÔ(à—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°9Ó=À¸xÖHr\   r£  c                óº  € RpRp\        4       pV P                  W1V.4       V P                  \        \	        V4      4      ^4       V P                  V P                  4      p\        P                  ! WC4      pVP                  RV4       V P                  P                  P                  4       w  rgV P                  VP                  P                  R4      R.4       R# )zf
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ü  Nr  r  s   &       rY   Útest_secureCookieÚ"CookieAgentTests.test_secureCookieJ  s­   € ð 2ˆØ ˆä“Kˆ	Ø�‰˜	¨¨Ô1Ø×ÑœœT )›_Ó-¨qÔ1à×-Ñ-¨d¯l©lÓ;ˆÜ×(Ò(¨Ó:ˆØ×Ñ˜F CÔ(à—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°9Ó=À¸zÖJr\   c                ó¸  € RpRp\        4       pV P                  W1V.4       V P                  \        \	        V4      4      ^4       V P                  V P                  4      p\        P                  ! WC4      pVP                  RV4       V P                  P                  P                  4       w  rgV P                  RVP                  P                  R4      4       R# )z[
If a cookie is setup as secure, it won't be sent with the request if
it's not over HTTPS.
rj  r  r×  Nrû  )r   rÇ  r©   r¯   rê  r%  r#  r/   rò  rw   r  rp   r½   rz  rî  rï  r  s   &       rY   Ú%test_secureCookieOnInsecureConnectionÚ6CookieAgentTests.test_secureCookieOnInsecureConnection^  s«   € ð
 ,ˆØ ˆä“Kˆ	Ø�‰˜	¨¨Ô1Ø×ÑœœT )›_Ó-¨qÔ1à×-Ñ-¨d¯l©lÓ;ˆÜ×(Ò(¨Ó:ˆØ×Ñ˜F CÔ(à—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜T 3§;¡;×#<Ñ#<¸YÓ#GÖHr\   c                óº  € RpRp\        4       pV P                  W1V.4       V P                  \        \	        V4      4      ^4       V P                  V P                  4      p\        P                  ! WC4      pVP                  RV4       V P                  P                  P                  4       w  rgV P                  VP                  P                  R4      R.4       R# )zb
L{CookieAgent} supports cookies which enforces the port number they
need to be transferred upon.
r–  ó   foo=1;port=1234r×  rû  rü  Nr  r  s   &       rY   Útest_portCookieÚ CookieAgentTests.test_portCookieq  s­   € ð
 1ˆØ#ˆä“Kˆ	Ø�‰˜	¨¨Ô1Ø×ÑœœT )›_Ó-¨qÔ1à×-Ñ-¨d¯l©lÓ;ˆÜ×(Ò(¨Ó:ˆØ×Ñ˜F CÔ(à—=‘=×)Ñ)×-Ñ-Ó/‰ˆØ×Ñ˜Ÿ™×2Ñ2°9Ó=À¸zÖJr\   c                ó�   € RpRp\        4       pV P                  W1V.4       V P                  \        \	        V4      4      ^ 4       R# )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?barr  N)r   rÇ  r©   r¯   rê  )rX   r  râ  r¿  s   &   rY   Útest_portCookieOnWrongPortÚ+CookieAgentTests.test_portCookieOnWrongPort„  s>   € ð
 1ˆØ#ˆä“Kˆ	Ø�‰˜	¨¨Ô1Ø×ÑœœT )›_Ó-¨qÖ1r\   rÕ  N)r]   r^   r_   r`   rz   r¼  r’   rþ  r  r  r   rå  r  r  r  r  ra   rb   r\   rY   rð  rð  æ  sU   † ñò
ò,ò(õTQò(Iñ( �
ŒNÐDÓEñKó FðKò&Iò&Kö&
2r\   rð  c                  ó   € ] tR tRtRtRtR# )ÚDecoder1i‘  úC
A test decoder to be used by L{client.ContentDecoderAgent} tests.
rb   N©r]   r^   r_   r`   rz   ra   rb   r\   rY   r  r  ‘  ó   † õr\   r  c                  ó   € ] tR tRtRtRtR# )ÚDecoder2i—  r  rb   Nr  rb   r\   rY   r  r  —  r  r\   r  c                  óD   € ] tR tRtRtR tR tR tR tR t	R t
R	 tR
tR# )ÚContentDecoderAgentTestsi�  z*
Tests for L{client.ContentDecoderAgent}.
c                óD   € \         P                  ! V P                  . 4      # )z:
@return: a new L{twisted.web.client.ContentDecoderAgent}
)r/   ÚContentDecoderAgentr$  rr   s   &rY   r¼  Ú"ContentDecoderAgentTests.makeAgent¢  s   € ô ×)Ò)¨$¯*©*°bÓ9Ð9r\   c                óp   € V P                  4       V n        V P                  V P                  4      V n        R# r  )r  r#  r%  r$  rr   s   &rY   r’   ÚContentDecoderAgentTests.setUp¨  s*   € ð ×)Ñ)Ó+ˆŒØ×2Ñ2°4·<±<Ó@ˆŽ
r\   c                óz  € \         P                  ! V P                  R\        3R\        3.4      pVP                  RR4       V P                  pV P                  \        VP                  4      ^4       VP                  P                  4       w  r4V P                  VP                  P                  R4      R.4       R# )zq
L{client.ContentDecoderAgent} sets the I{Accept-Encoding} header to the
names of the available decoder objects.
ó   decoder1ó   decoder2r×  r  ó   accept-encodingó   decoder1,decoder2N)r/   r"  r$  r  r  rw   r  r©   r¯   rp   r½   rî  rï  )rX   r$  r  rm  rn  s   &    rY   Útest_acceptHeadersÚ+ContentDecoderAgentTests.test_acceptHeaders¯  sž   € ô
 ×*Ò*Ø�J‰J˜+¤xÐ0°;ÄÐ2IÐJó
ˆð 	�‰�fÐ7Ô8à—=‘=ˆà×Ñœ˜X×.Ñ.Ó/°Ô3Ø×$Ñ$×(Ñ(Ó*‰ˆØ×ÑØ�K‰K×%Ñ%Ð&8Ó9Ð<PÐ;Qö	
r\   c                óð  € \         P                  ! RR.RR./4      p\        P                  ! V P                  R\
        3R\        3.4      pVP                  RRVR	7       V P                  pV P                  \        VP                  4      ^4       VP                  P                  4       w  rEV P                  \        \        VP                  P!                  4       4      4      R
RR.3RR.3RR.3.4       R# )z…
If there are existing I{Accept-Encoding} fields,
L{client.ContentDecoderAgent} creates a new field for the decoders it
knows about.
r-  rw  r)  ó   fizzr'  r(  r×  r  ©rî  s   Accept-Encodingr*  ó   Foorä  rW  N)r1   rB   r/   r"  r$  r  r  rw   r  r©   r¯   rp   r½   rê  Úsortedrî  rì  )rX   rî  r$  r  rm  rn  s   &     rY   Útest_existingHeadersÚ-ContentDecoderAgentTests.test_existingHeadersÂ  sî   € ô ×&Ò&Ø�f�XÐ1°G°9Ð=ó
ˆô ×*Ò*Ø�J‰J˜+¤xÐ0°;ÄÐ2IÐJó
ˆð 	�‰�fÐ7ÀˆÔIà—=‘=ˆà×Ñœ˜X×.Ñ.Ó/°Ô3Ø×$Ñ$×(Ñ(Ó*‰ˆØ×ÑÜ”˜Ÿ™×4Ñ4Ó6Ó7Ó8à# gÐ/CÐ%DÐEØ˜&˜Ð"Ø˜>Ð*Ð+ðö	
r\   c                ón  € \         P                  ! V P                  R\        3R\        3.4      pVP                  RR4      pV P                  P                  P                  4       w  r4\        R^ÈR\        P                  ! 4       R4      pVP                  V4       VP                  V P                  V4      # )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  r·  Nr¸  )r/   r"  r$  r  r  rw   r  rp   r½   r6   r1   rB   r»  rO  rz  )rX   r$  rõ  rm  rn  rÿ  s   &     rY   Útest_plainEncodingResponseÚ3ContentDecoderAgentTests.test_plainEncodingResponseÝ  sš   € ô
 ×*Ò*Ø�J‰J˜+¤xÐ0°;ÄÐ2IÐJó
ˆð —=‘= Ð)BÓCˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä˜O¨S°%¼×9MÒ9MÓ9OÐQUÓVˆØ�‰�XÔà×#Ñ# D×$8Ñ$8¸(ÓCÐCr\   c                ó€  € \         P                  ! V P                  R\        3R\        3.4      pVP                  RR4      pV P                  P                  P                  4       w  r4\        P                  ! RR.RR./4      p\        R^ÈR	VR
4      pVP                  V4       VP                  V P                  V4      # )zb
If an encoding unknown to the L{client.ContentDecoderAgent} is found,
the response is unchanged.
r'  r(  r×  r  r-  rw  ó   content-encodingr.  r·  Nr¸  )r/   r"  r$  r  r  rw   r  rp   r½   r1   rB   r6   r»  rO  rz  )rX   r$  rõ  rm  rn  rî  rÿ  s   &      rY   Útest_unsupportedEncodingÚ1ContentDecoderAgentTests.test_unsupportedEncodingî  s³   € ô
 ×*Ò*Ø�J‰J˜+¤xÐ0°;ÄÐ2IÐJó
ˆð —=‘= Ð)BÓCˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ø�f�XÐ2°W°IÐ>ó
ˆô ˜O¨S°%¸À$ÓGˆØ�‰�XÔà×#Ñ# D×$8Ñ$8¸(ÓCÐCr\   c                ó|  a a€ \         P                  ! S P                  R\        3R\        3.4      pVP                  RR4      pS P                  P                  P                  4       w  r4\        P                  ! RR.RR./4      p\        R^ÈR	VR
4      oVP                  S4       VV 3R lpVP                  V4      # )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-  rw  r8  s   decoder1,fizz,decoder2r·  Nc                ó°   <€ SP                  SV 4       SP                  V \        4       SP                  R .V P                  P                  R4      4       R# )s   decoder1,fizzr8  N)r€  rF  r  r©   rî  rï  )rx   rÿ  rX   s   &€€rY   ÚcheckÚ<ContentDecoderAgentTests.test_unknownEncoding.<locals>.check	  sI   ø€ Ø×#Ñ# H¨fÔ5Ø×!Ñ! &¬(Ô3Ø×ÑØ!Ð" F§N¡N×$@Ñ$@ÐATÓ$Uör\   r¸  )r/   r"  r$  r  r  rw   r  rp   r½   r1   rB   r6   r»  rO  )rX   r$  rõ  rm  rn  rî  r=  rÿ  s   f      @rY   Útest_unknownEncodingÚ-ContentDecoderAgentTests.test_unknownEncoding	  sµ   ù€ ô
 ×*Ò*Ø�J‰J˜+¤xÐ0°;ÄÐ2IÐJó
ˆð —=‘= Ð)BÓCˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ø�f�XÐ2Ð5NÐ4OÐPó
ˆô ˜O¨S°%¸À$ÓGˆØ�‰�XÔö	ð ×#Ñ# EÓ*Ð*r\   rÕ  N)r]   r^   r_   r`   rz   r¼  r’   r+  r2  r5  r9  r?  ra   rb   r\   rY   r   r   �  s-   † ñò:òAò
ò&
ò6Dò"Dö(+r\   r   c                  ó2   € ] tR tRtRtR tR tR tR tRt	R# )	ÚSimpleAgentProtocoli	  zö
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                	óP   € \        4       V n        \        4       V n        . V n        R # r~   )r   ÚmadeÚfinishedÚreceivedrr   s   &rY   rs   ÚSimpleAgentProtocol.__init__)	  s   € Ü“JˆŒ	Ü ›
ˆŒØˆŽr\   c                	ó<   € V P                   P                  R 4       R # r~   )rD  r»  rr   s   &rY   ÚconnectionMadeÚ"SimpleAgentProtocol.connectionMade.	  s   € Ø�	‰	×Ñ˜4Ö r\   c                	ó<   € V P                   P                  R 4       R # r~   )rE  r»  )rX   Úreasons   &&rY   rª  Ú"SimpleAgentProtocol.connectionLost1	  s   € Ø�‰×Ñ˜tÖ$r\   c                	ó<   € V P                   P                  V4       R # r~   )rF  rv   ©rX   rê  s   &&rY   ÚdataReceivedÚ SimpleAgentProtocol.dataReceived4	  s   € Ø�‰×Ñ˜TÖ"r\   )rE  rD  rF  N)
r]   r^   r_   r`   rz   rs   rI  rª  rP  ra   rb   r\   rY   rB  rB  	  s   † ñòò
!ò%ö#r\   rB  c                  ó4   € ] tR tRtR tR tR tR tR tRt	R# )	Ú ContentDecoderAgentWithGzipTestsi8	  c                óÀ   € V P                  4       V n        V P                  V P                  4      p\        P                  ! VR\        P
                  3.4      V n        R# )r  ó   gzipN)r  r#  r%  r/   r"  ÚGzipDecoderr$  r  s   & rY   r’   Ú&ContentDecoderAgentWithGzipTests.setUp9	  sJ   € ð ×)Ñ)Ó+ˆŒØ×-Ñ-¨d¯l©lÓ;ˆÜ×/Ò/°¸Ä&×BTÑBTÐ8UÐ7VÓWˆŽ
r\   c                óH  a aa	€ S P                   P                  RR4      pS P                  P                  P	                  4       w  r#\
        P                  ! RR.RR./4      p\        4       p\        R	^ÈRWE4      o	^S	n	        VP                  S	4       \        P                  ! ^\        P                  ^\        P                  ,           4      pVP                  R
4      VP                  R4      ,           VP!                  4       ,           oVV	V 3R lpVP#                  V4       V# )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-  rw  r8  rU  r·  c                óþ  <€ SP                  V S4       SP                  V P                  R4       SP                  V P                  ^È4       SP                  V P                  R4       SP                  \        V P                  P                  4       4      RR.3.4       SP                  V P                  \        4       SP                  \        \        V R4       SP                  SR,          4       SP                  SR,          4       SP                  4        \        4       pV P!                  V4       SP                  VP"                  R.4       \$        P&                  ! VP(                  VP*                  .4      # )	r¹  r·  r0  rw  Úunknownræ   :rç   NNr¸  s
   xxxxxxyyyy)r€  r©   rÜ  ÚcodeÚphraserê  rî  rì  rª   rC   rF  ÚAttributeErrorÚgetattrÚ_bodyDataReceivedÚ_bodyDataFinishedrB  ÚdeliverBodyrF  r   ÚgatherResultsrD  rE  )rx   r  rê  rÿ  rX   s   & €€€rY   ÚcheckResponseÚQContentDecoderAgentWithGzipTests.test_gzipEncodingResponse.<locals>.checkResponseZ	  s(  ø€ Ø×#Ñ# F¨HÔ5Ø×Ñ˜VŸ^™^¨_Ô=Ø×Ñ˜VŸ[™[¨#Ô.Ø×Ñ˜VŸ]™]¨EÔ2Ø×ÑÜ�V—^‘^×4Ñ4Ó6Ó7¸6ÀFÀ8Ð:LÐ9Môð ×Ñ˜VŸ]™]¬NÔ;Ø×Ñœn¬g°v¸yÔIà×&Ñ& t¨B¥xÔ0Ø×&Ñ& t¨B¥xÔ0Ø×&Ñ&Ô(ä*Ó,ˆHØ×Ñ˜xÔ(à×Ñ˜X×.Ñ.Ð1DÐ0EÔFÜ×&Ò&¨¯©°x×7HÑ7HÐ'IÓJÐJr\   r¸  s   xxxxxxs   yyyy)r$  rw   r  rp   r½   r1   rB   r%   r6   rª   r»  ÚzlibÚcompressobjÚDEFLATEDÚ	MAX_WBITSÚcompressré  rO  )
rX   rõ  rm  rn  rî  rZ  Ú
compressorrc  rê  rÿ  s
   f       @@rY   Útest_gzipEncodingResponseÚ:ContentDecoderAgentWithGzipTests.test_gzipEncodingResponseA	  s÷   ú€ ð —:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ø�f�XÐ2°W°IÐ>ó
ˆô $Ó%ˆ	Ü˜O¨S°%¸ÓLˆØˆŒØ�‰�XÔä×%Ò% a¬¯©¸¼T¿^¹^Õ8KÓLˆ
à×Ñ Ó)Ø×!Ñ! (Ó+õ,à×ÑÓ õ!ð 	÷	Kð* 	×Ñ˜]Ô+àˆr\   c                óÆ  a aa	€ S P                   P                  RR4      pS P                  P                  P	                  4       w  r#\
        P                  ! RR.RR./4      p\        4       p\        R^ÈRWE4      o	^S	n	        VP                  S	4       RoVV	3R	 lpVP                  V4       S P                  V\        P                  4       V 3R
 lpVP                  V4      # )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-  rw  r8  rU  r·  s   not gzipped contentc                ó\   <€ SP                  S4       V P                  \        4       4       R # r~   )r_  ra  r   )rx   rê  rÿ  s   &€€rY   rc  ÚJContentDecoderAgentWithGzipTests.test_brokenContent.<locals>.checkResponse†	  s!   ø€ Ø×&Ñ& tÔ,à×Ñœx›zÖ*r\   c                ó¨   <€ V P                   ^ ,          P                  \        P                  4       SP	                  V P
                  \        4       R# )r­  N©ÚreasonsrÖ   re  r0   rF  rÿ  r6   ©r0   rX   s   &€rY   ÚcheckFailureÚIContentDecoderAgentWithGzipTests.test_brokenContent.<locals>.checkFailureŽ	  ó2   ø€ Ø�M‰M˜!Õ×!Ñ!¤$§*¡*Ô-Ø×!Ñ! %§.¡.´(Ö;r\   r¸  )r$  rw   r  rp   r½   r1   rB   r%   r6   rª   r»  rO  rL  r/   r7   )
rX   rõ  rm  rn  rî  rZ  rc  rt  rê  rÿ  s
   f       @@rY   Útest_brokenContentÚ3ContentDecoderAgentWithGzipTests.test_brokenContents	  sÌ   ú€ ð
 —:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ø�f�XÐ2°W°IÐ>ó
ˆô $Ó%ˆ	Ü˜O¨S°%¸ÓLˆØˆŒØ�‰�XÔà%ˆö	+ð
 	×Ñ˜]Ô+Ø×Ñ˜8¤V×%:Ñ%:Ô;õ	<ð ×#Ñ# LÓ1Ð1r\   c                óÄ  a a	€  ! R R4      p\         P                  pV\         n        S P                  \        \         RV4       S P                  P                  RR4      pS P                  P                  P                  4       w  rE\        P                  ! RR./4      p\        4       p\        R	^ÈRWg4      o	VP                  S	4       V	V 3R lpVP                  V4       V# )
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                  ó(   € ] tR tRtR tR tR tRtR# )ÚFContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobji›	  c                	ó   € R # r~   rb   ©rX   Úwbitss   &&rY   rs   ÚOContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobj.__init__œ	  r    r\   c                	ó   € R # ©ó   xrb   rO  s   &&rY   Ú
decompressÚQContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobj.decompressŸ	  ó   € Ùr\   c                	ó   € R # )ó   yrb   rr   s   &rY   ré  ÚLContentDecoderAgentWithGzipTests.test_flushData.<locals>.decompressobj.flush¢	  r…  r\   rb   N©r]   r^   r_   r`   rs   rƒ  ré  ra   rb   r\   rY   Údecompressobjr{  ›	  s   † òòör\   rŠ  r×  r  r8  rU  r·  c                ó  <€ SP                  R 4       SP                  4        \        4       pV P                  V4       SP	                  VP
                  RR.4       \        P                  ! VP                  VP                  .4      # ©s   datar‚  r‡  ©
r_  r`  rB  ra  r©   rF  r   rb  rD  rE  ©rx   r  rÿ  rX   s   & €€rY   rc  ÚFContentDecoderAgentWithGzipTests.test_flushData.<locals>.checkResponse²	  óm   ø€ Ø×&Ñ& wÔ/Ø×&Ñ&Ô(ä*Ó,ˆHØ×Ñ˜xÔ(à×Ñ˜X×.Ñ.°°t°Ô=Ü×&Ò&¨¯©°x×7HÑ7HÐ'IÓJÐJr\   r¸  )re  rŠ  Ú
addCleanupÚsetattrr$  rw   r  rp   r½   r1   rB   r%   r6   r»  rO  )
rX   rŠ  ÚoldDecompressObjrõ  rm  rn  rî  rZ  rc  rÿ  s
   f        @rY   Útest_flushDataÚ/ContentDecoderAgentWithGzipTests.test_flushData”	  s¾   ù€ ÷	ñ 	ô  ×-Ñ-ÐØ*ŒÔØ�‰œ¤ Ð8HÔIà—:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ð(;¸g¸YÐ'GÓHˆÜ#Ó%ˆ	Ü˜O¨S°%¸ÓLˆØ�‰�XÔö	Kð 	×Ñ˜]Ô+àˆr\   c                ó.  a a
€  ! R R4      p\         P                  pV\         n        S P                  \        \         RV4       S P                  P                  RR4      pS P                  P                  P                  4       w  rE\        P                  ! RR./4      p\        4       p\        R
^ÈRWg4      o
VP                  S
4       V
V 3R lpVP                  V4       S P                  V\         P"                  4       V 3R	 lp	VP                  V	4      # )z}
If the C{flush} call in C{connectionLost} fails, the C{zlib.error}
exception is caught and turned into a L{ResponseFailed}.
c                  ó(   € ] tR tRtR tR tR tRtR# )ÚGContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobjiÆ	  c                	ó   € R # r~   rb   r}  s   &&rY   rs   ÚPContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobj.__init__Ç	  r    r\   c                	ó   € R # r�  rb   rO  s   &&rY   rƒ  ÚRContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobj.decompressÊ	  r…  r\   c                	ó,   € \         P                  ! 4       hr~   )re  r0   rr   s   &rY   ré  ÚMContentDecoderAgentWithGzipTests.test_flushError.<locals>.decompressobj.flushÍ	  s   € Ü—j’j“lÐ"r\   rb   Nr‰  rb   r\   rY   rŠ  r˜  Æ	  s   † òòö#r\   rŠ  r×  r  r8  rU  r·  c                ó  <€ SP                  R 4       SP                  4        \        4       pV P                  V4       SP	                  VP
                  RR.4       \        P                  ! VP                  VP                  .4      # rŒ  r�  rŽ  s   & €€rY   rc  ÚGContentDecoderAgentWithGzipTests.test_flushError.<locals>.checkResponseÝ	  r�  r\   c                ó¨   <€ V P                   ^,          P                  \        P                  4       SP	                  V P
                  \        4       R# r¸  rq  rs  s   &€rY   rt  ÚFContentDecoderAgentWithGzipTests.test_flushError.<locals>.checkFailureë	  rv  r\   r¸  )re  rŠ  r‘  r’  r$  rw   r  rp   r½   r1   rB   r%   r6   r»  rO  rL  r/   r7   )rX   rŠ  r“  rõ  rm  rn  rî  rZ  rc  rt  rÿ  s   f         @rY   Útest_flushErrorÚ0ContentDecoderAgentWithGzipTests.test_flushErrorÀ	  sç   ù€ ÷	#ñ 	#ô  ×-Ñ-ÐØ*ŒÔØ�‰œ¤ Ð8HÔIà—:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ð(;¸g¸YÐ'GÓHˆÜ#Ó%ˆ	Ü˜O¨S°%¸ÓLˆØ�‰�XÔö	Kð 	×Ñ˜]Ô+à×Ñ˜8¤V×%:Ñ%:Ô;õ	<ð ×#Ñ# LÓ1Ð1r\   rÕ  N)
r]   r^   r_   r`   r’   rk  rw  r”  r£  ra   rb   r\   rY   rS  rS  8	  s   † òXò0òd2òB*öX/2r\   rS  c                  ó>   € ] tR tRtRtR tR tR tR tR t	R t
R	tR
# )ÚProxyAgentTestsiò	  z!
Tests for L{client.ProxyAgent}.
c                ón   € \         P                  ! \        V P                  RR4      V P                  4      # )z1
@return: a new L{twisted.web.client.ProxyAgent}
z	127.0.0.1rV  )r/   Ú
ProxyAgentr   r#  rr   s   &rY   r¼  ÚProxyAgentTests.makeAgent÷	  s-   € ô × Ò Ü˜tŸ|™|¨[¸$Ó?ÀÇÁó
ð 	
r\   c                	ó  € V P                  4       V n        \        P                  ! \	        V P                  R R4      V P                  4      V n        V P
                  P                  pV P                  W4      V P
                  n        R# )r×  é.  N)r  r#  r/   r¨  r   r$  Ú_proxyEndpointr  )rX   ÚoldEndpoints   & rY   r’   ÚProxyAgentTests.setUpÿ	  sb   € Ø×)Ñ)Ó+ˆŒÜ×&Ò&Ü˜tŸ|™|¨U°DÓ9¸4¿<¹<ó
ˆŒ
ð —j‘j×/Ñ/ˆØ$(×$5Ñ$5°kÓ$Hˆ�
‰
Ö!r\   c                ó^   € V P                  \        V P                  P                  RR4       R# )zW
L{ProxyAgent.request} raises L{TypeError} when the C{method} argument
isn't L{bytes}.
rC  rD  NrE  rr   s   &rY   rH  Ú#ProxyAgentTests.test_nonBytesMethod
  rJ  r\   c           	     óX  € \         P                  ! RR./4      p\        4       pV P                  P	                  RRW4       V P
                  P                  P                  4       R,          w  r4pV P                  VR4       V P                  VR4       V P                  VP                  \        P                  4       V P                  pV P                  \        VP                  4      ^4       VP                  P                  4       w  rxV P                  V\         4       V P                  VP"                  R4       V P                  VP$                  R4       V P                  VP&                  \         P                  ! RR.RR	./4      4       V P)                  VP*                  V4       R
# )zv
L{client.ProxyAgent} issues an HTTP request against the proxy, with the
full URI as path, when C{request} is called.
r-  rw  r×  r–  rP  r×  r«  r;  r—  N)r1   rB   r?  r$  rw   r#  r   r½   r©   rF  Ú_wrappedFactoryr/   r@   r  r¯   rp   r>   r˜  r  rî  rz  r=  )	rX   rî  r™  rn  ro  r  r  rm  rn  s	   &        rY   Útest_proxyRequestÚ!ProxyAgentTests.test_proxyRequest
  sX  € ô
 ×&Ò&¨°°Ð'9Ó:ˆô ‹xˆØ�
‰
×Ñ˜6Ð#EÀwÔUà"Ÿl™l×5Ñ5×9Ñ9Ó;¸BÕ?Ñˆ�GØ×Ñ˜˜uÔ%Ø×Ñ˜˜tÔ$à×Ñ˜g×5Ñ5´v×7RÑ7RÔSà—=‘=ˆð 	×Ñœ˜X×.Ñ.Ó/°Ô3Ø×$Ñ$×(Ñ(Ó*‰ˆØ×Ñ˜c¤7Ô+Ø×Ñ˜Ÿ™ VÔ,Ø×Ñ˜Ÿ™Ð"DÔEØ×ÑØ�K‰KÜ× Ò  &¨6¨(°GÐ>QÐ=RÐ!SÓTô	
ð 	×Ñ˜S×-Ñ-¨tÖ4r\   c                óf   € V P                  V P                  P                  P                  R4       R# )z:
C{ProxyAgent} connections are not persistent by default.
FN)r©   r$  r  ru  rr   s   &rY   r&  Ú"ProxyAgentTests.test_nonPersistent-
  s$   € ð 	×Ñ˜Ÿ™×)Ñ)×4Ñ4°eÖ<r\   c                ó4  a a€ \        4       o ! VV 3R lR4      pV! 4       p\        P                  ! SS P                  VR7      pS P	                  W#P
                  4       VP                  RR4       S P                  VP
                  P                  R4       R# )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                  ó.   <€ ] tR tRtRtRtV V3R ltRtR# )ÚAProxyAgentTests.test_connectUsesConnectionPool.<locals>.DummyPooli;
  Fc                	óš   <€ R V n         SP                  VS4       SP                  VRS34       \        P                  ! \        4       4      # )Tz
http-proxy)r5  rz  r©   r   r   rd   r6  s   &&&€€rY   rN  ÚOProxyAgentTests.test_connectUsesConnectionPool.<locals>.DummyPool.getConnection?
  sD   ø€ Ø!%�”Ø×$Ñ$ R¨Ô2ð × Ñ   |°XÐ&>Ô?Ü—}’}Ô%5Ó%7Ó8Ð8r\   rb   Nr9  r0  s   €€rY   r:  r¹  ;
  s   ø† ØˆIØˆJ÷9ò 9r\   r:  r  r×  r<  TN)	r,  r/   r¨  r#  rz  r  rw   r©   r5  )rX   r:  r@  r$  r  s   f   @rY   r@  Ú.ProxyAgentTests.test_connectUsesConnectionPool3
  sq   ù€ ô !“?ˆ÷	9õ 	9ñ ‹{ˆÜ×!Ò! (¨D¯L©L¸tÔDˆØ×Ñ˜T§;¡;Ô/à�‰�f˜nÔ-Ø×Ñ˜Ÿ™×.Ñ.°Ö5r\   rÕ  N)r]   r^   r_   r`   rz   r¼  r’   rH  r³  r&  r@  ra   rb   r\   rY   r¦  r¦  ò	  s'   † ñò
òIòXò5ò>=ö6r\   r¦  c                  óä   € ] tR tRt$ RtR]R&   R]R&   R]R&   R	 tR&R R lltR tR t	R t
R tR tR'R R lltR R ltR R ltR R ltR tR tR tR tR tR tR  tR! tR" tR# tR$ tR%tR
# )(Ú_RedirectAgentTestsMixiniY
  zR
Test cases mixin for L{RedirectAgentTests} and
L{BrowserLikeRedirectAgentTests}.
rD   r$  r$   r#  rd   r  c                óÎ  € V P                   P                  RR4      pV P                  P                  P	                  4       w  r#\
        P                  ! 4       p\        R^ÈRVR4      pVP                  V4       V P                  ^ \        V P                  P                  4      4       V P                  V4      pV P                  WV4       V P                  VP                  R4       R# )zb
L{client.RedirectAgent} behaves like L{client.Agent} if the response
doesn't contain a redirect.
r×  r  r·  Nr¸  )r$  rw   r  rp   r½   r1   rB   r6   r»  r©   r¯   r¿   rz  ÚpreviousResponse)rX   rõ  rm  rn  rî  rÿ  rx   s   &      rY   Útest_noRedirectÚ(_RedirectAgentTestsMixin.test_noRedirectc
  s´   € ð
 —:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ó(ˆÜ˜O¨S°%¸À$ÓGˆØ�‰�XÔà×Ñ˜œC §¡× 6Ñ 6Ó7Ô8Ø×%Ñ% hÓ/ˆØ×Ñ˜XÔ.Ø×Ñ˜V×4Ñ4°dÖ;r\   Nc               ó0   € V ^8„  d   QhRRRRRRRRRRR	R
/# )rg   r[  ÚintÚcrossSchemeÚboolÚcrossDomainÚ	crossPortÚrequestHeaderszOptional[Headers]rh   r>   rb   )rj   s   "rY   rk   Ú%_RedirectAgentTestsMixin.__annotate__u
  sF   € ÷ <ñ <àð<ð ð<ð ð	<ð
 ð<ð *ð<ð 
ñ<r\   c                ód  € Rp\         e   RMRpVR8X  d   ^PMRpV P                  P                  RVR,           V,           R,           VR	7       V P                  P                  P                  4       R
,          w  ršV P                  \        V	4       V P                  WŠ4       V P                  P                  P                  4       w  r¼TpTpTpV'       d*   \         f   \        R4      hVR8X  d   RMRpV^P8X  d   RM^PpRpV'       d   RpRpV'       d   RMTpVR,           V,           V,           R,           p\        P                  ! RV./4      p\        RVRVR4      pVP                  V4       V P                  P                  P                  4       w  ppV P                  RVP                  4       V P                  RVP                   4       V P                  P                  P                  4       R
,          w  ršT P                  V'       d   \"        M\        V	4       V P                  Wú4       V# )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.
rW  Nr�  rÑ  rs  r×  rØ  s   /foor/  :Nrg   Nz;Cross-scheme redirects can't be tested without TLS support.r\   iû   s   :8443ó   example.netó   /baró   locationr·  r¸  )rK   r$  rw   r#  r   r½   r©   rú   r  rp   r   r1   rB   r6   r»  r˜  r  rü   )rX   r[  rÅ  rÇ  rÈ  rÉ  ÚstartDomainÚstartSchemeÚ	startPortrn  ro  rm  rn  ÚtargetSchemeÚtargetDomainÚ
targetPortÚ
portSyntaxÚlocationValuerî  rÿ  Úreq2Úres2s   &&&&&&                rY   Ú_testRedirectDefaultÚ-_RedirectAgentTestsMixin._testRedirectDefaultu
  sá  € ð %ˆÜ"%¢/‘h°wˆØ%¨Ô0‘B°cˆ	Ø�
‰
×ÑØ�K &Õ(¨;Õ6¸Õ@È.ð 	ô 	
ð —\‘\×,Ñ,×0Ñ0Ó2°2Õ6‰
ˆØ×Ñœ¨Ô.Ø×Ñ˜Ô)à—=‘=×)Ñ)×-Ñ-Ó/‰ˆð #ˆØ"ˆØˆ
çÜŠ{ÜØQóð ð (3°gÔ'=™8À7ˆLØ )¨R¤™°RˆJàˆ
ßØˆJØ!ˆJß)4‘~¸+ˆØ$ vÕ-°Õ<¸zÕIÈGÕSˆÜ×&Ò&¨°m°_Ð'EÓFˆÜ˜O¨T°5¸'À4ÓHˆØ�‰�XÔà—]‘]×+Ñ+×/Ñ/Ó1‰
ˆˆdØ×Ñ˜ §¡Ô-Ø×Ñ˜ $§(¡(Ô+à—\‘\×,Ñ,×0Ñ0Ó2°2Õ6‰
ˆØ×Ñ¯;�¼NÈDÔQØ×Ñ˜Ô*Øˆr\   c                ó(   € V P                  R4       R# )z?
L{client.RedirectAgent} follows redirects on status code 301.
é-  N©rÙ  rr   s   &rY   Útest_redirect301Ú)_RedirectAgentTestsMixin.test_redirect301³
  ó   € ð 	×!Ñ! #Ö&r\   c                ó,   € V P                  RRR7       R# )z9
L{client.RedirectAgent} follows cross-scheme redirects.
rÜ  T©rÅ  NrÝ  rr   s   &rY   Útest_redirect301SchemeÚ/_RedirectAgentTestsMixin.test_redirect301Scheme¹
  s   € ð 	×!Ñ!ØØð 	"ö 	
r\   c                ó(   € V P                  R4       R# )z?
L{client.RedirectAgent} follows redirects on status code 302.
é.  NrÝ  rr   s   &rY   Útest_redirect302Ú)_RedirectAgentTestsMixin.test_redirect302Â
  rà  r\   c                ó(   € V P                  R4       R# )z?
L{client.RedirectAgent} follows redirects on status code 307.
é3  NrÝ  rr   s   &rY   Útest_redirect307Ú)_RedirectAgentTestsMixin.test_redirect307È
  rà  r\   c                ó(   € V P                  R4       R# )z?
L{client.RedirectAgent} follows redirects on status code 308.
i4  NrÝ  rr   s   &rY   Útest_redirect308Ú)_RedirectAgentTestsMixin.test_redirect308Î
  rà  r\   c               ó$   € V ^8„  d   QhRRRRRR/# )rg   ÚexpectedHostHeaderr„   ÚcrossKwargsrÆ  rh   ri   rb   )rj   s   "rY   rk   rÊ  Ô
  s$   € ÷ +
ñ +
Ø"'ð+
ØIMð+
à	ñ+
r\   c                óœ  € RR.RR.RR.RR.R	R
.RR./pRR./p\        / VCVC4      pV P                  RVR7      pR R lpV! VP                  4      pV P                  VRR./V! V4      C4       V P                  ! R/ VBR\        / VCVC4      /B p	V! V	P                  4      p
V P                  V
RV./V! \        V4      4      C4       R# )z^
L{client.RedirectAgent} scrubs sensitive headers when redirecting
between differing origins.
ó   authorizations   sensitive-authnzrû  s   sensitive-cookie-dataó   cookie2s   sensitive-cookie2-dataó   proxy-authorizations   sensitive-proxy-auths   wWw-auThentiCates   sensitive-authns   x-custom-sensitives   sensitive-customs   x-random-headers   x-random-valuerÜ  )rÉ  c               ó    € V ^8„  d   QhRRRR/# )rg   rî  rB   rh   zDict[bytes, Sequence[bytes]]rb   )rj   s   "rY   rk   ÚD_RedirectAgentTestsMixin._sensitiveHeadersTest.<locals>.__annotate__ç
  s   € ÷ 	Kñ 	K ð 	KÐ-Iñ 	Kr\   c                ót   € V P                  4        UUu/ uF  w  rVP                  4       VbK  	  upp# u uppi r~   )rì  Úlower)rî  r´  Úvs   &  rY   ÚnormHeadersÚC_RedirectAgentTestsMixin._sensitiveHeadersTest.<locals>.normHeadersç
  s1   € Ø/6×/GÑ/GÔ/IÔJÑ/I¡V a�A—G‘G“I˜q’LÑ/IÒJÐJùÓJs   ”4r;  rW  rÉ  N)rÜ  )rB   rÙ  rî  r�  )rX   rñ  rò  ÚsensitiveHeaderValuesÚotherHeaderValuesÚ
allHeadersÚ
redirectedrü  ÚsameOriginHeadersÚredirectedElsewhereÚotherOriginHeaderss   &&,        rY   Ú_sensitiveHeadersTestÚ._RedirectAgentTestsMixin._sensitiveHeadersTestÔ
  s@  € ð Ð2Ð3ØÐ0Ð1ØÐ2Ð3Ø"Ð%<Ð$=ØÐ"4Ð!5Ø!Ð$7Ð#8ð!
Ðð 0Ð2CÐ1DÐEÐÜÐKÐ 5ÐKÐ9JÐKÓLˆ
Ø×.Ñ.¨sÀ:Ð.ÓNˆ
õ	Kñ (¨
×(:Ñ(:Ó;ÐØ×ÑØà˜.Ð)ðá˜jÓ)ðô	
ð #×7Ò7ñ 
àñ
ô #Ð#QÐ&;Ð#QÐ?PÐ#QÓRò
Ðñ
 )Ð)<×)DÑ)DÓEÐØ×ÑØàÐ,Ð-ðáœgÐ&7Ó8Ó9ðö	
r\   c               ó   € V ^8„  d   QhRR/# rf   rb   )rj   s   "rY   rk   rÊ    s   € ÷ Xñ X¨ñ Xr\   c                ó,   € V P                  RRR7       R# )z^
L{client.RedirectAgent} scrubs sensitive headers when redirecting
between differing domains.
TrÌ  )rÇ  rñ  N©r  rr   s   &rY   Útest_crossDomainHeadersÚ0_RedirectAgentTestsMixin.test_crossDomainHeaders  s   € ð
 	×"Ñ"¨tÈÐ"ÖWr\   c               ó   € V ^8„  d   QhRR/# rf   rb   )rj   s   "rY   rk   rÊ    s   € ÷ 
ñ 
 tñ 
r\   c                ó,   € V P                  RRR7       R# )z\
L{client.RedirectAgent} scrubs sensitive headers when redirecting
between differing ports.
Ts   example.com:8443)rÈ  rñ  Nr	  rr   s   &rY   Útest_crossPortHeadersÚ._RedirectAgentTestsMixin.test_crossPortHeaders  s   € ð
 	×"Ñ"ØÐ/Bð 	#ö 	
r\   c               ó   € V ^8„  d   QhRR/# rf   rb   )rj   s   "rY   rk   rÊ    s   € ÷ 5ñ 5¨ñ 5r\   c                ó*   € V P                  RR7       R# )z^
L{client.RedirectAgent} scrubs sensitive headers when redirecting
between differing schemes.
Trâ  Nr	  rr   s   &rY   Útest_crossSchemeHeadersÚ0_RedirectAgentTestsMixin.test_crossSchemeHeaders  s   € ð
 	×"Ñ"¨tÐ"Ö4r\   c                ó¸  € V P                   P                  VR4       V P                  P                  P	                  4       w  r4\
        P                  ! RR./4      p\        RVRVR4      pVP                  V4       V P                  P                  P	                  4       w  rxV P                  RVP                  4       V P                  RVP                  4       R# )	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/barr·  Nr×  rÍ  r¸  )r$  rw   r  rp   r½   r1   rB   r6   r»  r©   r˜  r  )	rX   r[  r˜  rm  rn  rî  rÿ  r×  rØ  s	   &&&      rY   Ú_testRedirectToGetÚ+_RedirectAgentTestsMixin._testRedirectToGet  s¬   € ð 	�
‰
×Ñ˜6Ð#<Ô=à—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&¨Ð6OÐ5PÐ'QÓRˆÜ˜O¨T°5¸'À4ÓHˆØ�‰�XÔà—]‘]×+Ñ+×/Ñ/Ó1‰
ˆØ×Ñ˜ §¡Ô-Ø×Ñ˜ $§(¡(Ö+r\   c                ó*   € V P                  RR4       R# )zh
L{client.RedirectAgent} changes the method to I{GET} when getting a 303
redirect on a I{POST} request.
i/  ru  N©r  rr   s   &rY   Útest_redirect303Ú)_RedirectAgentTestsMixin.test_redirect303-  ó   € ð
 	×Ñ  WÖ-r\   c                óŠ  € V P                   P                  RR4      pV P                  P                  P	                  4       w  r#\
        P                  ! 4       p\        RRRVR4      pVP                  V4       V P                  V\        P                  4      pVP                  P                  ^ ,          P                  \        P                   4       V P#                  RVP                  P                  ^ ,          P                  P$                  4       V P#                  RVP                  P&                  P(                  4       R# )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  rÜ  r·  Nr¸  )r$  rw   r  rp   r½   r1   rB   r6   r»  rÕ   r/   r7   r�  rr  rÖ   r0   ÚRedirectWithNoLocationr©   r  rÿ  r[  )rX   rõ  rm  rn  rî  rÿ  Úfails   &      rY   Útest_noLocationFieldÚ-_RedirectAgentTestsMixin.test_noLocationField4  sè   € ð —:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ó(ˆÜ˜O¨S°%¸À$ÓGˆØ�‰�XÔà×#Ñ# H¬f×.CÑ.CÓDˆØ�
‰
×Ñ˜1Õ×"Ñ"¤5×#?Ñ#?Ô@Ø×ÑÐ2°D·J±J×4FÑ4FÀqÕ4I×4OÑ4O×4SÑ4SÔTØ×Ñ˜˜dŸj™j×1Ñ1×6Ñ6Ö7r\   c                óˆ  € V P                   P                  VR4      pV P                  P                  P	                  4       w  rE\
        P                  ! 4       p\        RVRVR4      pVP                  V4       V P                  V\        P                  4      pVP                  P                  ^ ,          P                  \        P                   4       V P#                  RVP                  P                  ^ ,          P                  P$                  4       V P#                  WP                  P&                  P(                  4       R# )zé
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  r·  Nr¸  )r$  rw   r  rp   r½   r1   rB   r6   r»  rÕ   r/   r7   r�  rr  rÖ   r0   ÚPageRedirectr©   Úlocationrÿ  r[  )	rX   r[  r˜  rõ  rm  rn  rî  rÿ  r  s	   &&&      rY   Ú_testPageRedirectFailureÚ1_RedirectAgentTestsMixin._testPageRedirectFailureG  sê   € ð —:‘:×%Ñ% fÐ.GÓHˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&Ó(ˆÜ˜O¨T°5¸'À4ÓHˆØ�‰�XÔà×#Ñ# H¬f×.CÑ.CÓDˆØ�
‰
×Ñ˜1Õ×"Ñ"¤5×#5Ñ#5Ô6Ø×ÑØ% t§z¡z×'9Ñ'9¸!Õ'<×'BÑ'B×'KÑ'Kô	
ð 	×Ñ˜Ÿz™z×2Ñ2×7Ñ7Ö8r\   c                ó*   € V P                  RR4       R# )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ê  ru  N©r%  rr   s   &rY   Útest_307OnPostÚ'_RedirectAgentTestsMixin.test_307OnPost`  ó   € ð 	×%Ñ% c¨7Ö3r\   c                ón  € V P                  V P                  4      p\        P                  ! V^4      pVP	                  RR4      pV P
                  P                  P                  4       w  rE\        P                  ! RR./4      p\        RRRVR4      pVP                  V4       V P
                  P                  P                  4       w  r‰\        RRRVR4      p
V	P                  V
4       V P                  V\        P                  4      pVP                  P                  ^ ,          P!                  \"        P$                  4       V P'                  RVP                  P                  ^ ,          P                  P(                  4       V P'                  RVP                  P*                  P,                  4       R# )	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æ  r·  Nr¸  )r%  r#  r/   ÚRedirectAgentrw   r  rp   r½   r1   rB   r6   r»  rÕ   r7   r�  rr  rÖ   r0   ÚInfiniteRedirectionr©   r$  rÿ  r[  )rX   r$  ÚredirectAgentrõ  rm  rn  rî  rÿ  r×  rØ  Ú	response2r  s   &           rY   Útest_redirectLimitÚ+_RedirectAgentTestsMixin.test_redirectLimith  sQ  € ð ×-Ñ-¨d¯l©lÓ;ˆÜ×,Ò,¨U°AÓ6ˆà ×(Ñ(¨Ð1JÓKˆà—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&¨Ð6OÐ5PÐ'QÓRˆÜ˜O¨S°%¸À$ÓGˆØ�‰�XÔà—]‘]×+Ñ+×/Ñ/Ó1‰
ˆä˜_¨c°5¸'À4ÓHˆ	Ø�‰�iÔ à×#Ñ# H¬f×.CÑ.CÓDˆà�
‰
×Ñ˜1Õ×"Ñ"¤5×#<Ñ#<Ô=Ø×ÑØ% t§z¡z×'9Ñ'9¸!Õ'<×'BÑ'B×'KÑ'Kô	
ð 	×Ñ˜˜dŸj™j×1Ñ1×6Ñ6Ö7r\   c                ó¶  € V P                   P                  RV4       V P                  P                  P	                  4       w  rE\
        P                  ! RV./4      p\        RRRVR4      pVP                  V4       V P                  P                  P	                  4       w  r‰V P                  RVP                  4       V P                  W8P                  4       R# )a  
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Î  ræ  r·  Nr¸  )r$  rw   r  rp   r½   r1   rB   r6   r»  r©   r˜  r¼  )
rX   r  r$  ÚfinalURIrm  rn  rî  rÿ  r×  rØ  s
   &&&&      rY   Ú_testRedirectURIÚ)_RedirectAgentTestsMixin._testRedirectURI†  s©   € ð 	�
‰
×Ñ˜6 3Ô'à—=‘=×)Ñ)×-Ñ-Ó/‰ˆä×&Ò&¨°h°ZÐ'@ÓAˆÜ˜O¨S°%¸À$ÓGˆØ�‰�XÔà—]‘]×+Ñ+×/Ñ/Ó1‰
ˆØ×Ñ˜ §¡Ô-Ø×Ñ˜×#3Ñ#3Ö4r\   c                óx   € V P                  RRR4       V P                  RRR4       V P                  RRR4       R# )	zg
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©r5  rr   s   &rY   Útest_relativeURIÚ)_RedirectAgentTestsMixin.test_relativeURI�  sJ   € ð
 	×ÑØ)¨6Ð3Pô	
ð 	×ÑØ)¨7Ð4Mô	
ð 	×ÑØ)¨9Ð6Qö	
r\   c                óR   € V P                  RRR4       V P                  RRR4       R# )zë
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#fragr9  s   http://example.com/baz?a#fragr8  s   /baz?a#frag2s   http://example.com/baz?a#frag2Nr:  rr   s   &rY   Ú!test_relativeURIPreserveFragmentsÚ:_RedirectAgentTestsMixin.test_relativeURIPreserveFragments¬  s4   € ð 	×ÑØ.ØØ,ô	
ð
 	×ÑØ)ØØ-ö	
r\   c                óR   € V P                  RRR4       V P                  RRR4       R# )zƒ
L{client.RedirectAgent} resolves and follows scheme relative I{URI}s in
redirects, replacing the hostname and port when required.
r8  s   //foo.com/bazs   http://foo.com/bazs   //foo.com:81/bazs   http://foo.com:81/bazNr:  rr   s   &rY   Útest_relativeURISchemeRelativeÚ7_RedirectAgentTestsMixin.test_relativeURISchemeRelative¿  s4   € ð
 	×ÑØ)Ð+;Ð=Rô	
ð 	×ÑØ)Ð+>Ð@Xö	
r\   c                óh  € V P                  V P                  4      p\        P                  ! V4      pVP	                  RR4      pV P
                  P                  P                  4       w  rE\        P                  ! RR./4      p\        RRRVR4      pVP                  V4       V P
                  P                  P                  4       w  r‰\        R^ÈRVR4      p
V	P                  V
4       V P                  V4      pV P                  VP                  V4       V P                  VP                  R4       R# )	zy
L{Response.response} references the previous L{Response} from
a redirect, or L{None} if there was no previous response.
r×  r  rÎ  r  ræ  r·  Nr¸  )r%  r#  r/   r-  rw   r  rp   r½   r1   rB   r6   r»  r¿   rz  rÀ  )rX   r$  r/  rõ  ÚredirectReqÚredirectResrî  ÚredirectResponserm  rn  rÿ  ÚfinalResponses   &           rY   Útest_responseHistoryÚ-_RedirectAgentTestsMixin.test_responseHistoryË  s  € ð
 ×-Ñ-¨d¯l©lÓ;ˆÜ×,Ò,¨UÓ3ˆà ×(Ñ(¨Ð1JÓKˆà#'§=¡=×#9Ñ#9×#=Ñ#=Ó#?Ñ ˆä×&Ò&¨Ð6OÐ5PÐ'QÓRˆÜ# O°S¸%ÀÈ$ÓOÐØ×ÑÐ-Ô.à—=‘=×)Ñ)×-Ñ-Ó/‰ˆä˜O¨S°%¸À$ÓGˆØ�‰�XÔà×,Ñ,¨XÓ6ˆØ×Ñ˜]×;Ñ;Ð=MÔNØ×ÑÐ-×>Ñ>ÀÖEr\   rb   )FFFN)rW  )r]   r^   r_   r`   rz   Ú__annotations__rÁ  rÙ  rÞ  rã  rç  rë  rî  r  r
  r  r  r  r  r   r%  r)  r1  r5  r;  r>  rA  rH  ra   rb   r\   rY   r¾  r¾  Y
  sŒ   ‡ ñð
 ƒMØÓØÓò<÷$<ò|'ò
ò'ò'ò'÷+
õZXõ
õ5ò,ò*.ò8ò&9ò24ò8ò<5ò.
ò
ò&

öFr\   r¾  c                  ó2   € ] tR tRtRtR tR tR tR tRt	R# )	ÚRedirectAgentTestsiå  z$
Tests for L{client.RedirectAgent}.
c                óf   € \         P                  ! V P                  V P                  4      R.R7      # )z4
@return: a new L{twisted.web.client.RedirectAgent}
s   X-Custom-sensitive©ÚsensitiveHeaderNames)r/   r-  r%  r#  rr   s   &rY   r¼  ÚRedirectAgentTests.makeAgentï  s/   € ô ×#Ò#Ø×)Ñ)¨$¯,©,Ó7Ø"7Ð!8ô
ð 	
r\   c                	óZ   € V P                  4       V n        V P                  4       V n        R # r~   r  rr   s   &rY   r’   ÚRedirectAgentTests.setUpø  ó    € Ø×)Ñ)Ó+ˆŒØ—^‘^Ó%ˆŽ
r\   c                ó*   € V P                  RR4       R# )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Ü  ru  Nr(  rr   s   &rY   Útest_301OnPostÚ!RedirectAgentTests.test_301OnPostü  r+  r\   c                ó*   € V P                  RR4       R# )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æ  ru  Nr(  rr   s   &rY   Útest_302OnPostÚ!RedirectAgentTests.test_302OnPost  r+  r\   rÕ  N)
r]   r^   r_   r`   rz   r¼  r’   rU  rX  ra   rb   r\   rY   rL  rL  å  s   † ñò
ò&ò4ö4r\   rL  c                  ó2   € ] tR tRtRtR tR tR tR tRt	R# )	ÚBrowserLikeRedirectAgentTestsi  z/
Tests for L{client.BrowserLikeRedirectAgent}.
c                óf   € \         P                  ! V P                  V P                  4      R.R7      # )z?
@return: a new L{twisted.web.client.BrowserLikeRedirectAgent}
s   x-Custom-sensitiverN  )r/   ÚBrowserLikeRedirectAgentr%  r#  rr   s   &rY   r¼  Ú'BrowserLikeRedirectAgentTests.makeAgent  s/   € ô ×.Ò.Ø×)Ñ)¨$¯,©,Ó7Ø"7Ð!8ô
ð 	
r\   c                	óZ   € V P                  4       V n        V P                  4       V n        R # r~   r  rr   s   &rY   r’   Ú#BrowserLikeRedirectAgentTests.setUp   rS  r\   c                ó*   € V P                  RR4       R# )ús
L{client.BrowserLikeRedirectAgent} changes the method to I{GET} when
getting a 302 redirect on a I{POST} request.
rÜ  ru  Nr  rr   s   &rY   Útest_redirectToGet301Ú3BrowserLikeRedirectAgentTests.test_redirectToGet301$  r  r\   c                ó*   € V P                  RR4       R# )rb  ræ  ru  Nr  rr   s   &rY   Útest_redirectToGet302Ú3BrowserLikeRedirectAgentTests.test_redirectToGet302+  r  r\   rÕ  N)
r]   r^   r_   r`   rz   r¼  r’   rc  rf  ra   rb   r\   rY   r[  r[    s   † ñò
ò&ò.ö.r\   r[  c                  ó$   € ] tR tRtRtRtR tRtR# )ÚAbortableStringTransporti3  zC
A version of L{StringTransport} that supports C{abortConnection}.
Fc                ó4   € RV n         V P                  4        R# )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ÚloseConnectionrr   s   &rY   ÚabortConnectionÚ(AbortableStringTransport.abortConnection;  s   € ð ˆŒØ×ÑÖr\   )rk  N)r]   r^   r_   r`   rz   rk  rm  ra   rb   r\   rY   ri  ri  3  s   † ñð
 €Hör\   ri  c                  ó6   € ] tR tRtRt^ÈtRtR]3R ltR t	Rt
R# )ÚDummyResponseiF  al  
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.
r·  Nc                óF   € Vf   \        4       pWn        V! 4       V n        R# )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)rB   rî  rZ  )rX   rî  ÚtransportFactorys   &&&rY   rs   ÚDummyResponse.__init__U  s   € ð Š?Ü“iˆGØŒÙ)Ó+ˆŽr\   c                ó\   € Wn         V P                   P                  V P                  4       R# )z\
Record the given protocol and use it to make a connection with
L{DummyResponse.transport}.
N©r  r(  rZ  r^  s   &&rY   ra  ÚDummyResponse.deliverBodyb  s   € ð
 !ŒØ�‰×$Ñ$ T§^¡^Ö4r\   )rî  r  rZ  )r]   r^   r_   r`   rz   r[  r\  ri  rs   ra  ra   rb   r\   rY   rp  rp  F  s#   † ñ	ð €DØ€Fà#Ð6Nô ,ö5r\   rp  c                  ó    € ] tR tRtRtR tRtR# )ÚAlreadyCompletedDummyResponseik  z=
A dummy response that has already had its transport closed.
c                ó~   € Wn         V P                   P                  V P                  4       RV P                   n        R# )z1
Make the connection, then remove the transport.
Nru  r^  s   &&rY   ra  Ú)AlreadyCompletedDummyResponse.deliverBodyp  s+   € ð !ŒØ�‰×$Ñ$ T§^¡^Ô4Ø"&ˆ�‰Ör\   r  N)r]   r^   r_   r`   rz   ra  ra   rb   r\   rY   rx  rx  k  s   † ñö'r\   rx  c                  ó>   € ] tR tRtRtR tR tR tR tR t	R t
R	tR
# )ÚReadBodyTestsiy  z
Tests for L{client.readBody}
c                óL  € \        4       p\        P                  ! V4      pVP                  P	                  R4       VP                  P	                  R4       VP                  P                  \        \        4       4      4       V P                  V P                  V4      R4       R# )zx
L{client.readBody} returns a L{Deferred} which fires with the complete
body of the L{IResponse} provider passed to it.
ó   firstó   secondó   firstsecondN)
rp  r/   ÚreadBodyr  rP  rª  r)   r?   r©   r¿   )rX   rÿ  rQ  s   &  rY   Útest_successÚReadBodyTests.test_success~  sw   € ô
 !“?ˆÜ�OŠO˜HÓ%ˆØ×Ñ×&Ñ& xÔ0Ø×Ñ×&Ñ& yÔ1Ø×Ñ×(Ñ(¬´³Ó)@ÔAØ×Ñ˜×-Ñ-¨aÓ0°.ÖAr\   c                óð   € \        4       p\        P                  ! V4      pVP                  4        V P	                  V\
        P                  4       V P                  VP                  P                  4       R# )zo
When cancelling the L{Deferred} returned by L{client.readBody}, the
connection to the server will be aborted.
N)
rp  r/   r�  rÛ   rÕ   r   r   r•   rZ  rk  )rX   rÿ  rõ  s   &  rY   Útest_cancelÚReadBodyTests.test_cancelŠ  sQ   € ô
 !“?ˆÜ—?’? 8Ó,ˆØ�‰ÔØ×Ñ˜X¤u×';Ñ';Ô<Ø�‰˜×*Ñ*×3Ñ3Ö4r\   c           	     ó  € \        4       p\        P                  ! V4      pVP                  P	                  R4       VP                  P	                  R4       VP                  P                  \        \        4       4      4       V P                  V4      pVP                  \        P                  4       V P                  RVP                  P                  RVP                  P                  RVP                  P                  /RRRRRR/4       R	# )
zò
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   200r·  r€  N)rp  r/   r�  r  rP  rª  r)   r3   rÕ   rÖ   ÚPartialDownloadErrorr©   r�  rˆ  r)  rÿ  )rX   rÿ  rQ  Úfailures   &   rY   Útest_withPotentialDataLossÚ(ReadBodyTests.test_withPotentialDataLoss•  sÖ   € ô !“?ˆÜ�OŠO˜HÓ%ˆØ×Ñ×&Ñ& xÔ0Ø×Ñ×&Ñ& yÔ1Ø×Ñ×(Ñ(¬Ô1BÓ1DÓ)EÔFØ×&Ñ& qÓ)ˆØ�‰”V×0Ñ0Ô1Ø×Ñà˜'Ÿ-™-×.Ñ.Ø˜7Ÿ=™=×0Ñ0Ø˜Ÿ™×.Ñ.ðð ˜&Ø˜5Ø˜ðö	
r\   c                ón  € \        4       p\        P                  ! V4      pVP                  P	                  R4       VP                  P                  \        \        R4      4      4       V P                  V4      pVP                  \        4       V P                  VP                  P                  R4       R# )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 problemN)rŽ  )rp  r/   r�  r  rP  rª  r)   r   rÕ   rÖ   r©   r�  r  )rX   rÿ  rQ  rL  s   &   rY   Útest_otherErrorsÚReadBodyTests.test_otherErrors°  sƒ   € ô !“?ˆÜ�OŠO˜HÓ%ˆØ×Ñ×&Ñ& xÔ0Ø×Ñ×(Ñ(¬´Ð@QÓ1RÓ)SÔTØ×%Ñ% aÓ(ˆØ�‰”NÔ#Ø×Ñ˜Ÿ™×*Ñ*Ð,@ÖAr\   c                óê   a€ \        \        R7      oRSP                  n        V P	                  \
        R\        V3R l4      pVP                  4        V P                  V\        P                  4       R# )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.
)rr  NzLUsing readBody with a transport that does not have an abortConnection methodc                 ó0   <€ \         P                  ! S 4      # r~   )r/   r�  )rÿ  s   €rY   rŠ   Ú8ReadBodyTests.test_deprecatedTransport.<locals>.<lambda>Ë  s   ø€ ”F—O’O HÔ-r\   )rp  r%   rZ  rm  ÚassertWarnsr+  Ú__file__rÛ   rÕ   r   r   )rX   rQ  rÿ  s   & @rY   Útest_deprecatedTransportÚ&ReadBodyTests.test_deprecatedTransport¾  s\   ø€ ô !´/ÔBˆØ-1ˆ×ÑÔ*Ø×ÑÜð%äÜ-ó
ˆð 	
�‰Œ
Ø×Ñ˜Q¤× 4Ñ 4Ö5r\   c                óœ   € \        4       p\        P                  ! V4       V P                  4       pV P	                  \        V4      ^ 4       R# )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.
N)rx  r/   r�  r*  r©   r¯   )rX   rÿ  r,  s   &  rY   Ú!test_deprecatedTransportNoWarningÚ/ReadBodyTests.test_deprecatedTransportNoWarningÐ  s:   € ô 1Ó2ˆÜ�Š˜Ô!à×%Ñ%Ó'ˆØ×Ñœ˜X›¨Ö*r\   rb   N)r]   r^   r_   r`   rz   r‚  r…  r‹  r�  r–  r™  ra   rb   r\   rY   r|  r|  y  s'   † ñò
Bò	5ò
ò6Bò6ö$
+r\   r|  c                  ó(   € ] tR tRtR tR tR tRtR# )ÚHostnameCachingHTTPSPolicyTestsiÝ  c                óÊ  € \        4       p\        VR7      p\        V4      pVP                  RR4      pV P	                  VP
                  4       RVn        V P                  ^\        VP                  4      4       VP                  R4      pV P                  VP                  VP                  4       4       VP                  RR4       V P                  VP
                  4       R# )z„
Verify that the connection creator is added to the
policy's cache, and that it is reused on subsequent calls
to creatorForNetLoc.

r1  r-  i5  FN)rS   r:   r<   r  r•   rV   r�  r¯   Ú_cacher  rÒ  rW   r3  rx  )rX   r2  ÚwrappedPolicyr4  r5  r6  s   &     rY   Útest_cacheIsUsedÚ0HostnameCachingHTTPSPolicyTests.test_cacheIsUsedß  s¶   € ô +Ó,ˆ	Ü1¸IÔFˆÜ+¨MÓ:ˆØ×)Ñ)¨&°$Ó7ˆØ�‰˜	×(Ñ(Ô)Ø ˆ	ÔØ×Ñ˜!œS §¡Ó/Ô0Ø×3Ñ3°DÓ9ˆ
Ø�‰�i×'Ñ'¨×)?Ñ)?Ó)AÔBà×Ñ ¨Ô-Ø×Ñ˜×)Ñ)Ö*r\   c                ó   € \        4       p\        VR7      p\        V4      p\        ^ ^4       F6  pR\	        V4      ,           pVP                  VP                  R4      R4       K8  	  RpVP                  VP                  R4      R4       V P                  WcP                  4       V P                  ^\        VP                  4      4       RpVP                  VP                  R4      R4       RpV P                  WƒP                  4       V P                  ^\        VP                  4      4       V P                  WsP                  4       V P                  WcP                  4       \        ^4       F$  p	VP                  VP                  R4      R4       K&  	  R	p
VP                  V
P                  R4      R
4       V P                  RVP                  4       V P                  ^\        VP                  4      4       V P                  W£P                  4       V P                  WsP                  4       V P                  WcP                  4       R# )z\
Verify that when the cache is full, and a new entry is added,
the oldest entry is removed.
r1  rn  r:  éã!  Úhost0é5  ÚnewÚhost1Únew1i   Úhost2N©rS   r:   r<   r¼   Ústrr  r`  r\  rž  r�  r¯   rG  )rX   r2  rŸ  r4  rÅ   r  r¤  Úhostnr§  rÏ  Ú
hostNPlus1s   &          rY   Útest_cacheRemovesOldestÚ7HostnameCachingHTTPSPolicyTests.test_cacheRemovesOldestó  sµ  € ô
 +Ó,ˆ	Ü1¸IÔFˆÜ+¨MÓ:ˆÜ�q˜"–ˆAØ¤ A£•ˆHØ×#Ñ# H§O¡O°GÓ$<¸dÖCñ ð
 ˆØ×Ñ §¡¨WÓ 5°sÔ;Ø�‰�eŸ]™]Ô+Ø×Ñ˜"œc &§-¡-Ó0Ô1àˆØ×Ñ §¡¨WÓ 5°sÔ;àˆØ×Ñ˜§¡Ô.Ø×Ñ˜"œc &§-¡-Ó0Ô1à�‰�eŸ]™]Ô+Ø�‰�eŸ]™]Ô+ô �r–ˆAØ×#Ñ# E§L¡L°Ó$9¸4Ö@ñ ð ˆ
à×Ñ 
× 1Ñ 1°'Ó :¸CÔ@à×Ñ˜ &§-¡-Ô0Ø×Ñ˜"œc &§-¡-Ó0Ô1à�‰�j§-¡-Ô0Ø�‰�eŸ]™]Ô+Ø�‰�eŸ]™]Ö+r\   c                óX  € \        4       p\        VR7      p\        V^R7      p\        ^ ^4       F6  pR\	        V4      ,           pVP                  VP                  R4      R4       K8  	  RpV P                  WcP                  4       V P                  ^\        VP                  4      4       RpVP                  VP                  R4      R4       V P                  WcP                  4       V P                  ^\        VP                  4      4       V P                  WsP                  4       R	# )
zp
Verify that changing the cache size results in a policy that
respects the new cache size and not the default.

r1  )Ú	cacheSizern  r:  r£  r¤  r¦  r¥  Nrª  )rX   r2  rŸ  r4  rÅ   r  Úfirstr¬  s   &       rY   Útest_changeCacheSizeÚ4HostnameCachingHTTPSPolicyTests.test_changeCacheSize  sá   € ô +Ó,ˆ	Ü1¸IÔFˆÜ+¨MÀQÔGˆÜ�q˜!–ˆAØ¤ A£•ˆHØ×#Ñ# H§O¡O°GÓ$<¸dÖCñ ð ˆØ�‰�eŸ]™]Ô+Ø×Ñ˜!œS §¡Ó/Ô0àˆØ×Ñ §¡¨WÓ 5°sÔ;Ø×Ñ˜§¡Ô.Ø×Ñ˜!œS §¡Ó/Ô0à�‰�eŸ]™]Ö+r\   rb   N)r]   r^   r_   r`   r   r®  r³  ra   rb   r\   rY   rœ  rœ  Ý  s   † ò+ò(),öV,r\   rœ  c                  ó    € ] tR tRtRtR tRtR# )ÚRequestMethodInjectionTestsi7  z8
Test L{client.Request} against HTTP method injections.
c                ó`   € \         P                  ! VR\        P                  ! 4       RR7       R# )rÙ  rÚ  N©r˜  r  rî  r=  ©r/   r>   r1   rB   )rX   r˜  s   &&rY   rÜ  Ú=RequestMethodInjectionTests.attemptRequestWithMaliciousMethod?  s%   € ô 	�ŠØØ)Ü ×(Ò(Ó*Ø÷		
r\   rb   NrÞ  rb   r\   rY   r¶  r¶  7  ó   † ñö
r\   r¶  c                  ó    € ] tR tRtRtR tRtR# )Ú"RequestWriteToMethodInjectionTestsiM  ú@
Test L{client.Request.writeTo} against HTTP method injections.
c                óª   € \         P                  ! RR./4      p\        P                  ! RRVRR7      pWn        VP                  \        4       4       R# )rÙ  rä  ó   twisted.invalidr×  rÚ  Nr¸  )r1   rB   r/   r>   r˜  ÚwriteTor%   )rX   r˜  rî  rm  s   &&  rY   rÜ  ÚDRequestWriteToMethodInjectionTests.attemptRequestWithMaliciousMethodU  sM   € ô ×&Ò&¨Ð2DÐ1EÐ'FÓGˆÜ�nŠnØØ)ØØô	
ˆð Œ
Ø�‰”OÓ%Ö&r\   rb   NrÞ  rb   r\   rY   r½  r½  M  ó   † ñö'r\   r½  c                  ó    € ] tR tRtRtR tRtR# )ÚRequestURIInjectionTestsif  z5
Test L{client.Request} against HTTP URI injections.
c                ó`   € \         P                  ! RV\        P                  ! 4       RR7       R# )zX
Attempt a request with the provided URI.

@param method: see L{URIInjectionTestsMixin}
r×  Nr¸  r¹  r  s   &&rY   rã  Ú7RequestURIInjectionTests.attemptRequestWithMaliciousURIn  s%   € ô 	�ŠØØÜ ×(Ò(Ó*Ø÷		
r\   rb   Nrå  rb   r\   rY   rÅ  rÅ  f  r»  r\   rÅ  c                  ó    € ] tR tRtRtR tRtR# )ÚRequestWriteToURIInjectionTestsi|  r¾  c                óª   € \         P                  ! RR./4      p\        P                  ! RRVRR7      pWn        VP                  \        4       4       R# )z[
Attempt a request with the provided method.

@param method: see L{URIInjectionTestsMixin}
rä  rÀ  r×  rÚ  Nr¸  )r1   rB   r/   r>   r  rÁ  r%   )rX   r  rî  rm  s   &&  rY   rã  Ú>RequestWriteToURIInjectionTests.attemptRequestWithMaliciousURI„  sM   € ô ×&Ò&¨Ð2DÐ1EÐ'FÓGˆÜ�nŠnØØ)ØØô	
ˆð ŒØ�‰”OÓ%Ö&r\   rb   Nrå  rb   r\   rY   rÉ  rÉ  |  rÃ  r\   rÉ  )rô  rû  rõ  rö  s   www-authenticate)©rz   Ú
__future__r   re  Ú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.webr/   r0   r1   Útwisted.web._newclientr2   r3   r4   r5   r6   r7   r8   rU  r9   r:   r;   r<   r=   r>   r?   r@   Útwisted.web.errorrA   Útwisted.web.http_headersrB   rI  rC   rD   rE   rF   rG   rH   Ú!twisted.web.test.injectionhelpersrI   rJ   ÚtestMixinClassr?  ÚruntimeTestCaserK   Ú_sslrå  Útwisted.internet._sslverifyrL   rM   Útwisted.internet.sslrN   Útwisted.protocolsrO   Útwisted.protocols.tlsrP   rQ   rS   ÚImportErrorrd   r|   r‡   rú   rû   rü   rý   rþ   rÿ   rõ   r,  r2  r7  r=  rº  r¿  r  r	  r×  rá  rç  rR  rs  r½  rÊ  rð  r  r  r   rB  rS  r¦  ÚSENSITIVE_HEADERSr¾  rL  r[  ri  rp  rx  r|  rœ  r¶  r½  rÅ  rÉ  rb   r\   rY   Ú<module>rò     sê  ðñõ #ã Ý $Ý ß G× Gß %å 3Ý .å ç (ß =ß DÑ Dß K÷ñ õ
 Hß 7Ý 'Ý N÷ó õ .Ý 7Ý @Ý *ß 4Ý Iß @ß 3Ñ 3÷÷ ñ ÷	÷ 	ó 	õ 1Ý ,÷÷ ÷÷ Ø€NØ�Oà€NØ€Oð#Ý,ð
 €CØ€JßOÝ8Ý%ßOáÐ"Ó#÷#ð #ó $ð#ô�xô ÷2%ñ %ô]&˜Hô ]&ð@ €ØÐ Ø€Ø€Ø€Ø€
÷P!ñ P!÷f!ñ !÷Gñ Gô �7ô  ôjV˜hÐ(Bô jV÷Z		@ñ 	@÷u
ñ u
ñp Ð"Ó#÷0ð 0ó $ð0ô$Y)ØÐ(¨/Ð;RôY)ôx4ØØØô4ô(4ØØØô4ñ( ˆJŒÐ@ÓAôX
�hÐ :Ð<Só X
ó BðX
ôv?U 8ô ?UôDy, 8Ð-Gô y,÷x!ñ !ô2;
�XÐ/ô ;
ô|h2ØÐÐ :¸Oôh2ôVÑ  Ó+ô ôˆxô ô~+˜xÐ)CÀ_ô ~+ôB#˜(ô #ô4w2 xÐ1Kô w2ôt[6�hÐ :¸Oô [6ò|Ð ôIF˜~ô IFôX%4ØØØØô	%4ôP#.ØØØØô	#.ôL˜ô ÷&"5ñ "5ôJ' Mô 'ôa+�Hô a+ñH ˆJŒÐ@ÓAôV, hó V,ó BðV,ôr
ØØô
ô,'ØØô'ô2
ØØô
ô,'ØØö'øðh ô Ø
€CØƒJðús   Ä)M  Í M/Í.M/