mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
fix: set tcp keep alive
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## v4.3.0 (2022-10-24)
|
## v4.3.0 (2022-10-24)
|
||||||
|
|
||||||
Release hrp sub package `uixt` to support iOS/Android UI automation 🎉
|
Release hrp sub package `uixt` to support iOS/Android UI automation testing 🎉
|
||||||
|
|
||||||
- feat: support iOS UI automation with [WebDriverAgent] and [gwda]
|
- feat: support iOS UI automation with [WebDriverAgent] and [gwda]
|
||||||
- feat: support Android UI automation with [uiautomator2] and [guia2]
|
- feat: support Android UI automation with [uiautomator2] and [guia2]
|
||||||
|
|||||||
@@ -93,10 +93,18 @@ func (wd *Driver) httpRequest(method string, rawURL string, rawBody []byte) (raw
|
|||||||
}
|
}
|
||||||
|
|
||||||
func convertToHTTPClient(conn net.Conn) *http.Client {
|
func convertToHTTPClient(conn net.Conn) *http.Client {
|
||||||
|
// set tcp keep alive
|
||||||
|
tcpConn := conn.(*net.TCPConn)
|
||||||
|
if err := tcpConn.SetKeepAlive(true); err != nil {
|
||||||
|
log.Error().Err(err).Msg("set tcp keep alive failed")
|
||||||
|
}
|
||||||
|
if err := tcpConn.SetKeepAlivePeriod(5 * time.Second); err != nil {
|
||||||
|
log.Error().Err(err).Msg("set tcp keep alive period failed")
|
||||||
|
}
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
|
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
|
||||||
return conn, nil
|
return tcpConn, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Timeout: 0,
|
Timeout: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user