changeset 57449:202c408c174b

url-vars.el (url-gateway-method): Add new method `tls'. url-news.el (url-snews): Use nntp-open-tls-stream if url-gateway-method is tls. url-ldap.el (url-ldap-certificate-formatter): Use tls-certificate-information if ssl.el is not available. url-https.el (url-https-create-secure-wrapper): Use tls if ssl is not available. url-gw.el (url-open-stream): Support tls url-gateway-method. (url-open-stream): Likewise.
author Simon Josefsson <jas@extundo.com>
date Tue, 12 Oct 2004 09:55:08 +0000
parents 821d95294db5
children 7e2887ad4c51
files lisp/url/url-gw.el lisp/url/url-https.el lisp/url/url-ldap.el lisp/url/url-news.el lisp/url/url-vars.el
diffstat 5 files changed, 24 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/url/url-gw.el	Tue Oct 12 09:40:45 2004 +0000
+++ b/lisp/url/url-gw.el	Tue Oct 12 09:55:08 2004 +0000
@@ -3,7 +3,7 @@
 ;; Keywords: comm, data, processes
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1997, 1998 Free Software Foundation, Inc.
+;;; Copyright (c) 1997, 1998, 2004 Free Software Foundation, Inc.
 ;;;
 ;;; This file is part of GNU Emacs.
 ;;;
@@ -29,6 +29,7 @@
 
 (autoload 'socks-open-network-stream "socks")
 (autoload 'open-ssl-stream "ssl")
+(autoload 'open-tls-stream "tls")
 
 (defgroup url-gateway nil
   "URL gateway variables"
@@ -212,6 +213,7 @@
 Will not make a connexion if `url-gateway-unplugged' is non-nil."
   (unless url-gateway-unplugged
     (let ((gw-method (if (and url-gateway-local-host-regexp
+			      (not (eq 'tls url-gateway-method))
 			      (not (eq 'ssl url-gateway-method))
 			      (string-match
 			       url-gateway-local-host-regexp
@@ -242,6 +244,8 @@
 	  (let ((coding-system-for-read 'binary)
 		(coding-system-for-write 'binary))
 	    (setq conn (case gw-method
+			 (tls
+			  (open-tls-stream name buffer host service))
 			 (ssl
 			  (open-ssl-stream name buffer host service))
 			 ((native)
--- a/lisp/url/url-https.el	Tue Oct 12 09:40:45 2004 +0000
+++ b/lisp/url/url-https.el	Tue Oct 12 09:55:08 2004 +0000
@@ -1,4 +1,4 @@
-;;; url-https.el --- HTTP over SSL routines
+;;; url-https.el --- HTTP over SSL/TLS routines
 
 ;; Copyright (c) 1999, 2004 Free Software Foundation, Inc.
 
@@ -30,6 +30,7 @@
 (require 'url-parse)
 (require 'url-cookie)
 (require 'url-http)
+(require 'tls)
 
 (defconst url-https-default-port 443 "Default HTTPS port.")
 (defconst url-https-asynchronous-p t "HTTPS retrievals are asynchronous.")
@@ -38,12 +39,11 @@
 (defmacro url-https-create-secure-wrapper (method args)
   `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) ,args
     ,(format "HTTPS wrapper around `%s' call." (or method "url-http"))
-    (condition-case ()
-	(require 'ssl)
-      (error
-       (error "HTTPS support could not find `ssl' library")))
-    (let ((url-gateway-method 'ssl))
-      ( ,(intern (format (if method "url-http-%s" "url-http") method)) ,@(remove '&rest (remove '&optional args))))))
+    (let ((url-gateway-method (condition-case ()
+				  (require 'ssl)
+				(error 'tls))))
+      (,(intern (format (if method "url-http-%s" "url-http") method))
+       ,@(remove '&rest (remove '&optional args))))))
 
 (url-https-create-secure-wrapper nil (url callback cbargs))
 (url-https-create-secure-wrapper file-exists-p (url))
--- a/lisp/url/url-ldap.el	Tue Oct 12 09:40:45 2004 +0000
+++ b/lisp/url/url-ldap.el	Tue Oct 12 09:55:08 2004 +0000
@@ -28,6 +28,7 @@
 (require 'url-parse)
 (require 'url-util)
 (require 'ldap)
+(autoload 'tls-certificate-information "tls")
 
 ;; This has been implemented from RFC2255 'The LDAP URL Format' (Dec 1997)
 ;;
@@ -96,7 +97,8 @@
       (require 'ssl)
     (error nil))
   (let ((vals (if (fboundp 'ssl-certificate-information)
-		  (ssl-certificate-information data))))
+		  (ssl-certificate-information data)
+		(tls-certificate-information data))))
     (if (not vals)
 	"<b>Unable to parse certificate</b>"
       (concat "<table border=0>\n"
--- a/lisp/url/url-news.el	Tue Oct 12 09:40:45 2004 +0000
+++ b/lisp/url/url-news.el	Tue Oct 12 09:55:08 2004 +0000
@@ -2,7 +2,7 @@
 ;; Keywords: comm, data, processes
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1996 - 1999 Free Software Foundation, Inc.
+;;; Copyright (c) 1996 - 1999, 2004 Free Software Foundation, Inc.
 ;;;
 ;;; This file is part of GNU Emacs.
 ;;;
@@ -125,7 +125,9 @@
 
 ;;;###autoload
 (defun url-snews (url)
-  (let ((nntp-open-connection-function 'nntp-open-ssl-stream))
+  (let ((nntp-open-connection-function (if (eq 'tls url-gateway-method)
+					   nntp-open-tls-stream
+					 nntp-open-ssl-stream)))
     (url-news url)))
 
 (provide 'url-news)
--- a/lisp/url/url-vars.el	Tue Oct 12 09:40:45 2004 +0000
+++ b/lisp/url/url-vars.el	Tue Oct 12 09:55:08 2004 +0000
@@ -2,7 +2,7 @@
 ;; Keywords: comm, data, processes, hypermedia
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Copyright (c) 1996,1997,1998,1999,2001 Free Software Foundation, Inc.
+;;; Copyright (c) 1996,1997,1998,1999,2001,2004 Free Software Foundation, Inc.
 ;;;
 ;;; This file is part of GNU Emacs.
 ;;;
@@ -368,12 +368,14 @@
 `telnet': Run telnet in a subprocess to connect;
 `rlogin': Rlogin to another machine to connect;
 `socks': Connect through a socks server;
-`ssl': Connect with SSL;
+`tls': Connect with TLS;
+`ssl': Connect with SSL (deprecated, use `tls' instead);
 `native': Connect directy."
   :type '(radio (const :tag "Telnet to gateway host" :value telnet)
 		(const :tag "Rlogin to gateway host" :value rlogin)
 		(const :tag "Use SOCKS proxy" :value socks)
-		(const :tag "Use SSL for all connections" :value ssl)
+		(const :tag "Use SSL/TLS for all connections" :value tls)
+		(const :tag "Use SSL for all connections (obsolete)" :value ssl)
 		(const :tag "Direct connection" :value native))
   :group 'url-hairy)