diff --git a/confluent/httpapi.py b/confluent/httpapi.py index 174998e8..8373ff9a 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -141,15 +141,18 @@ def resourcehandler(env, start_response): start_response('404 Not Found', []) return ["Unrecognized directive (404)"] + +def serve(): + # TODO(jbjohnso): move to unix socket and explore + # either making apache deal with it + # or just supporting nginx or lighthttpd + # for now, http port access + scgi.WSGIServer(resourcehandler, bindAddress=("localhost",4004)).run()) + + class HttpApi(object): def start(self): - # TODO(jbjohnso): move to unix socket and explore - # either making apache deal with it - # or just supporting nginx or lighthttpd - # for now, http port access - self.server = eventlet.spawn( - scgi.WSGIServer(resourcehandler, - bindAddress=("localhost",4004)).run()) + self.server = eventlet.spawn(serve) diff --git a/confluent/main.py b/confluent/main.py index 9dae3437..0c26cf63 100644 --- a/confluent/main.py +++ b/confluent/main.py @@ -13,6 +13,7 @@ import confluent.pluginapi as pluginapi import confluent.httpapi as httpapi +import confluent.sockapi as sockapi import eventlet from eventlet.green import socket from eventlet import wsgi @@ -24,8 +25,8 @@ def run(): pluginapi.load_plugins() webservice = httpapi.HttpApi() webservice.start() - sockapi = sockapi.SockApi() - sockapi.start() + sockservice = sockapi.SockApi() + sockservice.start() while (1): eventlet.sleep(100) diff --git a/confluent/sockapi.py b/confluent/sockapi.py index 6cc73e18..bb5f6c06 100644 --- a/confluent/sockapi.py +++ b/confluent/sockapi.py @@ -8,6 +8,7 @@ import confluent.console as console import confluent.config as config import eventlet.green.socket as socket import eventlet.green.ssl as ssl +import eventlet def sessionhdl(connection): #TODO: authenticate and authorize peer @@ -23,7 +24,9 @@ def sessionhdl(connection): def _handler(): plainsocket = socket.socket() srv = ssl.wrap_socket(plainsocket, keyfile="/etc/confluent/privkey.pem", - cert="/etc/confluent/srvcert.pem", server_side=True) + certfile="/etc/confluent/srvcert.pem", + ssl_version=ssl.PROTOCOL_TLSv1, + server_side=True) srv.bind(('0.0.0.0', 4001)) srv.listen(5) while (1): # TODO: exithook