If STARTTLS failed, then just open a normal connection.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 28 Nov 2010 02:43:43 +0000 (03:43 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 28 Nov 2010 02:43:43 +0000 (03:43 +0100)
lisp/ChangeLog
lisp/proto-stream.el

index 2319ef7..96e6e46 100644 (file)
@@ -6,6 +6,8 @@
        that what we've checked for.
        (proto-stream-always-use-starttls): Only default to t if
        open-gnutls-stream exists.
+       (proto-stream-open-network): If STARTTLS failed, then just open a
+       normal connection.
 
        * nntp.el (nntp-open-connection): Report what the connection error is.
 
index 6f4b019..c1acf4b 100644 (file)
@@ -148,7 +148,16 @@ command to switch on STARTTLS otherwise."
          (proto-stream-command stream starttls-command eoc)
          (if (fboundp 'open-gnutls-stream)
              (gnutls-negotiate stream nil)
-           (starttls-negotiate stream))
+           (unless (starttls-negotiate stream)
+             (delete-process stream)
+             (setq stream nil)))
+         (when (or (null stream)
+                   (not (memq (process-status stream)
+                              '(open run))))
+           ;; It didn't successfully negotiate STARTTLS, so we reopen
+           ;; the connection.
+           (setq stream (open-network-stream name buffer host service))
+           (proto-stream-get-response stream start eoc))
          ;; Re-get the capabilities, since they may have changed
          ;; after switching to TLS.
          (list stream greeting