* [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests
@ 2026-03-16 14:19 Hannes Laimer
2026-03-16 14:22 ` Hannes Laimer
2026-03-17 11:29 ` Christian Ebner
0 siblings, 2 replies; 3+ messages in thread
From: Hannes Laimer @ 2026-03-16 14:19 UTC (permalink / raw)
To: pbs-devel
Use the IANA registered `application/octet-stream` content type instead
of the non-standard `binary/octet` value in put_object.
Also set Content-Type explicitly in copy_object requests, since some S3
providers drop all source metadata, including Content-Type, when using
x-amz-metadata-directive REPLACE unless it is explicitly provided. This
caused s3_refresh to fail with "missing header 'content-type'" on such
providers when fetching objects moved via copy_object.
Setting it unconditionally is safe, since put_object already does the
same.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
did notice this with RustFS, MinIO did not have that problem
v2, thanks @Chris:
- use `application/octet-stream`
- also change to `application/octet-stream` in `put_object`
proxmox-s3-client/src/client.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index 413b3984..fbffe3e9 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -530,7 +530,7 @@ impl S3Client {
let mut request = Request::builder()
.method(Method::PUT)
.uri(self.build_uri(&object_key, &[])?)
- .header(header::CONTENT_TYPE, "binary/octet");
+ .header(header::CONTENT_TYPE, "application/octet-stream");
if !replace {
// Some providers not implement this and fails with error if the header is set,
@@ -660,6 +660,7 @@ impl S3Client {
.method(Method::PUT)
.uri(self.build_uri(&destination_key, &[])?)
.header("x-amz-copy-source", HeaderValue::from_str(©_source)?)
+ .header(header::CONTENT_TYPE, "application/octet-stream")
.header(
"x-amz-metadata-directive",
HeaderValue::from_str("REPLACE")?,
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests
2026-03-16 14:19 [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests Hannes Laimer
@ 2026-03-16 14:22 ` Hannes Laimer
2026-03-17 11:29 ` Christian Ebner
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Laimer @ 2026-03-16 14:22 UTC (permalink / raw)
To: pbs-devel
oops, sorry, wrong header. this is for `proxmox`
On 2026-03-16 15:19, Hannes Laimer wrote:
> Use the IANA registered `application/octet-stream` content type instead
> of the non-standard `binary/octet` value in put_object.
>
> Also set Content-Type explicitly in copy_object requests, since some S3
> providers drop all source metadata, including Content-Type, when using
> x-amz-metadata-directive REPLACE unless it is explicitly provided. This
> caused s3_refresh to fail with "missing header 'content-type'" on such
> providers when fetching objects moved via copy_object.
>
> Setting it unconditionally is safe, since put_object already does the
> same.
>
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> did notice this with RustFS, MinIO did not have that problem
>
> v2, thanks @Chris:
> - use `application/octet-stream`
> - also change to `application/octet-stream` in `put_object`
>
>
> proxmox-s3-client/src/client.rs | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
> index 413b3984..fbffe3e9 100644
> --- a/proxmox-s3-client/src/client.rs
> +++ b/proxmox-s3-client/src/client.rs
> @@ -530,7 +530,7 @@ impl S3Client {
> let mut request = Request::builder()
> .method(Method::PUT)
> .uri(self.build_uri(&object_key, &[])?)
> - .header(header::CONTENT_TYPE, "binary/octet");
> + .header(header::CONTENT_TYPE, "application/octet-stream");
>
> if !replace {
> // Some providers not implement this and fails with error if the header is set,
> @@ -660,6 +660,7 @@ impl S3Client {
> .method(Method::PUT)
> .uri(self.build_uri(&destination_key, &[])?)
> .header("x-amz-copy-source", HeaderValue::from_str(©_source)?)
> + .header(header::CONTENT_TYPE, "application/octet-stream")
> .header(
> "x-amz-metadata-directive",
> HeaderValue::from_str("REPLACE")?,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests
2026-03-16 14:19 [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests Hannes Laimer
2026-03-16 14:22 ` Hannes Laimer
@ 2026-03-17 11:29 ` Christian Ebner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Ebner @ 2026-03-17 11:29 UTC (permalink / raw)
To: Hannes Laimer, pbs-devel
On 3/16/26 3:19 PM, Hannes Laimer wrote:
> Use the IANA registered `application/octet-stream` content type instead
> of the non-standard `binary/octet` value in put_object.
>
> Also set Content-Type explicitly in copy_object requests, since some S3
> providers drop all source metadata, including Content-Type, when using
> x-amz-metadata-directive REPLACE unless it is explicitly provided. This
> caused s3_refresh to fail with "missing header 'content-type'" on such
> providers when fetching objects moved via copy_object.
>
> Setting it unconditionally is safe, since put_object already does the
> same.
>
> Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
Only one small nit: The header value "application/octet-stream" could
have been defined as common constant.
Tested by syncing new contents from a local datastore to an s3 datastore
backed by Ceph RGW and inspecting the content-type header value in the
ceph client logs. Further, moved a group with patches [0] applied again
checking the content-type header in the Ceph logs, performed a
successful s3-refresh and verification job on the group.
[0]
https://lore.proxmox.com/pbs-devel/c883656f-d89c-4e9d-97ab-3a47ee966200@proxmox.com/T/#t
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
Tested-by: Christian Ebner <c.ebner@proxmox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-17 11:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-16 14:19 [PATCH proxmox-backup v2] s3-client: fix Content-Type for put and copy object requests Hannes Laimer
2026-03-16 14:22 ` Hannes Laimer
2026-03-17 11:29 ` Christian Ebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.