From e8995b85b8b169e5c080905e9f95026b7a101782 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 25 Jan 2017 17:07:58 +0100 Subject: [PATCH] rest backend: Do not close the reader Closes #747 --- src/restic/backend/rest/rest.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/restic/backend/rest/rest.go b/src/restic/backend/rest/rest.go index 6ed05965f..fe931a6b9 100644 --- a/src/restic/backend/rest/rest.go +++ b/src/restic/backend/rest/rest.go @@ -80,6 +80,10 @@ func (b *restBackend) Save(h restic.Handle, rd io.Reader) (err error) { return err } + // make sure that client.Post() cannot close the reader by wrapping it in + // backend.Closer, which has a noop method. + rd = backend.Closer{Reader: rd} + <-b.connChan resp, err := b.client.Post(restPath(b.url, h), "binary/octet-stream", rd) b.connChan <- struct{}{}