Skip to content

Commit

Permalink
http_proxy: close idle conn from http.Transport on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
Choraden committed Oct 17, 2024
1 parent f40e119 commit 6c94e27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,5 +581,10 @@ func (hp *HTTPProxy) Addr() string {
func (hp *HTTPProxy) Close() error {
err := hp.listener.Close()
hp.proxy.Close()

if tr, ok := hp.transport.(*http.Transport); ok {
tr.CloseIdleConnections()
}

return err
}

0 comments on commit 6c94e27

Please sign in to comment.