From d3c06c39f93d7493d94763ad220000ba230b5950 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 9 Jun 2017 22:32:42 +0200 Subject: [PATCH] debug: Fix EOF detection in HTTP transport --- src/restic/debug/round_tripper_debug.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/restic/debug/round_tripper_debug.go b/src/restic/debug/round_tripper_debug.go index 0ff9343ad..523d8438d 100644 --- a/src/restic/debug/round_tripper_debug.go +++ b/src/restic/debug/round_tripper_debug.go @@ -52,7 +52,9 @@ func (rd *eofDetectReader) Close() error { func (tr eofDetectRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) { res, err = tr.RoundTripper.RoundTrip(req) - res.Body = &eofDetectReader{rd: res.Body} + if res != nil && res.Body != nil { + res.Body = &eofDetectReader{rd: res.Body} + } return res, err }