Skip to content
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

Autodetect proxy in windows #953

Open
Mapashito1 opened this issue May 31, 2023 · 4 comments
Open

Autodetect proxy in windows #953

Mapashito1 opened this issue May 31, 2023 · 4 comments
Labels
package:http type-enhancement A request for a change that isn't a bug

Comments

@Mapashito1
Copy link

Mapashito1 commented May 31, 2023

Hi,

I use http package to connect through the proxy in windows and it works.

httpClient.findProxy = (uri) { return "PROXY ip:port"; }; IOClient client = IOClient(httpClient);

The problem is I have to manually configure it on each computer.

How can I autodetect if windows has a proxy?
image

@Mapashito1 Mapashito1 added package:http type-enhancement A request for a change that isn't a bug labels May 31, 2023
@SamJakob
Copy link

I’m not sure if it works on Windows, but have you tried findProxyFromEnvironment?

@Mapashito1
Copy link
Author

I’m not sure if it works on Windows, but have you tried findProxyFromEnvironment?

Yep, I have tried but it is not work in windows :( I imagine it is a feature only for android/ios

@SamJakob
Copy link

Hmm, and/or Unix-like (i.e., macOS/Linux).

Another option could be to read it manually and check - e.g., using something like the platform_proxy package (or implementing it in platform channels yourself if you feel it's worth the effort).

I'm not a maintainer or author of this package by the way, but this seems like it would be out of scope of the http package anyhow. Seeing as the proxy configuration happens on HttpClient from dart:io, it might be worth filing an issue over at dart-lang/sdk about getting that to work on Windows.

@dkbast
Copy link

dkbast commented Feb 16, 2024

This is not just a 'Windows' issue - all Flutter apps don't use the system proxy by default as reported here: flutter/flutter#26359 - as Flutter becomes adopted by more and more enterprise clients, and those often rely on the system proxies it would be great to address this issue (either through adding more documentation and making people aware that http does not behave like a client in the 'competing' frameworks or by adding the functionality. Imho both options are valid but adding the functionality would probably be my favourite :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:http type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants