This patch is being used on pfSense to fix pkg when proxy is configured and many users reported it works as expected.
libfetch: Retry with proxy authentication when HTTP server
returns 407 (HTTP_NEED_PROXY_AUTH)
PR: 220468
Submitted by: Egil Hasting <egil.hasting@higen.org> (based on)
Reviewed by: kevans, kp
Approved by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29533