def _get_socket(self, host, port, timeout): if self.debuglevel > 0: print >>sys.stderr, "connect:", (host, port) new_socket = socket.create_connection((host, port), timeout) new_socket = sslutil.wrapsocket(new_socket, self.keyfile, self.certfile, **self._sslkwargs) self.file = smtplib.SSLFakeFile(new_socket) return new_socket
def _get_socket(self, host, port, timeout): if self.debuglevel > 0: print >> sys.stderr, 'connect:', (host, port) new_socket = socket.create_connection((host, port), timeout) new_socket = sslutil.wrapsocket(new_socket, self.keyfile, self.certfile, **self._sslkwargs) self.file = smtplib.SSLFakeFile(new_socket) return new_socket
def connect(self): if has_https and self.realhostport: # use CONNECT proxy self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) if _generic_proxytunnel(self): # we do not support client X.509 certificates self.sock = sslutil.wrapsocket(self.sock, None, None, None, serverhostname=self.host) else: keepalive.HTTPConnection.connect(self)
def connect(self): self.sock = _create_connection((self.host, self.port)) host = self.host if self.realhostport: # use CONNECT proxy _generic_proxytunnel(self) host = self.realhostport.rsplit(':', 1)[0] self.sock = sslutil.wrapsocket( self.sock, self.key_file, self.cert_file, serverhostname=host, **sslutil.sslkwargs(self.ui, host)) sslutil.validator(self.ui, host)(self.sock)
def connect(self): self.sock = _create_connection((self.host, self.port)) host = self.host if self.realhostport: # use CONNECT proxy _generic_proxytunnel(self) host = self.realhostport.rsplit(':', 1)[0] self.sock = sslutil.wrapsocket(self.sock, self.key_file, self.cert_file, serverhostname=host, **sslutil.sslkwargs(self.ui, host)) sslutil.validator(self.ui, host)(self.sock)
def starttls(self, keyfile=None, certfile=None): if not self.has_extn("starttls"): msg = "STARTTLS extension not supported by server" raise smtplib.SMTPException(msg) (resp, reply) = self.docmd("STARTTLS") if resp == 220: self.sock = sslutil.wrapsocket(self.sock, keyfile, certfile, **self._sslkwargs) if not util.safehasattr(self.sock, "read"): # using httplib.FakeSocket with Python 2.5.x or earlier self.sock.read = self.sock.recv self.file = smtplib.SSLFakeFile(self.sock) self.helo_resp = None self.ehlo_resp = None self.esmtp_features = {} self.does_esmtp = 0 return (resp, reply)