IDN with Gemini?
Scot
gmi1 at scotdoyle.com
Mon Dec 7 21:00:33 GMT 2020
On 12/7/20 12:00 PM, colecmac at protonmail.com wrote:
> What parsing would a client have to do?
>
> - Extracting the domain, so it can be punycoded for DNS lookups
>
Can we be sure gemini host resolution will always use the global DNS?
Section 4 of RFC 6055 cautions against assuming that all name resolution
is using the global DNS and therefore that querying with punycode
domain names will succeed:
It is inappropriate for an application that calls a general-purpose
name resolution library to convert a name to an A-label unless the
application is absolutely certain that, in all environments where the
application might be used, only the global DNS that uses IDNA
A-labels actually will be used to resolve the name.
Conversely, querying with utf8 domain names fails on Ubuntu 20.04
using systemd-resolved [1].
Some languages/libraries such as Python convert utf8 requests to
punycode silently before submitting the request to the resolver [2].
[1] C program fails without punycode conversion
#include <netdb.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
int show_ip(char *name) {
struct hostent *entry;
entry = gethostbyname(name);
if (entry) {
printf("name '%s' has ip address\n", entry->h_name);
printf("ip: %s\n\n",inet_ntoa(*(struct in_addr*)entry->h_name));
} else {
printf("error querying '%s': %s\n", name, hstrerror(h_errno));
}
}
int main() {
show_ip("xn--td2a.jp");
show_ip("蛸.jp");
}
[2] Python program succeeds with *implicit* punycode conversion
import socket
def show_ip(name):
print("name '%s' has ip '%s'" % (name, (socket.gethostbyname(name))))
show_ip('xn--td2a.jp')
show_ip('蛸.jp')
More information about the Gemini
mailing list