Project

Profile

Help

Issue #963

Invalid Content-Encoding HTTP header in REST API

Added by pvandepitte over 6 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
2.5
Platform Release:
2.8.7
OS:
CentOS 6
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
Quarter:

Description

When I upload metadata, the V2 REST API returns an invalid Content-Encoding HTTP header: utf-8. Some libraries (e.g. apache commons-httpclient) fail on invalid values for Content-Encoding... Valid content encodings are e.g. gzip, inflate, ... utf-8 is a charset and should be appended to the content-type header

curl -ik --cert /path/to/client.pem -X POST -d @/path/to/metadata.json https://pulp.host/pulp/api/v2/repositories/repo-id/actions/import_upload/
HTTP/1.1 202 Accepted
Date: Thu, 07 May 2015 15:31:06 GMT
Server: Apache/2.2.15 (CentOS)
Content-Encoding: utf-8
Content-Length: 172
Connection: close
Content-Type: application/json

{"spawned_tasks": [{"_href": "/pulp/api/v2/tasks/3f9e74d3-fc7a-410d-9ae3-9f679c317289/", "task_id": "3f9e74d3-fc7a-410d-9ae3-9f679c317289"}], "result": null, "error": null}

Associated revisions

Revision 8bf3c595 View on GitHub
Added by Austin Macdonald over 6 years ago

fix http header responses

fixes #963

Revision 8bf3c595 View on GitHub
Added by Austin Macdonald over 6 years ago

fix http header responses

fixes #963

History

#1 Updated by mhrivnak over 6 years ago

How strange. Thanks for the report. Here is some info on where it's happening:

$ grep -r -i content-encoding *
pulp/server/webservices/middleware/postponed.py:            response_obj['Content-Encoding'] = 'utf-8'
pulp/server/webservices/middleware/exception.py:        response_obj['Content-Encoding'] = 'utf-8'

#2 Updated by jortel@redhat.com over 6 years ago

  • Priority changed from Normal to High
  • Triaged changed from No to Yes
  • Tags Easy Fix added

#3 Updated by jortel@redhat.com over 6 years ago

  • Severity changed from 2. Medium to 1. Low

#4 Updated by amacdona@redhat.com over 6 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to amacdona@redhat.com
  • Platform Release set to 2.7.1

#6 Updated by amacdona@redhat.com over 6 years ago

  • Status changed from ASSIGNED to POST

#7 Updated by amacdona@redhat.com over 6 years ago

  • Status changed from POST to MODIFIED

#8 Updated by Anonymous over 6 years ago

  • % Done changed from 0 to 100

#9 Updated by amacdona@redhat.com almost 6 years ago

  • Platform Release changed from 2.7.1 to 2.7.2

#10 Updated by dkliban@redhat.com almost 6 years ago

  • Status changed from MODIFIED to 5

#11 Updated by semyers over 5 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE
  • Platform Release changed from 2.7.2 to 2.7.0

#12 Updated by amacdona@redhat.com over 5 years ago

  • Status changed from CLOSED - CURRENTRELEASE to POST
  • Triaged changed from Yes to No

#13 Updated by amacdona@redhat.com over 5 years ago

  • Status changed from POST to MODIFIED
  • Platform Release changed from 2.7.0 to 2.8.7
  • Triaged changed from No to Yes

#14 Updated by semyers over 5 years ago

  • Status changed from MODIFIED to 5

#15 Updated by pthomas@redhat.com over 5 years ago

  • Status changed from 5 to 6

verified

$ ssh $hostname rpm -qa | sort | grep -i pulp
pulp-admin-client-2.8.7-0.3.beta.el7.noarch
pulp-docker-admin-extensions-2.0.3-1.el7.noarch
pulp-docker-plugins-2.0.3-1.el7.noarch
pulp-ostree-admin-extensions-1.1.3-1.el7.noarch
pulp-ostree-plugins-1.1.3-1.el7.noarch
pulp-puppet-admin-extensions-2.8.7-0.2.beta.el7.noarch
pulp-puppet-plugins-2.8.7-0.2.beta.el7.noarch
pulp-python-admin-extensions-1.1.3-1.el7.noarch
pulp-python-plugins-1.1.3-1.el7.noarch
pulp-rpm-admin-extensions-2.8.7-0.2.beta.el7.noarch
pulp-rpm-plugins-2.8.7-0.2.beta.el7.noarch
pulp-selinux-2.8.7-0.3.beta.el7.noarch
pulp-server-2.8.7-0.3.beta.el7.noarch
python-isodate-0.5.0-4.pulp.el7.noarch
python-kombu-3.0.33-6.pulp.el7.noarch
python-pulp-bindings-2.8.7-0.3.beta.el7.noarch
python-pulp-client-lib-2.8.7-0.3.beta.el7.noarch
python-pulp-common-2.8.7-0.3.beta.el7.noarch
python-pulp-docker-common-2.0.3-1.el7.noarch
python-pulp-oid_validation-2.8.7-0.3.beta.el7.noarch
python-pulp-ostree-common-1.1.3-1.el7.noarch
python-pulp-puppet-common-2.8.7-0.2.beta.el7.noarch
python-pulp-python-common-1.1.3-1.el7.noarch
python-pulp-repoauth-2.8.7-0.3.beta.el7.noarch
python-pulp-rpm-common-2.8.7-0.2.beta.el7.noarch
python-pulp-streamer-2.8.7-0.3.beta.el7.noarch

http --verify no --auth admin:admin POST https://localhost/pulp/api/v2/repositories/
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:769: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
HTTP/1.1 400 BAD REQUEST
Connection: close
Content-Length: 328
Content-Type: application/json; charset=utf-8
Date: Mon, 15 Aug 2016 17:56:19 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5

{
    "_href": "/pulp/api/v2/repositories/", 
    "args": [], 
    "error": {
        "code": "PLP1009", 
        "data": {}, 
        "description": "The request body does not contain valid JSON", 
        "sub_errors": []
    }, 
    "error_message": "The request body does not contain valid JSON", 
    "exception": null, 
    "http_request_method": "POST", 
    "http_status": 400, 
    "traceback": null
}

#16 Updated by semyers over 5 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#18 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF