• 问题:用360极速浏览器访问Flask站点时报以下错误,google浏览器访问正常
cat >Hello_production.py << EOF
from flask import Flask
from wsgiref.simple_server import make_server

app = Flask(__name__)

@app.route('/')
def hello_world():
    return "hello"
@app.route('/web')
def hello_world2():
    return "hello web"
if __name__ == '__main__':
    server = make_server('0.0.0.0', 5000, app)
    server.serve_forever()
EOF
# 
# python3 Hello_production.py
Traceback (most recent call last):
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 332, in send_headers
    self.send_preamble()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 252, in send_preamble
    self._write(('HTTP/%s %s\r\n' % (self.http_version,self.status)).encode('iso-8859-1'))
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib64/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
192.168.209.1 - - [08/Mar/2021 17:15:02] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('192.168.209.1', 52933)
Traceback (most recent call last):
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 332, in send_headers
    self.send_preamble()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 252, in send_preamble
    self._write(('HTTP/%s %s\r\n' % (self.http_version,self.status)).encode('iso-8859-1'))
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib64/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 344, in client_is_modern
    return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib64/python3.6/socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib64/python3.6/socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python3.6/socketserver.py", line 724, in __init__
    self.handle()
  File "/usr/lib64/python3.6/wsgiref/simple_server.py", line 133, in handle
    handler.run(self.server.get_app())
  File "/usr/lib64/python3.6/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/usr/lib64/python3.6/wsgiref/simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
  • 解决 将360极速浏览器设置为极速模式即可。