Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Modified SSL implementation so that it works #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added sleepymongoose/handlers.pyc
Binary file not shown.
15 changes: 3 additions & 12 deletions sleepymongoose/httpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from handlers import MongoHandler

try:
from OpenSSL import SSL
except ImportError:
pass
import ssl

import os.path, socket
import urlparse
Expand All @@ -45,15 +42,9 @@ class MongoServer(HTTPServer):
pem = None

def __init__(self, server_address, HandlerClass):
BaseServer.__init__(self, server_address, HandlerClass)
ctx = SSL.Context(SSL.SSLv23_METHOD)

fpem = MongoServer.pem
ctx.use_privatekey_file(fpem)
ctx.use_certificate_file(fpem)

self.socket = SSL.Connection(ctx, socket.socket(self.address_family,
self.socket_type))
BaseServer.__init__(self, server_address, HandlerClass)
self.socket = ssl.SSLSocket(sock=socket.socket(self.address_family,self.socket_type), ssl_version=ssl.PROTOCOL_SSLv23, certfile=fpem, keyfile=fpem, server_side=True)
self.server_bind()
self.server_activate()

Expand Down