0i ~ d Z dZg dZddlZddlZddlZddlZddlZ ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddl mZ dZdZdZ G d d ej Z G d dej e Z G d dej Z G d de Z!d Z"da#d Z$d Z% G d de! Z&d Z'e edddfdZ(e)dk rddl*Z*ddl+Z+ e*j, Z-e-. ddd e-. dd d!d"# e-. d$d% e j/ d&' e-. d(d)d*dd+, e-. d-de0d.d/0 e-1 Z2e2j3 re&Z4ne!Z4 G d1 d2e Z5 e(e4e5e2j6 e2j7 e2j8 3 dS dS )4a@ HTTP server classes. Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, and CGIHTTPRequestHandler for CGI scripts. It does, however, optionally implement HTTP/1.1 persistent connections, as of version 0.3. Notes on CGIHTTPRequestHandler ------------------------------ This class implements GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (e.g. on Windows), subprocess.Popen() is used as a fallback, with slightly altered semantics. In all cases, the implementation is intentionally naive -- all requests are executed synchronously. SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL -- it may execute arbitrary Python code or external programs. Note that status code 200 is sent prior to execution of a CGI script, so scripts cannot send other status codes such as 302 (redirect). XXX To do: - log requests even later (to capture byte count) - log user-agent header and other interesting goodies - send error log to separate file z0.6) HTTPServerThreadingHTTPServerBaseHTTPRequestHandlerSimpleHTTPRequestHandlerCGIHTTPRequestHandler N) HTTPStatusaD
Error code: %(code)d
Message: %(message)s.
Error code explanation: %(code)s - %(explain)s.
ztext/html;charset=utf-8i c e Zd ZdZd ZdS )r c t j | | j dd \ }}t j | | _ || _ dS )z.Override server_bind to store the server name.N )socketserver TCPServerserver_bindserver_addresssocketgetfqdnserver_nameserver_port)selfhostports 2/opt/alt/python311/lib64/python3.11/http/server.pyr zHTTPServer.server_bind sN **4000(!, d!>$// N)__name__ __module____qualname__allow_reuse_addressr r r r r s) r r c e Zd ZdZdS )r TN)r r r daemon_threadsr r r r r s NNNr r c e Zd ZdZdej d z Zdez Z e ZeZ dZd Zd Zd Zd Zd#dZd$dZd$d Zd Zd Zd Zd%dZd Ze d ej ed edd D Z de e!d <