HTTP D. Damjanovic Internet-Draft Microsoft Intended status: Informational 10 March 2023 Expires: 11 September 2023 Advertising the WebSockets support in the HTTPS resource record draft-damjanovic-websockets-https-rr-01 Abstract This specification introduces a mechanism to advertise the support for WebSockets over different HTTP versions using HTTPS resource records. This mechanism allows clients to avoid delays in establishing WebSocket connections using HTTP-based advertisement for WebSocket support. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on 11 September 2023. Copyright Notice Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. Damjanovic Expires 11 September 2023 [Page 1] Internet-Draft Advertising WebSockets support in HTTPSR March 2023 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Conventions and Definitions . . . . . . . . . . . . . . . . . 2 3. Extending HTTPS DNS resource record . . . . . . . . . . . . . 3 4. The Client Behavior . . . . . . . . . . . . . . . . . . . . . 3 5. Security Considerations . . . . . . . . . . . . . . . . . . . 3 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 4 7. Normative References . . . . . . . . . . . . . . . . . . . . 4 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 5 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction The mechanisms for running the WebSocket Protocol over a single stream of an HTTP/2 and HTTP/3 connection are defined in [RFC8441] and [RFC9220]. For bootstrapping WebSockets from HTTP/2 and HTTP/3 the extended CONNECT is used. The support for the extended CONNECT is advertised using HTTP/2 and HTTP/3 settings (see [RFC9113] and [RFC9114]). A client needs to establish an HTTP/2 or HTTP/3 connection and wait for the setting frames to be exchanged to discover whether it can try to use WebSockets over HTTP/2 or HTTP/3. The request still may be rejected because the settings advertise the support for the extended CONNECT but not explicitly the support for the WebSockets Protocol. The clients may choose to attempt HTTP/2 or HTTP/3 first and fall back to HTTP/1.1 or HTTP/2 if the WebSocket Protocol is not supported. This may add a delay. The other option is to try to use WebSockets over HTTP/2 or HTTP/3 only on connections that are already established and where it is known the extended CONNECT is supported. This approach leads to WebSockets over HTTP/2 or HTTP/3 being used less frequently. This specification adds a way to advertise the support for WebSockets over HTTP versions using HTTPS resource record [HTTPSRR]. The client may choose to try using an HTTP/2 or HTTP/3 connection only if the support for the protocol is advertised. This will eliminate the delay in most cases and increase usage of WebSockets over HTTP/2 and HTTP/3. 2. Conventions and Definitions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. Damjanovic Expires 11 September 2023 [Page 2] Internet-Draft Advertising WebSockets support in HTTPSR March 2023 3. Extending HTTPS DNS resource record This specification introduces the "wss" SvcParamKey (see [HTTPSRR]) that indicates a set of HTTP versions that support the WebSocket Protocol on the particular service endpoint. The HTTP versions are identified using alpn-id specified in [HTTPSRR]. The presentation value SHALL be a comma-separated list of one or more alpn-ids. The wire format values for the "wss" SvcParamKey consists of at least one alpn-id prefixed by its length as a single octet, and these length-value pairs are concatenated to form the SvcParamValue. These pairs MUST exactly fill the SvcParamValue; otherwise, the SvcParamValue is malformed. All alpn-ids listed in the "wss" MUST also be present in the "alpn" key. example.net IN HTTPS 1 . alpn=h2,h3 wss=h2,h3 4. The Client Behavior Upon receiving an HTTPS RR, a client should use the "wss" SvcParamKey as an indication of whether a particular service endpoint supports the WebSocket Protocol over HTTP /2 or HTTP/3. If the key is present, that is a strong indication that the service endpoint supports WebSockets over HTTP/2 or HTTP/3 protocol and the client can attempt using WebSockets over HTTP/2 or HTTP/3 protocol. Due to difficulties of deployments, the client may discover that the feature, although advertised, is not supported and in this case, the client should fall back to using HTTP/1.1. If the "no-default-alpn" key is present, the WebSocket Protocol over HTTP/1.1 is not supported by the endpoint. Otherwise, it might be supported whether the "wss" key is present or not. If the "wss" key is not present, the client should not try using WebSockets over HTTP/2 and HTTP/3, and should directly use HTTP/1.1. 5. Security Considerations This specification only adds a new SvcParamKey that is a hint of whether the WebSockets over HTTP/2 and HTTP/3 are supported. Therefore, it does not introduce additional security considerations beyond one described in [HTTPSRR], [RFC8441] and [RFC9220]. Damjanovic Expires 11 September 2023 [Page 3] Internet-Draft Advertising WebSockets support in HTTPSR March 2023 6. IANA Considerations This specification adds the following entry to the Service Parameter Keys (SvcParamKeys) registry: +========+======+========================+==================+ | Number | Name | Meaning | Format Reference | +========+======+========================+==================+ | XX | wss | Support for WebSockets | (This document) | | | | over HTTP/2 and HTTP/3 | Section 3 | +--------+------+------------------------+------------------+ Table 1 7. Normative References [HTTPSRR] Schwartz, B. M., Bishop, M., and E. Nygren, "Service binding and parameter specification via the DNS (DNS SVCB and HTTPS RRs)", Work in Progress, Internet-Draft, draft- ietf-dnsop-svcb-https-11, 11 October 2022, . [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . [RFC8441] McManus, P., "Bootstrapping WebSockets with HTTP/2", RFC 8441, DOI 10.17487/RFC8441, September 2018, . [RFC9113] Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113, DOI 10.17487/RFC9113, June 2022, . [RFC9114] Bishop, M., Ed., "HTTP/3", RFC 9114, DOI 10.17487/RFC9114, June 2022, . [RFC9220] Hamilton, R., "Bootstrapping WebSockets with HTTP/3", RFC 9220, DOI 10.17487/RFC9220, June 2022, . Damjanovic Expires 11 September 2023 [Page 4] Internet-Draft Advertising WebSockets support in HTTPSR March 2023 Acknowledgments Author's Address Dragana Damjanovic Microsoft Email: dragana.damjano@gmail.com Damjanovic Expires 11 September 2023 [Page 5]