+
    :1jh                     r    R t ^ RIt^ RIt^ RIt^ RIt^ RItR R lt]R8X  d   ]! RR7      t	]
! ]	4       R# R# )af  
HTTP test server for serving local files during tests.

This module provides a local HTTP server that can be used in pytest fixtures
to serve files from a specified directory. The server runs on a random port
and supports both IPv4 and IPv6.

The server is commonly used for testing:
- Mock conda channels with packages and repodata
- Remote environment files (environment.yml)
- Remote configuration files
- Any scenario where conda needs to fetch files from HTTP URLs

Example usage:

    from conda.testing import http_test_server

    def test_something():
        server = http_test_server.run_test_server("/path/to/files")
        host, port = server.socket.getsockname()[:2]
        url = f"http://{host}:{port}/file.txt"

        # Make HTTP requests to url...

        server.shutdown()

For pytest fixtures that wrap this functionality, see:
- `http_test_server` - function-scoped fixture

The fixture can be configured via `@pytest.mark.parametrize("http_test_server", ["<directory>"], indirect=True)`
to specify the directory to serve, or used without parametrize (or with `None`) for dynamic content generation.
Nc                X    V ^8  d   QhR\         R\        P                  P                  /# )   	directoryreturn)strhttpserverThreadingHTTPServer)formats   ">lib/python3.14/site-packages/conda/testing/http_test_server.py__annotate__r   +   s$     %" %"s %"t{{'F'F %"    c                   a a  ! V 3R lR\         P                  P                  4      oV3R lp\        P                  ! 4       p\
        P                  ! W3RR7      P                  4        VP                  ^R7      # )zX
Run a test server on a random port. Inspect returned server to get port,
shutdown etc.
c                   L   <a a ] tR t^1t oRtRt^@tV 3R ltV3R ltRt	Vt
V ;t# )(run_test_server.<locals>.DualStackServerFTc                  < \         P                  ! \        4      ;_uu_ 4        V P                  P	                  \        P
                  \        P                  ^ 4       RRR4       \        SV `!  4       #   + '       g   i     L; i)    N)	
contextlibsuppress	Exceptionsocket
setsockoptIPPROTO_IPV6IPV6_V6ONLYsuperserver_bind)self	__class__s   &r   r   4run_test_server.<locals>.DualStackServer.server_bind6   sS    $$Y//&&v':':F<N<NPQR 07&(( 0/s   :A44B	c                0   < V P                  WV SR 7       R# )r   N)RequestHandlerClass)r   requestclient_addressr   s   &&&r   finish_request7run_test_server.<locals>.DualStackServer.finish_request<   s    $$Wdi$Xr    )__name__
__module____qualname____firstlineno__daemon_threadsallow_reuse_addressrequest_queue_sizer   r$   __static_attributes____classdictcell____classcell__)r   __classdict__r   s   @@r   DualStackServerr   1   s'     "	)	Y 	Yr   r2   c                   < S! R\         P                  P                  4      ;_uu_ 4       pVP                  P	                  4       R,          w  r#V P
                  ! V4       RV9   d   RV R2MTp\        RV RV RV RV R2	4        VP                  4        R
R
R
4       R
#   \         d    \        R	4        L"i ; i  + '       g   i     R
# ; i)	127.0.0.1:Nr   N:[]zServing HTTP on z port z	 (http://z/) ...z&
Keyboard interrupt received, exiting.N)r4   r   )	r   r   SimpleHTTPRequestHandlerr   getsocknameputprintserve_foreverKeyboardInterrupt)queuehttpdhostporturl_hostr2   s   &    r   start_server%run_test_server.<locals>.start_server?   s    dkkBB
 
113B7JDIIe&)Tk4&{tH$TF&iz4&PVWXA##%
 
 % A?@A
 
 
s*   AB?	B##B<9B?;B<<B??C	T)targetargsdaemon)timeout)	r   r   r	   r>   Queue	threadingThreadstartget)r   rC   startedr2   s   f  @r   run_test_serverrO   +   sZ    Y$++99 YA kkmGLz$GMMO;;q;!!r   __main__.r    )__doc__r   http.serverr   r>   r   rJ   rO   r'   r   r;   r&   r   r   <module>rT      sB   B     %"P zs+F	&M r   