mirror of
https://github.com/restic/restic.git
synced 2026-10-12 04:57:12 +00:00
rest: improve handling of HTTP2 goaway
The HTTP client can only retry HTTP2 requests after receiving a GOAWAY response if it can rewind the body. As we use a custom data type, explicitly provide an implementation of `GetBody`.
This commit is contained in:
1 parent
55ff4e046e
commit
8828c76f92
2 files changed
+19
No files matched your search
@@ -143,6 +143,12 @@ func (b *Backend) Save(ctx context.Context, h backend.Handle, rd backend.RewindR
|
||||
if err != nil {
|
||||
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("Accept", ContentTypeV2)
|
||||
|
||||
|
||||
Reference in new issue
Block a user