mirror of
https://codeberg.org/cage/tinmop/
synced 2024-12-20 23:34:40 +01:00
- [gemini] when resolving host try UTF8 encoded name first and punycoded last.
This commit is contained in:
parent
11fa85ad79
commit
d92c103c43
@ -326,6 +326,14 @@
|
|||||||
debug-gemini-request)
|
debug-gemini-request)
|
||||||
(apply #'misc:dbg (text-utils:strcat "[gemini] " (first data)) (rest data)))
|
(apply #'misc:dbg (text-utils:strcat "[gemini] " (first data)) (rest data)))
|
||||||
|
|
||||||
|
(defun open-tls-socket (host port)
|
||||||
|
(flet ((open-socket (hostname)
|
||||||
|
(usocket:socket-connect hostname
|
||||||
|
port
|
||||||
|
:element-type '(unsigned-byte 8))))
|
||||||
|
(or (ignore-errors (open-socket host))
|
||||||
|
(open-socket (idn:host-unicode->ascii host)))))
|
||||||
|
|
||||||
(defun request (host path &key
|
(defun request (host path &key
|
||||||
(query nil)
|
(query nil)
|
||||||
(port +gemini-default-port+)
|
(port +gemini-default-port+)
|
||||||
@ -339,9 +347,8 @@
|
|||||||
:fragment (percent-encode-fragment fragment)))
|
:fragment (percent-encode-fragment fragment)))
|
||||||
(ctx (cl+ssl:make-context :verify-mode cl+ssl:+ssl-verify-none+)))
|
(ctx (cl+ssl:make-context :verify-mode cl+ssl:+ssl-verify-none+)))
|
||||||
(cl+ssl:with-global-context (ctx :auto-free-p t)
|
(cl+ssl:with-global-context (ctx :auto-free-p t)
|
||||||
(when-let* ((socket (usocket:socket-connect (idn:host-unicode->ascii host)
|
|
||||||
port
|
(when-let* ((socket (open-tls-socket host port))
|
||||||
:element-type '(unsigned-byte 8)))
|
|
||||||
(stream (usocket:socket-stream socket))
|
(stream (usocket:socket-stream socket))
|
||||||
(ssl-stream (cl+ssl:make-ssl-client-stream stream
|
(ssl-stream (cl+ssl:make-ssl-client-stream stream
|
||||||
:certificate client-certificate
|
:certificate client-certificate
|
||||||
|
Loading…
Reference in New Issue
Block a user