Skip to content

Commit

Permalink
remote pull: cancel pull when connection is closed
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Luap99 committed Jun 8, 2021
1 parent 9a3a732 commit c605482
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/api/handlers/libpod/images_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c605482

Please sign in to comment.