idnits 2.17.1 draft-thomson-hybi-http-timeout-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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document date (July 14, 2012) is 4304 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) == Unused Reference: 'RFC2068' is defined on line 408, but no explicit reference was found in the text == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p1-messaging-19 ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) -- Obsolete informational reference (is this intentional?): RFC 2068 (Obsoleted by RFC 2616) Summary: 1 error (**), 0 flaws (~~), 4 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HYBI M. Thomson 3 Internet-Draft Microsoft 4 Intended status: Standards Track S. Loreto 5 Expires: January 15, 2013 Ericsson 6 G. Wilkins 7 Intalio 8 July 14, 2012 10 Hypertext Transfer Protocol (HTTP) Keep-Alive Header 11 draft-thomson-hybi-http-timeout-02 13 Abstract 15 A Keep-Alive header is defined for HTTP. This hop-by-hop header 16 informs hosts about connection management policies. Parameters are 17 defined for idle connection timeout and maximum request count. 19 Status of this Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on January 15, 2013. 36 Copyright Notice 38 Copyright (c) 2012 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 54 1.1. Idle Connection Timeouts and Connection Reuse . . . . . . 3 55 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 56 2. Keep-Alive Header . . . . . . . . . . . . . . . . . . . . . . 4 57 2.1. 'timeout' Parameter . . . . . . . . . . . . . . . . . . . 4 58 2.2. Other Header Parameters . . . . . . . . . . . . . . . . . 5 59 2.2.1. 'max' Parameter . . . . . . . . . . . . . . . . . . . 5 60 3. Existing Intermediaries . . . . . . . . . . . . . . . . . . . 5 61 4. Upgraded HTTP Connections . . . . . . . . . . . . . . . . . . 6 62 5. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 63 6. Security Considerations . . . . . . . . . . . . . . . . . . . 7 64 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 65 7.1. Registration for Keep-Alive Header . . . . . . . . . . . . 8 66 7.2. Registry for Keep-Alive Information . . . . . . . . . . . 8 67 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 8 68 9. Change Log . . . . . . . . . . . . . . . . . . . . . . . . . . 9 69 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 9 70 10.1. Normative References . . . . . . . . . . . . . . . . . . . 9 71 10.2. Informative References . . . . . . . . . . . . . . . . . . 10 72 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 10 74 1. Introduction 76 This document describes the "Keep-Alive" header. The "Keep-Alive" 77 header provides Hypertext Transfer Protocol (HTTP) 78 [I-D.ietf-httpbis-p1-messaging] clients, servers and intermediaries 79 with information about the connection use policies of their peers. 81 The "timeout" header parameter indicates the time that a connection 82 will be allowed to remain idle before it is closed. 84 The "max" header parameter indicates the maximum number of requests 85 that will be permitted before the connection is closed. 87 Some HTTP implementations already provide an implementation for this 88 header. Not all of those implementations are interoperable due to 89 significant differences in the header format. This draft defines a 90 single format for the header and ascribes specific semantics to the 91 header parameters. 93 1.1. Idle Connection Timeouts and Connection Reuse 95 Management of idle HTTP connections has an impact on long-lived 96 communications between hosts. Hosts are able to close idle 97 connections in order to reduce resource consumption. 99 Many clients choose not to send non-idempotent requests on idle 100 connections. If the intermediary or server holding the other end of 101 the connection chooses to close the connection while a non-idempotent 102 request is in transit, the client has no way to tell if the request 103 has succeeded. For this reason, many clients establish a new 104 connection for every non-idempotent request. This is inefficient if 105 the existing connection is a usable connection: establishing a new 106 connection adds significantly to the latency of the request. 108 Connection resources can be more efficiently used when an idle 109 connection timeout is known. A client that only periodically sends 110 request can learn about the possibility of a connection timeout and 111 can act to create a new connection for requests or send requests that 112 keep the connection from timing out. Alternatively, a client that 113 knows that more requests on a connection are unlikely within the 114 discovered timeout interval can close the connection immediately 115 after a poll, releasing resources. 117 1.2. Terminology 119 In this document, the key words "MUST", "MUST NOT", "REQUIRED", 120 "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT 121 RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as 122 described in BCP 14, RFC 2119 [RFC2119] and indicate requirement 123 levels for compliant implementations. 125 2. Keep-Alive Header 127 The "Keep-Alive" header is a hop-by-hop header that provides 128 information about a persistent connection. Both client and server 129 are able to provide information independently. 131 Keep-Alive = "Keep-Alive" ":" 1#keep-alive-info 132 keep-alive-info = "timeout" "=" delta-seconds 133 / keep-alive-extension 134 keep-alive-extension = token [ "=" ( token / quoted-string ) ] 136 This header is sent by either host participating in a persistent 137 connection. The values might be set based on policy implemented by 138 servers, clients and intermediaries. Values might also be set based 139 on knowledge that a host has about lower layer intermediaries in the 140 path of the request, such as a TCP middlebox. Such middleboxes, in 141 particular network address translators (NATs), frequently discard 142 mappings for idle connections, causing the connection to fail after a 143 certain duration of inactivity. 145 The value of Keep-Alive parameters can change on each request or 146 response sent on a connection. Absence of the header or any 147 parameter implies that any previously provided value still applies. 149 As a hop-by-hop header, this header only applies to a single 150 transport-level connection. If a Keep-Alive header is added to a 151 request or response, the Connection header MUST include the tag 152 "Keep-Alive". This ensures that compliant intermediaries that do not 153 recognize this header remove it before forwarding a request. 155 2.1. 'timeout' Parameter 157 A host sets the value of the "timeout" parameter to the time that the 158 host will allow an idle connection to remain open before it is 159 closed. A connection is idle if no data is sent or received by a 160 host. 162 The value of the "timeout" parameter is a single integer in seconds. 164 A host MAY keep an idle connection open for longer than the time that 165 it indicates, but it SHOULD attempt to retain a connection for at 166 least as long as indicated. 168 Each peer, client or server, has a different view of the time that a 169 connection becomes idle. Packet transmission at one peer necessarily 170 occurs before receipt, meaning that the sending peer perceives the 171 connection as being idle earlier to the receiving peer. Similarly, 172 the buffering or retransmission of data by lower layers of the stack, 173 which is unlikely to be visible to the HTTP implementation, compounds 174 this effect. Clients are advised to make allowances for delays in 175 determining whether to reuse an idle connection. 177 2.2. Other Header Parameters 179 The Keep-Alive header can be extended by adding any number of keep- 180 alive-extension values to the header. Any extension that is not 181 understood MUST be ignored. 183 The HTTP Keep-Alive Information Registry defines the namespace for 184 Keep-Alive extensions. Section 7.2 describes this registry. 186 2.2.1. 'max' Parameter 188 The "max" parameter has been used to indicate the maximum number of 189 requests that would be made on the connection. This parameter is 190 deprecated. Any limit on requests can be enforced by sending 191 "Connection: close" and closing the connection. 193 3. Existing Intermediaries 195 The exact impact of an intermediary on an HTTP request with a Keep- 196 Alive header depends on the type of intermediary. 198 An intermediary that is compliant with HTTP/1.1, but does not 199 implement Keep-Alive, ignores and discards this header before 200 forwarding a request. Since it is unaware of the semantics of the 201 header it could drop an idle connection at any time (see Section 202 7.1.4 of [I-D.ietf-httpbis-p1-messaging]). 204 A non-compliant "transparent" intermediary could pass this header on 205 to the next hop. This results in errors of the sort that are 206 described in Section A.1.2 of [I-D.ietf-httpbis-p1-messaging]. 207 Clients that send this header to HTTP/1.0 servers or proxies SHOULD 208 monitor for "hung" connections and avoid sending the header if a 209 connection appears to hang. 211 A network address translation (NAT) device or other middlebox might 212 cause a connection to become unavailable prior to the advertised 213 timeout. 215 A client or intermediary can revise or remove the Keep-Alive header 216 for subsequent requests to the same resource or origin server if it 217 detects non-compliant intermediaries or middleboxes that have shorter 218 timeout periods. 220 4. Upgraded HTTP Connections 222 A connection timeout can apply to a connection that is subsequently 223 upgraded to another protocol [RFC2817], such as the websocket 224 protocol [RFC6455]. 226 The idle connection timeout applies to the upgraded connection, 227 unless the upgraded protocol provides another method for indicating 228 idle timeouts. The maximum request count does not apply to the 229 upgraded connection; the upgrade request and subsequent exchange are 230 regarded as a single HTTP request. 232 A server, client or intermediary might apply different policies to an 233 upgraded protocol. 235 5. Examples 237 The example in Figure 1 shows how a Keep-Alive header could be used. 238 All connections are independently negotiated. In this example, the 239 client indicates a timeout of 600 seconds (10 minutes), but the proxy 240 is prepared to retain the connection for up to 3600 seconds (1 hour). 241 On the link between proxy and server, the proxy requests a timeout of 242 1200 seconds and the server indicates a lower limit of 300 seconds. 244 Client Proxy Server 245 | | | 246 +- Keep-Alive: timeout=600 -->| | 247 | Connection: Keep-Alive | | 248 | +- Keep-Alive: timeout=1200 -->| 249 | | Connection: Keep-Alive | 250 | | | 251 | |<-- Keep-Alive: timeout=300 --+ 252 | | Connection: Keep-Alive | 253 |<- Keep-Alive: timeout=3600 -+ | 254 | Connection: Keep-Alive | | 255 | | | 257 Figure 1: Independent HTTP Hops 259 As this example shows, the timeout policies maintained by the proxy 260 are different for each connection. Each connection hop is 261 independent. 263 The example in Figure 2 shows the headers included in an upgrade from 264 HTTP/1.1 to WebSocket [RFC6455]. With a websocket upgrade, the 265 connections on each hop cannot have independent lifecycles on either 266 side of an intermediary. After the upgrade, timeout policies cannot 267 be independent for each hop. The proxy adjusts the timeout value to 268 reflect the lower of the values set by client and the proxy policies 269 so that the server is aware of the connection characteristics; 270 similarly, the value from the server is provided to the client. 272 Client Proxy Server 273 | | | 274 | Upgrade: websocket | | 275 +- Keep-Alive: timeout=600 -->| | 276 | Connection: Keep-Alive, | | 277 | Upgrade | | 278 | | Upgrade: websocket | 279 | +- Keep-Alive: timeout=600 --->| 280 | | Connection: Keep-Alive, | 281 | | Upgrade | 282 | | | 283 | | Upgrade: websocket | 284 | |<-- Keep-Alive: timeout=300 --+ 285 | | Connection: Keep-Alive, | 286 | | Upgrade | 287 | Upgrade: websocket | | 288 |<- Keep-Alive: timeout=300 --+ | 289 | Connection: Keep-Alive, | | 290 | Upgrade | | 291 | | | 293 Figure 2: Interdependent Connections with Upgrade 295 6. Security Considerations 297 Establishing a persistent connection requires a commitment of 298 resources at a host. The Keep-Alive header are used to express host 299 policy that could alter the way that a host allocates connection 300 resources. Since these policies can be enacted without this 301 feedback, these indications have little effect on security other than 302 exposing specifics of policy. 304 A host can close a non-idle connection sooner than the indicated time 305 if necessary or as dictated by local policy (see Section 7.1.4 of 306 [I-D.ietf-httpbis-p1-messaging]). 308 7. IANA Considerations 310 [[Note to IANA/RFC Editor: Please replace instance of RFCXXXX with 311 the number of the published RFC and remove this note.]] 313 7.1. Registration for Keep-Alive Header 315 This document registers the HTTP "Keep-Alive" header in the 316 "Permanent Message Header Fields" registry established by [RFC3864] 318 Header field: Keep-Alive 320 Applicable protocol: HTTP 322 Status: standard 324 Author/change controller: Internet Engineering Task Force, IETF 325 (iesg@ietf.org) 327 Specification document(s): RFCXXXX (this document) 329 7.2. Registry for Keep-Alive Information 331 This document establishes a registry for Keep-Alive Information. 333 Registrations are subject to Specification Required [RFC5226]. The 334 designated expert is advised to review registrations and work with 335 the submitter to ensure that: 337 o the registration name conforms to the HTTP "token" grammar 339 o a stable specification exists that is sufficient for interoperable 340 implementation 342 o the registration does not duplicate an existing entry 344 The registry includes the following initial values: 346 timeout See Section 2.1 of this document. 348 max Deprecated. See Section 2.2.1 of this document. 350 8. Acknowledgments 352 Jamie Lokier provided valuable contributions of experience, insight 353 and text suggestions to this document. Roy Fielding provided 354 information on existing implementations of the poorly documented 355 header. Also provided useful feedback: Dave Thaler, Konstantinos 356 Pentikousis. 358 9. Change Log 360 Since -01: 362 o Deprecated 'max' 364 o Corrected badly misleading examples 366 o Loosened the registry policy from IETF Review 368 Since -00: 370 o Removed Request-Timeout in favor of the wait parameter of the 371 Prefer header. 373 o Connection-Timeout has now been replaced with the zombie spawn of 374 Keep-Alive. This means that it picks up the 'max' parameter as 375 baggage. Open question: should 'max' be deprecated? 377 Since draft-loreto-http-timeout: 379 o Changed Timeout to Request-Timeout to avoid a conflict with an 380 existing header definition. 382 o Added note about the application of Connection-Timeout to upgraded 383 protocols. 385 10. References 387 10.1. Normative References 389 [I-D.ietf-httpbis-p1-messaging] 390 Fielding, R., Lafon, Y., and J. Reschke, "HTTP/1.1, part 391 1: URIs, Connections, and Message Parsing", 392 draft-ietf-httpbis-p1-messaging-19 (work in progress), 393 March 2012. 395 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 396 Requirement Levels", BCP 14, RFC 2119, March 1997. 398 [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration 399 Procedures for Message Header Fields", BCP 90, RFC 3864, 400 September 2004. 402 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 403 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 404 May 2008. 406 10.2. Informative References 408 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 409 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 410 RFC 2068, January 1997. 412 [RFC2817] Khare, R. and S. Lawrence, "Upgrading to TLS Within 413 HTTP/1.1", RFC 2817, May 2000. 415 [RFC6455] Fette, I. and A. Melnikov, "The WebSocket Protocol", 416 RFC 6455, December 2011. 418 Authors' Addresses 420 Martin Thomson 421 Microsoft 422 3210 Porter Drive 423 Palo Alto, CA 94304 424 US 426 Phone: +1 650-353-1925 427 Email: martin.thomson@skype.net 429 Salvatore Loreto 430 Ericsson 431 Hirsalantie 11 432 Jorvas 02420 433 Finland 435 Email: salvatore.loreto@ericsson.com 437 Greg Wilkins 438 Intalio 439 644 Emerson Street, Suite 200 440 Palo Alto 94301 441 USA 443 Email: gregw@intalio.com