CoRE Working Group P. van der Stok Internet-Draft consultant Intended status: Informational K. Hartke Expires: August 30, 2018 Universitaet Bremen TZI February 26, 2018 "Pending" Responses for the Constrained Application Protocol (CoAP) draft-hartke-core-pending-02 Abstract This document proposes a new type of response for the Constrained Application Protocol (CoAP) called a "Pending" response. A CoAP server can use a Pending response to indicate that it has accepted a request but has not yet started processing it or that processing the request will take longer than a client is typically willing to wait for a response. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on August 30, 2018. Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of van der Stok & Hartke Expires August 30, 2018 [Page 1] Internet-Draft "Pending" Responses for CoAP February 2018 the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 2. Pending Responses . . . . . . . . . . . . . . . . . . . . . . 3 2.1. Observing Resources . . . . . . . . . . . . . . . . . . . 4 3. Security Considerations . . . . . . . . . . . . . . . . . . . 4 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 5 5. References . . . . . . . . . . . . . . . . . . . . . . . . . 5 5.1. Normative References . . . . . . . . . . . . . . . . . . 5 5.2. Informative References . . . . . . . . . . . . . . . . . 5 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 6 1. Introduction The Constrained Application Protocol (CoAP) [RFC7252] is a request/ response protocol not unlike HTTP. CoAP defines no upper bound for the time between a request and the resulting response. For example, a CoAP-over-UDP server is expected to return an empty Acknowledgement to the client if it cannot provide a response right away, but there is no limit on the time when the server should return the Separate Response. In particular in the case of requests with long processing times, a CoAP client faces the problem that it cannot easily determine how long it should wait for the response and whether the CoAP server is actually still processing the request. Long processing times occur, for example, when requests need manual intervention to authorize their processing, or when they perform a long sequence of remote actions. An example for this is the "possibly long" authorization request specified in EST-coaps [I-D.vanderstok-ace-coap-est]. This document proposes a new kind of response in CoAP, called a "Pending" response. The semantics of this response are modelled after the HTTP 202 (Accepted) status code [RFC7231]: The 202 (Accepted) status code indicates that the request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. [...] The representation sent with this response ought to describe the request's current status and point to (or embed) a status monitor that can provide the user with an estimate of when the request will be fulfilled. van der Stok & Hartke Expires August 30, 2018 [Page 2] Internet-Draft "Pending" Responses for CoAP February 2018 Pending responses are not intended for overload cases, which are better handled by the 5.03 (Service Unavailable) response code. 1.1. Terminology Readers are expected to be familiar with the terms and concepts described in [RFC7252] and [RFC7641]. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 2. Pending Responses A Pending response is denoted by a response code in the 2.xx range and a Content-Format Option that is set to content-format ID TBD1. A 2.01 (Creation Pending) response in reply to a POST request indicates that the result of processing the request is not available yet, for example, because the server needs more time to process the request than a client is typically willing to wait for a response. The server MAY specify a location using the Location-* options where the result will become available. If the server does not specify a location, the result will become available at the target resource of the POST request. To retrieve the result, the client MAY poll or observe the resource at this location using the GET request method. A 2.02 (Deletion Pending) response in reply to a DELETE request indicates that the server has accepted the request but the target has not been fully deleted yet. A 2.04 (Change Pending) response in reply to a POST or PUT request indicates that the server has accepted the request but the result of processing the request is not available yet. A 2.05 (Content Pending) response in reply to GET request indicates that the target resource exists but a representation of the resource is not available yet. The Max-Age Option indicates after what time a client should retry its GET request to retrieve the representation. The client MAY observe the resource [RFC7641] to get notified when the representation becomes available (see Section 2.1 for details). The payload of a Pending response MAY be a brief human-readable diagnostic message, explaining the situation, or MUST be absent. The cacheability of Pending responses is as specified for the respective response code. van der Stok & Hartke Expires August 30, 2018 [Page 3] Internet-Draft "Pending" Responses for CoAP February 2018 2.1. Observing Resources When a client registers to observe a resource [RFC7641] for which no representation is available yet, the server MAY send one or more 2.05 (Content Pending) notifications before sending the first actual 2.05 (Content) or 2.03 (Valid) notification. The possible resulting sequence of notifications is shown in Figure 1. __________ __________ __________ | | | | | | ---->| 2.05 |---->| 2.05 / |---->| 4.xx / | | Pending | | 2.03 | | 5.xx | |__________| |__________| |__________| ^ \ \ ^ \ ^ \__/ \ \___/ / \_______________________/ Figure 1: Sequence of Notifications Unless the server is unwilling to add the client to the list of observers, each 2.05 (Content Pending) notification MUST include an Observe Option with a sequence number as specified in [RFC7641]. Otherwise, the registration request falls back to a normal GET request. 3. Security Considerations This section analyses the possible threats related to Pending responses. It is meant to inform protocol and application developers about the security limitations of the response code as described in this document. A Pending response is subject to the same general security considerations as all CoAP responses as described in Section 11 of [RFC7252]. Specifically, the security considerations for the response code are closest to those of the Observe Option as stated in Section 7 of [RFC7641], because the server stores additional state over an extended period. Pending responses are secured following the recommendations for the existing CoAP response codes as specified in Section 9 of [RFC7252]. When additional security techniques are standardized for CoAP (e.g., based on object security), these are then also available for securing the responses. van der Stok & Hartke Expires August 30, 2018 [Page 4] Internet-Draft "Pending" Responses for CoAP February 2018 4. IANA Considerations This document adds the content-format used to signal Pending responses to the "CoAP Content-Formats" registry. +------------+----------------+------+-----------------+ | Media Type | Content Coding | ID | Reference | +------------+----------------+------+-----------------+ | - | - | TBD1 | [This Document] | +------------+----------------+------+-----------------+ New CoAP Content-Formats TBD1 is taken from the "First Come First Served" range of the "CoAP Content-Formats" registry. 5. References 5.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10.17487/RFC7252, June 2014, . [RFC7641] Hartke, K., "Observing Resources in the Constrained Application Protocol (CoAP)", RFC 7641, DOI 10.17487/RFC7641, September 2015, . 5.2. Informative References [I-D.vanderstok-ace-coap-est] Stok, P., Kampanakis, P., Kumar, S., Richardson, M., Furuhed, M., and S. Raza, "EST over secure CoAP (EST- coaps)", draft-vanderstok-ace-coap-est-04 (work in progress), January 2018. [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10.17487/RFC7231, June 2014, . van der Stok & Hartke Expires August 30, 2018 [Page 5] Internet-Draft "Pending" Responses for CoAP February 2018 Authors' Addresses Peter van der Stok consultant Phone: +31-492474673 (Netherlands), +33-966015248 (France) Email: consultancy@vanderstok.org URI: www.vanderstok.org Klaus Hartke Universitaet Bremen TZI Postfach 330440 Bremen D-28359 Germany Phone: +49-421-218-63905 Email: hartke@tzi.org van der Stok & Hartke Expires August 30, 2018 [Page 6]