3 f @ s d Z dZddddgZddlZddlZddlZddlZddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlZddlZddlZddlmZ d Zd ZG dd dejZG dd dejZG d d deZdd Zdadd Z dd Z!G dd deZ"eedddfddZ#e$dkrej% Z&e&j'dddd e&j'dd dd!d"d# e&j'd$d%de(d&d'd( e&j) Z*e*j+r~e"Z,neZ,e#e,e*j-e*j.d) dS )*a@ 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 HTTPServerBaseHTTPRequestHandlerSimpleHTTPRequestHandlerCGIHTTPRequestHandler N) HTTPStatusa
Error code: %(code)d
Message: %(message)s.
Error code explanation: %(code)s - %(explain)s.
ztext/html;charset=utf-8c @ s e Zd ZdZdd ZdS )r c C s4 t jj| | jdd \}}tj|| _|| _dS )z.Override server_bind to store the server name.N )socketserver TCPServerserver_bindserver_addresssocketZgetfqdnserver_nameserver_port)selfhostport r #/usr/lib64/python3.6/http/server.pyr s zHTTPServer.server_bindN)__name__ __module____qualname__Zallow_reuse_addressr r r r r r s c @ s e Zd ZdZdejj d Zde Z e ZeZ dZdd Zdd Zd d Zdd Zd@ddZdAddZdBddZdd Zdd Zdd ZdCddZdd Zd d! Zd"d# ZdDd$d%Zd&d' Zd(d)d*d+d,d-d.gZdd/d0d1d2d3d4d5d6d7d8d9d:g Z d;d<