Project

Profile

Help

Issue #1781

closed

Files ending in .gz are delivered with incorrect content headers

Added by rmcgover over 8 years ago. Updated over 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Master
Platform Release:
2.12.1
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Sprint 14
Quarter:

Description

Files ending in .gz served up by pulp.server.content.web.views are served with an incorrect content type and encoding.

This affects .xml.gz files generated by yum-distributor. For example:

$ curl -v http://192.168.121.51/pulp/repos/f04a1d5b-32d8-4a60-a580-cc158ab25004/repodata/5f90923d6f2e4b3d0f27c13e927821b9a7001b349f99222752c37496a40531d8-updateinfo.xml.gz > /dev/null
*   Trying 192.168.121.51...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 192.168.121.51 (192.168.121.51) port 80 (#0)
> GET /pulp/repos/f04a1d5b-32d8-4a60-a580-cc158ab25004/repodata/5f90923d6f2e4b3d0f27c13e927821b9a7001b349f99222752c37496a40531d8-updateinfo.xml.gz HTTP/1.1
> User-Agent: curl/7.40.0
> Host: 192.168.121.51
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Thu, 17 Mar 2016 03:24:50 GMT
< Server: Apache/2.4.18 (Fedora) OpenSSL/1.0.2g-fips mod_wsgi/4.4.8 Python/2.7.10
< Last-Modified: Thu, 17 Mar 2016 00:57:43 GMT
< ETag: "278-52e341e355108"
< Content-Length: 632
< Content-Type: text/xml
< 

The server incorrectly claims that the response content is Content-Type: text/xml, with no Content-Encoding.
It should be: Content-Type: text/xml, Content-Encoding: gzip.

It looks like this can't be made to work correctly with mod_xsendfile, since that module discards any Content-Encoding header.
If that won't be fixed then some other options could be:

  • set Content-Type: application/x-gzip, if mimetypes.guess_type guessed an encoding of gzip
  • set Content-Type: application/octet-stream, if mimetypes.guess_type guessed any encoding other than None

Related issues

Has duplicate Docker Support - Issue #1868: Pulp on RHEL 6 serves wrong filesCLOSED - DUPLICATEActions
Has duplicate Pulp - Issue #2471: Repo download fails for drpmCLOSED - DUPLICATEActions

Also available in: Atom PDF