From 5caf714c278ecc92cbca3a26cf55afb861526f69 Mon Sep 17 00:00:00 2001 From: Ina Panova Date: Tue, 9 Jul 2024 11:57:51 +0200 Subject: [PATCH] Fixed the long accept header limit exceed during sync. closes #1696 https://issues.redhat.com/browse/SAT-26277 (cherry picked from commit a81deb18593fc8a05662c99a4a1d13e8e7b074ba) --- CHANGES/1696.bugfix | 1 + pulp_container/app/downloaders.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 CHANGES/1696.bugfix diff --git a/CHANGES/1696.bugfix b/CHANGES/1696.bugfix new file mode 100644 index 000000000..d514781b7 --- /dev/null +++ b/CHANGES/1696.bugfix @@ -0,0 +1 @@ +Fixed the long accept header limit exceed during sync. diff --git a/pulp_container/app/downloaders.py b/pulp_container/app/downloaders.py index fb361198e..55d81158f 100644 --- a/pulp_container/app/downloaders.py +++ b/pulp_container/app/downloaders.py @@ -19,6 +19,11 @@ ["status_code", "path", "artifact_attributes", "url", "headers"], ) +# Usually webservers ignore accept headers for blob endpoint +# However, some webservers when serving blobs need to have explicitly specified octet-stream +# in the accept headers +V2_ACCEPT_HEADERS_OCTET = {"Accept": V2_ACCEPT_HEADERS["Accept"] + ",application/octet-stream"} + class RegistryAuthHttpDownloader(HttpDownloader): """ @@ -57,11 +62,7 @@ async def _run(self, handle_401=True, extra_data=None): # these accept headers are going to be sent with every request to ensure downloader # can download manifests, namely in the repair core task # FIXME this can be rolledback after https://github.com/pulp/pulp_container/issues/1288 - headers = V2_ACCEPT_HEADERS - # Usually webservers ignore accept headers for blob endpoint - # However, some webservers when serving blobs need to have explicitly specified octet-stream - # in the accept headers - headers["Accept"] = headers["Accept"] + ",application/octet-stream" + headers = V2_ACCEPT_HEADERS_OCTET repo_name = None if extra_data is not None: headers = extra_data.get("headers", headers)