§
    Ètºfç<  ã                  óÖ  — d Z ddlmZ ddgZddlmZ ddlmZmZm	Z	 ddl
mZmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z" ddl#m$Z$m%Z%m&Z& d„ dD ¦   «         Z'dZ(d„ e'D ¦   «         Z)e( *                    d¦  «        Z+ ee¦  «         G d„ d¦  «        ¦   «         Z, G d„ d¦  «        Z- G d„ d¦  «        Z. G d„ dej/        ¦  «        Z0dS )z2
Helpers related to HTTP requests, used by tests.
é    )ÚannotationsÚDummyChannelÚDummyRequest)ÚBytesIO)ÚDictÚListÚOptional)ÚimplementerÚverify)ÚVersion)ÚIPv4AddressÚIPv6Address)ÚDeferred)ÚIAddressÚISSLTransport)ÚClock)Ú
deprecated)Úunittest)ÚFOUND)ÚHeaders)ÚResource)ÚNOT_DONE_YETÚSessionÚSitec                ó   — g | ]}d |› d�‘Œ	S )ÚFooÚbar© )Ú.0Úlws     ú]/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/web/test/requesthelper.pyú
<listcomp>r"      s    € Ð!OÐ!OÐ!O°B -¨ - - -Ð!OÐ!OÐ!Oó    )úú
z
zFoo barc                ó8   — g | ]}|                      d ¦  «        ‘ŒS )Úascii)Úencode)r   Ú	components     r!   r"   r"   !   s3   € ð #ð #ð #Ø"+€I×Ò�WÑÔð#ð #ð #r#   r'   c                  ó   — e Zd ZdZdS )ÚNullAddressz/
    A null implementation of L{IAddress}.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r#   r!   r+   r+   '   s   € € € € € ðð ð ð r#   r+   c                  ó   — e Zd Z G d„ d¦  «        Z ee¦  «         G d„ de¦  «        ¦   «         Z e e¦   «         ¦  «        Z	dd„Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )r   c                  óH   — e Zd ZdZdZdd„Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ ZdS )úDummyChannel.TCPéP   FNc                ón   — |€t          ddd¦  «        }|| _        t          ¦   «         | _        g | _        d S )NÚTCPz192.168.1.1i80  )r   Ú_peerr   ÚwrittenÚ	producers©ÚselfÚpeers     r!   Ú__init__zDummyChannel.TCP.__init__3   s5   € Øˆ|Ý" 5¨-¸Ñ?Ô?�ØˆDŒJÝ"™9œ9ˆDŒLØˆDŒNˆNˆNr#   c                ó   — | j         S ©N)r6   ©r:   s    r!   ÚgetPeerzDummyChannel.TCP.getPeer:   s
   € Ø”:Ðr#   c                óˆ   — t          |t          ¦  «        st          d|›�¦  «        ‚| j                             |¦  «         d S )Nz)Can only write bytes to a transport, not )Ú
isinstanceÚbytesÚ	TypeErrorr7   Úwrite©r:   Údatas     r!   rE   zDummyChannel.TCP.write=   sH   € Ý˜d¥EÑ*Ô*ð VÝÐ TÈDÐ TÐ TÑUÔUÐUØŒL×Ò˜tÑ$Ô$Ð$Ð$Ð$r#   c                ó:   — |D ]}|                       |¦  «         Œd S r>   )rE   )r:   ÚiovecrG   s      r!   ÚwriteSequencezDummyChannel.TCP.writeSequenceB   s0   € Øð !ð !�Ø—
’
˜4Ñ Ô Ð Ð ð!ð !r#   c                ó.   — t          dd| j        ¦  «        S )Nr5   z10.0.0.1)r   Úportr?   s    r!   ÚgetHostzDummyChannel.TCP.getHostF   s   € Ý˜u j°$´)Ñ<Ô<Ð<r#   c                ó>   — | j                              ||f¦  «         d S r>   )r8   Úappend©r:   ÚproducerÚ	streamings      r!   ÚregisterProducerz!DummyChannel.TCP.registerProducerI   s#   € ØŒN×!Ò! 8¨YÐ"7Ñ8Ô8Ð8Ð8Ð8r#   c                ó   — d S r>   r   r?   s    r!   ÚunregisterProducerz#DummyChannel.TCP.unregisterProducerL   s   € ØˆDr#   c                ó   — d| _         d S )NT)Údisconnectedr?   s    r!   ÚloseConnectionzDummyChannel.TCP.loseConnectionO   s   € Ø $ˆDÔÐÐr#   r>   )r,   r-   r.   rL   rW   r<   r@   rE   rJ   rM   rS   rU   rX   r   r#   r!   r5   r2   /   s›   € € € € € ØˆØˆð	 ð 	 ð 	 ð 	 ð	ð 	ð 	ð	%ð 	%ð 	%ð
	!ð 	!ð 	!ð	=ð 	=ð 	=ð	9ð 	9ð 	9ð	ð 	ð 	ð	%ð 	%ð 	%ð 	%ð 	%r#   r5   c                  ó8   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dS )	úDummyChannel.SSLc                ó   — d S r>   r   r?   s    r!   ÚabortConnectionz DummyChannel.SSL.abortConnectionT   ó   € àˆDr#   c                ó   — d S r>   r   r?   s    r!   ÚgetTcpKeepAlivez DummyChannel.SSL.getTcpKeepAliveX   r]   r#   c                ó   — d S r>   r   r?   s    r!   ÚgetTcpNoDelayzDummyChannel.SSL.getTcpNoDelay\   r]   r#   c                ó   — d S r>   r   r?   s    r!   ÚloseWriteConnectionz$DummyChannel.SSL.loseWriteConnection`   r]   r#   c                ó   — d S r>   r   ©r:   Úenableds     r!   ÚsetTcpKeepAlivez DummyChannel.SSL.setTcpKeepAlived   r]   r#   c                ó   — d S r>   r   re   s     r!   ÚsetTcpNoDelayzDummyChannel.SSL.setTcpNoDelayh   r]   r#   c                ó   — d S r>   r   r?   s    r!   ÚgetPeerCertificatez#DummyChannel.SSL.getPeerCertificatel   r]   r#   N)
r,   r-   r.   r\   r_   ra   rc   rg   ri   rk   r   r#   r!   ÚSSLrZ   R   s}   € € € € € ð	ð 	ð 	ð	ð 	ð 	ð	ð 	ð 	ð	ð 	ð 	ð	ð 	ð 	ð	ð 	ð 	ð	ð 	ð 	ð 	ð 	r#   rl   Nc                ó:   — |                       |¦  «        | _        d S r>   )r5   Ú	transportr9   s     r!   r<   zDummyChannel.__init__r   s   € ØŸš $™œˆŒˆˆr#   c                ó   — d S r>   r   )r:   Úrequests     r!   ÚrequestDonezDummyChannel.requestDoneu   ó   € Øˆr#   c                ó0  — t          |t          ¦  «        rd„ |                     ¦   «         D ¦   «         }|dz   |z   dz   |z   dz   }|g}|                     d„ |D ¦   «         ¦  «         |                     d¦  «         | j                             |¦  «         d S )Nc                ó&   — g | ]\  }}|D ]}||f‘ŒŒS r   r   )r   ÚkÚvaluesÚvs       r!   r"   z-DummyChannel.writeHeaders.<locals>.<listcomp>z   sA   € ð ð ð Ù&˜A˜vÈfðð ØIJ��A�ðð ð ð r#   ó    ó   
c              3  ó2   K  — | ]\  }}|d z   |z   dz   V — ŒdS )s   : ry   Nr   )r   ÚnameÚvalues      r!   ú	<genexpr>z,DummyChannel.writeHeaders.<locals>.<genexpr>   s4   è è € ÐXÐXÁÀÀu˜d U™l¨UÑ2°WÑ<ÐXÐXÐXÐXÐXÐXr#   )rB   r   ÚgetAllRawHeadersÚextendrO   rn   rJ   )r:   ÚversionÚcodeÚreasonÚheadersÚresponse_lineÚheaderSequences          r!   ÚwriteHeaderszDummyChannel.writeHeadersx   s¸   € Ý�g�wÑ'Ô'ð 	ðð Ø*1×*BÒ*BÑ*DÔ*Dðñ ô ˆGð   $™¨Ñ-°Ñ4°vÑ=ÀÑGˆØ'˜ˆØ×ÒÐXÐXÐPWÐXÑXÔXÑXÔXÐXØ×Ò˜gÑ&Ô&Ð&ØŒ×$Ò$ ^Ñ4Ô4Ð4Ð4Ð4r#   c                ó4   — | j                              ¦   «         S r>   )rn   r@   r?   s    r!   r@   zDummyChannel.getPeerƒ   ó   € ØŒ~×%Ò%Ñ'Ô'Ð'r#   c                ó4   — | j                              ¦   «         S r>   )rn   rM   r?   s    r!   rM   zDummyChannel.getHost†   rˆ   r#   c                ó<   — | j                              ||¦  «         d S r>   )rn   rS   rP   s      r!   rS   zDummyChannel.registerProducer‰   s    € ØŒ×'Ò'¨°)Ñ<Ô<Ð<Ð<Ð<r#   c                ó8   — | j                              ¦   «          d S r>   )rn   rU   r?   s    r!   rU   zDummyChannel.unregisterProducerŒ   s   € ØŒ×)Ò)Ñ+Ô+Ð+Ð+Ð+r#   c                ó:   — | j                              |¦  «         d S r>   )rn   rE   rF   s     r!   rE   zDummyChannel.write�   s   € ØŒ×Ò˜TÑ"Ô"Ð"Ð"Ð"r#   c                ó:   — | j                              |¦  «         d S r>   )rn   rJ   )r:   rI   s     r!   rJ   zDummyChannel.writeSequence’   s   € ØŒ×$Ò$ UÑ+Ô+Ð+Ð+Ð+r#   c                ó8   — | j                              ¦   «          d S r>   )rn   rX   r?   s    r!   rX   zDummyChannel.loseConnection•   s   € ØŒ×%Ò%Ñ'Ô'Ð'Ð'Ð'r#   c                ó   — d S r>   r   r?   s    r!   Ú
endRequestzDummyChannel.endRequest˜   rr   r#   c                ó6   — t          | j        | j        ¦  «        S r>   )rB   rn   rl   r?   s    r!   ÚisSecurezDummyChannel.isSecure›   s   € Ý˜$œ.¨$¬(Ñ3Ô3Ð3r#   c                ó   — d S r>   r   r?   s    r!   r\   zDummyChannel.abortConnectionž   ó   € àˆr#   c                ó   — d S r>   r   r?   s    r!   r_   zDummyChannel.getTcpKeepAlive¢   r”   r#   c                ó   — d S r>   r   r?   s    r!   ra   zDummyChannel.getTcpNoDelay¦   r”   r#   c                ó   — d S r>   r   r?   s    r!   rc   z DummyChannel.loseWriteConnectionª   r”   r#   c                ó   — d S r>   r   r?   s    r!   rg   zDummyChannel.setTcpKeepAlive®   r”   r#   c                ó   — d S r>   r   r?   s    r!   ri   zDummyChannel.setTcpNoDelay²   r”   r#   c                ó   — d S r>   r   r?   s    r!   rk   zDummyChannel.getPeerCertificate¶   r”   r#   r>   )r,   r-   r.   r5   r
   r   rl   r   r   Úsiter<   rq   r†   r@   rM   rS   rU   rE   rJ   rX   r�   r’   r\   r_   ra   rc   rg   ri   rk   r   r#   r!   r   r   .   s·  € € € € € ð!%ð !%ð !%ð !%ð !%ñ !%ô !%ð !%ðF €[�ÑÔðð ð ð ð ˆcñ ô ñ  Ôðð: ˆ4��‘
”
ÑÔ€Dð(ð (ð (ð (ðð ð ð	5ð 	5ð 	5ð(ð (ð (ð(ð (ð (ð=ð =ð =ð,ð ,ð ,ð#ð #ð #ð,ð ,ð ,ð(ð (ð (ðð ð ð4ð 4ð 4ðð ð ðð ð ðð ð ðð ð ðð ð ðð ð ðð ð ð ð r#   c                  ó.  — e Zd ZU dZdZdZdZded<   ded<   ded	<   ded
<   ded<   ded<   d„ Zd„ Z		 	 d2d3d„Z
d„ Zd„ Zd„ Zd4d„Zd„ Zd„ Zd5d„Zd „ Zd!„ Zd"„ Zd4d#„Zd$„ Zd%„ Z e ed&d'd(d)¦  «        d*¬+¦  «        d,„ ¦   «         Zd-„ Zd.„ Zd/„ Zd6d0„Zd1„ ZdS )7r   a  
    Represents a dummy or fake request. See L{twisted.web.server.Request}.

    @ivar _finishedDeferreds: L{None} or a C{list} of L{Deferreds} which will
        be called back with L{None} when C{finish} is called or which will be
        errbacked if C{processingFailed} is called.

    @type requestheaders: C{Headers}
    @ivar requestheaders: A Headers instance that stores values for all request
        headers.

    @type responseHeaders: C{Headers}
    @ivar responseHeaders: A Headers instance that stores values for all
        response headers.

    @type responseCode: C{int}
    @ivar responseCode: The response code which was passed to
        C{setResponseCode}.

    @type written: C{list} of C{bytes}
    @ivar written: The bytes which have been written to the request.
    s   http://dummy/s   GETNúOptional[IAddress]ÚclientzList[bytes]Úsitepathr7   ÚprepathzDict[bytes, List[bytes]]ÚargszList[Deferred[None]]Ú_finishedDeferredsc                ó\   — d| _         | j         r|                     ¦   «          | j         °dS dS )zû
        Call an L{IPullProducer}'s C{resumeProducing} method in a
        loop until it unregisters itself.

        @param prod: The producer.
        @type prod: L{IPullProducer}

        @param s: Whether or not the producer is streaming.
        é   N)ÚgoÚresumeProducing)r:   ÚprodÚss      r!   rS   zDummyRequest.registerProducerÜ   sG   € ð ˆŒØŒgð 	#Ø× Ò Ñ"Ô"Ð"ð Œgð 	#ð 	#ð 	#ð 	#ð 	#r#   c                ó   — d| _         d S )Nr   )r¥   r?   s    r!   rU   zDummyRequest.unregisterProducerë   s   € ØˆŒˆˆr#   Úpostpathúlist[bytes]ÚsessionúOptional[Session]ÚreturnÚNonec                ó6  — g | _         g | _        d| _        || _        g | _        d | _        |pt          d dt          ¦   «         ¬¦  «        | _        i | _	        t          ¦   «         | _        t          ¦   «         | _        d | _        g | _        d| _        d| _        d S )Nr   ó   0)r›   ÚuidÚreactors   dummys   HTTP/1.0)rŸ   r7   Úfinishedrª   r    r¬   r   r   ÚprotoSessionr¡   r   ÚrequestHeadersÚresponseHeadersÚresponseCoder¢   Ú_serverNameÚclientproto)r:   rª   r¬   rž   s       r!   r<   zDummyRequest.__init__î   s“   € ð ˆŒØˆŒØˆŒØ ˆŒØˆŒØˆŒØ#ÐT¥w°D¸dÍEÉGÌGÐ'TÑ'TÔ'TˆÔØˆŒ	Ý%™iœiˆÔÝ&™yœyˆÔØ ˆÔØ"$ˆÔØ#ˆÔØ&ˆÔÐÐr#   c                ó‚   — i }| j                              ¦   «         D ]"\  }}|d         ||                     ¦   «         <   Œ#|S )ah  
        Return dictionary mapping the names of all received headers to the last
        value received for each.

        Since this method does not return all header information,
        C{self.requestHeaders.getAllRawHeaders()} may be preferred.

        NOTE: This function is a direct copy of
        C{twisted.web.http.Request.getAllRawHeaders}.
        éÿÿÿÿ)r¶   r~   Úlower)r:   rƒ   ru   rw   s       r!   ÚgetAllHeaderszDummyRequest.getAllHeaders  sI   € ð ˆØÔ'×8Ò8Ñ:Ô:ð 	'ð 	'‰DˆAˆqØ!" 2¤ˆG�A—G’G‘I”IÑÐØˆr#   c                ój   — | j                              |                     ¦   «         dg¦  «        d         S )aH  
        Retrieve the value of a request header.

        @type name: C{bytes}
        @param name: The name of the request header for which to retrieve the
            value.  Header names are compared case-insensitively.

        @rtype: C{bytes} or L{None}
        @return: The value of the specified request header.
        Nr   )r¶   ÚgetRawHeadersr½   )r:   r{   s     r!   Ú	getHeaderzDummyRequest.getHeader  s,   € ð Ô"×0Ò0°·²±´À¸vÑFÔFÀqÔIÐIr#   c                ó<   — | j                              ||¦  «         dS )zATODO: make this assert on write() if the header is content-lengthN)r·   ÚaddRawHeader©r:   r{   r|   s      r!   Ú	setHeaderzDummyRequest.setHeader   s!   € àÔ×)Ò)¨$°Ñ6Ô6Ð6Ð6Ð6r#   c                óf   — | j         r| j         S | j        r
J d¦   «         ‚| j        | _         | j         S )Nz8Session cannot be requested after data has been written.)r¬   r7   rµ   )r:   ÚsessionInterfaces     r!   Ú
getSessionzDummyRequest.getSession$  sN   € ØŒ<ð 	 Ø”<Ðà”ð	Fð 	FàEñ	Fô 	Fð 	Fð Ô(ˆŒØŒ|Ðr#   c                ó˜   — |                      | ¦  «        }|t          u rdS |                      |¦  «         |                      ¦   «          dS )a   
        Render the given resource as a response to this request.

        This implementation only handles a few of the most common behaviors of
        resources.  It can handle a render method that returns a string or
        C{NOT_DONE_YET}.  It doesn't know anything about the semantics of
        request methods (eg HEAD) nor how to set any particular headers.
        Basically, it's largely broken, but sufficient for some tests at least.
        It should B{not} be expanded to do all the same stuff L{Request} does.
        Instead, L{DummyRequest} should be phased out and L{Request} (or some
        other real code factored in a different way) used.
        N)Úrenderr   rE   Úfinish)r:   ÚresourceÚresults      r!   rÊ   zDummyRequest.render-  sH   € ð —’ Ñ&Ô&ˆØ•\Ð!Ð!ØˆFØ�
Š
�6ÑÔÐØ�Š‰Œˆˆˆr#   c                ó‚   — t          |t          ¦  «        st          d¦  «        ‚| j                             |¦  «         d S )Nzwrite() only accepts bytes)rB   rC   rD   r7   rO   rF   s     r!   rE   zDummyRequest.write@  s?   € Ý˜$¥Ñ&Ô&ð 	:ÝÐ8Ñ9Ô9Ð9ØŒ×Ò˜DÑ!Ô!Ð!Ð!Ð!r#   úDeferred[None]c                óV   — t          ¦   «         }| j                             |¦  «         |S )z¹
        Return a L{Deferred} which is called back with L{None} when the request
        is finished.  This will probably only work if you haven't called
        C{finish} yet.
        )r   r¢   rO   )r:   r´   s     r!   ÚnotifyFinishzDummyRequest.notifyFinishE  s)   € õ $,¡:¤:ˆØÔ×&Ò& xÑ0Ô0Ð0Øˆr#   c                ó†   — | j         dz   | _         | j        �(| j        }d| _        |D ]}|                     d¦  «         ŒdS dS )z}
        Record that the request is finished and callback and L{Deferred}s
        waiting for notification of this.
        r¤   N)r´   r¢   Úcallback)r:   Ú	observersÚobss      r!   rË   zDummyRequest.finishO  sa   € ð
 œ¨Ñ)ˆŒØÔ"Ð.ØÔ/ˆIØ&*ˆDÔ#Ø ð #ð #�Ø—’˜TÑ"Ô"Ð"Ð"ð	 /Ð.ð#ð #r#   c                óh   — | j         �(| j         }d| _         |D ]}|                     |¦  «         ŒdS dS )zK
        Errback and L{Deferreds} waiting for finish notification.
        N)r¢   Úerrback)r:   r‚   rÔ   rÕ   s       r!   ÚprocessingFailedzDummyRequest.processingFailed[  sS   € ð Ô"Ð.ØÔ/ˆIØ&*ˆDÔ#Ø ð $ð $�Ø—’˜FÑ#Ô#Ð#Ð#ð	 /Ð.ð$ð $r#   c                ó   — |g| j         |<   d S r>   )r¡   rÄ   s      r!   ÚaddArgzDummyRequest.addArge  s   € Ø ˜'ˆŒ	�$‰ˆˆr#   c                óš   — | j         r5J d                     d                     | j         ¦  «        ¦  «        ¦   «         ‚|| _        || _        dS )z{
        Set the HTTP status response code, but takes care that this is called
        before any data is written.
        z;Response code cannot be set after data hasbeen written: {}.ú@@@@N)r7   ÚformatÚjoinr¸   ÚresponseMessage)r:   r�   Úmessages      r!   ÚsetResponseCodezDummyRequest.setResponseCodeh  s^   € ð ”ð	
ð 	
àK×RÒRØ�KŠK˜œÑ%Ô%ñ
ô 
ñ	
ô 	
ð 	
ð
 !ˆÔØ&ˆÔÐÐr#   c                ó~   — | j         r5J d                     d                     | j         ¦  «        ¦  «        ¦   «         ‚d S )Nz<Last-Modified cannot be set after data has been written: {}.rÜ   ©r7   rÝ   rÞ   )r:   Úwhens     r!   ÚsetLastModifiedzDummyRequest.setLastModifiedu  sN   € à”ð	
ð 	
àL×SÒSØ�KŠK˜œÑ%Ô%ñ
ô 
ñ	
ô 	
ð 	
ð 	
ð 	
r#   c                ó~   — | j         r5J d                     d                     | j         ¦  «        ¦  «        ¦   «         ‚d S )Nz3ETag cannot be set after data has been written: {}.rÜ   rã   )r:   Útags     r!   ÚsetETagzDummyRequest.setETag|  sN   € à”ð	
ð 	
àC×JÒJØ�KŠK˜œÑ%Ô%ñ
ô 
ñ	
ô 	
ð 	
ð 	
ð 	
r#   ÚTwistedé   é   r   ÚgetClientAddress)Úreplacementc                ó`   — t          | j        t          t          f¦  «        r| j        j        S dS )z|
        Return the IPv4 address of the client which made this request, if there
        is one, otherwise L{None}.
        N)rB   rž   r   r   Úhostr?   s    r!   ÚgetClientIPzDummyRequest.getClientIPƒ  s-   € õ �d”k¥KµÐ#=Ñ>Ô>ð 	$Ø”;Ô#Ð#Øˆtr#   c                ó:   — | j         €t          ¦   «         S | j         S )z•
        Return the L{IAddress} of the client that made this request.

        @return: an address.
        @rtype: an L{IAddress} provider.
        )rž   r+   r?   s    r!   rì   zDummyRequest.getClientAddress�  s   € ð Œ;ÐÝ‘=”=Ð ØŒ{Ðr#   c                ó   — | j         S )zƒ
        Get a dummy hostname associated to the HTTP request.

        @rtype: C{bytes}
        @returns: a dummy hostname
        )r¹   r?   s    r!   ÚgetRequestHostnamezDummyRequest.getRequestHostname˜  s   € ð ÔÐr#   c                ó$   — t          ddd¦  «        S )zz
        Get a dummy transport's host.

        @rtype: C{IPv4Address}
        @returns: a dummy transport's host
        r5   ú	127.0.0.1r3   )r   r?   s    r!   rM   zDummyRequest.getHost¡  s   € õ ˜5 +¨rÑ2Ô2Ð2r#   c                óœ   — || _         |                      ¦   «         rd}nd}||k    r|}nd||fz  }| j                             d|¦  «         dS )a_  
        Change the host and port the request thinks it's using.

        @type host: C{bytes}
        @param host: The value to which to change the host header.

        @type ssl: C{bool}
        @param ssl: A flag which, if C{True}, indicates that the request is
            considered secure (if C{True}, L{isSecure} will return C{True}).
        i»  r3   s   %b:%ds   hostN)Ú	_forceSSLr’   r¶   rÃ   )r:   rï   rL   ÚsslÚdefaultÚ
hostHeaders         r!   ÚsetHostzDummyRequest.setHostª  sd   € ð ˆŒØ�=Š=‰?Œ?ð 	ØˆGˆGàˆGØ�7Š?ˆ?ØˆJˆJà! T¨4 LÑ0ˆJØÔ×(Ò(¨°*Ñ=Ô=Ð=Ð=Ð=r#   c                óf   — |                       t          ¦  «         |                      d|¦  «         dS )zu
        Utility function that does a redirect.

        The request should have finish() called after this.
        s   locationN)rá   r   rÅ   )r:   Úurls     r!   ÚredirectzDummyRequest.redirectÀ  s2   € ð 	×Ò�UÑ#Ô#Ð#Ø�Š�{ CÑ(Ô(Ð(Ð(Ð(r#   )NN)rª   r«   r¬   r­   rž   r�   r®   r¯   r>   )r®   rÏ   )r   ) r,   r-   r.   r/   ÚuriÚmethodrž   Ú__annotations__rS   rU   r<   r¾   rÁ   rÅ   rÈ   rÊ   rE   rÑ   rË   rØ   rÚ   rá   rå   rè   r   r   rð   rì   ró   rM   rû   rþ   r   r#   r!   r   r   »   s  € € € € € € ðð ð. €CØ€FØ!%€FÐ%Ð%Ð%Ñ%ØÐÐÑØÐÐÑØÐÐÑØ"Ð"Ð"Ñ"Ø,Ð,Ð,Ñ,ð#ð #ð #ðð ð ð &*Ø%)ð	'ð 'ð 'ð 'ð 'ð*ð ð ð Jð Jð Jð7ð 7ð 7ðð ð ð ðð ð ð&"ð "ð "ð
ð ð ð ð
#ð 
#ð 
#ð$ð $ð $ð"ð "ð "ð'ð 'ð 'ð 'ð
ð 
ð 
ð
ð 
ð 
ð €Z��˜	 2 q¨!Ñ,Ô,Ð:LÐMÑMÔMðð ñ NÔMðð	ð 	ð 	ð ð  ð  ð3ð 3ð 3ð>ð >ð >ð >ð,)ð )ð )ð )ð )r#   c                  ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚDummyRequestTestsz$
    Tests for L{DummyRequest}.
    c                ó€  — t          g ¦  «        }|                     ¦   «          |                      | j        g¬¦  «        }|                      dt          |¦  «        ¦  «         |\  }|                      |                     d¦  «        t          ¦  «         |                      |                     d¦  «        d¦  «         dS )zp
        L{DummyRequest.getClientIP} is deprecated in favor of
        L{DummyRequest.getClientAddress}
        )ÚoffendingFunctionsr¤   Úcategoryrà   z}twisted.web.test.requesthelper.DummyRequest.getClientIP was deprecated in Twisted 18.4.0; please use getClientAddress insteadN)r   rð   ÚflushWarningsÚtest_getClientIPDeprecatedÚassertEqualÚlenÚgetÚDeprecationWarning)r:   rp   ÚwarningsÚwarnings       r!   r  z,DummyRequestTests.test_getClientIPDeprecatedÏ  sÄ   € õ ˜rÑ"Ô"ˆØ×ÒÑÔÐà×%Ò%Ø $Ô ?Ð@ð &ñ 
ô 
ˆð 	×Ò˜�C ™MœMÑ*Ô*Ð*Ø‰	ˆØ×Ò˜Ÿš ZÑ0Ô0Õ2DÑEÔEÐEØ×ÒØ�KŠK˜	Ñ"Ô"ð6ñ	
ô 	
ð 	
ð 	
ð 	
r#   c                ó¤   — t          g ¦  «        }t          ddd¦  «        }||_        |                      d|                     ¦   «         ¦  «         dS )z�
        L{DummyRequest.getClientIP} supports IPv6 addresses, just like
        L{twisted.web.http.Request.getClientIP}.
        r5   z::1é90  N)r   r   rž   r	  rð   )r:   rp   rž   s      r!   Útest_getClientIPSupportsIPv6z.DummyRequestTests.test_getClientIPSupportsIPv6è  sQ   € õ
 ˜rÑ"Ô"ˆÝ˜U E¨5Ñ1Ô1ˆØˆŒà×Ò˜ × 3Ò 3Ñ 5Ô 5Ñ6Ô6Ð6Ð6Ð6r#   c                ó€   — t          g ¦  «        }|                     ¦   «         }t          j        t          |¦  «         dS )zu
        L{DummyRequest.getClientAddress} returns an L{IAddress}
        provider no C{client} has been set.
        N)r   rì   r   ÚverifyObjectr   )r:   rp   Únulls      r!   Ú"test_getClientAddressWithoutClientz4DummyRequestTests.test_getClientAddressWithoutClientó  s;   € õ
 ˜rÑ"Ô"ˆØ×'Ò'Ñ)Ô)ˆÝÔ�H dÑ+Ô+Ð+Ð+Ð+r#   c                ó¨   — t          g ¦  «        }t          ddd¦  «        }||_        |                     ¦   «         }|                      ||¦  «         dS )zI
        L{DummyRequest.getClientAddress} returns the C{client}.
        r5   rõ   r  N)r   r   rž   rì   ÚassertIs)r:   rp   rž   Úaddresss       r!   Útest_getClientAddressz'DummyRequestTests.test_getClientAddressü  sT   € õ ˜rÑ"Ô"ˆÝ˜U K°Ñ7Ô7ˆØˆŒØ×*Ò*Ñ,Ô,ˆØ�Š�g˜vÑ&Ô&Ð&Ð&Ð&r#   N)r,   r-   r.   r/   r  r  r  r  r   r#   r!   r  r  Ê  sZ   € € € € € ðð ð
ð 
ð 
ð2	7ð 	7ð 	7ð,ð ,ð ,ð'ð 'ð 'ð 'ð 'r#   r  N)1r/   Ú
__future__r   Ú__all__Úior   Útypingr   r   r	   Úzope.interfacer
   r   Úincrementalr   Útwisted.internet.addressr   r   Útwisted.internet.deferr   Útwisted.internet.interfacesr   r   Útwisted.internet.taskr   Útwisted.python.deprecater   Útwisted.trialr   Útwisted.web._responsesr   Útwisted.web.http_headersr   Útwisted.web.resourcer   Útwisted.web.serverr   r   r   ÚtextLinearWhitespaceComponentsÚsanitizedTextÚbytesLinearWhitespaceComponentsr(   ÚsanitizedBytesr+   r   r   ÚSynchronousTestCaser  r   r#   r!   ú<module>r/     sy  ððð ð #Ð "Ð "Ð "Ð "Ð "à˜>Ð
*€à Ð Ð Ð Ð Ð Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'à .Ð .Ð .Ð .Ð .Ð .Ð .Ð .à Ð Ð Ð Ð Ð à =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø +Ð +Ð +Ð +Ð +Ð +Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ø /Ð /Ð /Ð /Ð /Ð /Ø "Ð "Ð "Ð "Ð "Ð "Ø (Ð (Ð (Ð (Ð (Ð (Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø )Ð )Ð )Ð )Ð )Ð )Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :à!OÐ!OÐ:NÐ!OÑ!OÔ!OÐ à€ð#ð #Ø/Mð#ñ #ô #Ð ð ×%Ò% gÑ.Ô.€ð €ˆXÑÔðð ð ð ð ñ ô ñ ÔððJð Jð Jð Jð Jñ Jô Jð JðZL)ð L)ð L)ð L)ð L)ñ L)ô L)ð L)ð^:'ð :'ð :'ð :'ð :'˜Ô4ñ :'ô :'ð :'ð :'ð :'r#   