The current questions regarding this topic didn't solve my problem and neither has Google.
relevant server code:
class ReuseHTTPServer(BaseHTTPServer.HTTPServer):
def __init__(self, address, handler, queue=None):
BaseHTTPServer.HTTPServer.__init__(self, address, handler)
self.address = address
ssl_socket = ssl.wrap_socket(socket.socket(self.address_family, self.socket_type),
keyfile = KEY_PATH,
certfile = CERTIFICATE_PATH,
server_side = True,
cert_reqs = ssl.CERT_REQUIRED,
ssl_version = ssl.PROTOCOL_TLSv1,
ca_certs = CA_PATH)
s = self.socket.getsockname()
print "serving:", s[0], "on port:", s[1]
self.socket = ssl_socket
self.server_bind()
self.server_activate()
client code:
conn = https.HTTPSConnection(HOST, port=PORT, key_file=KEY_PATH, cert_file=CERT_PATH)
conn.putrequest("GET", '/cgi-bin/retrieveRunningInstances')
conn.endheaders()
response = conn.getresponse()
Trying to connect with the client gets an SSLError errno 8; EOF occurred in violation of protocol. I have verified the certificates using openssl. I am pulling my hair out. Any help would be appreciated.
Edit:
The error occurs during the handshake in conn.getresponse()
.
I think I figured it out. I had the same problem:
SSLError errno 8; EOF occurred in violation of protocol
It turned out that I had a missing cert_file. I had specified one as follows, but did not have one.
server = HTTPServer( ('',5005), HttpHandler )
server.socket = ssl.wrap_socket( server.socket, certfile='kencert.pem', server_side=True )
When I added the .pem file it worked!
Hope this helps!