Skip to content

Proxy::try_from_env should prefer more specific environment variables #1134

@niklasmohrin

Description

@niklasmohrin

I have a concern that came up in tealdeer here: tealdeer-rs/tealdeer#450 (comment)

In Proxy::try_from_env, the environment variables all_proxy, https_proxy, and http_proxy are checked, in this order:

ureq/src/proxy.rs

Lines 211 to 218 in 428bba8

const TRY_ENV: &[&str] = &[
"ALL_PROXY",
"all_proxy",
"HTTPS_PROXY",
"https_proxy",
"HTTP_PROXY",
"http_proxy",
];

However, doesn't it make more sense to prefer the more specific https_proxy variable over the general all_proxy one? Additionally, should https_proxy and http_proxy even be used for for HTTP and HTTPS requests respectively?

For reference, the described behavior is what happens in hyper-util, and thus, reqwest: https://github.com/hyperium/hyper-util/blob/d91ea8efe6f3b09cc2fd6cc9e303566bd887a3ea/src/client/proxy/matcher.rs#L315-L319

Thanks for the library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions