From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dsmich@roadrunner.com Newsgroups: gmane.lisp.guile.bugs Subject: bug#53201: string->uri-reference rejects domain names with final =?UTF-8?Q?=E2=80=98.=E2=80=99?= Date: Thu, 27 Jan 2022 00:40:03 +0000 Message-ID: References: <877db5ldok.fsf@nckx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=_60855a8cfae73ebc2ad2412f28d0155c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12919"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "'53201@debbugs.gnu.org'" <53201@debbugs.gnu.org> To: "'Tobias Geerinckx-Rice'" Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Thu Jan 27 01:41:40 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCsr6-0003Fh-1Z for guile-bugs@m.gmane-mx.org; Thu, 27 Jan 2022 01:41:40 +0100 Original-Received: from localhost ([::1]:46178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCsr4-0008IH-JX for guile-bugs@m.gmane-mx.org; Wed, 26 Jan 2022 19:41:38 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCsqU-0008Hb-KP for bug-guile@gnu.org; Wed, 26 Jan 2022 19:41:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCsqU-0001AB-75 for bug-guile@gnu.org; Wed, 26 Jan 2022 19:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nCsqT-0001Pl-Pf for bug-guile@gnu.org; Wed, 26 Jan 2022 19:41:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <877db5ldok.fsf@nckx> Resent-From: dsmich@roadrunner.com Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 27 Jan 2022 00:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53201 X-GNU-PR-Package: guile Original-Received: via spool by 53201-submit@debbugs.gnu.org id=B53201.16432440135345 (code B ref 53201); Thu, 27 Jan 2022 00:41:01 +0000 Original-Received: (at 53201) by debbugs.gnu.org; 27 Jan 2022 00:40:13 +0000 Original-Received: from localhost ([127.0.0.1]:53846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCspg-0001O7-Rr for submit@debbugs.gnu.org; Wed, 26 Jan 2022 19:40:13 -0500 Original-Received: from p-impout009aa.msg.pkvw.co.charter.net ([47.43.26.140]:40818 helo=p-impout009.msg.pkvw.co.charter.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCspe-0001No-J8 for 53201@debbugs.gnu.org; Wed, 26 Jan 2022 19:40:11 -0500 Original-Received: from localhost ([52.86.171.38]) by cmsmtp with ESMTP id CspXnFtpaIjNRCspYnDRmU; Thu, 27 Jan 2022 00:40:04 +0000 X-Authority-Analysis: v=2.4 cv=LeovVxTi c=1 sm=1 tr=0 ts=61f1e9e4 a=KRKCKI1VKQ4u2uwitZ6MRA==:117 a=KRKCKI1VKQ4u2uwitZ6MRA==:17 a=dO-r_OgLWBAA:10 a=ZCCh32qSjNMA:10 a=5KLPUuaC_9wA:10 a=A5rC-8FTAAAA:8 a=flPnO-knAAAA:8 a=5Dti7XgrxjodCihwQc4A:9 a=QEXdDO2ut3YA:10 a=-FEs8UIgK8oA:10 a=qiWi7Edwir4A:10 a=KsCKKrhOzxYA:10 a=NWVoK91CQyQA:10 a=mDV3o1hIAAAA:8 a=yutfU5nr0myig40deG8A:9 a=M-BLvH7DKaImB2L3:21 a=_W_S_7VecoQA:10 a=PxaQQihm7Irf3_GUMlOW:22 a=0VNN33crjTfVWQGLboud:22 a=_FVE-zBwftR9WsbkzFJk:22 X-Mailer: Atmail X-Originating-IP: [24.29.205.215] X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal X-CMAE-Envelope: MS4xfCnJnM7tkY/5vvzK2uXP/GCL6wxxDS0knX8CvKtB1q/JzY1+MlbqtGCpkKLBW0OF19/GG4Sfa12lOsDAIP8EIYDgP27D45BnyXek7zhvxp0z2lDB1tBo QELFr8d3zXw2wMH46+UUeEFs9EiRjLa5TYaGn6FerGVfsKJwznuw+A74aMFZyVOp1QH5FCx9ANGyJLtwE04cQWU3jjJUgJOTGFk= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10241 Archived-At: --=_60855a8cfae73ebc2ad2412f28d0155c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Probably not the best fix. Seems to work. Includes a few tests.=0A=0A-Da= le=0A=0Adiff --git a/module/web/uri.scm b/module/web/uri.scm=0Aindex 8e0= b9bee7..d6758fcc6 100644=0A--- a/module/web/uri.scm=0A+++ b/module/web/u= ri.scm=0A@@ -212,7 +212,9 @@ for =E2=80=98build-uri=E2=80=99 except ther= e is no scheme."=0A (and (regexp-exec domain-label-regexp=0A (substring= host start end))=0A (lp (1+ end)))=0A- (regexp-exec top-label-regexp ho= st start)))))))=0A+ (if (< start (string-length host))=0A+ (regexp-exec= top-label-regexp host start)=0A+ #t)))))))=0A=0A (define userinfo-pat= =0A (string-append "[" letters digits "_.!~*'();:&=3D+$,-]+"))=0Adiff --= git a/test-suite/tests/web-uri.test=0Ab/test-suite/tests/web-uri.test=0A= index 95fd82f16..c49142d48 100644=0A--- a/test-suite/tests/web-uri.test= =0A+++ b/test-suite/tests/web-uri.test=0A@@ -367,6 +367,9 @@=0A (pass-if= "//bad.host.1"=0A (not (string->uri-reference "//bad.host.1")))=0A=0A+= (pass-if "//bad.host.."=0A+ (not (string->uri-reference "//bad.host..")= ))=0A+=0A (pass-if "http://1.good.host"=0A (uri=3D? (string->uri-referen= ce "http://1.good.host")=0A #:scheme 'http #:host "1.good.host" #:path "= "))=0A@@ -375,6 +378,10 @@=0A (uri=3D? (string->uri-reference "//1.good.= host")=0A #:host "1.good.host" #:path ""))=0A=0A+ (pass-if "//1.good.hos= t."=0A+ (uri=3D? (string->uri-reference "//1.good.host.")=0A+ #:host "1.= good.host." #:path ""))=0A+=0A (when (memq 'socket *features*)=0A (pass-= if "http://192.0.2.1"=0A (uri=3D? (string->uri-reference "http://192.0.2= .1")=0A=0A --=_60855a8cfae73ebc2ad2412f28d0155c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Probably not the best fix.  Seems to work.  Includ= es a few tests.

-Dale


diff --git a/module/web/uri.scm= b/module/web/uri.scm
index 8e0b9bee7..d6758fcc6 100644
--- a/modu= le/web/uri.scm
+++ b/module/web/uri.scm
@@ -212,7 +212,9 @@ for= =E2=80=98build-uri=E2=80=99 except there is no scheme."
  =            (and (regex= p-exec domain-label-regexp
       =             =             (subs= tring host start end))
       &nbs= p;          (lp (1+ end)))<= br>-            (= regexp-exec top-label-regexp host start)))))))
+   &nb= sp;        (if (< start (string-le= ngth host))
+         &n= bsp;      (regexp-exec top-label-regexp host st= art)
+          &nb= sp;     #t)))))))
 
 (define userinf= o-pat
   (string-append "[" letters digits "_.!~*'();:&= =3D+$,-]+"))
diff --git a/test-suite/tests/web-uri.test b/test-suite/= tests/web-uri.test
index 95fd82f16..c49142d48 100644
--- a/test-su= ite/tests/web-uri.test
+++ b/test-suite/tests/web-uri.test
@@ -367= ,6 +367,9 @@
   (pass-if "//bad.host.1"
  &nbs= p;  (not (string->uri-reference "//bad.host.1")))
 
+=   (pass-if "//bad.host.."
+    (not (string->u= ri-reference "//bad.host..")))
+
   (pass-if "http://1.g= ood.host"
     (uri=3D? (string->uri-reference= "http://1.good.host")
       &nbs= p;    #:scheme 'http #:host "1.good.host" #:path ""))
= @@ -375,6 +378,10 @@
     (uri=3D? (string->ur= i-reference "//1.good.host")
      &nbs= p;     #:host "1.good.host" #:path ""))
 +  (pass-if "//1.good.host."
+    (uri=3D? (stri= ng->uri-reference "//1.good.host.")
+     = ;      #:host "1.good.host." #:path ""))
+   (when (memq 'socket *features*)
   &nbs= p; (pass-if "http://192.0.2.1"
       (= uri=3D? (string->uri-reference "http://192.0.2.1")

=0A --=_60855a8cfae73ebc2ad2412f28d0155c--