X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=elpher.el;h=5b75ce3f522beb11cbcac6fa82f404cde1350ac2;hb=06f8413403015f8da746a04f6dd24f484a7f3f8c;hp=b323cbb2ec49374f991a11eba1da596d1964a2e3;hpb=c4cd344dafc01c940bc0d9f318f90e025cbae82b;p=elpher.git diff --git a/elpher.el b/elpher.el index b323cbb..5b75ce3 100644 --- a/elpher.el +++ b/elpher.el @@ -145,6 +145,11 @@ These certificates may be used for establishing authenticated TLS connections." "The command used to launch openssl when generating TLS client certificates." :type '(file)) +(defcustom elpher-default-url-type "gopher" + "Default URL type to assume if not explicitly given." + :type '(choice (const "gopher") + (const "gemini"))) + (defcustom elpher-gemini-TLS-cert-checks nil "If non-nil, verify gemini server TLS certs using the default security level. Otherwise, certificate verification is disabled. @@ -282,13 +287,17 @@ Otherwise, the SOCKS proxy is only used for connections to onion services." (setf (url-filename url) (url-unhex-string (url-filename url))) (unless (url-type url) - (setf (url-type url) "gopher")) + (setf (url-type url) elpher-default-url-type)) + (unless (url-host url) + (let ((p (split-string (url-filename url) "/" nil nil))) + (setf (url-host url) (car p)) + (setf (url-filename url) + (if (cdr p) + (concat "/" (mapconcat #'identity (cdr p) "/")) + "")))) (when (or (equal "gopher" (url-type url)) (equal "gophers" (url-type url))) ;; Gopher defaults - (unless (url-host url) - (setf (url-host url) (url-filename url)) - (setf (url-filename url) "")) (when (or (equal (url-filename url) "") (equal (url-filename url) "/")) (setf (url-filename url) "/1"))) @@ -631,7 +640,8 @@ the host operating system and the local network capabilities." (unless (< (elpher-address-port address) 65536) (error "Cannot establish network connection: port number > 65536")) (when (and (eq use-tls 'gemini) (not elpher-gemini-TLS-cert-checks)) - (setq-local network-security-level 'low)) + (setq-local network-security-level 'low) + (setq-local gnutls-verify-error nil)) (condition-case nil (let* ((kill-buffer-query-functions nil) (port (elpher-address-port address))