idnits 2.17.1 draft-benfield-http2-p2p-02.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 document seems to lack a Security Considerations section. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 09, 2015) is 3121 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Hypertext Transfer Protocol Working Group C. Benfield 3 Internet-Draft October 09, 2015 4 Intended status: Standards Track 5 Expires: April 11, 2016 7 Peer-to-peer Extension to HTTP/2 8 draft-benfield-http2-p2p-02 10 Abstract 12 This document introduces a negotiated extension to HTTP/2 that turns 13 a single HTTP/2 connection into a bi-directional communication 14 channel. 16 Status of This Memo 18 This Internet-Draft is submitted in full conformance with the 19 provisions of BCP 78 and BCP 79. 21 Internet-Drafts are working documents of the Internet Engineering 22 Task Force (IETF). Note that other groups may also distribute 23 working documents as Internet-Drafts. The list of current Internet- 24 Drafts is at http://datatracker.ietf.org/drafts/current/. 26 Internet-Drafts are draft documents valid for a maximum of six months 27 and may be updated, replaced, or obsoleted by other documents at any 28 time. It is inappropriate to use Internet-Drafts as reference 29 material or to cite them other than as "work in progress." 31 This Internet-Draft will expire on April 11, 2016. 33 Copyright Notice 35 Copyright (c) 2015 IETF Trust and the persons identified as the 36 document authors. All rights reserved. 38 This document is subject to BCP 78 and the IETF Trust's Legal 39 Provisions Relating to IETF Documents 40 (http://trustee.ietf.org/license-info) in effect on the date of 41 publication of this document. Please review these documents 42 carefully, as they describe your rights and restrictions with respect 43 to this document. Code Components extracted from this document must 44 include Simplified BSD License text as described in Section 4.e of 45 the Trust Legal Provisions and are provided without warranty as 46 described in the Simplified BSD License. 48 Table of Contents 50 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 51 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 52 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 53 2. Additions to HTTP/2 . . . . . . . . . . . . . . . . . . . . . 3 54 2.1. SETTINGS_PEER_TO_PEER Setting . . . . . . . . . . . . . . 3 55 2.2. CLIENT_AUTHORITY Frame . . . . . . . . . . . . . . . . . 4 56 2.2.1. Payload . . . . . . . . . . . . . . . . . . . . . . . 4 57 2.2.2. Semantics . . . . . . . . . . . . . . . . . . . . . . 4 58 2.3. HTTP Changes . . . . . . . . . . . . . . . . . . . . . . 5 59 2.3.1. Client and Server . . . . . . . . . . . . . . . . . . 5 60 2.3.2. Stream IDs . . . . . . . . . . . . . . . . . . . . . 5 61 2.4. Dialer Behavioral Changes . . . . . . . . . . . . . . . . 5 62 2.5. Listener Behavioral Changes . . . . . . . . . . . . . . . 6 63 2.6. PUSH_PROMISE . . . . . . . . . . . . . . . . . . . . . . 6 64 2.7. Other Extensions . . . . . . . . . . . . . . . . . . . . 6 65 3. Authority Validation . . . . . . . . . . . . . . . . . . . . 6 66 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 67 4.1. HTTP/2 Frame Type Registry Update . . . . . . . . . . . . 7 68 4.2. HTTP/2 Settings Registry Update . . . . . . . . . . . . . 7 69 5. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 7 70 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 8 71 6.1. Normative References . . . . . . . . . . . . . . . . . . 8 72 6.2. Informative References . . . . . . . . . . . . . . . . . 8 73 Appendix A. Changelog . . . . . . . . . . . . . . . . . . . . . 8 74 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 9 76 1. Introduction 78 The HTTP/2 [RFC7540] specification provides an alternative framing 79 layer for the semantics of HTTP/1.1 [RFC7231]. This framing layer in 80 principle allows for both parties in a HTTP/2 session to send 81 requests and responses. However, the HTTP/2 specification also 82 requires that the semantics of HTTP/1.1 be preserved. This means 83 that one party of the conversation is considered the client, and one 84 the server. Only the client may send requests, and only the server 85 may send responses. 87 This document introduces an extension that can be advertised by a 88 HTTP/2 client. This extension allows both the client and the server 89 to send requests and responses. Essentially, this extension changes 90 the protocol such that the notion of 'client' and 'server' are 91 defined on a per-stream basis, rather than a per-connection basis. 93 The principle of this extension is similar to the Reverse HTTP 94 [I-D.lentczner-rhttp] proposal made in 2009. HTTP/2's framing makes 95 this a substantially more flexible extension than Reverse HTTP by 96 allowing the client and server to vary on a per-stream basis, rather 97 than affecting the whole connection. 99 1.1. Notational Conventions 101 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 102 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 103 document are to be interpreted as described in RFC 2119 [RFC2119]. 105 1.2. Terminology 107 The nature of this specification is that which peer is a 'client' and 108 which is a 'server' changes from stream-to-stream. Therefore, the 109 terms 'listener' and 'dialer' are introduced to unambiguously refer 110 to peers. 112 The 'dialer', or dialing peer, is the peer that initiated the HTTP/2 113 connection. In a standard, non-peer-to-peer HTTP/2 transaction, the 114 'dialer' and the 'client' are the same. 116 The 'listener', or listening peer, is the peer that accepted the 117 HTTP/2 connection. In a standard, non-peer-to-peer HTTP/2 118 transaction, the 'listener' and the 'server' are the same. 120 'Client' and 'server' are defined on a per-stream basis, following 121 the rules in Section 2.3.1. 123 2. Additions to HTTP/2 125 This document introduces a new HTTP/2 setting ([RFC7540], 126 Section 11.3) and a new HTTP/2 frame type ([RFC7540], Section 11.2), 127 to allow for a HTTP/2 dialer to advertise its support for receiving 128 server-initiated streams, and to allow a listener to advertise its 129 support for receiving client-initiated pushed streams. 131 2.1. SETTINGS_PEER_TO_PEER Setting 133 The following new SETTINGS parameters ([RFC7540], Section 6.5.2) are 134 defined: 136 o SETTINGS_PEER_TO_PEER (0xTBA): Informs the remote endpoint of 137 whether the sender supports the peer-to-peer extension to HTTP/2. 138 A value of 1 indicates that the peer-to-peer extension is 139 supported. Any other value, or the absence of this setting, 140 indicates that the peer-to-peer extension is not supported. 142 This setting MUST NOT be emitted by the listener on the HTTP/2 143 connection. If the dialer receives this setting from the listener 144 it MUST respond with a connection error ([RFC7540] Section 5.4.1) 145 of type PROTOCOL_ERROR. 147 2.2. CLIENT_AUTHORITY Frame 149 This document introduces the CLIENT_AUTHORITY frame. This frame MUST 150 be emitted by a dialer after it sends a value of 151 SETTINGS_PEER_TO_PEER of 1, and MUST NOT be emitted by a dialer any 152 time after. The purpose of this frame is to allow a dialer to 153 advertise the authority or authorities for which it is prepared to 154 accept requests. 156 This frame always applies to a whole connection. Therefore, the 157 stream identifier for CLIENT_AUTHORITY frames MUST be 0. If a 158 listener receives a CLIENT_AUTHORITY frame whose stream identifier 159 field is anything other than 0, it MUST respond with a connection 160 error ([RFC7540] Section 5.4.1) of type PROTOCOL_ERROR. 162 2.2.1. Payload 164 Each CLIENT_AUTHORITY frame is made up of one or more of the 165 following authority segments: 167 +----------------------+ 168 | Authority Length (8) | 169 +----------------------+----------------------------------+ 170 | Authority (*) | 171 +---------------------------------------------------------+ 173 Figure 1: Client Authority Frame Payload 175 Each segment begins with a one-byte field indicating the length of 176 the authority string the client is asserting. That field is then 177 followed by a single authority field. The authority MUST be sent in 178 whatever character encoding is going to be expected by the dialer on 179 receipt of the :authority pseudo-header field. 181 2.2.2. Semantics 183 Generally speaking, a listener or coalescing intermediary has no in- 184 band method of validating that a dialer's authority claims are valid. 185 Therefore, a conforming listener MUST confirm a dialer's authority 186 claims using some out-of-band method: see Section 3 for more. 188 A dialer MUST NOT send a CLIENT_AUTHORITY frame after the first one. 189 The CLIENT_AUTHORITY frame is considered to be a complete list of 190 authorities: therefore, a dialer MUST start a new connection if it 191 would like to change the list of authorities it claims. 193 2.3. HTTP Changes 195 From the perspective of other HTTP RFCs, such as RFC 7231 [RFC7231] 196 and RFC 7540 [RFC7540], this extension changes whether a peer is 197 considered a 'client' or a 'server' on a per-stream basis, instead of 198 a per-connection basis, based on which peer opened the stream and how 199 they did so. 201 The rest of the requirements of RFC 7231 [RFC7231] are preserved. 203 2.3.1. Client and Server 205 For the purpose of the rest of this document, 'client' and 'server' 206 are defined on a per-stream basis. For a stream that is opened by 207 means of a HEADERS frame, the peer that sent the initial headers 208 frame is 'client' and the other peer is 'server'. For a stream that 209 is opened by means of a PUSH_PROMISE frame, the peer that sent the 210 PUSH_PROMISE frame is 'server' and the other peer is 'client'. 212 2.3.2. Stream IDs 214 RFC 7540 [RFC7540] Section 5.1.1 applies restrictions on what stream 215 IDs MUST be used by a given peer. 217 This document amends that section to state that streams initiated by 218 a dialer MUST use odd-numbered stream identifiers, and streams 219 initiated by a listener MUST use even-numbered stream identifiers. 220 This ensures that there will be no conflict when both peers are 221 actively creating streams. 223 The other limitations of RFC 7540 [RFC7540] Section 5.1.1 continue to 224 apply. 226 2.4. Dialer Behavioral Changes 228 When a dialer emits the SETTINGS_PEER_TO_PEER setting with a value of 229 1, it is informing the listener that it is willing to accept HTTP 230 requests from the server, allowing the listener to open streams with 231 HEADERS frames. This lifts some of the restrictions of RFC 7540 232 [RFC7540] Section 8. 234 If a dialer has sent the SETTINGS_PEER_TO_PEER setting with a value 235 of 1, the dialer MUST NOT reject an attempt by the listener to change 236 the value of SETTINGS_ENABLE_PUSH to 1. 238 If the dialer, subsequent to sending SETTINGS_PEER_TO_PEER with value 239 1, receives from the listener a value of SETTINGS_ENABLE_PUSH of 1, 240 it MAY open streams by sending PUSH_PROMISE frames. 242 2.5. Listener Behavioral Changes 244 When a listener receives the SETTINGS_PEER_TO_PEER setting from the 245 dialer with a value of 1, it MAY at any point afterwards issue a non- 246 zero value for SETTINGS_ENABLE_PUSH. This allows dialers to open 247 streams with PUSH_PROMISE, subject to some limitations (see 248 Section 2.6), and also lifts some of the restrictions of RFC 7540 249 [RFC7540] Section 8: specifically those sections that only allow 250 listeners to send PUSH_PROMISE frames, and only allow dialers to 251 receive them. 253 A HTTP/2 listener, before receiving SETTINGS_PEER_TO_PEER, must have 254 SETTINGS_ENABLE_PUSH equal to 0, as per [RFC7540] Section 8.2. 255 However, once a listener has received SETTINGS_PEER_TO_PEER, it MAY 256 set SETTINGS_ENABLE_PUSH equal to 1. If it does not, it is assumed 257 that SETTINGS_ENABLE_PUSH remains at 0, and the listener is unwilling 258 to accept pushed streams. 260 2.6. PUSH_PROMISE 262 Whichever peer is client on a given stream MUST NOT send PUSH_PROMISE 263 frames on that stream. All other limitations about PUSH_PROMISE 264 frames in RFC 7540 [RFC7540] continue to apply. 266 If a peer attempts to send a PUSH_PROMISE frame on a stream in which 267 it is the client, the peer that is server for that stream MUST treat 268 this event as a connection error ([RFC7540] Section 5.4.1) of type 269 PROTOCOL_ERROR. 271 2.7. Other Extensions 273 When this extension is deployed with other extensions to HTTP/2, the 274 behaviour of this extension does not change. All other extensions 275 that refer to 'client' or 'server' SHOULD be treated as though those 276 terms apply on a per-stream basis. 278 If other extensions apply 'server' or 'client' to the whole 279 connection (e.g. for settings in SETTINGS frames, which are sent on 280 stream 0), then both peers SHOULD be considered clients and both 281 peers should be considered servers. 283 3. Authority Validation 285 Generally speaking, a listener or coalescing intermediary has no in- 286 band method of validating that a dialer's authority claims are valid. 287 Therefore, a conforming listener MUST confirm a dialer's authority 288 claims using some out-of-band method. 290 This specification does not lay out in detail any proposed mechanism 291 for doing this validation, as the best approach may vary from 292 deployment to deployment. However, some options include: 294 o validating authorities against a TLS certificate presented by the 295 dialer during TLS handshake. 297 o confirming that a reverse DNS lookup for the dialer IP returns the 298 authority asserted by the dialer. 300 o a static list of IP addresses trusted for a given authority. 302 The only requirement is that a listener MUST implement some form of 303 validation, and then MUST treat any attempt by a dialer to assert an 304 authority that it cannot validate as a connection error ([RFC7540] 305 Section 5.4.1) of type PROTOCOL_ERROR. 307 4. IANA Considerations 309 4.1. HTTP/2 Frame Type Registry Update 311 This document updates the HTTP/2 Frame Type registry ([RFC7540], 312 Section 11.2). The entries in the following table are registered by 313 this document. 315 +------------------+------+-------------+ 316 | Name | Code | Section | 317 +------------------+------+-------------+ 318 | CLIENT_AUTHORITY | TBD | Section 2.2 | 319 +------------------+------+-------------+ 321 4.2. HTTP/2 Settings Registry Update 323 This document updates the registry for HTTP/2 Settings ([RFC7540], 324 Section 11.4). The entries in the following table are registered by 325 this document. 327 +--------------+------+---------------+-------------+ 328 | Name | Code | Initial Value | Section | 329 +--------------+------+---------------+-------------+ 330 | PEER_TO_PEER | TBD | 0 | Section 2.1 | 331 +--------------+------+---------------+-------------+ 333 5. Acknowledgements 335 Thanks to David Dias, Juan Benet, and Fedor Indutny for the original 336 idea, and Amos Jeffries, Mike Bishop, and Ilari Liusvaara for their 337 follow-up. 339 Thanks also to Tyrel Souza, Donald Stufft, and Paul Kehrer for 340 proofreading. 342 Thanks to David Reid for pointing out the Reverse HTTP proposal 343 [I-D.lentczner-rhttp]. 345 Thanks to Amos Jeffries for proposing an advertised extension, rather 346 than a negotiated one. 348 6. References 350 6.1. Normative References 352 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 353 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 354 RFC2119, March 1997, 355 . 357 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 358 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 359 10.17487/RFC7231, June 2014, 360 . 362 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 363 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, DOI 364 10.17487/RFC7540, May 2015, 365 . 367 6.2. Informative References 369 [I-D.lentczner-rhttp] 370 Lentczner, M. and D. Preston, "Reverse HTTP", draft- 371 lentczner-rhttp-00 (work in progress), March 2009. 373 Appendix A. Changelog 375 (This appendix to be deleted by the RFC Editor.) 377 Since -01: 379 o Introduce the terms 'dialer' and 'listener'. 381 o Clarify the terms 'client' and 'server'. 383 o Clarify what stream IDs are used by which peer. 385 o Remove the ability to send multiple CLIENT_AUTHORITY frames. 387 o Correctly credit David Dias and Juan Benet for their role. 389 Since -00: 391 o Clarified the semantics behind multiple CLIENT_AUTHORITY frames. 393 o Removed the requirement for servers to issue 394 SETTINGS_PEER_TO_PEER, instead allowing the extension to be purely 395 client-advertised. 397 Author's Address 399 Cory Benfield 401 Email: cory@lukasa.co.uk