Issue #8208
closeddocker 20.10 client pull operation fails with Error response from daemon: missing or empty Content-Type header
Description
Starting with docker client 20.10, a pull operation fails with the following message:
sudo docker pull pulp.example.com/test:manifest_a docker: Error response from daemon: missing or empty Content-Type header.
The logs for pulp show that a 200 response was sent:
127.0.0.1 - - [04/Feb/2021:15:48:33 +0000] "HEAD /v2/test/manifests/manifest_a HTTP/1.0" 200 4 "-"
Related issues
Updated by pulpbot almost 4 years ago
- Status changed from NEW to POST
Updated by ipanova@redhat.com almost 4 years ago
- Assignee set to dkliban@redhat.com
- Sprint/Milestone set to 2.3.0
- Sprint set to Sprint 89
Updated by dkliban@redhat.com almost 4 years ago
It looks like even if we set the Content-Type header for HEAD requests, DRF strips it out[0].
My reading on the internet has led me to believe that we should not implement a separate method for handling HEAD requests and simply respond with the same response as we would for GET. The body will get stripped away by other parts of the web server. I've tested this out and it works.
[0] https://github.com/encode/django-rest-framework/blob/3.9.x/rest_framework/response.py#L72-L81
Added by dkliban@redhat.com almost 4 years ago
Updated by dkliban@redhat.com almost 4 years ago
- Status changed from POST to MODIFIED
Applied in changeset 63f5b87c82a7ce1ea079eb3e55bad99bfa0f11cf.
Added by dkliban@redhat.com almost 4 years ago
Revision f3209cba | View on GitHub
Handle HEAD requests as if they are GET requests
The Content-Type header is stripped by DRF when there is no body in the response.
Django and aiohttp both strip the body of HEAD requests. It is safe to handle HEAD requests the same as GET requests and rely on the web server to strip the body of the response.
This patch also adds the Content-Type header to the ManifestResponse objects which are used when responding to requests of Manifest creation.
Added by dkliban@redhat.com almost 4 years ago
Revision ceb266c7 | View on GitHub
Handle HEAD requests as if they are GET requests
The Content-Type header is stripped by DRF when there is no body in the response.
Django and aiohttp both strip the body of HEAD requests. It is safe to handle HEAD requests the same as GET requests and rely on the web server to strip the body of the response.
This patch also adds the Content-Type header to the ManifestResponse objects which are used when responding to requests of Manifest creation.
Added by dkliban@redhat.com almost 4 years ago
Revision ceb266c7 | View on GitHub
Handle HEAD requests as if they are GET requests
The Content-Type header is stripped by DRF when there is no body in the response.
Django and aiohttp both strip the body of HEAD requests. It is safe to handle HEAD requests the same as GET requests and rely on the web server to strip the body of the response.
This patch also adds the Content-Type header to the ManifestResponse objects which are used when responding to requests of Manifest creation.
Updated by pulpbot almost 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Updated by ipanova@redhat.com almost 4 years ago
- Copied to Backport #8366: Backpot to 2.1: docker 20.10 client pull operation fails with Error response from daemon: missing or empty Content-Type header added
Handle HEAD requests as if they are GET requests
The Content-Type header is stripped by DRF when there is no body in the response.
Django and aiohttp both strip the body of HEAD requests. It is safe to handle HEAD requests the same as GET requests and rely on the web server to strip the body of the response.
This patch also adds the Content-Type header to the ManifestResponse objects which are used when responding to requests of Manifest creation.
fixes: #8208 https://pulp.plan.io/issues/8208