관리-도구
편집 파일: server.cpython-36.opt-2.pyc
3 �Qg�� � @ s� d Z ddddgZddlZddlZddlZddlZddlZddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlZddlZddlmZ dZd ZG d d� dej�ZG dd� dej�ZG dd� de�Zd d� Zdadd� Zdd� Z G dd� de�Z!eedddfdd�Z"e#dk�r�ej$� Z%e%j&dddd� e%j&dddd d!d"� e%j&d#d$de'd%d&d'� e%j(� Z)e)j*�rze!Z+neZ+e"e+e)j,e)j-d(� dS ))z0.6� HTTPServer�BaseHTTPRequestHandler�SimpleHTTPRequestHandler�CGIHTTPRequestHandler� N)� 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 jj| � | jd d� \}}tj|�| _|| _d S )N� )�socketserver� TCPServer�server_bind�server_address�socketZgetfqdn�server_name�server_port)�self�host�port� 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 Zdejj� d Zde Ze Z eZdZ dd� Zdd� Zd d � Zdd� Zd?dd�Zd@dd�ZdAdd�Zdd� Zdd� Zdd� ZdBdd�Zdd� Zdd � Zd!d"� ZdCd#d$�Zd%d&� Zd'd(d)d*d+d,d-gZd d.d/d0d1d2d3d4d5d6d7d8d9g Zd:d;� Z d<Z!e"j#j$Z%d=d>� e&j'j(� D �Z)d S )Dr zPython/r z BaseHTTP/zHTTP/0.9c C s� d | _ | j | _}d| _t| jd�}|jd�}|| _|j� }t |�dk�r|\}}}yZ|d d� dkrjt �|jdd�d }|jd �}t |�d kr�t �t|d �t|d �f}W n* t tfk r� | j tjd| � d S X |dkr�| jdkr�d | _|dk�rr| j tjd| � d S n^t |�d k�rR|\}}d| _|dk�rr| j tjd| � d S n |�s\d S | j tjd| � d S ||| | _ | _| _| jjd��r�d| jjd� | _ytjj| j| jd�| _W nr tjjk �r� } z| j tjdt|�� d S d }~X n: tjjk �r4 } z| j tjdt|�� d S d }~X nX | jjdd�} | j� dk�rZd| _n | j� dk�rz| jdk�rzd | _| jjdd�} | j� dk�r�| jdk�r�| jdk�r�| j � �s�d S dS )NTz iso-8859-1z � � zHTTP/�/r �.r r zBad request version (%r)FzHTTP/1.1zInvalid HTTP version (%s)ZGETzBad HTTP/0.9 request type (%r)zBad request syntax (%r)z//)Z_classz Line too longzToo many headers� Connection� �closez keep-aliveZExpectz100-continue)r r )r r )!�command�default_request_version�request_version�close_connection�str�raw_requestline�rstrip�requestline�split�len� ValueError�int� IndexError� send_errorr ZBAD_REQUEST�protocol_versionZHTTP_VERSION_NOT_SUPPORTED�path� startswith�lstrip�http�clientZ parse_headers�rfile�MessageClass�headersZLineTooLongZREQUEST_HEADER_FIELDS_TOO_LARGEZ HTTPException�get�lower�handle_expect_100)r �versionr&