Skip to content

Conversation

milosgajdos
Copy link
Member

Client ReadFrom doesn't set Content-Type header leading to server side implementor to assume it's application/octet-stream. This commit makes this explicit on the client side.

Closes #3965

Client ReadFrom doesn't set Content-Type header leading to server
side implementor to assume it's application/octet-stream. This commit
makes this explicit on the client side.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 15, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (0e18af1) 55.91% compared to head (24de708) 55.91%.
Report is 4 commits behind head on main.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3981   +/-   ##
=======================================
  Coverage   55.91%   55.91%           
=======================================
  Files         110      110           
  Lines       11057    11057           
=======================================
  Hits         6183     6183           
  Misses       4185     4185           
  Partials      689      689           
Files Changed Coverage Δ
registry/client/blob_writer.go 50.45% <100.00%> (+0.90%) ⬆️
...egistry/storage/cache/cachedblobdescriptorstore.go 58.13% <100.00%> (-1.87%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

Also wondering;

  • should requests set a user-agent?
  • very off-topic; I noticed the Docker-Upload-UUID header; is that only for "v1" images? (as v2 would be content-addressable, so more likely to have a digest?)

@thaJeztah
Copy link
Member

We probably need a backport for this (although I still think it's a bit odd to make this a required header in the spec; not sure if that was intentional).

@milosgajdos
Copy link
Member Author

very off-topic; I noticed the Docker-Upload-UUID header; is that only for "v1" images?

No, this header is set on every blob upload (spec mentions them https://github.com/opencontainers/distribution-spec/blob/v1.0.1/spec.md#post-then-put); I think all these legacy headers have Docker- prefix that would be quite risky to chuck due to b/w compat.

Copy link
Collaborator

@davidspek davidspek left a comment

Choose a reason for hiding this comment

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

LGTM!

@milosgajdos
Copy link
Member Author

Before we merge, I wanna wait for @corhere 👍 as he was the original reporter.

@milosgajdos milosgajdos merged commit 2918c32 into distribution:main Aug 15, 2023
@milosgajdos milosgajdos deleted the set-content-type-client-readfrom branch August 15, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(*client.httpBlobUpload).ReadFrom omits Content-Type header
5 participants