python 简易 http server

蒲曦
2023-12-01

get方式:

http://www.cnblogs.com/shenshangzz/p/8318143.html

 

# coding=utf-8
#!/usr/bin/env python
#--coding:utf-8--
#python 简易 http server
from http.server import BaseHTTPRequestHandler, HTTPServer
from os import path
from urllib.parse import urlparse
# from BaseHTTPServer import BaseHTTPRequestHandler
import cgi

# MIME-TYPE
mimedic = [
                        ('.html', 'text/html'),
                        ('.htm', 'text/html'),
                        ('.js', 'application/javascript'),
                        ('.css', 'text/css'),
                        ('.json', 'application/json'),
                        ('.png', 'image/png'),
                        ('.jpg', 'image/jpeg'),
                        ('.gif', 'image/
 类似资料: