Open liudonghua123 opened 4 years ago
I read the code implementation
https://github.com/dart-lang/sdk/blob/04591ddfbcd92caf6d1155bf62906d47a559bdaa/sdk/lib/_http/http_impl.dart#L2632-L2652
it seems the proxy pac support in dart:io is not complete. It only support simple PROXY
/DIRECT
, other return values like SOCKS
/HTTP
/HTTPS
/SOCKS4
/SOCKS5
(https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_(PAC)_file) is not support.
Same issue here.
And depends on the official document HttpClient.findProxyFromEnvironment, https_proxy
should work but it's not.
I also read the source code L2211 in sdk/lib/_http/http_impl.dart:
Future<ConnectionTask> connectionTask = (isSecure && proxy.isDirect
? SecureSocket.startConnect(host, port,
context: context, onBadCertificate: callback)
: Socket.startConnect(host, port));
it says that: only build HTTPS (SecureSocket) connection when the RAW target is secure and without proxy, with proxy never HTTPS.
So @liudonghua123 , they don't even implement https proxy feature, not only the HTTPS directive in PAC.
This may also be able to be set up manually once #43277 is resolved.
I have a pac script which returns
HTTPS usa.cn-cloudflare.com:443
and I just want to use this https proxy in my dart code. So I write some code like this.But it shown me the following erros.
I also read the doc https://api.dart.dev/stable/2.9.3/dart-io/HttpClient/findProxyFromEnvironment.html, https://api.dart.dev/stable/2.9.3/dart-io/HttpClient/findProxy.html, and find it seems do not support
HTTPS
of pac.