Search code examples
clinuxproxyhttp-proxy

Does http_proxy automatically work in Linux for all applications?


If I export http_proxy, then curl will use the proxy automatically. Is this because curl looks up http_proxy and setup proxy internally in the source code or it just automatically works? Seems many other applications support http_proxy automatically, so I think maybe http_proxy is handled by Linux??

I'm writing an application that needs to support proxy(http_proxy ENV), and wondering should I handle http_proxy in the source code.


Solution

  • Is this because curl looks up http_proxy and setup proxy internally in the source code or it just automatically works?

    curl get's the value of environment variable http_proxy in curl/lib/url.c and processes it. It does not work "automatically".

    I think maybe http_proxy is handled by Linux?

    No, it is not. It is explicitly handled by curl.

    wondering should I handle http_proxy in the source code.

    You can keep compatibility with other tools like curl and support http_proxy environment variable in your application.