1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 23:09:41 +02:00

fix(http): drain and close response bodies EE-5486 (#8933)

This commit is contained in:
andres-portainer 2023-05-12 17:55:27 -03:00 committed by GitHub
parent 5b96136dd2
commit 511adabce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 12 deletions

View file

@ -3,6 +3,7 @@ package chisel
import (
"context"
"fmt"
"io"
"net/http"
"sync"
"time"
@ -58,7 +59,11 @@ func (service *Service) pingAgent(endpointID portainer.EndpointID) error {
httpClient := &http.Client{
Timeout: 3 * time.Second,
}
_, err = httpClient.Do(req)
resp, err := httpClient.Do(req)
io.Copy(io.Discard, resp.Body)
resp.Body.Close()
return err
}