Skip to content

Commit

Permalink
Fixed the long accept header limit exceed during sync.
Browse files Browse the repository at this point in the history
closes #1696

https://issues.redhat.com/browse/SAT-26277
(cherry picked from commit a81deb1)
  • Loading branch information
ipanova authored and mdellweg committed Dec 4, 2024
1 parent 4482792 commit e6b1188
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES/1696.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the long accept header limit exceed during sync.
11 changes: 6 additions & 5 deletions pulp_container/app/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e6b1188

Please sign in to comment.