mirror of
https://github.com/safing/portmaster
synced 2025-09-01 10:09:11 +00:00
Close HTTP response body before client reuse
This commit is contained in:
parent
cc7b1e770a
commit
47f4627f1f
1 changed files with 3 additions and 1 deletions
|
@ -326,6 +326,8 @@ func checkOnlineStatus(ctx context.Context) {
|
|||
// this might be a weird captive portal, just direct the user there
|
||||
updateOnlineStatus(StatusPortal, "detectportal.firefox.com", "http request succeeded, response content not as expected")
|
||||
}
|
||||
// close the body now as we plan to re-uise the http.Client
|
||||
response.Body.Close()
|
||||
|
||||
// 3) try a https request
|
||||
|
||||
|
@ -339,7 +341,7 @@ func checkOnlineStatus(ctx context.Context) {
|
|||
response, err = client.Do(request)
|
||||
if err != nil {
|
||||
// if we fail, something is really weird
|
||||
updateOnlineStatus(StatusSemiOnline, "", "http request failed")
|
||||
updateOnlineStatus(StatusSemiOnline, "", "http request failed to "+parsedHTTPSTestURL.String()+" with error "+err.Error())
|
||||
return
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
|
Loading…
Add table
Reference in a new issue