draft-ietf-core-href-04.txt   draft-ietf-core-href-05.txt 
CoRE Working Group K. Hartke CoRE Working Group C. Bormann, Ed.
Internet-Draft Ericsson Internet-Draft Universität Bremen TZI
Intended status: Standards Track C. Bormann, Ed. Intended status: Standards Track H. Birkholz
Expires: 8 November 2021 Universitaet Bremen TZI Expires: 13 January 2022 Fraunhofer SIT
7 May 2021 12 July 2021
Constrained Resource Identifiers Constrained Resource Identifiers
draft-ietf-core-href-04 draft-ietf-core-href-05
Abstract Abstract
The Constrained Resource Identifier (CRI) is a complement to the The Constrained Resource Identifier (CRI) is a complement to the
Uniform Resource Identifier (URI) that serializes the URI components Uniform Resource Identifier (URI) that serializes the URI components
in Concise Binary Object Representation (CBOR) instead of a sequence in Concise Binary Object Representation (CBOR) instead of a sequence
of characters. This simplifies parsing, comparison and reference of characters. This simplifies parsing, comparison and reference
resolution in environments with severe limitations on processing resolution in environments with severe limitations on processing
power, code size, and memory size. power, code size, and memory size.
skipping to change at page 1, line 46 skipping to change at page 1, line 46
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on 8 November 2021. This Internet-Draft will expire on 13 January 2022.
Copyright Notice Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the Copyright (c) 2021 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
skipping to change at page 2, line 28 skipping to change at page 2, line 28
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3
2. Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 4
3. Creation and Normalization . . . . . . . . . . . . . . . . . 5 3. Creation and Normalization . . . . . . . . . . . . . . . . . 5
4. Comparison . . . . . . . . . . . . . . . . . . . . . . . . . 6 4. Comparison . . . . . . . . . . . . . . . . . . . . . . . . . 6
5. CRI References . . . . . . . . . . . . . . . . . . . . . . . 6 5. CRI References . . . . . . . . . . . . . . . . . . . . . . . 6
5.1. CBOR Serialization . . . . . . . . . . . . . . . . . . . 7 5.1. CBOR Serialization . . . . . . . . . . . . . . . . . . . 7
5.2. Reference Resolution . . . . . . . . . . . . . . . . . . 8 5.2. Ingesting and encoding a CRI Reference . . . . . . . . . 10
6. Relationship between CRIs, URIs and IRIs . . . . . . . . . . 10 5.3. Reference Resolution . . . . . . . . . . . . . . . . . . 10
6.1. Converting CRIs to URIs . . . . . . . . . . . . . . . . . 10 6. Relationship between CRIs, URIs and IRIs . . . . . . . . . . 11
7. Security Considerations . . . . . . . . . . . . . . . . . . . 12 6.1. Converting CRIs to URIs . . . . . . . . . . . . . . . . . 12
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 12 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 14
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 8. Security Considerations . . . . . . . . . . . . . . . . . . . 14
9.1. Normative References . . . . . . . . . . . . . . . . . . 12 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14
9.2. Informative References . . . . . . . . . . . . . . . . . 13 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 14
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 14 10.1. Normative References . . . . . . . . . . . . . . . . . . 14
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 15 10.2. Informative References . . . . . . . . . . . . . . . . . 15
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 15 Appendix A. CDDL specification . . . . . . . . . . . . . . . . . 16
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 16
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 18
Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 18
1. Introduction 1. Introduction
The Uniform Resource Identifier (URI) [RFC3986] and its most common The Uniform Resource Identifier (URI) [RFC3986] and its most common
usage, the URI reference, are the Internet standard for linking to usage, the URI reference, are the Internet standard for linking to
resources in hypertext formats such as HTML [W3C.REC-html52-20171214] resources in hypertext formats such as HTML [W3C.REC-html52-20171214]
or the HTTP "Link" header field [RFC8288]. or the HTTP "Link" header field [RFC8288].
A URI reference is a sequence of characters chosen from the A URI reference is a sequence of characters chosen from the
repertoire of US-ASCII characters. The individual components of a repertoire of US-ASCII characters. The individual components of a
skipping to change at page 3, line 16 skipping to change at page 3, line 23
dot-segments, and recomposing the result back into a character dot-segments, and recomposing the result back into a character
sequence. sequence.
Overall, the proper handling of URI references is quite intricate. Overall, the proper handling of URI references is quite intricate.
This can be a problem especially in constrained environments This can be a problem especially in constrained environments
[RFC7228], where nodes often have severe code size and memory size [RFC7228], where nodes often have severe code size and memory size
limitations. As a result, many implementations in such environments limitations. As a result, many implementations in such environments
support only an ad-hoc, informally-specified, bug-ridden, non- support only an ad-hoc, informally-specified, bug-ridden, non-
interoperable subset of half of RFC 3986. interoperable subset of half of RFC 3986.
This document defines the Constrained Resource Identifier (CRI) by This document defines the _Constrained Resource Identifier (CRI)_ by
constraining URIs to a simplified subset and serializing their constraining URIs to a simplified subset and serializing their
components in Concise Binary Object Representation (CBOR) [RFC8949] components in Concise Binary Object Representation (CBOR) [RFC8949]
instead of a sequence of characters. This allows typical operations instead of a sequence of characters. This allows typical operations
on URI references such as parsing, comparison and reference on URI references such as parsing, comparison and reference
resolution (including all corner cases) to be implemented in a resolution (including all corner cases) to be implemented in a
comparatively small amount of code. comparatively small amount of code.
As a result of simplification, however, CRIs are not capable of As a result of simplification, however, CRIs are not capable of
expressing all URIs permitted by the generic syntax of RFC 3986 expressing all URIs permitted by the generic syntax of RFC 3986
(hence the "constrained" in "Constrained Resource Identifier"). The (hence the "constrained" in "Constrained Resource Identifier"). The
skipping to change at page 4, line 13 skipping to change at page 4, line 17
underscores). underscores).
2. Constraints 2. Constraints
A Constrained Resource Identifier consists of the same five A Constrained Resource Identifier consists of the same five
components as a URI: scheme, authority, path, query, and fragment. components as a URI: scheme, authority, path, query, and fragment.
The components are subject to the following constraints: The components are subject to the following constraints:
C1. The scheme name can be any Unicode string (see Definition D80 C1. The scheme name can be any Unicode string (see Definition D80
in [Unicode]) that matches the syntax of a URI scheme (see in [Unicode]) that matches the syntax of a URI scheme (see
Section 3.1 of [RFC3986]) and is lowercase (see Definition D139 Section 3.1 of [RFC3986], which constrains schemes to ASCII)
in [Unicode]). and is lowercase (see Definition D139 in [Unicode]). The
scheme is always present.
C2. An authority is always a host identified by an IP address or C2. An authority is always a host identified by an IP address or
registered name, along with optional port information. User registered name, along with optional port information. User
information is not supported. information is not supported. The authority can be absent; in
[RFC3986], in this case the path can be rootless or, as when he
authority is present, begin with a root ("/"); this is modelled
by two different values for an absent authority.
C3. An IP address can be either an IPv4 address or an IPv6 address. C3. An IP address can be either an IPv4 address or an IPv6 address.
IPv6 scoped addressing zone identifiers and future versions of IPv6 scoped addressing zone identifiers and future versions of
IP are not supported. IP are not supported.
C4. A registered name can be any Unicode string that is lowercase C4. A registered name can be any Unicode string that is lowercase
and in Unicode Normalization Form C (NFC) (see Definition D120 and in Unicode Normalization Form C (NFC) (see Definition D120
in [Unicode]). (The syntax may be further restricted by the in [Unicode]). (The syntax may be further restricted by the
scheme.) scheme.)
skipping to change at page 7, line 8 skipping to change at page 7, line 15
This section defines the serialization of CRIs in Concise Binary This section defines the serialization of CRIs in Concise Binary
Object Representation (CBOR) [RFC8949]. To reduce representation Object Representation (CBOR) [RFC8949]. To reduce representation
size, CRIs are not serialized directly. Instead, CRIs are indirectly size, CRIs are not serialized directly. Instead, CRIs are indirectly
referenced through _CRI references_. These take advantage of referenced through _CRI references_. These take advantage of
hierarchical locality and provide a very compact encoding. The CBOR hierarchical locality and provide a very compact encoding. The CBOR
serialization of CRI references is specified in Section 5.1. serialization of CRI references is specified in Section 5.1.
The only operation defined on a CRI reference is _reference The only operation defined on a CRI reference is _reference
resolution_: the act of transforming a CRI reference into a CRI. An resolution_: the act of transforming a CRI reference into a CRI. An
application MUST implement this operation by applying the algorithm application MUST implement this operation by applying the algorithm
specified in Section 5.2 (or any algorithm that is functionally specified in Section 5.3 (or any algorithm that is functionally
equivalent to it). equivalent to it).
The reverse operation of transforming a CRI into a CRI reference is The reverse operation of transforming a CRI into a CRI reference is
unspecified; implementations are free to use any algorithm as long as unspecified; implementations are free to use any algorithm as long as
reference resolution of the resulting CRI reference yields the reference resolution of the resulting CRI reference yields the
original CRI. Notably, a CRI reference is not required to satisfy original CRI. Notably, a CRI reference is not required to satisfy
all of the constraints of a CRI; the only requirement on a CRI all of the constraints of a CRI; the only requirement on a CRI
reference is that reference resolution MUST yield the original CRI. reference is that reference resolution MUST yield the original CRI.
When testing for equivalence or difference, applications SHOULD NOT When testing for equivalence or difference, applications SHOULD NOT
directly compare CRI references; the references should be resolved to directly compare CRI references; the references should be resolved to
their respective CRI before comparison. their respective CRI before comparison.
5.1. CBOR Serialization 5.1. CBOR Serialization
A CRI reference is encoded as a CBOR array [RFC8949], with the A CRI reference is encoded as a CBOR array [RFC8949], with the
structure as described in the Concise Data Definition Language (CDDL) structure as described in the Concise Data Definition Language (CDDL)
[RFC8610] as follows: [RFC8610] as follows:
; not expressed in this CDDL spec: trailing nulls to be left off
CRI-Reference = [ CRI-Reference = [
(authority // discard), ((scheme / null, authority / null / true)
*path, // discard), ; relative reference
? (([], fragment) ; include array only if path / null,
//([+query], ?fragment)) ; at least one query and/or fragment query / null,
fragment / null
] ]
authority = (?scheme, ?(host, ?port)) scheme = scheme-name / scheme-id
scheme = (scheme-name scheme-name = text .regexp "[a-z][a-z0-9+.-]*"
// COAP // COAPS // HTTP // HTTPS) scheme-id = (COAP / COAPS / HTTP / HTTPS / other-scheme)
scheme-name = (false, text .regexp "[a-z][a-z0-9+.-]*") .within nint
COAP = -1 COAPS = -2 HTTP = -3 HTTPS = -4 COAP = -1 COAPS = -2 HTTP = -3 HTTPS = -4
host = (host-name // host-ip) other-scheme = nint .feature "scheme-id-extension"
host-name = (true, text)
authority = host / [host, port]
host = host-name / host-ip
host-name = text
host-ip = bytes .size 4 / bytes .size 16 host-ip = bytes .size 4 / bytes .size 16
port = 0..65535 port = 0..65535
discard = 0..127
path = text discard = true / 0..127
query = text path = [*text]
query = [*text]
fragment = text fragment = text
The rules "scheme", "host", "port", "path", "query", "fragment" This CDDL specification is simplified for exposition and needs to be
augmented by the following rule for interchange: Trailing null values
are removed, and two leading null values (scheme and authority both
not given) are represented by using the "discard" alternative
instead. A complete CDDL specification is given in Appendix A.
The rules "scheme", "authority", "path", "query", "fragment"
correspond to the (sub-)components of a CRI, as described in correspond to the (sub-)components of a CRI, as described in
Section 2, with the addition of the "discard" element. While Section 2, with the addition of the "discard" section. The "discard"
"scheme" and "host" can comprise two array elements, we will treat section can be used when neither a scheme nor an authority is
such a combination as a single "element" in the following exposition. present. It then expresses path prefixes such as "/", "./", "../",
(The combination is needed to disambiguate what would otherwise be a "../../", etc. The exact semantics of the section values are defined
leading text string as a scheme, host, or path element.) The by Section 5.3.
"discard" element or its absence can be used to express path prefixes
such as "/", "./", "../", "../../", etc. The exact semantics of the Most URI references that Section 4.2 of [RFC3986] calls "relative
element values are defined by Section 5.2. references" (i.e., references that need to undergo a resolution
process to obtain a URI) correspond to the CRI form that starts with
"discard". The exception are relative references with an "authority"
(called a "network-path reference" in Section 4.2 of [RFC3986]),
which in CRI references never carry a "discard" section (the value of
"discard" defaults to "true").
| The structure of a CRI is visualized using the somewhat limited
| means of a railroad diagram below.
|
| cri-reference:
| ╭──────────────────────────────────────>───────────────────────────────────────╮
| │ │
| │ ╭─────────────────────>─────────────────────╮ │
| │ │ │ │
| │ │ ╭──────────────>──────────────╮ │ │
| │ │ │ │ │ │
| │ │ │ ╭──────>───────╮ │ │ │
| │ │ │ │ │ │ │ │
| │├──╯──╮── scheme ── authority ──╭──╯── path ──╯── query ──╯── fragment ──╰──╰──╰──╰──┤│
| │ │
| ╰──────── discard ────────╯
|
| This visualization does not go into the details of the
| elements.
Examples: Examples:
[-1, / scheme -- equivalent to ...false, "coap",... / [-1, / scheme -- equivalent to "coap" /
h'C6336401', / host / [h'C6336401', / host /
61616, / port / 61616], / port /
".well-known", / path / [".well-known", / path /
"core"] / path / "core"]
]
[".well-known", / path / [true, / discard /
"core", / path / [".well-known", / path /
["rt=temperature-c"]] / query / "core"],
["rt=temperature-c"]] / query /
A CRI reference is considered _well-formed_ if it matches the CDDL A CRI reference is considered _well-formed_ if it matches the CDDL
structure. structure.
A CRI reference is considered _absolute_ if it is well-formed and the A CRI reference is considered _absolute_ if it is well-formed and the
sequence of elements starts with a "scheme". sequence of sections starts with a non-null "scheme".
A CRI reference is considered _relative_ if it is well-formed and the A CRI reference is considered _relative_ if it is well-formed and the
sequence of elements is empty or starts with an element other than sequence of sections is empty or starts with a section other than
those that would constitute a "scheme". those that would constitute a "scheme".
5.2. Reference Resolution 5.2. Ingesting and encoding a CRI Reference
From an abstract point of view, a CRI Reference is a data structure
with six sections:
scheme, authority, discard, path, query, fragment
Each of these sections can be unset ("null"), except for discard,
which is always an unsigned number or "true". If scheme and/or
authority are non-null, discard must be "true".
When ingesting a CRI Reference that is in the transfer form, those
sections are filled in from the transfer form (unset sections are
filled with null), and the following steps are performed:
* If the array is entirely empty, replace it with "[0]".
* If discard is present in the transfer form (i.e., the outer array
starts with true or an unsigned number), set scheme and authority
to null.
* If scheme and/or authority are present in the transfer form (i.e.,
the outer array starts with null, a text string, or a negative
integer), set discard to "true".
Upon encoding the abstract form into the transfer form, the inverse
processing is performed: If scheme and/or authority are not null, the
discard value is not transferred (it must be true in this case). If
they are both null, they are both left out and only discard is
transferred. Trailing null values are removed from the array. As a
special case, an empty array is sent in place for a remaining "[0]"
(URI "").
5.3. Reference Resolution
The term "relative" implies that a "base CRI" exists against which The term "relative" implies that a "base CRI" exists against which
the relative reference is applied. Aside from fragment-only the relative reference is applied. Aside from fragment-only
references, relative references are only usable when a base CRI is references, relative references are only usable when a base CRI is
known. known.
The following steps define the process of resolving any well-formed The following steps define the process of resolving any well-formed
CRI reference against a base CRI so that the result is a CRI in the CRI reference against a base CRI so that the result is a CRI in the
form of an absolute CRI reference: form of an absolute CRI reference:
1. Establish the base CRI of the CRI reference and express it in the 1. Establish the base CRI of the CRI reference and express it in the
form of an absolute CRI reference. (The base CRI can be form of an abstract absolute CRI reference.
established in a number of ways; see Section 5.1 of [RFC3986].)
Assign each element an element number according to the number E
for that element in Table 1.
2. Determine the values of two variables, T and E, based on the
first element in the sequence of elements of the CRI reference to
be resolved, according to Table 1.
3. Initialize a buffer with all the elements from the base CRI where
the element number is less than the value of E.
4. If the value of T is greater than 0, remove the last T-many
"path" elements from the end of the buffer (up to the number of
"path" elements in the buffer).
5. Append all the elements from the CRI reference to the buffer, 2. Initialize a buffer with the sections from the base CRI.
except for any "discard" element.
6. If the number of "path" elements in the buffer is one and the 3. If the value of discard is "true" in the CRI reference, replace
value of that element is the zero-length string, remove that the path in the buffer with the empty array, unset query and
element from the buffer. fragment, and set a "true" authority to "null". If the value of
discard is an unsigned number, remove as many elements from the
end of the path array; if it is non-zero, unset query and
fragment. Set discard to "true" in the buffer.
7. Return the sequence of elements in the buffer as the resolved 4. If the path section is set in the CRI reference, append all
CRI. elements from the path array to the array in the path section in
the buffer; unset query and fragment.
+=====================+===============+===+ 5. Apart from the path and discard, copy all non-null sections from
| First Element | T | E | the CRI reference to the buffer in sequence; unset fragment if
+=====================+===============+===+ query is non-null and thus copied.
| (scheme) | 0 | 0 |
+---------------------+---------------+---+
| (host) | 0 | 1 |
+---------------------+---------------+---+
| (discard) | element value | 3 |
+---------------------+---------------+---+
| (path) | 0 | 2 |
+---------------------+---------------+---+
| (query) | 0 | 3 |
+---------------------+---------------+---+
| (fragment) | 0 | 4 |
+---------------------+---------------+---+
| none/empty sequence | 0 | 4 |
+---------------------+---------------+---+
Table 1: Values of the Variables T and E 6. Return the sections in the buffer as the resolved CRI.
6. Relationship between CRIs, URIs and IRIs 6. Relationship between CRIs, URIs and IRIs
CRIs are meant to replace both Uniform Resource Identifiers (URIs) CRIs are meant to replace both Uniform Resource Identifiers (URIs)
[RFC3986] and Internationalized Resource Identifiers (IRIs) [RFC3987] [RFC3986] and Internationalized Resource Identifiers (IRIs) [RFC3987]
in constrained environments [RFC7228]. Applications in these in constrained environments [RFC7228]. Applications in these
environments may never need to use URIs and IRIs directly, especially environments may never need to use URIs and IRIs directly, especially
when the resource identifier is used simply for identification when the resource identifier is used simply for identification
purposes or when the CRI can be directly converted into a CoAP purposes or when the CRI can be directly converted into a CoAP
request. request.
skipping to change at page 10, line 49 skipping to change at page 12, line 24
references and IRI references. references and IRI references.
6.1. Converting CRIs to URIs 6.1. Converting CRIs to URIs
Applications MUST convert a CRI reference to a URI reference by Applications MUST convert a CRI reference to a URI reference by
determining the components of the URI reference according to the determining the components of the URI reference according to the
following steps and then recomposing the components to a URI following steps and then recomposing the components to a URI
reference string as specified in Section 5.3 of [RFC3986]. reference string as specified in Section 5.3 of [RFC3986].
scheme scheme
If the CRI reference contains a "scheme" element, the scheme If the CRI reference contains a "scheme" section, the scheme
component of the URI reference consists of the value of that component of the URI reference consists of the value of that
element. Otherwise, the scheme component is unset. section. Otherwise, the scheme component is unset.
authority authority
If the CRI reference contains a "host-name" or "host-ip" element, If the CRI reference contains a "host-name" or "host-ip" item, the
the authority component of the URI reference consists of a host authority component of the URI reference consists of a host
subcomponent, optionally followed by a colon (":") character and a subcomponent, optionally followed by a colon (":") character and a
port subcomponent. Otherwise, the authority component is unset. port subcomponent. Otherwise, the authority component is unset.
The host subcomponent consists of the value of the "host-name" or The host subcomponent consists of the value of the "host-name" or
"host-ip" element. "host-ip" item.
Any character in the value of a "host-name" element that is not in Any character in the value of a "host-name" item that is not in
the set of unreserved characters (Section 2.3 of [RFC3986]) or the set of unreserved characters (Section 2.3 of [RFC3986]) or
"sub-delims" (Section 2.2 of [RFC3986]) MUST be percent-encoded. "sub-delims" (Section 2.2 of [RFC3986]) MUST be percent-encoded.
The value of a "host-ip" element MUST be represented as a string The value of a "host-ip" item MUST be represented as a string that
that matches the "IPv4address" or "IP-literal" rule (Section 3.2.2 matches the "IPv4address" or "IP-literal" rule (Section 3.2.2 of
of [RFC3986]). [RFC3986]).
If the CRI reference contains a "port" element, the port If the CRI reference contains a "port" item, the port subcomponent
subcomponent consists of the value of that element in decimal consists of the value of that item in decimal notation.
notation. Otherwise, the colon (":") character and the port Otherwise, the colon (":") character and the port subcomponent are
subcomponent are both omitted. both omitted.
path path
If the CRI reference is an empty sequence of elements or starts If the CRI reference contains a "discard" item of value "true",
with a "port" element, a "path" element, or a "discard" element the path component is prefixed by a slash ("/") character. If it
where the value is not 0, the conversion fails. contains a "discard" item of value "0" and the "path" item is
present, the conversion fails. Otherwise, the path component is
prefixed by as many "../" components as the "discard" value minus
one indicates.
If the CRI reference contains a "host-name" element, a "host-ip" If the discard item is not present and the CRI reference contains
element or a "discard" element, the path component of the URI an authority that is "true", the path component of the URI
reference is prefixed by a slash ("/") character. Otherwise, the reference is prefixed by the zero-length string. Otherwise, the
path component is prefixed by the zero-length string. path component is prefixed by a slash ("/") character.
If the CRI reference contains one or more "path" elements, the If the CRI reference contains one or more "path" items, the prefix
prefix is followed by the value of each element, separated by a is followed by the value of each item, separated by a slash ("/")
slash ("/") character. character.
Any character in the value of a "path" element that is not in the Any character in the value of a "path" item that is not in the set
set of unreserved characters or "sub-delims" or a colon (":") or of unreserved characters or "sub-delims" or a colon (":") or
commercial at ("@") character MUST be percent-encoded. commercial at ("@") character MUST be percent-encoded.
If the authority component is defined and the path component does If the authority component is present (not "null" or "true") and
not match the "path-abempty" rule (Section 3.3 of [RFC3986]), the the path component does not match the "path-abempty" rule
conversion fails. (Section 3.3 of [RFC3986]), the conversion fails.
If the authority component is unset and the scheme component is If the authority component is not present, but the scheme
defined and the path component does not match the "path-absolute", component is, and the path component does not match the "path-
"path-rootless" or "path-empty" rule (Section 3.3 of [RFC3986]), absolute", "path-rootless" (authority == "true") or "path-empty"
the conversion fails. rule (Section 3.3 of [RFC3986]), the conversion fails.
If the authority component is unset and the scheme component is If neither the authority component nor the scheme component are
unset and the path component does not match the "path-absolute", present, and the path component does not match the "path-
"path-noscheme" or "path-empty" rule (Section 3.3 of [RFC3986]), absolute", "path-noscheme" or "path-empty" rule (Section 3.3 of
the conversion fails. [RFC3986]), the conversion fails.
query query
If the CRI reference contains one or more "query" elements, the If the CRI reference contains one or more "query" items, the query
query component of the URI reference consists of the value of each component of the URI reference consists of the value of each item,
element, separated by an ampersand ("&") character. Otherwise, separated by an ampersand ("&") character. Otherwise, the query
the query component is unset. component is unset.
Any character in the value of a "query" element that is not in the Any character in the value of a "query" item that is not in the
set of unreserved characters or "sub-delims" or a colon (":"), set of unreserved characters or "sub-delims" or a colon (":"),
commercial at ("@"), slash ("/") or question mark ("?") character commercial at ("@"), slash ("/") or question mark ("?") character
MUST be percent-encoded. Additionally, any ampersand character MUST be percent-encoded. Additionally, any ampersand character
("&") in the element value MUST be percent-encoded. ("&") in the item value MUST be percent-encoded.
fragment fragment
If the CRI reference contains a fragment element, the fragment If the CRI reference contains a fragment item, the fragment
component of the URI reference consists of the value of that component of the URI reference consists of the value of that item.
element. Otherwise, the fragment component is unset. Otherwise, the fragment component is unset.
Any character in the value of a "fragment" element that is not in Any character in the value of a "fragment" item that is not in the
the set of unreserved characters or "sub-delims" or a colon (":"), set of unreserved characters or "sub-delims" or a colon (":"),
commercial at ("@"), slash ("/") or question mark ("?") character commercial at ("@"), slash ("/") or question mark ("?") character
MUST be percent-encoded. MUST be percent-encoded.
7. Security Considerations 7. Implementation Status
With the exception of the authority=true fix, CRIs are implemented in
"https://gitlab.com/chrysn/micrurus".
8. Security Considerations
Parsers of CRI references must operate on input that is assumed to be Parsers of CRI references must operate on input that is assumed to be
untrusted. This means that parsers MUST fail gracefully in the face untrusted. This means that parsers MUST fail gracefully in the face
of malicious inputs. Additionally, parsers MUST be prepared to deal of malicious inputs. Additionally, parsers MUST be prepared to deal
with resource exhaustion (e.g., resulting from the allocation of big with resource exhaustion (e.g., resulting from the allocation of big
data items) or exhaustion of the call stack (stack overflow). See data items) or exhaustion of the call stack (stack overflow). See
Section 10 of [RFC8949] for additional security considerations Section 10 of [RFC8949] for additional security considerations
relating to CBOR. relating to CBOR.
The security considerations discussed in Section 7 of [RFC3986] and The security considerations discussed in Section 7 of [RFC3986] and
Section 8 of [RFC3987] for URIs and IRIs also apply to CRIs. Section 8 of [RFC3987] for URIs and IRIs also apply to CRIs.
8. IANA Considerations 9. IANA Considerations
This document has no IANA actions. This document has no IANA actions.
9. References 10. References
9.1. Normative References 10.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, DOI 10.17487/RFC3986, January 2005, RFC 3986, DOI 10.17487/RFC3986, January 2005,
<https://www.rfc-editor.org/info/rfc3986>. <https://www.rfc-editor.org/info/rfc3986>.
skipping to change at page 13, line 38 skipping to change at page 15, line 24
[RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object
Representation (CBOR)", STD 94, RFC 8949, Representation (CBOR)", STD 94, RFC 8949,
DOI 10.17487/RFC8949, December 2020, DOI 10.17487/RFC8949, December 2020,
<https://www.rfc-editor.org/info/rfc8949>. <https://www.rfc-editor.org/info/rfc8949>.
[Unicode] The Unicode Consortium, "The Unicode Standard, Version [Unicode] The Unicode Consortium, "The Unicode Standard, Version
13.0.0", ISBN 978-1-936213-26-9, March 2020, 13.0.0", ISBN 978-1-936213-26-9, March 2020,
<https://www.unicode.org/versions/Unicode13.0.0/>. <https://www.unicode.org/versions/Unicode13.0.0/>.
9.2. Informative References 10.2. Informative References
[RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for
Constrained-Node Networks", RFC 7228, Constrained-Node Networks", RFC 7228,
DOI 10.17487/RFC7228, May 2014, DOI 10.17487/RFC7228, May 2014,
<https://www.rfc-editor.org/info/rfc7228>. <https://www.rfc-editor.org/info/rfc7228>.
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
Protocol (HTTP/1.1): Message Syntax and Routing", Protocol (HTTP/1.1): Message Syntax and Routing",
RFC 7230, DOI 10.17487/RFC7230, June 2014, RFC 7230, DOI 10.17487/RFC7230, June 2014,
<https://www.rfc-editor.org/info/rfc7230>. <https://www.rfc-editor.org/info/rfc7230>.
skipping to change at page 14, line 28 skipping to change at page 16, line 11
[RFC8820] Nottingham, M., "URI Design and Ownership", BCP 190, [RFC8820] Nottingham, M., "URI Design and Ownership", BCP 190,
RFC 8820, DOI 10.17487/RFC8820, June 2020, RFC 8820, DOI 10.17487/RFC8820, June 2020,
<https://www.rfc-editor.org/info/rfc8820>. <https://www.rfc-editor.org/info/rfc8820>.
[W3C.REC-html52-20171214] [W3C.REC-html52-20171214]
Faulkner, S., Eicholz, A., Leithead, T., Danilo, A., and Faulkner, S., Eicholz, A., Leithead, T., Danilo, A., and
S. Moon, "HTML 5.2", World Wide Web Consortium S. Moon, "HTML 5.2", World Wide Web Consortium
Recommendation REC-html52-20171214, 14 December 2017, Recommendation REC-html52-20171214, 14 December 2017,
<https://www.w3.org/TR/2017/REC-html52-20171214>. <https://www.w3.org/TR/2017/REC-html52-20171214>.
Appendix A. Change Log Appendix A. CDDL specification
The full CDDL specification is somewhat redundant internally in order
to express trailing null suppression.
; expressing null suppression
CRI-Reference = [
?( ((scheme, (authority / null / true)
// (null, authority))
// discard), ; relative reference
?( (path / null, query / null, fragment) //
(path / null, query) //
path)
)
]
scheme = scheme-name / scheme-id
scheme-name = text .regexp "[a-z][a-z0-9+.-]*"
scheme-id = (COAP / COAPS / HTTP / HTTPS / other-scheme)
.within nint
COAP = -1 COAPS = -2 HTTP = -3 HTTPS = -4
other-scheme = nint .feature "scheme-id-extension"
authority = host / [host, port]
host = host-name / host-ip
host-name = text
host-ip = bytes .size 4 / bytes .size 16
port = 0..65535
discard = true / 0..127
path = [*text]
query = [*text]
fragment = text
Appendix B. Change Log
This section is to be removed before publishing as an RFC. This section is to be removed before publishing as an RFC.
Changes from -04 to -05
* Simplify CBOR structure.
* Add implementation status section.
Changes from -03 to -04: Changes from -03 to -04:
* Minor editorial improvements. * Minor editorial improvements.
* Renamed path.type/path-type to discard. * Renamed path.type/path-type to discard.
* Renamed option to element. * Renamed option to section, substructured into items.
* Simplied Table 1. * Simplied the table "resolution-variables".
* Use the CBOR structure inspired by Jim Schaad's proposals. * Use the CBOR structure inspired by Jim Schaad's proposals.
Changes from -02 to -03: Changes from -02 to -03:
* Expanded the set of supported schemes (#3). * Expanded the set of supported schemes (#3).
* Specified creation, normalization and comparison (#9). * Specified creation, normalization and comparison (#9).
* Clarified the default value of the "discard" option (#33). * Clarified the default value of the "path.type" option (#33).
* Removed the "append-relation" discard option (#41). * Removed the "append-relation" path.type option (#41).
* Renumbered the remaining discards. * Renumbered the remaining path.types.
* Renumbered the option numbers. * Renumbered the option numbers.
* Restructured the document. * Restructured the document.
* Minor editorial improvements. * Minor editorial improvements.
Changes from -01 to -02: Changes from -01 to -02:
* Changed the syntax of schemes to exclude upper case characters * Changed the syntax of schemes to exclude upper case characters
(#13). (#13).
* Minor editorial improvements (#34 #37). * Minor editorial improvements (#34 #37).
Changes from -00 to -01: Changes from -00 to -01:
* None. * None.
Acknowledgements Acknowledgements
CRIs were developed by Klaus Hartke for use in the Constrained
RESTful Application Language (CoRAL). The current author team is
completing this work with a view to achieve good integration with the
potential use cases, both inside and outside of CoRAL.
Thanks to Christian Amsüss, Ari Keränen, Jim Schaad and Dave Thaler Thanks to Christian Amsüss, Ari Keränen, Jim Schaad and Dave Thaler
for helpful comments and discussions that have shaped the document. for helpful comments and discussions that have shaped the document.
Authors' Addresses Contributors
Klaus Hartke Klaus Hartke
Ericsson Ericsson
Torshamnsgatan 23 Torshamnsgatan 23
SE-16483 Stockholm SE-16483 Stockholm
Sweden Sweden
Email: klaus.hartke@ericsson.com Email: klaus.hartke@ericsson.com
Authors' Addresses
Carsten Bormann (editor) Carsten Bormann (editor)
Universitaet Bremen TZI Universität Bremen TZI
Postfach 330440 Postfach 330440
D-28359 Bremen D-28359 Bremen
Germany Germany
Phone: +49-421-218-63921 Phone: +49-421-218-63921
Email: cabo@tzi.org Email: cabo@tzi.org
Henk Birkholz
Fraunhofer SIT
Rheinstrasse 75
64295 Darmstadt
Germany
Email: henk.birkholz@sit.fraunhofer.de
 End of changes. 62 change blocks. 
156 lines changed or deleted 267 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/