Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3552

Use application/json Content-Type/Accepts instead of PSON

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 5.0.0
    • None
    • Hide

      This ticket is about ensuring the agent and server are correctly using and preferring application/json, and that the server responds correctly when an unsupported format is used.

      • Puppet agents send an HTTP header Accepts: application/json, pson, ... (where application/json is before pson) for catalogs, nodes, file_metadata(s).
      • Agents continue to send Accepts: s for cert related endpoints, e.g. ca, certificate, certificate_request, certificate_revocation_list.
      • Agents continue to send Accepts: application/octet-stream when requesting file content.
      • If an agent requests a format that the server doesn't understand, e.g. Accepts: foo, then the server should reply with HTTP 406.
      • If an agent requests a format that is not supported for catalogs, e.g. Accepts: application/octet-stream, then the server should reply with HTTP 406.
      • If an agent uploads a report without specifying a Content-Type header, then the server should return HTTP 400. Same if the agent sets Content-Type: application/json, but the body is not valid JSON.
      • If an agent uploads a report and specifies a content-type that the server doesn't understand, e..g Content-Type: foo, then the server should respond with HTTP 415
      • If an agent uploads a report and specifies a content-type that is not supported for reports, e.g. Content-Type: application/octet-stream, then the server should respond with HTTP 415.
      Show
      This ticket is about ensuring the agent and server are correctly using and preferring application/json, and that the server responds correctly when an unsupported format is used. Puppet agents send an HTTP header Accepts: application/json, pson, ... (where application/json is before pson ) for catalogs, nodes, file_metadata(s). Agents continue to send Accepts: s for cert related endpoints, e.g. ca , certificate , certificate_request , certificate_revocation_list . Agents continue to send Accepts: application/octet-stream when requesting file content. If an agent requests a format that the server doesn't understand, e.g. Accepts: foo , then the server should reply with HTTP 406. If an agent requests a format that is not supported for catalogs, e.g. Accepts: application/octet-stream , then the server should reply with HTTP 406. If an agent uploads a report without specifying a Content-Type header, then the server should return HTTP 400. Same if the agent sets Content-Type: application/json , but the body is not valid JSON. If an agent uploads a report and specifies a content-type that the server doesn't understand, e..g Content-Type: foo , then the server should respond with HTTP 415 If an agent uploads a report and specifies a content-type that is not supported for reports, e.g. Content-Type: application/octet-stream , then the server should respond with HTTP 415.
    • Agent
    • 2
    • Agent 2017-05-31
    • Bug Fix
    • Hide
      Server replies with 500 if the HTTP request's Content-Type header is missing or if the server fails to parse the body of the request, i.e. it tries to read the submitted report using the specified Content-Type, but it fails to deserialize.

      Server replies with 415 if the client sends data in the body of the request (report), but the server doesn't support the specified Content-Type. For example, the agent supports msgpack and is configured to prefer it, but the server doesn't support it.

      Server replies with 406 if the client requests data from the server, but the server doesn't support at least one format specified in the request's {{Accepts}} header.
      Show
      Server replies with 500 if the HTTP request's Content-Type header is missing or if the server fails to parse the body of the request, i.e. it tries to read the submitted report using the specified Content-Type, but it fails to deserialize. Server replies with 415 if the client sends data in the body of the request (report), but the server doesn't support the specified Content-Type. For example, the agent supports msgpack and is configured to prefer it, but the server doesn't support it. Server replies with 406 if the client requests data from the server, but the server doesn't support at least one format specified in the request's {{Accepts}} header.
    • Manual

    Description

      Once puppet is handling everything as JSON instead of PSON, we need to change from using application/pson (or variants) to application/json (strictly, don't accept just json or x-json or any other variations).

      In order to be mostly backwards compatible puppet should still accept PSON content types but only decode and encode them like JSON. When it does this it needs to issue a warning about using a deprecated format and that it is no longer fully functional.

      Attachments

        Issue Links

          Activity

            People

              qa qa
              andy Andrew Parker
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support