summaryrefslogtreecommitdiff
path: root/lisp/net/network-stream.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/network-stream.el')
-rw-r--r--lisp/net/network-stream.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index 0c3d0285f91..e27b4541ab5 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -218,7 +218,7 @@ functionality.
(resulting-type 'plain)
(builtin-starttls (and (fboundp 'gnutls-available-p)
(gnutls-available-p)))
- starttls-command error)
+ starttls-available starttls-command error)
;; First check whether the server supports STARTTLS at all.
(when (and capabilities success-string starttls-function)
@@ -227,10 +227,11 @@ functionality.
;; If we have built-in STARTTLS support, try to upgrade the
;; connection.
(when (and starttls-command
- (or builtin-starttls
- (and (or require-tls
- (plist-get parameters :use-starttls-if-possible))
- (starttls-available-p)))
+ (setq starttls-available
+ (or builtin-starttls
+ (and (or require-tls
+ (plist-get parameters :use-starttls-if-possible))
+ (starttls-available-p))))
(not (eq (plist-get parameters :type) 'plain)))
;; If using external STARTTLS, drop this connection and start
;; anew with `starttls-open-stream'.
@@ -298,9 +299,13 @@ functionality.
;; support, or no gnutls-cli installed.
(eq resulting-type 'plain))
(setq error
- (if require-tls
+ (if starttls-available
"Server does not support TLS"
- "Server supports STARTTLS, but Emacs does not have support for it"))
+ (concat "Emacs does not support TLS, and no external `"
+ (if starttls-use-gnutls
+ starttls-gnutls-program
+ starttls-program)
+ "' program was found")))
(delete-process stream)
(setq stream nil))
;; Return value: