*j V S r Sr/ SQrSSKrSSKrSSKrSSKrSSKr SSK r SSKrSSKrSSK r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK Jr SrSrSr " S S \R6 5 r " S S\R: \5 r " S S\R> 5 r " S S\ 5 r!S r"Sq#S r$S r% " S S\!5 r&S r'\ \SSS4S jr(\)S:X a SSK*r*SSK+r+\*RX " 5 r-\-R] SSSS9 \-R] SS S!S"S#9 \-R] S$S%\ R^ " 5 S&S'9 \-R] S(S)S*SS+S,9 \-R] S-S\0S.S/S09 \-Rc 5 r2\2Rf ( a \&r4O\!r4 " S1 S2\5 r5\(" \4\5\2Rl \2Rn \2Rp S39 gg)4a HTTP server classes. Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, and (deprecated) CGIHTTPRequestHandler for CGI scripts. It does, however, optionally implement HTTP/1.1 persistent connections. Notes on CGIHTTPRequestHandler ------------------------------ This class is deprecated. It implements GET and POST requests to cgi-bin scripts. If the os.fork() function is not present (Windows), subprocess.Popen() is used, with slightly altered but never documented semantics. Use from a threaded process is likely to trigger a warning at os.fork() time. 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 \ rS rSrSrS rSrg)r c [ R R U 5 U R SS u p[ R " U5 U l X l g)z.Override server_bind to store the server name.N )socketserver TCPServerserver_bindserver_addresssocketgetfqdnserver_nameserver_port)selfhostports 2/opt/alt/python313/lib64/python3.13/http/server.pyr HTTPServer.server_bind sA **40((!, !>>$/ )r r N)__name__ __module____qualname____firstlineno__allow_reuse_addressr __static_attributes__ r r r r s r r c \ rS rSrSrSrg)r Tr" N)r r r r daemon_threadsr! r" r r r r s Nr r c h \ rS rSrSrS\R R 5 S - rS\ - r \r\ rSrS rS rS rS rS$S jrS%S jrS%S jrS rS rS rS&S jrS r\R; \R> " \ " S5 \ " SS5 5 V Vs0 s H oSUS 3_M snn 5 r!S\!\"" S5 ' S r#S r$S%S jr%S r&/ SQr'/ S Qr(S! r)S"r*\+RX RZ r.\/R` Rc 5 V Vs0 s H nX"Rd URf 4_M snn r4S#r5gs snn f s snn f )'r a HTTP request handler base class. The following explanation of HTTP serves to guide you through the code as well as to expose any misunderstandings I may have about HTTP (so you don't need to read the code to figure out I'm wrong :-). HTTP (HyperText Transfer Protocol) is an extensible protocol on top of a reliable stream transport (e.g. TCP/IP). The protocol recognizes three parts to a request: 1. One line identifying the request type and path 2. An optional set of RFC-822-style headers 3. An optional data part The headers and data are separated by a blank line. The first line of the request has the form