Today's topic isn't that exciting after all: IPv6.
I just committed an update of the Connection class and the URL parser to work nicely with IPv6. However, there's one thing to note so that I write this blog entry.
What changed (somewhat) is the basic URL syntax. It still remains as:
proto[s]://[user[:password]]@host[:port][/path]
...but for IPv6 the host part is somewhat treated specially if it's an IPv6 address rather than a domain name (in which case the DNS resolver will do the job together with the IPv6 stack of the operating system.)
IPv6 addresses have to be enclosed in [] since they contain colons (':') which are used to detect whether and what port is embedded in the URL in case it's non-standard for the protocoll.
Also, please keep in mind that all parts of the URL are expected to be encoded. This is important for IPv6's link-local addresses with KAME-derived IPv6 stacks such as found on the BSD systems. With KAME, an interface may be embedded like so:
fe80::1%lo0
which is the link-local address for the loopback device fe80::1 reachable via lo0 (of course, just ::1 is shorter but this serves only as an example for non-KAME users.)
In short, the percent sign ('%') is used in URLs for marking an encoded sequence so that itself has to be encoded as %25. A correct example IMAP URL to loopback for user joe with password secret using a secure connection to port 4711 would thus be:
imaps://joe:secret@[fe80::1%25lo0]:4711/
or shorter:
imaps://joe:secret@[::1]:4711/
Also, the code handling connect(2) has been replace by a portable and protocol-independent one so that IPv4 and IPv6 are expected to work without problems. As I didn't setup IPv6-enabled local servers and as I don't/won't get IPv6 connectivity, I couldn't test very much. Please report problems if you encounter any.
Testing can be done with the muttng-query tool like so:
$ muttng-query -d 5 pop[s]://ipv6host/
or
$ muttng-query -d 5 nntp[s]://ipv6host/group.