普通网友 2014-06-30 18:12
浏览 805
已采纳

golang:发送带有证书的http请求

For first I am newbie in golang.

I try to send https request. I create http.Client like this:

func httpClient(c *Config) (httpClient *http.Client) {
cert, _ := tls.LoadX509KeyPair(c.CertFile, c.KeyFile)

ssl := &tls.Config{
    Certificates:       []tls.Certificate{cert},
    InsecureSkipVerify: true,
}

ssl.Rand = rand.Reader
return &http.Client{
    Transport: &http.Transport{
        TLSClientConfig: ssl,
    },
}
}

But as result I get local error: no renegotiation.

Thanks for any help!

  • 写回答

2条回答 默认 最新

  • douquqiang1513 2014-06-30 18:44
    关注

    This is likely a problem with the remote server you're accessing, but it is a known problem (with Microsoft Azure services for one).

    There may be a workaround on the way for go1.4, but until then the go client still doesn't support TLS renegotiation.

    Relevant issue: https://code.google.com/p/go/issues/detail?id=5742

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?