mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-12 11:07:53 +08:00
修复HTTPClient超时不反回问题,并提供设置超时时间接口
This commit is contained in:
@@ -64,9 +64,14 @@ func (slf *HttpClientModule) Init(maxpool int, proxyUrl string) {
|
|||||||
Proxy: proxyfun,
|
Proxy: proxyfun,
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||||
},
|
},
|
||||||
|
Timeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (slf *HttpClientModule) SetTimeOut(value time.Duration) {
|
||||||
|
slf.client.Timeout = value
|
||||||
|
}
|
||||||
|
|
||||||
func (slf *HttpClientModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
|
func (slf *HttpClientModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
|
||||||
ret := SyncHttpRespone{
|
ret := SyncHttpRespone{
|
||||||
resp: make(chan HttpRespone, 1),
|
resp: make(chan HttpRespone, 1),
|
||||||
|
|||||||
Reference in New Issue
Block a user