diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/gnutls.el | 32 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 12 |
2 files changed, 23 insertions, 21 deletions
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 90bfe04af9e..9e261a7b04f 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el | |||
| @@ -128,8 +128,11 @@ trust and key files, and priority string." | |||
| 128 | :nowait nowait))) | 128 | :nowait nowait))) |
| 129 | (if nowait | 129 | (if nowait |
| 130 | (progn | 130 | (progn |
| 131 | (gnutls-mark-process process t) | 131 | (gnutls-asynchronous-parameters |
| 132 | (set-process-sentinel process 'gnutls-async-sentinel) | 132 | process |
| 133 | (gnutls-negotiate :type 'gnutls-x509pki | ||
| 134 | :return-keywords t | ||
| 135 | :hostname host)) | ||
| 133 | process) | 136 | process) |
| 134 | (gnutls-negotiate :process (open-network-stream name buffer host service) | 137 | (gnutls-negotiate :process (open-network-stream name buffer host service) |
| 135 | :type 'gnutls-x509pki | 138 | :type 'gnutls-x509pki |
| @@ -153,6 +156,7 @@ trust and key files, and priority string." | |||
| 153 | &key process type hostname priority-string | 156 | &key process type hostname priority-string |
| 154 | trustfiles crlfiles keylist min-prime-bits | 157 | trustfiles crlfiles keylist min-prime-bits |
| 155 | verify-flags verify-error verify-hostname-error | 158 | verify-flags verify-error verify-hostname-error |
| 159 | return-keywords | ||
| 156 | &allow-other-keys) | 160 | &allow-other-keys) |
| 157 | "Negotiate a SSL/TLS connection. Returns proc. Signals gnutls-error. | 161 | "Negotiate a SSL/TLS connection. Returns proc. Signals gnutls-error. |
| 158 | 162 | ||
| @@ -204,7 +208,13 @@ here's a recent version of the list. | |||
| 204 | GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 256 | 208 | GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 256 |
| 205 | 209 | ||
| 206 | It must be omitted, a number, or nil; if omitted or nil it | 210 | It must be omitted, a number, or nil; if omitted or nil it |
| 207 | defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." | 211 | defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT. |
| 212 | |||
| 213 | If RETURN-KEYWORDS, don't connect to anything, but just return | ||
| 214 | the computed parameters that we otherwise would be calling | ||
| 215 | gnutls-boot with. The return value will be a list where the | ||
| 216 | first element is the TLS type, and the rest of the list consists | ||
| 217 | of the keywords." | ||
| 208 | (let* ((type (or type 'gnutls-x509pki)) | 218 | (let* ((type (or type 'gnutls-x509pki)) |
| 209 | ;; The gnutls library doesn't understand files delivered via | 219 | ;; The gnutls library doesn't understand files delivered via |
| 210 | ;; the special handlers, so ignore all files found via those. | 220 | ;; the special handlers, so ignore all files found via those. |
| @@ -252,15 +262,17 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." | |||
| 252 | :verify-error ,verify-error | 262 | :verify-error ,verify-error |
| 253 | :callbacks nil)) | 263 | :callbacks nil)) |
| 254 | 264 | ||
| 255 | (gnutls-message-maybe | 265 | (if return-keywords |
| 256 | (setq ret (gnutls-boot process type params)) | 266 | (cons type params) |
| 257 | "boot: %s" params) | 267 | (gnutls-message-maybe |
| 268 | (setq ret (gnutls-boot process type params)) | ||
| 269 | "boot: %s" params) | ||
| 258 | 270 | ||
| 259 | (when (gnutls-errorp ret) | 271 | (when (gnutls-errorp ret) |
| 260 | ;; This is a error from the underlying C code. | 272 | ;; This is a error from the underlying C code. |
| 261 | (signal 'gnutls-error (list process ret))) | 273 | (signal 'gnutls-error (list process ret))) |
| 262 | 274 | ||
| 263 | process)) | 275 | process))) |
| 264 | 276 | ||
| 265 | (defun gnutls-trustfiles () | 277 | (defun gnutls-trustfiles () |
| 266 | "Return a list of usable trustfiles." | 278 | "Return a list of usable trustfiles." |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 43b2862e0ea..222dbc64d68 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -1277,17 +1277,7 @@ The return value of this function is the retrieval buffer." | |||
| 1277 | (pcase (process-status connection) | 1277 | (pcase (process-status connection) |
| 1278 | (`connect | 1278 | (`connect |
| 1279 | ;; Asynchronous connection | 1279 | ;; Asynchronous connection |
| 1280 | (if (not (process-sentinel connection)) | 1280 | (set-process-sentinel connection 'url-http-async-sentinel)) |
| 1281 | (set-process-sentinel connection 'url-http-async-sentinel) | ||
| 1282 | ;; If we already have a sentinel on this process (for | ||
| 1283 | ;; instance on TLS connections), then chain them | ||
| 1284 | ;; together. | ||
| 1285 | (let ((old (process-sentinel connection))) | ||
| 1286 | (set-process-sentinel | ||
| 1287 | connection | ||
| 1288 | `(lambda (proc why) | ||
| 1289 | (funcall ',old proc why) | ||
| 1290 | (url-http-async-sentinel proc why)))))) | ||
| 1291 | (`failed | 1281 | (`failed |
| 1292 | ;; Asynchronous connection failed | 1282 | ;; Asynchronous connection failed |
| 1293 | (error "Could not create connection to %s:%d" host port)) | 1283 | (error "Could not create connection to %s:%d" host port)) |