-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttp_server.py
More file actions
18 lines (14 loc) · 801 Bytes
/
http_server.py
File metadata and controls
18 lines (14 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from PooledProcessMixIn import PooledProcessMixIn
from BaseHTTPServer import HTTPServer
from request_handler import request_handler
import ssl
import server_settings
#http://code.activestate.com/recipes/442473-simple-http-server-supporting-ssl-secure-communica/
class http_server(PooledProcessMixIn,HTTPServer):
def __init__(self):
self._process_n=server_settings.num_forks
self._thread_n=server_settings.num_threads_per_fork
HTTPServer.__init__(self,("0.0.0.0",server_settings.port),request_handler)
#wrap socket provides a socket-like wrapper that also encrypts and decrypts the data going over the socket with SSL.
self.socket=ssl.wrap_socket(self.socket,keyfile='server.pem',certfile='server.pem',server_side=True)
self._init_pool()