ó
    ×›‘hG  ã                   óÌ   • S r SSKJr  SSKJrJr   " S S\R                  5      r " S S\R                  5      r	 " S S	\R                  5      r
 " S
 S\R                  5      rg)z&
I am a virtual hosts implementation.
é    )Úroots)ÚpagesÚresourcec                   óN   • \ rS rSrSr\R                  rS rS r	S r
S rS rSrg	)
ÚVirtualHostCollectioné   zOWrapper for virtual hosts collection.

This exists for configuration purposes.
c                 ó   • Xl         g ©N©Únvh)Úselfr   s     ÚUC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/web/vhost.pyÚ__init__ÚVirtualHostCollection.__init__   s   € Ø�ó    c                 óJ   • U R                   R                  R                  5       $ r
   )r   ÚhostsÚitems©r   s    r   ÚlistStaticEntitiesÚ(VirtualHostCollection.listStaticEntities   s   € Ø�x‰x�~‰~×#Ñ#Ó%Ð%r   c                 óL   • U R                   R                  R                  U 5      $ r
   )r   r   Úget©r   Únames     r   ÚgetStaticEntityÚ%VirtualHostCollection.getStaticEntity   s   € Ø�x‰x�~‰~×!Ñ! $Ó'Ð'r   c                 ó:   • U R                   R                  X5        g r
   )r   ÚaddHost)r   r   Úentitys      r   ÚreallyPutEntityÚ%VirtualHostCollection.reallyPutEntity    s   € Ø�‰×Ñ˜Õ&r   c                 ó:   • U R                   R                  U5        g r
   )r   Ú
removeHostr   s     r   Ú	delEntityÚVirtualHostCollection.delEntity#   s   € Ø�‰×Ñ˜DÕ!r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚResourceÚ
entityTyper   r   r   r!   r%   Ú__static_attributes__© r   r   r   r      s-   † ñð
 ×"Ñ"€Jòò&ò(ò'õ"r   r   c                   óL   • \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rS rSrg)ÚNameVirtualHosté'   z5I am a resource which represents named virtual hosts.Nc                 óP   • [         R                  R                  U 5        0 U l        g)zInitialize.N)r   r,   r   r   r   s    r   r   ÚNameVirtualHost.__init__,   s   € ä×Ñ×"Ñ" 4Ô(Øˆ�
r   c                 ó^   • [         R                  R                  U 5      S[        U 5      4/-   $ ©NzVirtual Hosts)r   r,   r   r   r   s    r   r   Ú"NameVirtualHost.listStaticEntities1   s3   € Ü× Ñ ×3Ñ3°DÓ9ØÔ3°DÓ9Ð:ð=
ñ 
ð 	
r   c                 ób   • US:X  a  [        U 5      $ [        R                  R                  X5      $ r6   )r   r   r,   r   r   s     r   r   ÚNameVirtualHost.getStaticEntity6   s,   € Ø�?Ó"Ü(¨Ó.Ð.ä×$Ñ$×4Ñ4°TÓ@Ð@r   c                 ó    • X R                   U'   g)a„  Add a host to this virtual host.

This will take a host named `name', and map it to a resource
`resrc'.  For example, a setup for our virtual hosts would be::

    nvh.addHost('divunal.com', divunalDirectory)
    nvh.addHost('www.divunal.com', divunalDirectory)
    nvh.addHost('twistedmatrix.com', twistedMatrixDirectory)
    nvh.addHost('www.twistedmatrix.com', twistedMatrixDirectory)
N©r   )r   r   Úresrcs      r   r   ÚNameVirtualHost.addHost<   s   € ð !�
‰
�4Òr   c                 ó   • U R                   U	 g)zRemove a host.Nr;   r   s     r   r$   ÚNameVirtualHost.removeHostI   s   € à�J‰J�tÑr   c                 óp  • UR                  S5      nUc(  U R                  =(       d    [        R                  " 5       $ UR	                  5       R                  SS5      S   nU R                  R                  X0R                  5      =(       d,    [        R                  " SSUR                  SS5      < S	35      $ )
z;(Internal) Get the appropriate resource for the given host.s   hostó   :é   r   z	Not Foundzhost ÚasciiÚreplacez not in vhost map)	Ú	getHeaderÚdefaultr   ÚnotFoundÚlowerÚsplitr   r   Údecode)r   ÚrequestÚ
hostHeaderÚhosts       r   Ú_getResourceForRequestÚ&NameVirtualHost._getResourceForRequestM   s“   € à×&Ñ& wÓ/ˆ
ØÑØ—<‘<×3¤5§>¢>Ó#3Ð3à×#Ñ#Ó%×+Ñ+¨D°!Ó4°QÑ7ˆDØ�z‰z�~‰~˜d§L¡LÓ1÷ 
´U·^²^ØØ�D—K‘K ¨Ó3Ñ6Ð6GÐHó6
ð 	
r   c                 óF   • U R                  U5      nUR                  U5      $ )z4Implementation of resource.Resource's render method.)rN   Úrender)r   rK   r<   s      r   rQ   ÚNameVirtualHost.renderY   s!   € à×+Ñ+¨GÓ4ˆØ�|‰|˜GÓ$Ð$r   c                 óÖ   • U R                  U5      nUR                  (       a7  UR                  R                  SUR                  R                  S5      5        U$ UR                  X5      $ )z6Implementation of resource.Resource's getChild method.r   éÿÿÿÿ)rN   ÚisLeafÚpostpathÚinsertÚprepathÚpopÚgetChildWithDefault)r   ÚpathrK   r<   s       r   ÚgetChildÚNameVirtualHost.getChild^   sT   € à×+Ñ+¨GÓ4ˆØ�<�<Ø×Ñ×#Ñ# A w§¡×':Ñ':¸2Ó'>Ô?ØˆLà×,Ñ,¨TÓ;Ð;r   r;   )r'   r(   r)   r*   r+   rF   r   r   r   r   r$   rN   rQ   r\   r.   r/   r   r   r1   r1   '   s3   † Ù?à€Gòò

ò
Aò!òò

ò%õ
<r   r1   c                   ó   • \ rS rSrS rSrg)Ú_HostResourceéh   c                 ó®  • SU;   a   UR                  SS5      u  p4[        U5      nOUSpCUR                  X45        SUR                  5       -   S-   [	        U5      -   [	        UR
                  S   5      -   nSSR                  UR                  5      -   Ul        UR                  US  Ul	        UR
                  S S2	 UR                  R                  U5      $ )NrA   rB   éP   é   é   éýÿÿÿó   /)rI   ÚintÚsetHostÚisSecureÚlenrX   ÚjoinrV   r[   ÚuriÚsiteÚgetResourceFor)r   r[   rK   rM   ÚportÚ	prefixLens         r   r\   Ú_HostResource.getChildi   s¾   € Ø�4‹<ØŸ™ D¨!Ó,‰JˆDÜ�t“9‰Dà˜r�$Ø�‰˜Ô#Ø˜×(Ñ(Ó*Ñ*¨QÑ.´°T³Ñ:¼SÀÇÁÐQSÑATÓ=UÑUˆ	Ø˜dŸi™i¨×(8Ñ(8Ó9Ñ9ˆŒØ—k‘k ) *Ð-ˆŒØ�O‰O˜B˜Q˜BÐØ�|‰|×*Ñ*¨7Ó3Ð3r   r/   N)r'   r(   r)   r*   r\   r.   r/   r   r   r_   r_   h   s   † õ4r   r_   c                   ó   • \ rS rSrSrS rSrg)ÚVHostMonsterResourceéw   a
  
Use this to be able to record the hostname and method (http vs. https)
in the URL without disturbing your web site. If you put this resource
in a URL http://foo.com/bar then requests to
http://foo.com/bar/http/baz.com/something will be equivalent to
http://foo.com/something, except that the hostname the request will
appear to be accessing will be "baz.com". So if "baz.com" is redirecting
all requests for to foo.com, while foo.com is inaccessible from the outside,
then redirect and url generation will work correctly
c                 ób   • US:X  a  S Ul         [        5       $ US:X  a  S Ul         [        5       $ )Ns   httpc                  ó   • g)Nr   r/   r/   r   r   Ú<lambda>Ú/VHostMonsterResource.getChild.<locals>.<lambda>†   ó   €  qr   s   httpsc                  ó   • g)NrB   r/   r/   r   r   rw   rx   ˆ   ry   r   )ri   r_   )r   r[   rK   s      r   r\   ÚVHostMonsterResource.getChild„   s5   € Ø�7‹?Ù(ˆGÔô ‹Ðð �XÓÙ(ˆGÔÜ‹Ðr   r/   N)r'   r(   r)   r*   r+   r\   r.   r/   r   r   rs   rs   w   s   † ñ	õr   rs   N)r+   Útwisted.pythonr   Útwisted.webr   r   Ú
Homogenousr   r,   r1   r_   rs   r/   r   r   Ú<module>r      s[   ðñ
õ !ß 'ô"˜E×,Ñ,ô "ô0><�h×'Ñ'ô ><ôB4�H×%Ñ%ô 4ô˜8×,Ñ,õ r   