After upgrading some dependencies our CI build failed due to got erroring out with an MaxRedirectsError when trying to download pngquant.
The pngquant server answeres the request with a redirect to HTTPS (status 301), so a new request is sent. For this new request the download module uses the same agent that was created for the initial request with the initial protocol (HTTP). This causes an endless loop when behind a corporate proxy since caw always sends the requests to HTTP port.
This merge requests fixes this by creating a new agent when the protocol differs after a redirect.
After upgrading some dependencies our CI build failed due to
got
erroring out with anMaxRedirectsError
when trying to download pngquant.The pngquant server answeres the request with a redirect to HTTPS (status 301), so a new request is sent. For this new request the
download
module uses the same agent that was created for the initial request with the initial protocol (HTTP). This causes an endless loop when behind a corporate proxy since caw always sends the requests to HTTP port.This merge requests fixes this by creating a new agent when the protocol differs after a redirect.
The reason why this showed up for us just now is that the download url for the pngquant sources changed between the version we used before and the current version. See https://github.com/imagemin/pngquant-bin/commit/172fd0edde7c0a5aeead42a94e8761949f780fc0#diff-f6618e1cc731d58106a806b7679a7616.
Fixes #159.