From 475b799818d3ec8aaf850405c788a7107cdac459 Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Mon, 6 Jun 2022 23:01:41 +0200 Subject: [PATCH] Close streams on request completion --- httputils/fasthttp.go | 1 + httputils/nethttp.go | 1 + 2 files changed, 2 insertions(+) diff --git a/httputils/fasthttp.go b/httputils/fasthttp.go index aa43aed..a31bba4 100644 --- a/httputils/fasthttp.go +++ b/httputils/fasthttp.go @@ -82,6 +82,7 @@ func (c *FastHTTPContext) SetResponseHeader(name string, value string) { } func (c *FastHTTPContext) ServeStream(stream Stream) { + defer stream.Close() const rangePrefix = "bytes=" if stream == nil { diff --git a/httputils/nethttp.go b/httputils/nethttp.go index b2bf296..c97367f 100644 --- a/httputils/nethttp.go +++ b/httputils/nethttp.go @@ -83,6 +83,7 @@ func (c *NetHTTPContext) SetResponseHeader(name string, value string) { } func (c *NetHTTPContext) ServeStream(stream Stream) { + defer stream.Close() const rangePrefix = "bytes=" if stream == nil {