Skip to content

[internal.file] Close HTTP response body on non-200 status - #1499

Merged
manugarg merged 1 commit into
mainfrom
fix-file-http-body-close
Sep 23, 2026
Merged

manugarg merged 1 commit into
mainfrom
fix-file-http-body-close

Conversation

@manugarg

Copy link
Copy Markdown
Contributor

readFileFromHTTP and httpModTime returned on a non-200 status before deferring res.Body.Close(), so the response body (and its connection) was never closed. With http(s) file paths now working (#1432), a persistently failing URL in file_targets would leak one connection on every refresh.

Move the defer res.Body.Close() right after the request succeeds.

readFileFromHTTP and httpModTime returned on a non-200 status before
deferring res.Body.Close(), leaking the response body and its connection.
With file_targets over http(s), a persistently failing URL would leak one
connection on every refresh.
@manugarg
manugarg merged commit fe24b64 into main Sep 23, 2026
13 checks passed
@manugarg
manugarg deleted the fix-file-http-body-close branch September 23, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant