From 5e6b1b5c9823f5941f40f8dc2bbf93f86342a897 Mon Sep 17 00:00:00 2001 From: Milos Gajdos Date: Fri, 22 Sep 2023 16:50:30 +0100 Subject: [PATCH] Do not close HTTP request body in HTTP handler Signed-off-by: Milos Gajdos --- registry/handlers/app.go | 2 -- registry/handlers/tags.go | 2 -- 2 files changed, 4 deletions(-) diff --git a/registry/handlers/app.go b/registry/handlers/app.go index 0ba3ebfea..bf56cea22 100644 --- a/registry/handlers/app.go +++ b/registry/handlers/app.go @@ -620,8 +620,6 @@ func (app *App) configureSecret(configuration *configuration.Configuration) { } func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request) { - defer r.Body.Close() // ensure that request body is always closed. - // Prepare the context with our own little decorations. ctx := r.Context() ctx = dcontext.WithRequest(ctx, r) diff --git a/registry/handlers/tags.go b/registry/handlers/tags.go index b7463a5a3..9d91cb9b1 100644 --- a/registry/handlers/tags.go +++ b/registry/handlers/tags.go @@ -33,8 +33,6 @@ type tagsAPIResponse struct { // GetTags returns a json list of tags for a specific image name. func (th *tagsHandler) GetTags(w http.ResponseWriter, r *http.Request) { - defer r.Body.Close() - tagService := th.Repository.Tags(th) tags, err := tagService.All(th) if err != nil {