Changeset c7000bb for skype/skyped.py
- Timestamp:
- 2010-12-11T15:14:12Z (14 years ago)
- Branches:
- master
- Children:
- 0b77a9b
- Parents:
- 35249d6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skyped.py
r35249d6 rc7000bb 33 33 from ConfigParser import ConfigParser, NoOptionError 34 34 from traceback import print_exception 35 import ssl 35 36 36 37 __version__ = "0.1.1" … … 86 87 def server(host, port): 87 88 global options 88 try: 89 if "SKYPED_NO_GNUTLS" in os.environ.keys(): 90 dprint("Warning, using OpenSSL instead of gnutls as requested (not recommended).") 91 raise ImportError 92 from gnutls import crypto, connection 93 cert = crypto.X509Certificate(open(options.config.sslcert).read()) 94 key = crypto.X509PrivateKey(open(options.config.sslkey).read()) 95 cred = connection.X509Credentials(cert, key) 96 sock = connection.ServerSessionFactory(socket.socket(), cred) 97 except ImportError: 98 from OpenSSL import SSL 99 ctx = SSL.Context(SSL.TLSv1_METHOD) 100 ctx.use_privatekey_file(options.config.sslkey) 101 ctx.use_certificate_file(options.config.sslcert) 102 sock = SSL.Connection(ctx, socket.socket()) 89 sock = socket.socket() 103 90 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 104 91 sock.bind((host, port)) … … 108 95 def listener(sock, *args): 109 96 global options 110 options.conn, addr = sock.accept() 97 rawsock, addr = sock.accept() 98 options.conn = ssl.wrap_socket(rawsock, 99 server_side=True, 100 certfile=options.config.sslcert, 101 keyfile=options.config.sslkey, 102 ssl_version=ssl.PROTOCOL_TLSv1) 111 103 if hasattr(options.conn, 'handshake'): 112 104 try:
Note: See TracChangeset
for help on using the changeset viewer.