dpysrta21239
2014-06-30 18:12
浏览 700
已采纳

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

    打赏 评论
  • duanlijia5864 2016-05-30 01:37

    It looks as though renegotiation (and client certificate authentication) was previously unsupported. This looks to have been fixed by commit https://github.com/golang/go/commit/af125a5193c75dd59307fcf1b26d885010ce8bfd

    打赏 评论

相关推荐 更多相似问题