Issue #8208
closed
docker 20.10 client pull operation fails with Error response from daemon: missing or empty Content-Type header
Status:
CLOSED - CURRENTRELEASE
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 "-"
- Status changed from NEW to POST
- Assignee set to dkliban@redhat.com
- Sprint/Milestone set to 2.3.0
- Sprint set to Sprint 89
- Sprint changed from Sprint 89 to Sprint 90
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
- Status changed from POST to MODIFIED
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
- 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
Also available in: Atom
PDF
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