mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: url test http response not closed
This commit is contained in:
parent
c1a99b9be4
commit
109a76e1fc
|
@ -156,20 +156,27 @@ func (p *Proxy) URLTest(ctx context.Context, url string) (t uint16, err error) {
|
|||
return http.ErrUseLastResponse
|
||||
},
|
||||
}
|
||||
|
||||
defer client.CloseIdleConnections()
|
||||
|
||||
resp, err := client.Do(req)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_ = resp.Body.Close()
|
||||
|
||||
if unifiedDelay {
|
||||
start = time.Now()
|
||||
resp, err = client.Do(req)
|
||||
respRepeat, err := client.Do(req)
|
||||
if err != nil {
|
||||
return
|
||||
return 0, err
|
||||
}
|
||||
|
||||
_ = respRepeat.Body.Close()
|
||||
}
|
||||
_ = resp.Body.Close()
|
||||
|
||||
t = uint16(time.Since(start) / time.Millisecond)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user