Dart Httpclient是否支持自定义的tls连接?

时间:2019-07-18 02:07:57

标签: flutter dart

我正在编写一个特殊的flutter应用程序,想要设置httpclient的tls连接,例如在golang DialTLS或android java sslsocketfactory

我找到了文档,其中提到httpclient可以使用SecurityContext作为参数,但是我需要为tls连接指定httpclient。如何设置httpclient的SecuritySocket

//golang
client := http.Client{
        Transport: &http.Transport{
            DialTLS: func(network, addr string) (conn net.Conn, e error) {
                conf := &tls.Config{
                    InsecureSkipVerify: true,
                    VerifyPeerCertificate: func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
                        return nil
                    },
                }
                fmt.Print(s)
                return tls.Dial("tcp", "", conf)

            },//This is the property I want to set in dart's httpclient
        },
    }

0 个答案:

没有答案