From c35b7279ec6b001ae693bedbce9dd100a81aa409 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sun, 28 Nov 2010 13:38:08 +0100 Subject: [PATCH] (proto-stream-open-network): Add some comments. --- lisp/ChangeLog | 2 ++ lisp/proto-stream.el | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f27b3e3d0..d5f84f797 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-11-28 Lars Magne Ingebrigtsen + * proto-stream.el (proto-stream-open-network): Add some comments. + * nntp.el (nntp-open-connection): Provide a :success condition. * nnimap.el (nnimap-open-connection-1): Ditto. diff --git a/lisp/proto-stream.el b/lisp/proto-stream.el index 19e932ba5..df8f3c599 100644 --- a/lisp/proto-stream.el +++ b/lisp/proto-stream.el @@ -123,18 +123,20 @@ command to switch on STARTTLS otherwise." (funcall (cadr (memq :starttls-function parameters)) capabilities))) (cond - ((or (not starttls-command) - (and (not (eq type 'starttls)) - (not proto-stream-always-use-starttls))) ;; If this server doesn't support STARTTLS, but we have ;; requested it explicitly, then close the connection and ;; return nil. + ((or (not starttls-command) + (and (not (eq type 'starttls)) + (not proto-stream-always-use-starttls))) (if (eq type 'starttls) (progn (delete-process stream) nil) ;; Otherwise, just return this plain network connection. (list stream greeting capabilities))) + ;; We have some kind of STARTTLS support, so we try to + ;; upgrade the connection opportunistically. ((or (fboundp 'open-gnutls-stream) (executable-find "gnutls-cli")) (unless (fboundp 'open-gnutls-stream) @@ -178,9 +180,12 @@ command to switch on STARTTLS otherwise." ;; after switching to TLS. (list stream greeting (proto-stream-command stream capability-command eoc)))) + ;; We don't have STARTTLS support available, but the caller + ;; requested a STARTTLS connection, so we give up. ((eq (cadr (memq :type parameters)) 'starttls) (delete-process stream) nil) + ;; Fall back on using a plain network stream. (t (list stream greeting capabilities))))))) -- 2.34.1