diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-06-08 13:29:23 +0200 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-06-11 13:06:07 -0400 |
commit | c28f442b28cf858feb0e7d9d6ee77df708030cd5 (patch) | |
tree | 3226332c8fd824e1f48f9620a9cae979007e57b8 | |
parent | 2993bdf1efe11823e6448993dad4deb3d9f27c2d (diff) | |
download | podman-c28f442b28cf858feb0e7d9d6ee77df708030cd5.tar.gz podman-c28f442b28cf858feb0e7d9d6ee77df708030cd5.tar.bz2 podman-c28f442b28cf858feb0e7d9d6ee77df708030cd5.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.go | 2 |
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 7545ba235..73d08a26e 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) |