[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#40582: Valid URIs are rejected
From: |
Julien Lepiller |
Subject: |
bug#40582: Valid URIs are rejected |
Date: |
Wed, 17 Jun 2020 21:17:11 -0400 |
User-agent: |
K-9 Mail for Android |
Le 17 juin 2020 17:57:33 GMT-04:00, "Ludovic Courtès" <ludo@gnu.org> a écrit :
>Hi Julien,
>
>Julien Lepiller <julien@lepiller.eu> skribis:
>
>> Using (web uri), I was trying to parse "uri://a/c". Reading RFC3986,
>it should be a valid URI (see rule for reg-name in 3.2.2). However,
>passing it to string->uri results in #f. I've tracked this down to
>valid-host? which returns #f for "a".
>>
>> 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. Indeed,
>when I try (string->uri "uri://g/b"), I get the expected result.
>
>Right. ‘authority-regexp’ is fine, but ‘ipv6-regexp’, used by
>‘valid-host?’, was too lax and would match “a” because it’s an hex
>digit
>sequence.
>
>The regexp below is still an approximation, but I think a better one.
>Can you confirm?
>
>Thanks,
>Ludo’.
Looks slightly better, thanks.
That's still incorrect, as it will match things that are not ipv6 addresses.
Does it have to be a regexp though? Why not simply check (false-if-exception
(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 sure
what it is used for.