idnits 2.17.1 draft-nottingham-link-hint-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([2], [3], [4], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 27, 2018) is 2222 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '1' on line 509 -- Looks like a reference, but probably isn't: '2' on line 511 -- Looks like a reference, but probably isn't: '3' on line 513 -- Looks like a reference, but probably isn't: '4' on line 515 ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7232 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7233 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111) ** Obsolete normative reference: RFC 7235 (Obsoleted by RFC 9110) Summary: 6 errors (**), 0 flaws (~~), 1 warning (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group M. Nottingham 3 Internet-Draft March 27, 2018 4 Intended status: Informational 5 Expires: September 28, 2018 7 HTTP Link Hints 8 draft-nottingham-link-hint-01 10 Abstract 12 This memo specifies "HTTP Link Hints", a mechanism for annotating Web 13 links to HTTP(S) resources with information that otherwise might be 14 discovered by interacting with them. 16 Note to Readers 18 _RFC EDITOR: please remove this section before publication_ 20 The issues list for this draft can be found at 21 https://github.com/mnot/I-D/labels/link-hint [1]. 23 The most recent (often, unpublished) draft is at 24 https://mnot.github.io/I-D/link-hint/ [2]. 26 Recent changes are listed at https://github.com/mnot/I-D/commits/gh- 27 pages/link-hint [3]. 29 See also the draft's current status in the IETF datatracker, at 30 https://datatracker.ietf.org/doc/draft-nottingham-link-hint/ [4]. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at https://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on September 28, 2018. 49 Copyright Notice 51 Copyright (c) 2018 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (https://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 Table of Contents 66 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 67 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 68 2. HTTP Link Hints . . . . . . . . . . . . . . . . . . . . . . . 4 69 3. Pre-Defined HTTP Link Hints . . . . . . . . . . . . . . . . . 4 70 3.1. allow . . . . . . . . . . . . . . . . . . . . . . . . . . 5 71 3.2. formats . . . . . . . . . . . . . . . . . . . . . . . . . 5 72 3.3. links . . . . . . . . . . . . . . . . . . . . . . . . . . 5 73 3.4. accept-post . . . . . . . . . . . . . . . . . . . . . . . 6 74 3.5. accept-patch . . . . . . . . . . . . . . . . . . . . . . 7 75 3.6. accept-ranges . . . . . . . . . . . . . . . . . . . . . . 7 76 3.7. accept-prefer . . . . . . . . . . . . . . . . . . . . . . 7 77 3.8. precondition-req . . . . . . . . . . . . . . . . . . . . 8 78 3.9. auth-schemes . . . . . . . . . . . . . . . . . . . . . . 8 79 3.10. status . . . . . . . . . . . . . . . . . . . . . . . . . 9 80 4. Security Considerations . . . . . . . . . . . . . . . . . . . 9 81 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 82 5.1. HTTP Link Hint Registry . . . . . . . . . . . . . . . . . 9 83 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 84 6.1. Normative References . . . . . . . . . . . . . . . . . . 10 85 6.2. Informative References . . . . . . . . . . . . . . . . . 11 86 6.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 11 87 Appendix A. Representing Link Hints in Link Headers . . . . . . 12 88 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 13 89 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13 91 1. Introduction 93 HTTP [RFC7230] clients can discover a variety of information about a 94 resource by interacting with it. For example, the methods supported 95 can be learned through the Allow response header field, and the need 96 for authentication is conveyed with a 401 Authentication Required 97 status code. 99 In some situations, it can be beneficial to know this information 100 before interacting with the resource; not only can it save time 101 (through reduced round trips), but it can also affect the choices 102 given to the code or user driving the interaction. 104 For example, a user interface that presents the data from an HTTP- 105 based API might need to know which resources the user has write 106 access to, so that it can present the appropriate interface. 108 This specification defines a vocabulary of "HTTP link hints" that 109 allow such metadata about HTTP resources to be attached to Web links 110 [RFC8288], thereby making it available before the link is followed. 111 It also establishes a registry for future hints. 113 It does not recommend a single way to express link hints; rather, it 114 is expected that this will be done by individual link serialisations 115 (see [RFC8288], Section 3.4.1). However, Appendix A does recommend 116 how to include link hints in the existing Link HTTP header field. 118 Hints are just that - they are not a "contract", and are to only be 119 taken as advisory. The runtime behaviour of the resource always 120 overrides hinted information. 122 For example, a client might receive a hint that the PUT method is 123 allowed on all "widget" resources. This means that generally, the 124 client can PUT to them, but a specific resource might reject a PUT 125 based upon access control or other considerations. 127 More fine-grained information might also be gathered by interacting 128 with the resource (e.g., via a GET), or by another resource 129 "containing" it (such as a "widgets" collection) or describing it 130 (e.g., one linked to it with a "describedby" link relation). 132 1.1. Notational Conventions 134 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 135 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 136 "OPTIONAL" in this document are to be interpreted as described in BCP 137 14 [RFC2119] [RFC8174] when, and only when, they appear in all 138 capitals, as shown here. 140 2. HTTP Link Hints 142 A HTTP link hint is a (key, value) tuple that describes the target 143 resource of a Web link [RFC8288], or the link itself. The value's 144 canonical form is a JSON [RFC8259] data structure specific to that 145 hint. 147 Typically, link hints are serialised in links as target attributes 148 ([RFC8288], Section 3.4.1). 150 In JSON-based formats, this can be achieved by simply serialising 151 link hints as an object; for example: 153 { 154 "_links": { 155 "self": { 156 "href": "/orders/523", 157 "hints": { 158 "allow": ["GET", "POST"], 159 "accept-post": { 160 "application/example+json": 161 {} 162 } 163 } 164 } 165 } 166 } 168 In other link formats, this requires a mapping from the canonical 169 JSON data model. One such mapping is described in Appendix A for the 170 Link HTTP header field. 172 The information in a link hint SHOULD NOT be considered valid for 173 longer than the freshness lifetime ([RFC7234], Section 4.2) of the 174 representation that the link occurred within, and in some cases, it 175 might be valid for a considerably shorter period. 177 Likewise, the information in a link hint is specific to the link it 178 is attached to. This means that if a representation is specific to a 179 particular user, the hints on links in that representation are also 180 specific to that user. 182 3. Pre-Defined HTTP Link Hints 183 3.1. allow 185 o Hint Name: allow 187 o Description: Hints the HTTP methods that can be used to interact 188 with the target resource; equivalent to the Allow HTTP response 189 header. 191 o Content Model: array (of strings) 193 o Specification: [this document] 195 Content MUST be an array of strings, containing HTTP methods. 197 3.2. formats 199 o Hint Name: formats 201 o Description: Hints the representation type(s) that the target 202 resource can produce and consume, using the GET and PUT (if 203 allowed) methods respectively. 205 o Content Model: object 207 o Specification: [this document] 209 Content MUST be an object, whose keys are media types, and values are 210 objects. 212 The object MAY have a "links" member, whose value is an object 213 representing links (in the sense of [RFC8288]) whose context is any 214 document that uses that format. Generally, this will be schema or 215 profile ([RFC6906]) information. The "links" member has the same 216 format as the "links" hint. 218 Furthermore, the object MAY have a "deprecated" member, whose value 219 is either true or false, indicating whether support for the format 220 might be removed in the near future. 222 All other members of the object are under control of the 223 corresponding media type's definition. 225 3.3. links 227 o Hint Name: links 229 o Description: Hints at links whose context is the target resource. 231 o Content Model: object 233 o Specification: [this document] 235 The "links" hint contains links (in the sense of [RFC8288]) whose 236 context is the hinted target resource, which are stable for the 237 lifetime of the hint. 239 Content MUST be an object, whose member names are link relations 240 ([RFC8288]) and values are objects that MUST have an "href" member 241 whose value is a URI-reference ([RFC3986], using the original link as 242 the base for resolution) for the link hint's target resource, and MAY 243 itself contain link hints, serialised as the value for a "hints" 244 member. 246 For example: 248 "links": { 249 "edit-form": { 250 "href": "./edit", 251 "hints": { 252 formats: { 253 "application/json": {} 254 } 255 } 256 } 257 } 259 3.4. accept-post 261 o Hint Name: accept-post 263 o Description: Hints the POST request format(s) that the target 264 resource can consume. 266 o Content Model: object 268 o Specification: [this document] 270 Content MUST be an object, with the same constraints as for 271 "formats". 273 When this hint is present, "POST" SHOULD be listed in the "allow" 274 hint. 276 3.5. accept-patch 278 o Hint Name: accept-patch 280 o Description: Hints the PATCH [RFC5789] request format(s) that the 281 target resource can consume; equivalent to the Accept-Patch HTTP 282 response header. 284 o Content Model: array (of strings) 286 o Specification: [this document] 288 Content MUST be an array of strings, containing media types. Note 289 that there is no opportunity to communicate format-specific hints for 290 PATCH formats. 292 When this hint is present, "PATCH" SHOULD be listed in the "allow" 293 hint. 295 3.6. accept-ranges 297 o Hint Name: accept-ranges 299 o Description: Hints the range-specifier(s) available for the target 300 resource; equivalent to the Accept-Ranges HTTP response header 301 [RFC7233]. 303 o Content Model: array (of strings) 305 o Specification: [this document] 307 Content MUST be an array of strings, containing HTTP range- 308 specifiers. 310 3.7. accept-prefer 312 o Hint Name: accept-prefer 314 o Description: Hints the preference(s) [RFC7240] that the target 315 resource understands (and might act upon) in requests. 317 o Content Model: array (of strings) 319 o Specification: [this document] 321 Content MUST be an array of strings, contain preferences. Note that, 322 by its nature, a preference can be ignored by the server. 324 3.8. precondition-req 326 o Hint Name: precondition-req 328 o Description: Hints that the target resource requires state- 329 changing requests (e.g., PUT, PATCH) to include a precondition, as 330 per [RFC7232], to avoid conflicts due to concurrent updates. 332 o Content Model: array (of strings) 334 o Specification: [this document] 336 Content MUST be an array of strings, with possible values "etag" and 337 "last-modified" indicating type of precondition expected. 339 See also the 428 Precondition Required status code ([RFC6585]). 341 3.9. auth-schemes 343 o Hint Name: auth-schemes 345 o Description: Hints that the target resource requires 346 authentication using the HTTP Authentication Framework [RFC7235]. 348 o Content Model: array (of objects) 350 o Specification: [this document] 352 Content MUST be an array of objects, each with a "scheme" member 353 containing a string that corresponds to a HTTP authentication scheme, 354 and optionally a "realms" member containing an array of zero to many 355 strings that identify protection spaces that the resource is a member 356 of. 358 For example: 360 { 361 "auth-req": [ 362 { 363 "scheme": "Basic", 364 "realms": ["private"] 365 } 366 ] 367 } 369 3.10. status 371 o Hint Name: status 373 o Description: Hints the status of the target resource. 375 o Content Model: string 377 o Specification: [this document] 379 Content MUST be a string; possible values are: 381 o "deprecated" - indicates that use of the resource is not 382 recommended, but it is still available. 384 o "gone" - indicates that the resource is no longer available; i.e., 385 it will return a 410 Gone HTTP status code if accessed. 387 4. Security Considerations 389 Clients need to exercise care when using hints. For example, a naive 390 client might send credentials to a server that uses the auth-req 391 hint, without checking to see if those credentials are appropriate 392 for that server. 394 5. IANA Considerations 396 5.1. HTTP Link Hint Registry 398 This specification defines the HTTP Link Hint Registry. See 399 Section 2 for a general description of the function of link hints. 401 Link hints are generic; that is, they are potentially applicable to 402 any HTTP resource, not specific to one application of HTTP, nor to 403 one particular format. Generally, they ought to be information that 404 would otherwise be discoverable by interacting with the resource. 406 Hint names MUST be composed of the lowercase letters (a-z), digits 407 (0-9), underscores ("_") and hyphens ("-"), and MUST begin with a 408 lowercase letter. 410 Hint content MUST be described in terms of JSON values ([RFC8259], 411 Section 3). 413 Hint semantics SHOULD be described in terms of the framework defined 414 in [RFC8288]. 416 New hints are registered using the Expert Review process described in 417 [RFC8126] to enforce the criteria above. Requests for registration 418 of new resource hints are to use the following template: 420 o Hint Name: [hint name] 422 o Description: [a short description of the hint's semantics] 424 o Content Model: [valid JSON value types; see RFC627 Section 2.1] 426 o Specification: [reference to specification document] 428 Initial registrations are enumerated in Section 3. The "rel", "rev", 429 "hreflang", "media", "title", and "type" hint names are reserved, so 430 as to avoid potential clashes with link serialisations. 432 6. References 434 6.1. Normative References 436 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 437 Requirement Levels", BCP 14, RFC 2119, 438 DOI 10.17487/RFC2119, March 1997, 439 . 441 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 442 Resource Identifier (URI): Generic Syntax", STD 66, 443 RFC 3986, DOI 10.17487/RFC3986, January 2005, 444 . 446 [RFC5789] Dusseault, L. and J. Snell, "PATCH Method for HTTP", 447 RFC 5789, DOI 10.17487/RFC5789, March 2010, 448 . 450 [RFC6585] Nottingham, M. and R. Fielding, "Additional HTTP Status 451 Codes", RFC 6585, DOI 10.17487/RFC6585, April 2012, 452 . 454 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 455 Protocol (HTTP/1.1): Message Syntax and Routing", 456 RFC 7230, DOI 10.17487/RFC7230, June 2014, 457 . 459 [RFC7232] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 460 Protocol (HTTP/1.1): Conditional Requests", RFC 7232, 461 DOI 10.17487/RFC7232, June 2014, 462 . 464 [RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 465 "Hypertext Transfer Protocol (HTTP/1.1): Range Requests", 466 RFC 7233, DOI 10.17487/RFC7233, June 2014, 467 . 469 [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, 470 Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", 471 RFC 7234, DOI 10.17487/RFC7234, June 2014, 472 . 474 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 475 Protocol (HTTP/1.1): Authentication", RFC 7235, 476 DOI 10.17487/RFC7235, June 2014, 477 . 479 [RFC7240] Snell, J., "Prefer Header for HTTP", RFC 7240, 480 DOI 10.17487/RFC7240, June 2014, 481 . 483 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 484 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 485 May 2017, . 487 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 488 Interchange Format", STD 90, RFC 8259, 489 DOI 10.17487/RFC8259, December 2017, 490 . 492 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 493 DOI 10.17487/RFC8288, October 2017, 494 . 496 6.2. Informative References 498 [RFC6906] Wilde, E., "The 'profile' Link Relation Type", RFC 6906, 499 DOI 10.17487/RFC6906, March 2013, 500 . 502 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 503 Writing an IANA Considerations Section in RFCs", BCP 26, 504 RFC 8126, DOI 10.17487/RFC8126, June 2017, 505 . 507 6.3. URIs 509 [1] https://github.com/mnot/I-D/labels/link-hint 511 [2] https://mnot.github.io/I-D/link-hint/ 513 [3] https://github.com/mnot/I-D/commits/gh-pages/link-hint 515 [4] https://datatracker.ietf.org/doc/draft-nottingham-link-hint/ 517 Appendix A. Representing Link Hints in Link Headers 519 A link hint can be represented in a Link header ([RFC8288], 520 Section 3) as a link-extension. 522 When doing so, the JSON of the hint's content SHOULD be normalised to 523 reduce extraneous spaces (%x20), and MUST NOT contain horizontal tabs 524 (%x09), line feeds (%x0A) or carriage returns (%x0D). When they are 525 part of a string value, these characters MUST be escaped as described 526 in [RFC8259] Section 7; otherwise, they MUST be discarded. 528 Furthermore, if the content is an array or an object, the surrounding 529 delimiters MUST be removed before serialisation. In other words, the 530 outermost object or array is represented without the braces ("{}") or 531 brackets ("[]") respectively, but this does not apply to inner 532 objects or arrays. 534 For example, the two JSON values below are those of the fictitious 535 "example" and "example1" hints, respectively: 537 "The Example Value" 538 1.2 540 In a Link header, they would be serialised as: 542 Link: ; rel="sample"; example="The Example Value"; 543 example1=1.2 545 A more complex, single value for "example": 547 [ 548 "foo", 549 -1.23, 550 true, 551 ["charlie", "bennet"], 552 {"cat": "thor"}, 553 false 554 ] 556 would be serialised as: 558 Link: ; rel="sample"; example="\"foo\", -1.23, true, 559 [\"charlie\", \"bennet\"], {"cat": \"thor\"}, false" 561 Appendix B. Acknowledgements 563 Thanks to Jan Algermissen, Mike Amundsen, Bill Burke, Graham Klyne, 564 Leif Hedstrom, Jeni Tennison, Erik Wilde and Jorge Williams for their 565 suggestions and feedback. 567 Author's Address 569 Mark Nottingham 571 Email: mnot@mnot.net 572 URI: http://www.mnot.net/