[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] web: Hosts ending in a full stop are valid.
From: |
Tobias Geerinckx-Rice |
Subject: |
[PATCH] web: Hosts ending in a full stop are valid. |
Date: |
Sun, 22 Jan 2023 01:00:53 +0100 |
* module/web/uri.scm (valid-host?): Drop one trailing "." before validating.
---
module/web/uri.scm | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/module/web/uri.scm b/module/web/uri.scm
index 8e0b9bee7..c6affa963 100644
--- a/module/web/uri.scm
+++ b/module/web/uri.scm
@@ -206,13 +206,16 @@ for ‘build-uri’ except there is no scheme."
((regexp-exec ipv6-regexp host)
(false-if-exception (inet-pton AF_INET6 host)))
(else
- (let lp ((start 0))
- (let ((end (string-index host #\. start)))
- (if end
- (and (regexp-exec domain-label-regexp
- (substring host start end))
- (lp (1+ end)))
- (regexp-exec top-label-regexp host start)))))))
+ (let ((fqdn (if (string=? "." (string-take-right host 1))
+ (string-drop-right host 1)
+ host)))
+ (let lp ((start 0))
+ (let ((end (string-index fqdn #\. start)))
+ (if end
+ (and (regexp-exec domain-label-regexp
+ (substring fqdn start end))
+ (lp (1+ end)))
+ (regexp-exec top-label-regexp fqdn start))))))))
(define userinfo-pat
(string-append "[" letters digits "_.!~*'();:&=+$,-]+"))
base-commit: 5b42f8c154906584455a4989038406c88b723cb0
--
2.39.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] web: Hosts ending in a full stop are valid.,
Tobias Geerinckx-Rice <=