upstream: https://cgit.freebsd.org/src/commit/lib/libfetch?id=ce700f78f7fb28a252978382a1d0a66d08b6469a