+
    h]	                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt ! R R]P                  P                  4      t ! R R]P                  P                  4      t ! R R]P                  P                  ]P                  4      tR	R ltR# )
z>Basic http server for tests to simulate PyPI or custom indexesNc                   l   a  ] tR t^t o RtR]P                  P                  3R ltR t	R t
R tRtV tR# )	IndexServera9  Basic single-threaded http server simulating a package index

You can use this server in unittest like this::
    s = IndexServer()
    s.start()
    index_url = s.base_url() + 'mytestindex'
    # do some test requests to the index
    # The index files should be located in setuptools/tests/indexes
    s.stop()
c                h    \         P                  P                  P                  WV4       R V n        R# TN)httpserver
HTTPServer__init___runselfserver_addressRequestHandlerClasss   &&&9/usr/lib/python3/dist-packages/setuptools/tests/server.pyr	   IndexServer.__init__   s&    
 	''>QR	    c                    \         P                  ! V P                  R 7      V n        V P                  P	                  4        R# ))targetN)	threadingThreadserve_foreverthreadstartr   s   &r   r   IndexServer.start   s*    &&d.@.@Ar   c                    \         P                  ! R4       V P                  4        V P                  P	                  4        V P
                  P                  4        R# )zStop the serverg?N)timesleepshutdownr   joinsocketcloser   s   &r   stopIndexServer.stop#   s8     	

3r   c                &    V P                   pR V R2# )zhttp://127.0.0.1:z/setuptools/tests/indexes/server_port)r   ports   & r   base_urlIndexServer.base_url-   s    "4&(BCCr   )r
   r   N     )__name__
__module____qualname____firstlineno____doc__r   r   SimpleHTTPRequestHandlerr	   r   r"   r(   __static_attributes____classdictcell____classdict__s   @r   r   r      s7     	  KK@@D Dr   r   c                   &   a  ] tR t^2t o R tRtV tR# )RequestRecorderc                    \        V P                  4      P                  R . 4      pVP                  V 4       V P	                  ^R4       R# )requestsOKN)varsr   
setdefaultappendsend_response)r   r:   s   & r   do_GETRequestRecorder.do_GET3   s9    $//
B?3%r    N)r-   r.   r/   r0   r@   r3   r4   r5   s   @r   r8   r8   2   s     & &r   r8   c                   X   a  ] tR t^9t o RtR]3R ltR t]R 4       t	]R 4       t
RtV tR# )	
MockServerz<
A simple HTTP Server that records the requests made to it.
c                    \         P                  P                  P                  WV4       \        P
                  P                  V 4       R V n        . V n        R# r   )r   r   r   r	   r   r   daemonr:   r   s   &&&r   r	   MockServer.__init__>   s?    ''>QR!!$'r   c                &    V P                  4        R # N)r   r   s   &r   runMockServer.runD   s    r   c                     R V P                    2# )z
localhost:r%   r   s   &r   netlocMockServer.netlocG   s    D,,-..r   c                "    R V P                    R2# )zhttp:///)rM   r   s   &r   urlMockServer.urlK   s    Q''r   )rF   r:   Nr*   )r-   r.   r/   r0   r1   r8   r	   rJ   propertyrM   rQ   r3   r4   r5   s   @r   rD   rD   9   sC      '.?  / / ( (r   rD   c                    \         P                  P                  \         P                  P                  V 4      4      p RpVe   VRV,           ,          p\        P
                  P                  V\        P                  P                  V 4      4      # )zConvert a path to a file: URL.zfile:z//)	ospathnormpathabspathurllibparseurljoinrequestpathname2url)rV   	authoritybases   && r   path_to_urlr`   P   sc    77BGGOOD12DDy  <<fnn&A&A$&GHHr   rI   )r1   http.serverr   rU   r   r   urllib.parserY   urllib.requestr   r   r   BaseHTTPRequestHandlerr8   r   rD   r`   rB   r   r   <module>re      sm    D  	    $D$++(( $DN&dkk88 &('')9)9 (.Ir   