Skip to content

Commit

Permalink
Add FINAL_DATA
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasc committed Nov 13, 2024
1 parent 57e8093 commit 1f82e24
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions draft-ietf-httpbis-connect-tcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ This specification describes an alternative mechanism for proxying TCP in HTTP.

# Specification

A template-driven TCP transport proxy for HTTP is identified by a URI Template {{!RFC6570}} containing variables named "target_host" and "target_port". This URI Template and its variable values MUST meet all the same requirements as for UDP proxying ({{!RFC9298, Section 2}}), and are subject to the same validation rules. The client MUST substitute the destination host and port number into this template to produce the request URI. The derived URI serves as the destination of a Capsule Protocol connection using the Upgrade Token "connect-tcp" (see registration in {#new-upgrade-token}).
A template-driven TCP transport proxy for HTTP is identified by a URI Template {{!RFC6570}} containing variables named "target_host" and "target_port". This URI Template and its variable values MUST meet all the same requirements as for UDP proxying ({{!RFC9298, Section 2}}), and are subject to the same validation rules. The client MUST substitute the destination host and port number into this template to produce the request URI. The derived URI serves as the destination of a Capsule Protocol connection using the Upgrade Token "connect-tcp" (see registration in {{new-upgrade-token}}).

When using "connect-tcp", TCP payload data is sent in the payload of a new Capsule Type named DATA (see registration in {{data-capsule}}). The ordered concatenation of DATA capsule payloads represents the TCP payload data.
When using "connect-tcp", TCP payload data is sent in the payload of new Capsule Types named DATA and FINAL_DATA (see registrations in {{data-capsule}}). The ordered concatenation of these capsule payloads represents the TCP payload data. A FINAL_DATA capsule indicates that sender has closed this stream, semantically equivalent to TCP FIN. After sending a FINAL_DATA capsule, an endpoint MUST NOT send any more DATA or FINAL_DATA capsules on this data stream. (See {{closing-connections}} for related requirements.)

An intermediary MAY split a DATA capsule into two consecutive capsules or merge two consecutive DATA capsules into one. Future CPUTs may use DATA capsules to represent their main data stream, if applicable.
An intermediary MAY merge and split successive DATA and FINAL_DATA capsules, subject to the following requirements:

* There are no intervening capsules of other types.
* The order of payload content is preserved.
* The final emitted capsule uses the same capsule type (DATA or FINAL_DATA) as the final input capsule, and all others use the DATA capsule type.

In "connect-tcp", Context ID 0 is reserved for DATA, and Context ID 1 is reserved for FINAL_DATA. Future CPUTs may also use DATA and FINAL_DATA capsules to represent their main data stream, if applicable.

## In HTTP/1.1

Expand Down Expand Up @@ -156,8 +162,9 @@ Clients SHOULD assume that all proxy resources generated by a single template sh

In each HTTP version, any requirements related to closing connections in Classic HTTP CONNECT also apply to "connect-tcp", with the following modifications:

* In HTTP/1.1, endpoints SHOULD terminate the connection with an incomplete DATA capsule (as defined in {{Section 3.3 of !RFC9297}}) to indicate receipt of a TCP connection error (e.g., a TCP RST or timeout). When a connection is terminated with any incomplete capsule, or with an error in the underlying connection (e.g. a TLS "internal_error" alert or TCP RST), the endpoint SHOULD send a TCP RST if the underlying TCP implementation permits it.
* In HTTP/2 and HTTP/3, senders MAY use an incomplete DATA capsule to indicate a TCP connection error, instead of (or in addition to) the signals defined for TCP connection errors in Classic HTTP CONNECT. Recipients MUST recognize an incomplete DATA capsule as a TCP connection error.
* If the TCP sender send a TCP FIN indicating clean shutdown, the endpoint in this specification MUST send a FINAL_DATA capsule.
* When a connection is terminated without a FINAL_DATA capsule, the endpoint SHOULD send a TCP RST if the underlying TCP implementation permits it.
* In HTTP/2 and HTTP/3, senders MAY additionally set stream-level error flags as in Classic HTTP CONNECT.

# Additional Connection Setup Behaviors

Expand Down Expand Up @@ -244,11 +251,10 @@ IF APPROVED, IANA is requested to add the following entry to the "MASQUE URI Suf

IF APPROVED, IANA is requested to add the following entry to the "HTTP Capsule Types" registry:

| ----- | ------------ | --------- | ------------------------------------- | ----------------- | ------- |
| Value | Capsule Type | Status | Reference | Change Controller | Contact |
| ----- | ------------ | --------- | ---------------------------------- | ----------------- | ------- |
| Value | Capsule Type | Status | Reference | Change Controller | Contact |
| (TBD) | DATA | permanent | (This document), {{specification}} | IETF | HTTPBIS |

For this draft version of the protocol, the Capsule Type value `0xb739a6d0` shall be used provisionally for testing, under the name "DATA-05".
| (TBD) | FINAL_DATA | permanent | (This document), {{specification}} | IETF | HTTPBIS |

--- back

Expand Down

0 comments on commit 1f82e24

Please sign in to comment.