Skip to content

[release/1.7] Fix HTTPFallback fails when pushing manifest#10044

Merged
mxpv merged 1 commit intocontainerd:release/1.7from
ktock:fail-plain-http-1.7
Apr 8, 2024
Merged

[release/1.7] Fix HTTPFallback fails when pushing manifest#10044
mxpv merged 1 commit intocontainerd:release/1.7from
ktock:fail-plain-http-1.7

Conversation

@ktock
Copy link
Copy Markdown
Member

@ktock ktock commented Apr 8, 2024

Backporting #10031

Description from #10031

The pusher supports fallback from HTTPS to HTTP using HTTPFallback. But the current implementation of HTTPFallback doesn't reset the request body on fallback so the body is used twice. When the pusher uploads the manifest using HTTPFallback, it results in io: read/write on closed pipe error because the request body is a *io.PipeReader that can't be used twice. This commit fixes this issue by modifying HTTPFallback to reset the request body on fallback, using http.Request.GetBody().

Reusing the request body didn't happen when uploading the layer because the pusher correctly selects the scheme based on Location header and avoids fallback. This commit also fixes the test to cover the code path of uploading the manifest with fallback.

Additional information

@ktock
Copy link
Copy Markdown
Member Author

ktock commented Apr 8, 2024

/retest

@mxpv mxpv merged commit 3d3287d into containerd:release/1.7 Apr 8, 2024
@ktock ktock deleted the fail-plain-http-1.7 branch April 9, 2024 00:46
@dmcgowan dmcgowan changed the title [release/1.7] remote: Fix HTTPFallback fails when pushing manifest [release/1.7] Fix HTTPFallback fails when pushing manifest Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants