| < draft-ietf-httpbis-h2-websockets-01.txt | draft-ietf-httpbis-h2-websockets-02.txt > | |||
|---|---|---|---|---|
| HTTP P. McManus | HTTP P. McManus | |||
| Internet-Draft Mozilla | Internet-Draft Mozilla | |||
| Intended status: Standards Track March 27, 2018 | Updates: 6455 (if approved) May 2, 2018 | |||
| Expires: September 28, 2018 | Intended status: Standards Track | |||
| Expires: November 3, 2018 | ||||
| Bootstrapping WebSockets with HTTP/2 | Bootstrapping WebSockets with HTTP/2 | |||
| draft-ietf-httpbis-h2-websockets-01 | draft-ietf-httpbis-h2-websockets-02 | |||
| Abstract | Abstract | |||
| This document defines a mechanism for running the WebSocket Protocol | This document defines a mechanism for running the WebSocket Protocol | |||
| over a single stream of an HTTP/2 connection. | over a single stream of an HTTP/2 connection. | |||
| Status of This Memo | Status of This Memo | |||
| This Internet-Draft is submitted in full conformance with the | This Internet-Draft is submitted in full conformance with the | |||
| provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
| skipping to change at page 1, line 31 ¶ | skipping to change at page 1, line 32 ¶ | |||
| 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 September 28, 2018. | This Internet-Draft will expire on November 3, 2018. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2018 IETF Trust and the persons identified as the | Copyright (c) 2018 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 | Provisions Relating to IETF Documents | |||
| (https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
| publication of this document. Please review these documents | publication of this document. Please review these documents | |||
| skipping to change at page 2, line 23 ¶ | skipping to change at page 2, line 23 ¶ | |||
| 6. Design Considerations . . . . . . . . . . . . . . . . . . . . 5 | 6. Design Considerations . . . . . . . . . . . . . . . . . . . . 5 | |||
| 7. About Intermediaries . . . . . . . . . . . . . . . . . . . . 6 | 7. About Intermediaries . . . . . . . . . . . . . . . . . . . . 6 | |||
| 8. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | 8. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | |||
| 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 | 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 6 | 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 11. Normative References . . . . . . . . . . . . . . . . . . . . 7 | 11. Normative References . . . . . . . . . . . . . . . . . . . . 7 | |||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 | Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 | |||
| 1. Introduction | 1. Introduction | |||
| The Hypertext Transfer Protocol (HTTP) provides compatible resource | The Hypertext Transfer Protocol (HTTP) provides compatible resource- | |||
| level semantics across different versions but it does not offer | level semantics across different versions but it does not offer | |||
| compatibility at the connection management level. Other protocols, | compatibility at the connection management level. Other protocols, | |||
| such as WebSockets, that rely on connection management details of | such as WebSockets, that rely on connection management details of | |||
| HTTP must be updated for new versions of HTTP. | HTTP must be updated for new versions of HTTP. | |||
| The WebSocket Protocol [RFC6455] uses the HTTP/1.1 [RFC7230] Upgrade | The WebSocket Protocol [RFC6455] uses the HTTP/1.1 [RFC7230] Upgrade | |||
| mechanism to transition a TCP connection from HTTP into a WebSocket | mechanism to transition a TCP connection from HTTP into a WebSocket | |||
| connection. A different approach must be taken with HTTP/2 | connection. A different approach must be taken with HTTP/2 | |||
| [RFC7540]. HTTP/2 does not allow connection wide header and status | [RFC7540]. HTTP/2 does not allow connection-wide headers and status | |||
| codes such as the Upgrade and Connection request headers or the 101 | codes such as the Upgrade and Connection request headers or the 101 | |||
| response code due to its multiplexing nature. These are all required | response code due to its multiplexing nature. These are all required | |||
| by the [RFC6455] opening handshake. | by the [RFC6455] opening handshake. | |||
| Being able to bootstrap WebSockets from HTTP/2 allows one TCP | Being able to bootstrap WebSockets from HTTP/2 allows one TCP | |||
| connection to be shared by both protocols and extends HTTP/2's more | connection to be shared by both protocols and extends HTTP/2's more | |||
| efficient use of the network to WebSockets. | efficient use of the network to WebSockets. | |||
| This document extends the HTTP/2 CONNECT method. The extension | This document extends the HTTP/2 CONNECT method. The extension | |||
| allows the substitution of a new protocol name to connect to rather | allows the substitution of a new protocol name to connect to rather | |||
| skipping to change at page 3, line 7 ¶ | skipping to change at page 3, line 7 ¶ | |||
| (or any other protocol). The other streams on the connection may | (or any other protocol). The other streams on the connection may | |||
| carry more extended CONNECT tunnels, traditional HTTP/2 data, or a | carry more extended CONNECT tunnels, traditional HTTP/2 data, or a | |||
| mixture of both. | mixture of both. | |||
| This tunneled stream will be multiplexed with other regular streams | This tunneled stream will be multiplexed with other regular streams | |||
| on the connection and enjoys the normal priority, cancellation, and | on the connection and enjoys the normal priority, cancellation, and | |||
| flow control features of HTTP/2. | flow control features of HTTP/2. | |||
| Streams that successfully establish a WebSocket connection using a | Streams that successfully establish a WebSocket connection using a | |||
| tunneled stream and the modifications to the opening handshake | tunneled stream and the modifications to the opening handshake | |||
| defined in this document then use the traditional WebSocket Protocol | defined in this document then use the traditional WebSocket Protocol, | |||
| treating the stream as if were the TCP connection in that | treating the stream as if were the TCP connection in that | |||
| specification. | specification. | |||
| 2. Terminology | 2. Terminology | |||
| In this document, the key words "MUST", "MUST NOT", "REQUIRED", | In this document, the key words "MUST", "MUST NOT", "REQUIRED", | |||
| "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", | "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", | |||
| and "OPTIONAL" are to be interpreted as described in BCP 14, | and "OPTIONAL" are to be interpreted as described in BCP 14, | |||
| [RFC2119]. | [RFC2119]. | |||
| 3. The SETTINGS_ENABLE_CONNECT_PROTOCOL SETTINGS Parameter | 3. The SETTINGS_ENABLE_CONNECT_PROTOCOL SETTINGS Parameter | |||
| This document adds a new SETTINGS Parameter to those defined by | This document adds a new SETTINGS Parameter to those defined by | |||
| [RFC7540], Section 6.5.2. | [RFC7540], Section 6.5.2. | |||
| The new parameter name is SETTINGS_ENABLE_CONNECT_PROTOCOL. The | The new parameter name is SETTINGS_ENABLE_CONNECT_PROTOCOL. The | |||
| value of the parameter MUST be 0 or 1. | value of the parameter MUST be 0 or 1. | |||
| Upon receipt of SETTINGS_ENABLE_CONNECT_PROTOCOL with a value of 1 a | Upon receipt of SETTINGS_ENABLE_CONNECT_PROTOCOL with a value of 1, a | |||
| client MAY use the Extended CONNECT definition of this document when | client MAY use the Extended CONNECT definition of this document when | |||
| creating new streams. Receipt of this parameter by a server does not | creating new streams. Receipt of this parameter by a server does not | |||
| have any impact. | have any impact. | |||
| A sender MUST NOT send a SETTINGS_ENABLE_CONNECT_PROTOCOL parameter | A sender MUST NOT send a SETTINGS_ENABLE_CONNECT_PROTOCOL parameter | |||
| with the value of 0 after previously sending a value of 1. | with the value of 0 after previously sending a value of 1. | |||
| The use of a SETTINGS Parameter to opt-in to an otherwise | The use of a SETTINGS Parameter to opt-in to an otherwise | |||
| incompatible protocol change is a use of "Extending HTTP/2" defined | incompatible protocol change is a use of "Extending HTTP/2" defined | |||
| by Section 5.5 of [RFC7540]. If a client were to use the provisions | by Section 5.5 of [RFC7540]. If a client were to use the provisions | |||
| of the extended CONNECT method defined in this document without first | of the extended CONNECT method defined in this document without first | |||
| receiving a SETTINGS_ENABLE_CONNECT_PROTOCOL parameter, a non- | receiving a SETTINGS_ENABLE_CONNECT_PROTOCOL parameter, a non- | |||
| supporting peer would detect a malformed request and generate a | supporting peer would detect a malformed request and generate a | |||
| stream error (Section 8.1.2.6 of [RFC7540]). | stream error (Section 8.1.2.6 of [RFC7540]). | |||
| 4. The Extended CONNECT Method | 4. The Extended CONNECT Method | |||
| The CONNECT Method defined in Section 8.3 of [RFC7540] is modified in | Usage of the CONNECT method in HTTP/2 is defined by Section 8.3 of | |||
| the following ways: | [RFC7540]. This extension modifies the method in the following ways: | |||
| o A new pseudo-header :protocol MAY be included on request HEADERS | o A new pseudo-header :protocol MAY be included on request HEADERS | |||
| indicating the desired protocol to be spoken on the tunnel created | indicating the desired protocol to be spoken on the tunnel created | |||
| by CONNECT. The pseudo-header is single valued and contains a | by CONNECT. The pseudo-header is single valued and contains a | |||
| value from the HTTP Upgrade Token Registry defined by [RFC7230]. | value from the HTTP Upgrade Token Registry defined by [RFC7230]. | |||
| o On requests bearing the :protocol pseudo-header, the :scheme and | o On requests bearing the :protocol pseudo-header, the :scheme and | |||
| :path pseudo-header fields MUST be included. | :path pseudo-header fields MUST be included. | |||
| o On requests bearing the :protocol pseudo-header, the :authority | o On requests bearing the :protocol pseudo-header, the :authority | |||
| skipping to change at page 4, line 22 ¶ | skipping to change at page 4, line 22 ¶ | |||
| indicated by the :authority. | indicated by the :authority. | |||
| Upon receiving a CONNECT request bearing the :protocol pseudo-header | Upon receiving a CONNECT request bearing the :protocol pseudo-header | |||
| the server establishes a tunnel to another service of the protocol | the server establishes a tunnel to another service of the protocol | |||
| type indicated by the pseudo-header. This service may or may not be | type indicated by the pseudo-header. This service may or may not be | |||
| co-located with the server. | co-located with the server. | |||
| 5. Using Extended CONNECT To Bootstrap The WebSocket Protocol | 5. Using Extended CONNECT To Bootstrap The WebSocket Protocol | |||
| The pseudo-header :protocol MUST be included in the CONNECT request | The pseudo-header :protocol MUST be included in the CONNECT request | |||
| and it MUST have a value of websocket to initiate a WebSocket | and it MUST have a value of "websocket" to initiate a WebSocket | |||
| connection on an HTTP/2 stream. Other HTTP request and response | connection on an HTTP/2 stream. Other HTTP request and response | |||
| headers, such as those for manipulating cookies, may be included in | headers, such as those for manipulating cookies, may be included in | |||
| the HEADERS with the CONNECT :method as usual. This request replaces | the HEADERS with the CONNECT method as usual. This request replaces | |||
| the GET based request in [RFC6455] and is used to process the | the GET-based request in [RFC6455] and is used to process the | |||
| WebSockets opening handshake. | WebSockets opening handshake. | |||
| The scheme of the Target URI [RFC7230] MUST be https for wss schemed | The scheme of the Target URI [RFC7230] MUST be "https" for "wss" | |||
| WebSockets and http for ws schemed WebSockets. The websocket URI is | schemed WebSockets and "http" for "ws" schemed WebSockets. The | |||
| still used for proxy autoconfiguration. | websocket URI is still used for proxy autoconfiguration. | |||
| [RFC6455] requires the use of Connection and Upgrade headers that are | [RFC6455] requires the use of Connection and Upgrade headers that are | |||
| not part of HTTP/2. They MUST not be included in the CONNECT request | not part of HTTP/2. They MUST not be included in the CONNECT request | |||
| defined here. | defined here. | |||
| [RFC6455] requires the use of a Host header which is also not part of | [RFC6455] requires the use of a Host header which is also not part of | |||
| HTTP/2. The Host information is conveyed as part of the :authority | HTTP/2. The Host information is conveyed as part of the :authority | |||
| pseudo-header which is required on every HTTP/2 transaction. | pseudo-header which is required on every HTTP/2 transaction. | |||
| Implementations using this extended CONNECT to bootstrap WebSockets | Implementations using this extended CONNECT to bootstrap WebSockets | |||
| do not do the processing of the [RFC6455] Sec-WebSocket-Key and Sec- | do not do the processing of the [RFC6455] Sec-WebSocket-Key and Sec- | |||
| WebSocket-Accept headers as that functionality has been superseded by | WebSocket-Accept headers as that functionality has been superseded by | |||
| the :protocol pseudo-header. | the :protocol pseudo-header. | |||
| The Sec-WebSocket-Version, Origin [RFC6454], Sec-WebSocket-Protocol, | The Sec-WebSocket-Version, Origin [RFC6454], Sec-WebSocket-Protocol, | |||
| and Sec-WebSocket-Extensions headers are used on the CONNECT request | and Sec-WebSocket-Extensions headers are used on the CONNECT request | |||
| and response headers in the same way as defined in [RFC6455]. Note | and response headers in the same way as defined in [RFC6455]. Note | |||
| that HTTP/1 header names were case insensitive and HTTP/2 requires | that HTTP/1 header names were case-insensitive and HTTP/2 requires | |||
| they be encoded as lower case. | they be encoded as lower case. | |||
| After successfully processing the opening handshake the peers should | After successfully processing the opening handshake, the peers should | |||
| proceed with The WebSocket Protocol [RFC6455] using the HTTP/2 stream | proceed with The WebSocket Protocol [RFC6455] using the HTTP/2 stream | |||
| from the CONNECT transaction as if it were the TCP connection | from the CONNECT transaction as if it were the TCP connection | |||
| referred to in [RFC6455]. The state of the WebSocket connection at | referred to in [RFC6455]. The state of the WebSocket connection at | |||
| this point is OPEN as defined by [RFC6455], Section 4.1. | this point is OPEN as defined by [RFC6455], Section 4.1. | |||
| The HTTP/2 stream closure is also analagous to the TCP connection of | ||||
| [RFC6455]. Orderly TCP level closures are represented as END_STREAM | ||||
| ([RFC7540] Section 6.1) flags and RST exceptions are represented with | ||||
| the RST_STREAM ([RFC7540] Section 6.4) frame with the CANCEL | ||||
| ([RFC7540] Secion 7) error code. | ||||
| 5.1. Example | 5.1. Example | |||
| [[ From Client ]] [[ From Server ]] | [[ From Client ]] [[ From Server ]] | |||
| SETTINGS | SETTINGS | |||
| SETTINGS_ENABLE_CONNECT_PROTOCOL = 1 | SETTINGS_ENABLE_CONNECT_PROTOCOL = 1 | |||
| HEADERS + END_HEADERS | HEADERS + END_HEADERS | |||
| :method = CONNECT | :method = CONNECT | |||
| :protocol = websocket | :protocol = websocket | |||
| skipping to change at page 6, line 8 ¶ | skipping to change at page 6, line 10 ¶ | |||
| 6. Design Considerations | 6. Design Considerations | |||
| A more native integration with HTTP/2 is certainly possible with | A more native integration with HTTP/2 is certainly possible with | |||
| larger additions to HTTP/2. This design was selected to minimize the | larger additions to HTTP/2. This design was selected to minimize the | |||
| solution complexity while still addressing the primary concern of | solution complexity while still addressing the primary concern of | |||
| running HTTP/2 and WebSockets concurrently. | running HTTP/2 and WebSockets concurrently. | |||
| 7. About Intermediaries | 7. About Intermediaries | |||
| This document does not change how WebSockets interacts with HTTP | This document does not change how WebSockets interacts with HTTP | |||
| proxies. If a client wishing to speak WebSockets connects via HTTP/2 | forward proxies. If a client wishing to speak WebSockets connects | |||
| to a HTTP proxy it should continue to use a traditional (i.e. not | via HTTP/2 to an HTTP proxy it should continue to use a traditional | |||
| with a :protocol pseudo-header) CONNECT to tunnel through that proxy | (i.e. not with a :protocol pseudo-header) CONNECT to tunnel through | |||
| to the WebSocket server via HTTP. | that proxy to the WebSocket server via HTTP. | |||
| The resulting version of HTTP on that tunnel determines whether | The resulting version of HTTP on that tunnel determines whether | |||
| WebSockets is initiated directly or via a modified CONNECT request | WebSockets is initiated directly or via a modified CONNECT request | |||
| described in this document. | described in this document. | |||
| 8. Security Considerations | 8. Security Considerations | |||
| [RFC6455] ensures that non WebSockets clients, especially | [RFC6455] ensures that non-WebSockets clients, especially | |||
| XMLHttpRequest based clients, cannot make a WebSocket connection. | XMLHttpRequest based clients, cannot make a WebSocket connection. | |||
| Its primary mechanism for doing that is the use of Sec- prefixed | Its primary mechanism for doing that is the use of Sec- prefixed | |||
| request headers that cannot be created by XMLHttpRequest based | request headers that cannot be created by XMLHttpRequest-based | |||
| clients. This specification addresses that concern in two ways: | clients. This specification addresses that concern in two ways: | |||
| o The CONNECT method is prohibited from being used by XMLHttpRequest | o The CONNECT method is prohibited from being used by XMLHttpRequest | |||
| o The use of a pseudo-header is something that is connection | o The use of a pseudo-header is something that is connection | |||
| specific and HTTP/2 does not ever allow to be created outside of | specific and HTTP/2 does not ever allow to be created outside of | |||
| the protocol stack. | the protocol stack. | |||
| 9. IANA Considerations | 9. IANA Considerations | |||
| End of changes. 17 change blocks. | ||||
| 24 lines changed or deleted | 31 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/ | ||||