Tuesday, March 15, 2022

[SOLVED] HTTP_PROXY not working

Issue

I have a situation where I can download a package from the internet using curl through a proxy server using the command

curl -x http://<proxy_host>:<proxy_port> --proxy-user <proxy_user>:<proxy_user_password> -L http://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/<package>.rpm -o <package>.rpm

But if I set the proxy with the command:

setenv HTTP_PROXY http://<proxy_user>:<proxy_user_password>@<proxy_host>:<proxy_port>

and then I try to get the package with the command:

curl -O http://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/package.rpm -o package.rpm

it doesn't work, it just return time out after a long time. My intention is to provide to that server access to the internet outside the internal network and I'm using curl to test this.

The OS is RedHat 6.9 and the shell that I'm using is '/bin/tcsh'.

What I'm doing wrong in this case?

Thanks for any help.


Solution

curl only supports the http_proxy environment variable for setting the proxy for HTTP with the environment. Lowercase being the key and vital difference.

curl does not acknowledge the uppercase version of that variable for security purposes: that variable can be set by an incoming request in a CGI environment.



Answered By - Daniel Stenberg
Answer Checked By - Pedro (WPSolving Volunteer)