标签:stl bad server for 不能 stat pre env httpd
目录
# 官网样例
from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server
# A relatively simple WSGI application. It's going to print out the
# environment dictionary after being updated by setup_testing_defaults
def simple_app(environ, start_response):
setup_testing_defaults(environ)
status = '200 OK'
headers = [('Content-type', 'text/plain; charset=utf-8')]
start_response(status, headers)
ret = [("%s: %s\n" % (key, value)).encode("utf-8")
for key, value in environ.items()]
# return ret
return [b"Hello World!"]
httpd = make_server('', 8000, simple_app)
print("Serving on port 8000...")
httpd.serve_forever()
# 模拟请求用的Restlet
# 请求地址中不能用https
# 错误信息 400 bad request
# 127.0.0.1 - - [06/Jul/2019 11:12:10] code 400, message Bad request version ('Y\xad41??°\x8cí??J¢2?|\x87a¥èt′#8¢?ü°aü}\x1b\x00"ZZ\x13\x01\x13\x02\x13\x03à+à/à,à0ì?ì¨à\x13à\x14\x00\x9c\x00\x9d\x00/\x005\x00')
# 127.0.0.1 - - [06/Jul/2019 11:12:10] " üC3}iê=7??Xí}?OHT?¤Xáúò~Y?|ü?? Y-41??°?í??J¢2?|?a¥èt′#8¢?ü°aü} "ZZà+à/à,à0ì?ì¨àà ? ? / 5 " 400 -
http://localhost:8000/
标签:stl bad server for 不能 stat pre env httpd
原文地址:https://www.cnblogs.com/qigs/p/11142226.html