"If non-nil, use TLS to communicate with gopher servers.")
(defvar elpher-client-certificate nil
- "If non-nil, contains client certificate details to use for TLS connections.")
+ "If non-nil, contains details of client certificate to use for TLS connections.
+See `elpher-generate-certificate' for further info.")
(defun elpher-process-cleanup ()
"Immediately shut down any extant elpher process and timers."
(elpher-gemini-insert-text response-meta))
(let ((chosen-certificate
(with-local-quit
- (elpher-acquire-client-certificate
- (elpher-address-to-url (elpher-page-address elpher-current-page))))))
+ (elpher-acquire-client-certificate))))
(unless chosen-certificate
(error "Gemini server requires a client certificate and none was provided"))
(setq-local elpher-client-certificate chosen-certificate))
(error "Gemini server response unknown: %s %s"
response-code response-meta))))))
-(defun elpher-acquire-client-certificate (url-prefix)
- "Select a pre-defined client certificate or prompt for one.
+(defun elpher-acquire-client-certificate ()
+ "Select and activate a pre-defined client certificate or prompt for one.
In this case, \"pre-defined\" means a certificate provided by
-the `elpher-certificate-map' variable.
-
-For this session, the certificate will remain active for all addresses
-having URLs begining with URL-PREFIX."
- (let ((entry (assoc url-prefix
- elpher-certificate-map
- #'string-prefix-p)))
+the `elpher-certificate-map' variable."
+ (let* ((current-url (elpher-address-to-url (elpher-page-address elpher-current-page)))
+ (entry (assoc current-url
+ elpher-certificate-map
+ #'string-prefix-p)))
(if entry
- (let ((cert-url-prefix (car entry))
+ (let ((cert-url-regex (car entry))
(cert-name (cadr entry)))
(message "Using certificate \"%s\" specified in elpher-certificate-map with prefix \"%s\""
- cert-name cert-url-prefix)
- (elpher-get-existing-certificate cert-name cert-url-prefix))
- (elpher-prompt-for-client-certificate url-prefix))))
+ cert-name cert-url-regex)
+ (elpher-get-existing-certificate cert-name cert-url-regex))
+ (elpher-prompt-for-client-certificate current-url))))
(defun elpher--read-answer-polyfill (question answers)
"Polyfill for `read-answer' in Emacs 26.1.