emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d7e5255: Make URL pass the TLS peer status to the c


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master d7e5255: Make URL pass the TLS peer status to the caller
Date: Tue, 09 Dec 2014 02:59:55 +0000

branch: master
commit d7e5255013e0d784865e03a1acb6d663c30f0907
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    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.
---
 etc/NEWS             |    4 ++++
 lisp/url/ChangeLog   |    5 +++++
 lisp/url/url-http.el |   11 +++++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 56036f8..2b40777 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -328,6 +328,10 @@ a function.
 to specify that we're running in a noninteractive context, and that
 we should not be queried about things like TLS certificate validity.
 
+*** If URL is used with a https connection, the first callback argument
+plist will contain a :peer element that has the output of
+`gnutls-peer-status' (if Emacs is built with GnuTLS support).
+
 ** Tramp
 
 *** New connection method "nc", which allows to access dumb busyboxes.
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index b39c67e..d544cf0 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-09  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * url-http.el (url-http-parse-headers): Pass the GnuTLS status of
+       the connection to the caller.
+
 2014-12-08  Stefan Monnier  <address@hidden>
 
        * 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 3d5b6be..f5a214a 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]