title CNP compression (draft) content section Overview text fmt This draft aims to specify the protocol for compressing body data of CNP requests and responses. section Syntax text fmt A new request and response parameter, ``compression``, would be defined: raw cnp compression={algorithm} text fmt Where ``{algorithm}`` is the compression algorithm used. A request parameter, ``accept_compression``, would be defined: raw cnp accept_compression={algorithms} text fmt Where ``{algorithms}`` is a comma-separated list of compression algorithms (e.g. ``accept_compression=lz4,gzip,deflate``) with decreasing priority. section Functionality text fmt The body data of the message is compressed using the specified algorithm. If the ``length`` parameter is to be set, it must contain the length of the data after compression, not before it. The client should only use the standard compression algorithms or ones provided by the server in something like the @@/draft/old/cnp-select/ options selector@@. The server may use any compression algorithm provided in the ``accept_compression`` request parameter, with the ones towards the start of the list being preferred; if that parameter is absent, the server must not use compression. section Algorithms text fmt While custom compression algorithms may be used, all server implementations are expected to support the following ones: list text fmt ``gzip``: A @@https://en.wikipedia.org/wiki/Gzip gzip@@ (@@https://www.ietf.org/rfc/rfc1952.txt RFC 1952@@) stream using the DEFLATE algorithm. text fmt ``zlib``: A @@https://en.wikipedia.org/wiki/Zlib zlib@@ (@@https://www.ietf.org/rfc/rfc1950.txt RFC 1950@@) stream using the DEFLATE algorithm. text fmt ``deflate``: A @@https://en.wikipedia.org/wiki/Deflate DEFLATE@@ (@@https://www.ietf.org/rfc/rfc1951.txt RFC 1951@@) data stream (**not** the zlib file format). section Possible changes list text fmt Remove all but ``gzip`` algorithms from the default ones, since they're all basically DEFLATE (plus maybe checksum). text fmt Consider algorithms like @@https://en.wikipedia.org/wiki/Brotli Brotli@@. site draft cnp-compression links /spec/ Specifications /doc/ Documents /draft/ Drafts /lib/ Libraries /util/ Tools and utilities