]> git.eshelyaron.com Git - emacs.git/commitdiff
Make the https logic in url-http work on redirects
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 9 Dec 2014 03:21:12 +0000 (04:21 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 9 Dec 2014 03:21:12 +0000 (04:21 +0100)
(url-http-parse-headers): When being redirected, make sure we
flush the previous certificate.

lisp/url/ChangeLog
lisp/url/url-http.el

index d544cf0d08355c82be141a2e42473f59857d135a..690f699191050f2f0c18cfc2ef45dc55cb315f98 100644 (file)
@@ -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  <monnier@iro.umontreal.ca>
 
index f5a214a89d8bb727bf17ddfce6f0512ed33238c7..34d325acf56a526b653b9bbfc42d0023ef12cc4e 100644 (file)
@@ -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)))