관리-도구
편집 파일: server.cpython-38.opt-1.pyc
U e5d� � @ s d Z dZdddddgZddlZddlZddlZddlZddlZ ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZdd lmZ dd l mZ dZdZG d d� dej�ZG dd� deje�Z G dd� dej!�Z"G dd� de"�Z#dd� Z$da%dd� Z&dd� Z'G dd� de#�Z(dd� Z)e"e dddfdd�Z*e+dk�rddl,Z,e,�-� Z.e.j/dd d!d"� e.j/d#d$d%d&d'� e.j/d(d)e �0� d*d+� e.j/d,d-de1d.d/d0� e.�2� Z3e3j4�r�e(Z5nee#e3j6d1�Z5G d2d3� d3e �Z7e*e5e7e3j8e3j9d4� dS )5a@ 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� HTTPServer�ThreadingHTTPServer�BaseHTTPRequestHandler�SimpleHTTPRequestHandler�CGIHTTPRequestHandler� N)�partial)� HTTPStatusa� <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>Error response</title> </head> <body> <h1>Error response</h1> <p>Error code: %(code)d</p> <p>Message: %(message)s.</p> <p>Error code explanation: %(code)s - %(explain)s.</p> </body> </html> ztext/html;charset=utf-8c @ s e Zd ZdZdd� ZdS )r � c C s4 t j�| � | jdd� \}}t�|�| _|| _dS )z.Override server_bind to store the server name.N� )�socketserver� TCPServer�server_bindZserver_address�socketZgetfqdn�server_name�server_port)�self�host�port� r �#/usr/lib64/python3.8/http/server.pyr � s zHTTPServer.server_bindN)�__name__� __module__�__qualname__Zallow_reuse_addressr r r r r r � s c @ s e Zd ZdZdS )r TN)r r r Zdaemon_threadsr r r r r � s c @ sJ e Zd ZdZdej�� d Zde Z e ZeZ dZdd� Zdd � Zd d� Zdd � ZdFdd�ZdGdd�ZdHdd�Zdd� Zdd� Zdd� ZdIdd�Zdd� Ze�d d!� e�ed"�ed#d$��D ��Z d%e e!d&�<