這個Python3 CGI HTTPS服務器過去幾周(或幾個月)才工作,但現在不再適用於Linux(Ubuntu)。我在Ubuntu 10.04和Ubuntu 14.04上試過,行爲是一樣的。Unix3上的Python3 CGI HTTPS服務器失敗
現在,當我嘗試訪問任何CGI腳本,我得到:
Secure Connection Failed
An error occurred during a connection to 127.0.0.1:4443. SSL received a record that exceeded the maximum permissible length. (Error code: ssl_error_rx_record_too_long)
下面是該服務器的代碼:
import http.server
import ssl
import os
server_address = ('', 4443)
cert = os.path.abspath('./server.pem')
handler = http.server.CGIHTTPRequestHandler
handler.cgi_directories = ['/cgi-bin']
httpd = http.server.HTTPServer(server_address, handler)
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True,
certfile=cert)
print ("Server started...")
httpd.serve_forever()
服務器記錄以下錯誤:
如果我禁用SSL,並且在使用SSL的Windows上正常工作,這將起作用。用Python 3.4測試。 奇怪的是,這個工作幾個月後 任何人都可以得到這個腳本(或任何python3 CGI HTTPS服務器)在更新的Linux系統上運行?
我在Linux上發現了與Python 2.7相同的問題,所以這對Python 3來說並不是孤立的。 – Alecz 2014-12-04 20:45:53