-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add configuration 'no-sys-proxy' to bypass the system proxy. #695
Conversation
Thanks for the PR. I think that's ok in general. What feels a bit weird is the multiplication of clients which are in there now. It feels like creating all possible options first, and then choosing later on is the wrong approach. |
Yes, I agree with that. I wrote below at first:
This would simplify code elsewhere as well, |
I am wondering if it wouldn't make more sense to:
|
Great point. but there's a problem: |
The question is: is that actually a problem? How many proxies would one configure? 5? 10? 100? I would assume that even with 100, we should have no problem creating so many clients. If you want to reduce it to an absolute limit, the you can come up with some "client factory". With an API like this: #[derive(Clone, Debug, PartialEq, Eq, Hash]
struct ClientOptions {
// … all kinds of options
}
struct ClientFactory {
clients: HashMap<ClientOptions, reqwest::Client>,
}
impl ClientFactory {
pub fn get(&mut self, options: ClientOptions) -> reqwest::Client { … }
} |
Okay, I got your point eventually.... |
Looks good @Xu-Mj. Is that PR still a draft? |
sorry about format errors, my ide format code automaticlly. |
This changes fixes some issues left by the original PR: #705 * don't always disable the proxy, only when requested * have a common way of creating the proxy setup/clients * re-use clients based on their configuration
add command line configuration 'proxy-no-sys-proxy' and Trunk.toml configuration 'no-sys-proxy' to bypass system proxy. #689