Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/debuginfo/debuginfod.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ func (c *HTTPDebuginfodClient) handleResponse(ctx context.Context, resp *http.Re
case 2:
return resp.Body, nil
case 3:
resp, err = c.doRequest(ctx, resp.Header.Get("Location"))
redirectURL := resp.Header.Get("Location")
resp.Body.Close() // Close old response before redirect
resp, err = c.doRequest(ctx, redirectURL)
if err != nil {
return nil, fmt.Errorf("request failed: %w", err)
}
Expand All @@ -425,6 +427,8 @@ func (c *HTTPDebuginfodClient) handleResponse(ctx context.Context, resp *http.Re
}
}

// Close the response body before returning error for too many redirects
resp.Body.Close()
return nil, errors.New("too many redirects")
}

Expand Down
Loading