summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-06-08 13:29:23 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-06-08 13:36:07 +0200
commitc60548279162d5d313b6f2f2dbf50e9a514e23a1 (patch)
tree2abec0e5f76f1ac83a130cfc92f7697651017167
parent9a3a7327fdafaac66c99130a6729e4bcde8df0b0 (diff)
downloadpodman-c60548279162d5d313b6f2f2dbf50e9a514e23a1.tar.gz
podman-c60548279162d5d313b6f2f2dbf50e9a514e23a1.tar.bz2
podman-c60548279162d5d313b6f2f2dbf50e9a514e23a1.zip
remote pull: cancel pull when connection is closed
If a client closes the http connection during image pull, the service should cancel the pull operation. [NO TESTS NEEDED] I have no idea how we could test this reliable. Fixes: #7558 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r--pkg/api/handlers/libpod/images_pull.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/api/handlers/libpod/images_pull.go b/pkg/api/handlers/libpod/images_pull.go
index fe56aa31d..e88b53a4b 100644
--- a/pkg/api/handlers/libpod/images_pull.go
+++ b/pkg/api/handlers/libpod/images_pull.go
@@ -85,7 +85,7 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
var pulledImages []*libimage.Image
var pullError error
- runCtx, cancel := context.WithCancel(context.Background())
+ runCtx, cancel := context.WithCancel(r.Context())
go func() {
defer cancel()
pulledImages, pullError = runtime.LibimageRuntime().Pull(runCtx, query.Reference, config.PullPolicyAlways, pullOptions)