From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Julien Lepiller Newsgroups: gmane.lisp.guile.bugs Subject: bug#40582: Valid URIs are rejected Date: Wed, 17 Jun 2020 21:17:11 -0400 Message-ID: <1CE6246D-B9ED-46F7-83F3-A51F0797C991@lepiller.eu> References: <3EFDD2B8-58F2-41E1-997B-76098A9A3715@lepiller.eu> <878sglpd82.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="48416"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: K-9 Mail for Android Cc: 40582@debbugs.gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Thu Jun 18 03:21:09 2020 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 1jljEp-000CT6-SJ for guile-bugs@m.gmane-mx.org; Thu, 18 Jun 2020 03:21:07 +0200 Original-Received: from localhost ([::1]:44930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jljEo-0007vO-F2 for guile-bugs@m.gmane-mx.org; Wed, 17 Jun 2020 21:21:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jljEk-0007vE-Hv for bug-guile@gnu.org; Wed, 17 Jun 2020 21:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jljEk-000260-8t for bug-guile@gnu.org; Wed, 17 Jun 2020 21:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jljEk-0004WD-4L for bug-guile@gnu.org; Wed, 17 Jun 2020 21:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 18 Jun 2020 01:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40582 X-GNU-PR-Package: guile Original-Received: via spool by 40582-submit@debbugs.gnu.org id=B40582.159244321117281 (code B ref 40582); Thu, 18 Jun 2020 01:21:02 +0000 Original-Received: (at 40582) by debbugs.gnu.org; 18 Jun 2020 01:20:11 +0000 Original-Received: from localhost ([127.0.0.1]:52478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jljDv-0004Ue-0D for submit@debbugs.gnu.org; Wed, 17 Jun 2020 21:20:11 -0400 Original-Received: from lepiller.eu ([89.234.186.109]:35430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jljDp-0004UL-3t for 40582@debbugs.gnu.org; Wed, 17 Jun 2020 21:20:09 -0400 Original-Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 24a80ced; Thu, 18 Jun 2020 01:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date :in-reply-to:references:mime-version:content-type :content-transfer-encoding:subject:to:cc:from:message-id; s= dkim; bh=StWDsEGfJlPUS2niaJEqbeEJ83aMnnaykIVYgsHqkqg=; b=PvhRmRh 2SyCcYSG0cBODWdO4tdYrodDsuFpM4uNZ7pXlm2hLJ7Vim2eC3eltRkbTtEWPDBe CxlFdBBi0mZY+iFxIZS2x3IyS0i4WVajA5aQBq/H1uM66/IJvnHL7dG6ExHURXzy UFHHX4GfwDhaTmyprL5XT83OJcTJbYe82yhIZnDnA4FhDRAMcy4deLRQtArpit8U tfVmOScudJrCZJPBxWrDX1uenZFf512u0IuT9SWWOBbDeT5Mhl9TQWvQ/WLxVE/K 8SmRiB0FeY/xgW862hc4w3G8mvVyfeb8SdhxZ5/yI1+5w1Mu4F1ctNqNEvmpujtp jSsWQj3TsC+TN7A== Original-Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 41b14848 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Thu, 18 Jun 2020 01:20:02 +0000 (UTC) In-Reply-To: <878sglpd82.fsf@gnu.org> 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:9801 Archived-At: Le 17 juin 2020 17:57:33 GMT-04:00, "Ludovic Court=C3=A8s" = a =C3=A9crit : >Hi Julien, > >Julien Lepiller skribis: > >> Using (web uri), I was trying to parse "uri://a/c"=2E Reading RFC3986, >it should be a valid URI (see rule for reg-name in 3=2E2=2E2)=2E However, >passing it to string->uri results in #f=2E I've tracked this down to >valid-host? which returns #f for "a"=2E >> >> The reason is that the regexp checking if the host is an ipv6 matches >"a", which shouldn't happen because a is not an ipv6 address=2E Indeed, >when I try (string->uri "uri://g/b"), I get the expected result=2E > >Right=2E =E2=80=98authority-regexp=E2=80=99 is fine, but =E2=80=98ipv6-r= egexp=E2=80=99, used by >=E2=80=98valid-host?=E2=80=99, was too lax and would match =E2=80=9Ca=E2= =80=9D because it=E2=80=99s an hex >digit >sequence=2E > >The regexp below is still an approximation, but I think a better one=2E >Can you confirm? > >Thanks, >Ludo=E2=80=99=2E Looks slightly better, thanks=2E That's still incorrect, as it will match things that are not ipv6 addresse= s=2E Does it have to be a regexp though? Why not simply check (false-if-exc= eption (inet-pton AF_INET6 host)), as in the return value of valid-host? There's also a ipv6-host-pat that has an incorrect regexp, but I'm not sur= e what it is used for=2E