summaryrefslogtreecommitdiff
path: root/module/web/uri.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/uri.scm')
-rw-r--r--module/web/uri.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/module/web/uri.scm b/module/web/uri.scm
index 8e0b9bee7..8c5c0d6f0 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 ((last (1- (string-length host))))
+ (let lp ((start 0))
+ (let ((end (string-index host #\. start)))
+ (if (and end (< end last))
+ (and (regexp-exec domain-label-regexp
+ (substring host start end))
+ (lp (1+ end)))
+ (if end
+ (regexp-exec top-label-regexp (substring host start end))
+ (regexp-exec top-label-regexp host start)))))))))
(define userinfo-pat
(string-append "[" letters digits "_.!~*'();:&=+$,-]+"))