libfetch: synchronized with NetBSD's pkgsrc/libfetch, preserving our changes.