Per the apache documentation at https://hc.apache.org/httpcomponents-client-4.5.x/quickstart.html, one must consume the entity to avoid leaking a connection. When attempting to execute a download command, the entity will not be automatically closed. However, if the download command's status fails verification (ex: 404), then an exception is received by the client and the client does not have a chance to use the InputStream and close it. This PR will close the entity if statusCodeVerification has failed.
Per the apache documentation at https://hc.apache.org/httpcomponents-client-4.5.x/quickstart.html, one must consume the entity to avoid leaking a connection. When attempting to execute a download command, the entity will not be automatically closed. However, if the download command's status fails verification (ex: 404), then an exception is received by the client and the client does not have a chance to use the InputStream and close it. This PR will close the entity if statusCodeVerification has failed.