[whatwg/url] RFC 4291 is not really sufficient to define "valid IPv6-address string" (Issue #916)

domenic created an issue (whatwg/url#916)

### What is the issue with the URL Standard?

> A valid IPv6-address string is defined in the ["Text Representation of Addresses" chapter of IP Version 6 Addressing Architecture](https://tools.ietf.org/html/rfc4291#section-2.2). [[RFC4291]](https://url.spec.whatwg.org/#biblio-rfc4291)

But the linked spec doesn't even have an ABNF; it just has a list of three forms, vaguely explained in prose, with examples. It isn't clear, for example, whether leading zeroes are allowed. ("it is not necessary to write the leading zeros in an individual field" kind of argues that they are allowed, at least in the IPv6 parts, but "standard IPv4 representation" tends to argue against them, at least in the IPv4 parts.) Arguably it isn't clear whether lowercase hex digits are allowed, or just uppercase.

In IETF land, the actual ABNF appears to be in our old friend [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986):

```

      IPv6address =                            6( h16 ":" ) ls32
                  /                       "::" 5( h16 ":" ) ls32
                  / [               h16 ] "::" 4( h16 ":" ) ls32
                  / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
                  / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
                  / [ *3( h16 ":" ) h16 ] "::"    h16 ":"   ls32
                  / [ *4( h16 ":" ) h16 ] "::"              ls32
                  / [ *5( h16 ":" ) h16 ] "::"              h16
                  / [ *6( h16 ":" ) h16 ] "::"

      ls32        = ( h16 ":" h16 ) / IPv4address
                  ; least-significant 32 bits of address

      h16         = 1*4HEXDIG
                  ; 16 bits of address represented in hexadecimal
```

This appears to allow leading zeroes for the IPv6 parts and not the IPv4 parts, and allows both lowercase and uppercase hex digits.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/916
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/916@github.com>

Received on Monday, 29 June 2026 12:26:30 UTC