Skip to content

Fix archive PUTs missing Content-Type - #51

Open
phattbeats wants to merge 1 commit into
linuxserver:mainfrom
phattbeats:fix/archive-put-content-type
Open

Fix archive PUTs missing Content-Type#51
phattbeats wants to merge 1 commit into
linuxserver:mainfrom
phattbeats:fix/archive-put-content-type

Conversation

@phattbeats

Copy link
Copy Markdown

  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

Default Content-Type to application/x-tar for Docker archive extraction PUT requests when the client omitted the header. Explicit client content types remain unchanged.

Benefits of this PR and context:

Docker's PUT /containers/{id}/archive endpoint can return HTTP 200 while extracting nothing when the request has no Content-Type. That creates a silent-success failure mode for callers sending a valid tar body. Supplying the endpoint's documented media type at the proxy keeps header-less clients from receiving a false success.

The rule is restricted to PUT requests whose decoded path exactly matches the versioned or unversioned container archive endpoint.

How Has This Been Tested?

Reproduced against Docker 24.0.9 through socket-proxy 3.4.2-r0-ls89:

  • PUT of a valid tar without Content-Type: HTTP 200, subsequent archive GET returned 404.
  • Identical PUT with Content-Type: application/x-tar: HTTP 200, subsequent archive GET returned 200.
  • git diff --check passes.

A local HAProxy syntax check could not be run in the submitting environment because it lacks a Docker CLI and the deployed proxy denies container creation.

Source / References:

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! Be sure to follow the pull request template!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants