Project

Profile

Help

Issue #963

closed

Invalid Content-Encoding HTTP header in REST API

Added by pvandepitte almost 9 years ago. Updated about 5 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}
Actions #1

Updated by mhrivnak almost 9 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'
Actions #2

Updated by jortel@redhat.com almost 9 years ago

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

Updated by jortel@redhat.com almost 9 years ago

  • Severity changed from 2. Medium to 1. Low
Actions #4

Updated by amacdona@redhat.com almost 9 years ago

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

Added by Austin Macdonald almost 9 years ago

Revision 8bf3c595 | View on GitHub

fix http header responses

fixes #963

Added by Austin Macdonald almost 9 years ago

Revision 8bf3c595 | View on GitHub

fix http header responses

fixes #963

Actions #6

Updated by amacdona@redhat.com almost 9 years ago

  • Status changed from ASSIGNED to POST
Actions #7

Updated by amacdona@redhat.com almost 9 years ago

  • Status changed from POST to MODIFIED
Actions #8

Updated by Anonymous almost 9 years ago

  • % Done changed from 0 to 100
Actions #9

Updated by amacdona@redhat.com over 8 years ago

  • Platform Release changed from 2.7.1 to 2.7.2
Actions #10

Updated by dkliban@redhat.com about 8 years ago

  • Status changed from MODIFIED to 5
Actions #11

Updated by semyers almost 8 years ago

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

Updated by amacdona@redhat.com over 7 years ago

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

Updated by amacdona@redhat.com over 7 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
Actions #14

Updated by semyers over 7 years ago

  • Status changed from MODIFIED to 5
Actions #15

Updated by pthomas@redhat.com over 7 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
}
Actions #16

Updated by semyers over 7 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE
Actions #18

Updated by bmbouter about 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF