summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-09 03:59:48 +0100
committerLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-09 03:59:48 +0100
commitd7e5255013e0d784865e03a1acb6d663c30f0907 (patch)
tree29d98f5408536c6a8bff0a06f84f8fc14ef62e48 /lisp/url
parentafa1d80fe03b8ca9af62158b563d6429b51b7ee1 (diff)
downloademacs-d7e5255013e0d784865e03a1acb6d663c30f0907.tar.gz
Make URL pass the TLS peer status to the caller
* lisp/url/url-http.el (url-http-parse-headers): Pass the GnuTLS status of the connection to the caller.
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-http.el11
2 files changed, 14 insertions, 2 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index b39c67effbb..d544cf0d083 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * url-http.el (url-http-parse-headers): Pass the GnuTLS status of
+ the connection to the caller.
+
2014-12-08 Stefan Monnier <monnier@iro.umontreal.ca>
* url-http.el (url-http-activate-callback): Make debug more verbose.
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 3d5b6be80ac..f5a214a89d8 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -25,7 +25,9 @@
;;; Code:
-(eval-when-compile (require 'cl-lib))
+(eval-when-compile
+ (require 'cl-lib)
+ (require 'subr-x))
(defvar url-callback-arguments)
(defvar url-callback-function)
@@ -492,7 +494,12 @@ 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.
+ (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))))
(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)))