server.pyc
1 o 2 ���cj� � @ s� d Z dZg d�ZddlZddlZddlZddlZddlZ ddl 3 Z 4 ddlZddlZddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddl mZ dZdZG dd � d ej�ZG d 5 d� deje�ZG dd � d ej�ZG dd� de�Z dd� Z!da"dd� Z#dd� Z$G dd� de �Z%dd� Z&eedddfdd�Z'e(dkr�ddl)Z)ddl*Z*e)�+� Z,e,j-dd d!d"� e,j-d#d$d%d&d'� e,j-d(d)e �.� d*d+� e,j-d,d-de/d.d/d0� e,�0� Z1e1j2r�e%Z3ne Z3G d1d2� d2e�Z4e'e3e4e1j5e1j6d3� dS dS )4a@ HTTP server classes. 6 7 Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see 8 SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST, 9 and CGIHTTPRequestHandler for CGI scripts. 10 11 It does, however, optionally implement HTTP/1.1 persistent connections, 12 as of version 0.3. 13 14 Notes on CGIHTTPRequestHandler 15 ------------------------------ 16 17 This class implements GET and POST requests to cgi-bin scripts. 18 19 If the os.fork() function is not present (e.g. on Windows), 20 subprocess.Popen() is used as a fallback, with slightly altered semantics. 21 22 In all cases, the implementation is intentionally naive -- all 23 requests are executed synchronously. 24 25 SECURITY WARNING: DON'T USE THIS CODE UNLESS YOU ARE INSIDE A FIREWALL 26 -- it may execute arbitrary Python code or external programs. 27 28 Note that status code 200 is sent prior to execution of a CGI script, so 29 scripts cannot send other status codes such as 302 (redirect). 30 31 XXX To do: 32 33 - log requests even later (to capture byte count) 34 - log user-agent header and other interesting goodies 35 - send error log to separate file 36 z0.6)� 37 HTTPServer�ThreadingHTTPServer�BaseHTTPRequestHandler�SimpleHTTPRequestHandler�CGIHTTPRequestHandler� N)� 38 HTTPStatusa� <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 39 "http://www.w3.org/TR/html4/strict.dtd"> 40 <html> 41 <head> 42 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 43 <title>Error response</title> 44 </head> 45 <body> 46 <h1>Error response</h1> 47 <p>Error code: %(code)d</p> 48 <p>Message: %(message)s.</p> 49 <p>Error code explanation: %(code)s - %(explain)s.</p> 50 </body> 51 </html> 52 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_bind�server_address�socket�getfqdn�server_name�server_port)�self�host�port� r �sC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2800.0_x64__qbz5n2kfra8p0\lib\http\server.pyr � s 53 zHTTPServer.server_bindN)�__name__� 54 __module__�__qualname__�allow_reuse_addressr r r r r r � s r c @ s e Zd ZdZdS )r TN)r r r �daemon_threadsr r r r r � s r c @ s* e Zd ZdZdej�� d Zde Z e 55 ZeZ dZdd� Zdd � Zd 56 d� Zdd � Zd5dd�Zd6dd�Zd6dd�Zdd� Zdd� Zdd� Zd7dd�Zdd� Ze�d d!� e�ed"�ed#d$��D ��Z d%e e!d&�<