From 9f962862e6eddcdf33f2d62256ff6d1e3de4de08 Mon Sep 17 00:00:00 2001 From: Nils Goroll Date: Wed, 9 Sep 2020 11:32:49 +0200 Subject: [PATCH 1/2] clarify Content-Type / Content-Encoding / Content-Language handling closes #158 --- protocol.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/protocol.md b/protocol.md index 047a8e5..ae2b823 100644 --- a/protocol.md +++ b/protocol.md @@ -45,6 +45,7 @@ Kleidl](https://twitter.com/Acconut_)
[J. Ryan Stinnett](https://convolv.es), [Ifedapo Olarewaju](https://github.com/ifedapoolarewaju) [Robert Nagy](https://github.com/ronag) +[Nils Goroll](https://github.com/nigoroll) The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be @@ -299,7 +300,7 @@ Host: tus.example.org Content-Length: 0 Upload-Length: 100 Tus-Resumable: 1.0.0 -Upload-Metadata: filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,is_confidential +Upload-Metadata: filename d29ybGRfZG9taW5hdGlvbl9wbGFuLnBkZg==,filetype YXBwbGljYXRpb24vcGRm,is_confidential ``` **Response:** @@ -334,6 +335,34 @@ Since metadata can contain arbitrary binary values, Servers SHOULD carefully validate metadata values or sanitize them before using them as header values to avoid header smuggling. +Clients and servers SHOULD implement the metadata key ``filetype`` +with the value containing the actual ``Content-Type`` of the Upload +(because the ``Content-Type`` header is formally required to be set to +``application/offset+octet-stream`` for [Creation with +Upload](#creation-with-upload)). + +Clients and servers MAY support additional well known metadata keys: + +* ``filename`` for a common file name + +The specific metadata keys documented herein are reserved for the +respective use and MUST NOT be used for other purposes. + +##### [Content-Encoding](https://httpwg.org/specs/rfc7231.html#header.content-encoding) + +Clients MUST set the ``Content-Encoding`` header correctly IFF a +content encoding is used. + +As per RFC7231, Servers MUST respond with status 415 if they can not +accept the ``Content-Encoding`` chosen by the client. + +Servers MUST either store the ``Content-Encoding`` and deliver it with +subsequent requests, or properly decode the content before storing it. + +##### [Content-Language](https://httpwg.org/specs/rfc7231.html#header.content-language) + +Clients and Servers SHOULD support the ``Content-Language`` header. + #### Requests ##### POST From 5b307aeaab8d4f68fdd43a620fdd69391a07c470 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 29 Sep 2020 13:00:08 +0200 Subject: [PATCH 2/2] Adjust phrasing of recommended metadata keys --- protocol.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/protocol.md b/protocol.md index ae2b823..0ef5ee6 100644 --- a/protocol.md +++ b/protocol.md @@ -335,18 +335,11 @@ Since metadata can contain arbitrary binary values, Servers SHOULD carefully validate metadata values or sanitize them before using them as header values to avoid header smuggling. -Clients and servers SHOULD implement the metadata key ``filetype`` -with the value containing the actual ``Content-Type`` of the Upload -(because the ``Content-Type`` header is formally required to be set to -``application/offset+octet-stream`` for [Creation with -Upload](#creation-with-upload)). - -Clients and servers MAY support additional well known metadata keys: - -* ``filename`` for a common file name - -The specific metadata keys documented herein are reserved for the -respective use and MUST NOT be used for other purposes. +Servers and Clients SHOULD use the metadata key `filename` to communicate the file name +of the uploaded data, if such a name is available. The metadata key `filetype` SHOULD +be used communicate the [media type](https://www.iana.org/assignments/media-types/media-types.xhtml) +of the uploaded data. These metadata keys SHOULD not be used for any other purposes as +described here. ##### [Content-Encoding](https://httpwg.org/specs/rfc7231.html#header.content-encoding)