I noticed that Jiri's ftp debug output had two instances where NULL was printed as a string. This fixes it.
$ ftp -o /dev/null -M -d -V http://ftp.eu.openbsd.org/pub/OpenBSD/snapshots/amd64/ Before: host ftp.eu.openbsd.org, port (null), path pub/OpenBSD/snapshots/amd64/, save as /dev/null, auth (null). After: host ftp.eu.openbsd.org, port http, path pub/OpenBSD/snapshots/amd64/, save as /dev/null, auth none. - todd Index: usr.bin/ftp/fetch.c =================================================================== RCS file: /cvs/src/usr.bin/ftp/fetch.c,v retrieving revision 1.149 diff -u -p -u -r1.149 fetch.c --- usr.bin/ftp/fetch.c 20 Aug 2016 20:18:42 -0000 1.149 +++ usr.bin/ftp/fetch.c 8 Dec 2016 19:23:10 -0000 @@ -470,6 +470,11 @@ noslash: portnum = strrchr(hosttail, ':'); /* find portnum */ if (portnum != NULL) *portnum++ = '\0'; +#ifndef SMALL + port = portnum ? portnum : (ishttpsurl ? httpsport : httpport); +#else /* !SMALL */ + port = portnum ? portnum : httpport; +#endif /* !SMALL */ #ifndef SMALL if (full_host == NULL) @@ -477,18 +482,13 @@ noslash: errx(1, "Cannot allocate memory for hostname"); if (debug) fprintf(ttyout, "host %s, port %s, path %s, " - "save as %s, auth %s.\n", - host, portnum, path, savefile, credentials); + "save as %s, auth %s.\n", host, port, path, + savefile, credentials ? credentials : "none"); #endif /* !SMALL */ memset(&hints, 0, sizeof(hints)); hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; -#ifndef SMALL - port = portnum ? portnum : (ishttpsurl ? httpsport : httpport); -#else /* !SMALL */ - port = portnum ? portnum : httpport; -#endif /* !SMALL */ error = getaddrinfo(host, port, &hints, &res0); /* * If the services file is corrupt/missing, fall back