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)