2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-27 15:26:37 +00:00

Merge pull request #5018 from MichaelEischer/rest-retry-http2-goaway

rest: improve handling of HTTP2 goaway
This commit is contained in:
Michael Eischer 2024-08-29 16:58:04 +02:00 committed by GitHub
commit 0aadfe32bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,13 @@
Bugfix: Improve HTTP2 support for rest backend
If rest-server tried to gracefully shut down an HTTP2 connection still used by the client,
this could result in the following error.
```
http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error
```
This has been fixed.
https://github.com/restic/restic/pull/5018
https://forum.restic.net/t/receiving-http2-goaway-messages-with-windows-restic-v0-17-0/8367

View File

@ -143,6 +143,12 @@ func (b *Backend) Save(ctx context.Context, h backend.Handle, rd backend.RewindR
if err != nil { if err != nil {
return errors.WithStack(err) return errors.WithStack(err)
} }
req.GetBody = func() (io.ReadCloser, error) {
if err := rd.Rewind(); err != nil {
return nil, err
}
return io.NopCloser(rd), nil
}
req.Header.Set("Content-Type", "application/octet-stream") req.Header.Set("Content-Type", "application/octet-stream")
req.Header.Set("Accept", ContentTypeV2) req.Header.Set("Accept", ContentTypeV2)