From: Lars Magne Ingebrigtsen Date: Tue, 9 Dec 2014 03:21:12 +0000 (+0100) Subject: Make the https logic in url-http work on redirects X-Git-Tag: emacs-25.0.90~2635^2~142 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0cc8da5cd8f3a4d7c19501a018cf2a38f86c509b;p=emacs.git Make the https logic in url-http work on redirects (url-http-parse-headers): When being redirected, make sure we flush the previous certificate. --- diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index d544cf0d083..690f6991910 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -2,6 +2,8 @@ * url-http.el (url-http-parse-headers): Pass the GnuTLS status of the connection to the caller. + (url-http-parse-headers): When being redirected, make sure we + flush the previous certificate. 2014-12-08 Stefan Monnier diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index f5a214a89d8..34d325acf56 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -494,12 +494,14 @@ should be shown to the user." (url-http-mark-connection-as-free (url-host url-current-object) (url-port url-current-object) url-http-process) - ;; Pass the certificate on to the caller. + ;; Pass the https certificate on to the caller. (when (gnutls-available-p) - (when-let (status (gnutls-peer-status url-http-process)) - (setcar url-callback-arguments - (plist-put (car url-callback-arguments) - :peer status)))) + (let ((status (gnutls-peer-status url-http-process))) + (when (or status + (plist-get (car url-callback-arguments) :peer)) + (setcar url-callback-arguments + (plist-put (car url-callback-arguments) + :peer status))))) (if (or (not (boundp 'url-http-end-of-headers)) (not url-http-end-of-headers)) (error "Trying to parse headers in odd buffer: %s" (buffer-name)))