I am hosting my server on python and have written the following code,
import BaseHTTPServer, SimpleHTTPServer
import ssl
webServer = BaseHTTPServer.HTTPServer(('0.0.0.0', port),
SimpleHTTPServer.SimpleHTTPRequestHandler)
webServer.socket =ssl.wrap_socket(webServer.socket,keyfile="keyfile",certfile='certfile',server_side=True)
print('Server is listening now.....')
webServer.serve_forever()
This is throwing error as below,
code 400, message Bad request syntax ('\x16\x03\x01\x02
error:[Errno 32] Broken pipe.
I did some research and found that the ssl connection is getting closed first and then the response is coming up due to which its throwing this exception. The solution what I have found is below
try:
# The code mentioned above
except IOError, e:
if e.errno == errno.EPIPE:
# How to handle, what should be here
In the above solution how do we handle the error. Do we need to reopen the connection?