comparison lisp/url/url-https.el @ 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 1ebec6b5e54f
children a8fa7c632ee4 e86fc76a45e4
comparison
equal deleted inserted replaced
57448:821d95294db5 57449:202c408c174b
1 ;;; url-https.el --- HTTP over SSL routines 1 ;;; url-https.el --- HTTP over SSL/TLS routines
2 2
3 ;; Copyright (c) 1999, 2004 Free Software Foundation, Inc. 3 ;; Copyright (c) 1999, 2004 Free Software Foundation, Inc.
4 4
5 ;; Keywords: comm, data, processes 5 ;; Keywords: comm, data, processes
6 6
28 (require 'url-gw) 28 (require 'url-gw)
29 (require 'url-util) 29 (require 'url-util)
30 (require 'url-parse) 30 (require 'url-parse)
31 (require 'url-cookie) 31 (require 'url-cookie)
32 (require 'url-http) 32 (require 'url-http)
33 (require 'tls)
33 34
34 (defconst url-https-default-port 443 "Default HTTPS port.") 35 (defconst url-https-default-port 443 "Default HTTPS port.")
35 (defconst url-https-asynchronous-p t "HTTPS retrievals are asynchronous.") 36 (defconst url-https-asynchronous-p t "HTTPS retrievals are asynchronous.")
36 (defalias 'url-https-expand-file-name 'url-http-expand-file-name) 37 (defalias 'url-https-expand-file-name 'url-http-expand-file-name)
37 38
38 (defmacro url-https-create-secure-wrapper (method args) 39 (defmacro url-https-create-secure-wrapper (method args)
39 `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) ,args 40 `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) ,args
40 ,(format "HTTPS wrapper around `%s' call." (or method "url-http")) 41 ,(format "HTTPS wrapper around `%s' call." (or method "url-http"))
41 (condition-case () 42 (let ((url-gateway-method (condition-case ()
42 (require 'ssl) 43 (require 'ssl)
43 (error 44 (error 'tls))))
44 (error "HTTPS support could not find `ssl' library"))) 45 (,(intern (format (if method "url-http-%s" "url-http") method))
45 (let ((url-gateway-method 'ssl)) 46 ,@(remove '&rest (remove '&optional args))))))
46 ( ,(intern (format (if method "url-http-%s" "url-http") method)) ,@(remove '&rest (remove '&optional args))))))
47 47
48 (url-https-create-secure-wrapper nil (url callback cbargs)) 48 (url-https-create-secure-wrapper nil (url callback cbargs))
49 (url-https-create-secure-wrapper file-exists-p (url)) 49 (url-https-create-secure-wrapper file-exists-p (url))
50 (url-https-create-secure-wrapper file-readable-p (url)) 50 (url-https-create-secure-wrapper file-readable-p (url))
51 (url-https-create-secure-wrapper file-attributes (url &optional id-format)) 51 (url-https-create-secure-wrapper file-attributes (url &optional id-format))