tidb http 源码
tidb http 代码
文件路径:/br/pkg/httputil/http.go
// Copyright 2021 PingCAP, Inc. Licensed under Apache-2.0.
package httputil
import (
"crypto/tls"
"net/http"
"time"
)
// NewClient returns an HTTP(s) client.
func NewClient(tlsConf *tls.Config) *http.Client {
// defaultTimeout for non-context requests.
const defaultTimeout = 30 * time.Second
cli := &http.Client{Timeout: defaultTimeout}
if tlsConf != nil {
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = tlsConf
cli.Transport = transport
}
return cli
}
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦