1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-21 08:50:51 +01:00

- fixed 'make-gemini-iri', was building wrong IRI with ipv6 address as host.

This commit is contained in:
cage 2021-04-16 14:44:22 +02:00
parent 32e1394422
commit 90bad8b21c
3 changed files with 19 additions and 2 deletions

View File

@ -247,8 +247,11 @@
(actual-port (if port
(to-s port)
(to-s +gemini-default-port+)))
(actual-host (if (iri:ipv6-address-p host)
(strcat "[" host "]")
host))
(iri (strcat scheme "://"
host ":"
actual-host ":"
actual-port "/"
actual-path)))
(when query

View File

@ -335,3 +335,15 @@
(defun absolute-url-p (url)
(when-let ((iri (iri:iri-parse url :null-on-error t)))
(not (null (uri:scheme iri)))))
(defun ipv4-address-p (string)
(ignore-errors
(let ((bytes (mapcar #'parse-integer
(cl-ppcre:split "\\."
string))))
(and (= (length bytes)
4)
(every (lambda (a) (<= 0 a 255)) bytes)))))
(defun ipv6-address-p (string)
(cl-ppcre:scan ":" string))

View File

@ -676,7 +676,9 @@
:render-iri
:make-iri
:iri-parse
:absolute-url-p))
:absolute-url-p
:ipv4-address-p
:ipv6-address-p))
(defpackage :x509
(:use