Make the https logic in url-http work on redirects

(url-http-parse-headers): When being redirected, make sure we
flush the previous certificate.
This commit is contained in:
Lars Magne Ingebrigtsen 2014-12-09 04:21:12 +01:00
parent d7e5255013
commit 0cc8da5cd8
2 changed files with 9 additions and 5 deletions

View 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>

View 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)))