idnits 2.17.1 draft-ietf-httpbis-p1-messaging-07.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** The document seems to lack a License Notice according IETF Trust Provisions of 28 Dec 2009, Section 6.b.i or Provisions of 12 Sep 2009 Section 6.b -- however, there's a paragraph with a matching beginning. Boilerplate error? (You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Feb 2009 rather than one of the newer Notices. See https://trustee.ietf.org/license-info/.) 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 contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (July 13, 2009) is 5399 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'ISO-8859-1' == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p2-semantics-07 == Outdated reference: A later version (-20) exists of draft-ietf-httpbis-p3-payload-07 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p5-range-07 == Outdated reference: A later version (-26) exists of draft-ietf-httpbis-p6-cache-07 -- Possible downref: Non-RFC (?) normative reference: ref. 'USASCII' -- Obsolete informational reference (is this intentional?): RFC 1305 (Obsoleted by RFC 5905) -- Obsolete informational reference (is this intentional?): RFC 2068 (Obsoleted by RFC 2616) -- Obsolete informational reference (is this intentional?): RFC 2109 (Obsoleted by RFC 2965) -- Obsolete informational reference (is this intentional?): RFC 2145 (Obsoleted by RFC 7230) -- Obsolete informational reference (is this intentional?): RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 2965 (Obsoleted by RFC 6265) -- Obsolete informational reference (is this intentional?): RFC 4288 (Obsoleted by RFC 6838) -- Obsolete informational reference (is this intentional?): RFC 4395 (Obsoleted by RFC 7595) Summary: 1 error (**), 0 flaws (~~), 5 warnings (==), 14 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPbis Working Group R. Fielding, Ed. 3 Internet-Draft Day Software 4 Obsoletes: 2616 (if approved) J. Gettys 5 Intended status: Standards Track One Laptop per Child 6 Expires: January 14, 2010 J. Mogul 7 HP 8 H. Frystyk 9 Microsoft 10 L. Masinter 11 Adobe Systems 12 P. Leach 13 Microsoft 14 T. Berners-Lee 15 W3C/MIT 16 Y. Lafon, Ed. 17 W3C 18 J. Reschke, Ed. 19 greenbytes 20 July 13, 2009 22 HTTP/1.1, part 1: URIs, Connections, and Message Parsing 23 draft-ietf-httpbis-p1-messaging-07 25 Status of this Memo 27 This Internet-Draft is submitted to IETF in full conformance with the 28 provisions of BCP 78 and BCP 79. This document may contain material 29 from IETF Documents or IETF Contributions published or made publicly 30 available before November 10, 2008. The person(s) controlling the 31 copyright in some of this material may not have granted the IETF 32 Trust the right to allow modifications of such material outside the 33 IETF Standards Process. Without obtaining an adequate license from 34 the person(s) controlling the copyright in such materials, this 35 document may not be modified outside the IETF Standards Process, and 36 derivative works of it may not be created outside the IETF Standards 37 Process, except to format it for publication as an RFC or to 38 translate it into languages other than English. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF), its areas, and its working groups. Note that 42 other groups may also distribute working documents as Internet- 43 Drafts. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 The list of current Internet-Drafts can be accessed at 50 http://www.ietf.org/ietf/1id-abstracts.txt. 52 The list of Internet-Draft Shadow Directories can be accessed at 53 http://www.ietf.org/shadow.html. 55 This Internet-Draft will expire on January 14, 2010. 57 Copyright Notice 59 Copyright (c) 2009 IETF Trust and the persons identified as the 60 document authors. All rights reserved. 62 This document is subject to BCP 78 and the IETF Trust's Legal 63 Provisions Relating to IETF Documents in effect on the date of 64 publication of this document (http://trustee.ietf.org/license-info). 65 Please review these documents carefully, as they describe your rights 66 and restrictions with respect to this document. 68 Abstract 70 The Hypertext Transfer Protocol (HTTP) is an application-level 71 protocol for distributed, collaborative, hypertext information 72 systems. HTTP has been in use by the World Wide Web global 73 information initiative since 1990. This document is Part 1 of the 74 seven-part specification that defines the protocol referred to as 75 "HTTP/1.1" and, taken together, obsoletes RFC 2616. Part 1 provides 76 an overview of HTTP and its associated terminology, defines the 77 "http" and "https" Uniform Resource Identifier (URI) schemes, defines 78 the generic message syntax and parsing requirements for HTTP message 79 frames, and describes general security concerns for implementations. 81 Editorial Note (To be removed by RFC Editor) 83 Discussion of this draft should take place on the HTTPBIS working 84 group mailing list (ietf-http-wg@w3.org). The current issues list is 85 at and related 86 documents (including fancy diffs) can be found at 87 . 89 The changes in this draft are summarized in Appendix E.8. 91 Table of Contents 93 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 6 94 1.1. Requirements . . . . . . . . . . . . . . . . . . . . . . . 7 95 1.2. Syntax Notation . . . . . . . . . . . . . . . . . . . . . 7 96 1.2.1. ABNF Extension: #rule . . . . . . . . . . . . . . . . 7 97 1.2.2. Basic Rules . . . . . . . . . . . . . . . . . . . . . 8 98 1.2.3. ABNF Rules defined in other Parts of the 99 Specification . . . . . . . . . . . . . . . . . . . . 9 100 2. HTTP architecture . . . . . . . . . . . . . . . . . . . . . . 10 101 2.1. Uniform Resource Identifiers . . . . . . . . . . . . . . . 10 102 2.1.1. http URI scheme . . . . . . . . . . . . . . . . . . . 11 103 2.1.2. https URI scheme . . . . . . . . . . . . . . . . . . . 11 104 2.1.3. URI Comparison . . . . . . . . . . . . . . . . . . . . 11 105 2.1.4. Scheme aliases considered harmful . . . . . . . . . . 12 106 2.2. Overall Operation . . . . . . . . . . . . . . . . . . . . 12 107 2.3. Use of HTTP for proxy communication . . . . . . . . . . . 14 108 2.4. Interception of HTTP for access control . . . . . . . . . 14 109 2.5. Use of HTTP by other protocols . . . . . . . . . . . . . . 14 110 2.6. Use of HTTP by media type specification . . . . . . . . . 14 111 3. Protocol Parameters . . . . . . . . . . . . . . . . . . . . . 14 112 3.1. HTTP Version . . . . . . . . . . . . . . . . . . . . . . . 14 113 3.2. Date/Time Formats: Full Date . . . . . . . . . . . . . . . 15 114 3.3. Transfer Codings . . . . . . . . . . . . . . . . . . . . . 18 115 3.3.1. Chunked Transfer Coding . . . . . . . . . . . . . . . 19 116 3.4. Product Tokens . . . . . . . . . . . . . . . . . . . . . . 21 117 3.5. Quality Values . . . . . . . . . . . . . . . . . . . . . . 22 118 4. HTTP Message . . . . . . . . . . . . . . . . . . . . . . . . . 22 119 4.1. Message Types . . . . . . . . . . . . . . . . . . . . . . 22 120 4.2. Message Headers . . . . . . . . . . . . . . . . . . . . . 23 121 4.3. Message Body . . . . . . . . . . . . . . . . . . . . . . . 24 122 4.4. Message Length . . . . . . . . . . . . . . . . . . . . . . 25 123 4.5. General Header Fields . . . . . . . . . . . . . . . . . . 27 124 5. Request . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 125 5.1. Request-Line . . . . . . . . . . . . . . . . . . . . . . . 27 126 5.1.1. Method . . . . . . . . . . . . . . . . . . . . . . . . 28 127 5.1.2. request-target . . . . . . . . . . . . . . . . . . . . 28 128 5.2. The Resource Identified by a Request . . . . . . . . . . . 30 129 6. Response . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 130 6.1. Status-Line . . . . . . . . . . . . . . . . . . . . . . . 31 131 6.1.1. Status Code and Reason Phrase . . . . . . . . . . . . 31 132 7. Connections . . . . . . . . . . . . . . . . . . . . . . . . . 32 133 7.1. Persistent Connections . . . . . . . . . . . . . . . . . . 32 134 7.1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . 32 135 7.1.2. Overall Operation . . . . . . . . . . . . . . . . . . 32 136 7.1.3. Proxy Servers . . . . . . . . . . . . . . . . . . . . 34 137 7.1.4. Practical Considerations . . . . . . . . . . . . . . . 34 138 7.2. Message Transmission Requirements . . . . . . . . . . . . 35 139 7.2.1. Persistent Connections and Flow Control . . . . . . . 35 140 7.2.2. Monitoring Connections for Error Status Messages . . . 35 141 7.2.3. Use of the 100 (Continue) Status . . . . . . . . . . . 36 142 7.2.4. Client Behavior if Server Prematurely Closes 143 Connection . . . . . . . . . . . . . . . . . . . . . . 38 144 8. Header Field Definitions . . . . . . . . . . . . . . . . . . . 38 145 8.1. Connection . . . . . . . . . . . . . . . . . . . . . . . . 39 146 8.2. Content-Length . . . . . . . . . . . . . . . . . . . . . . 40 147 8.3. Date . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 148 8.3.1. Clockless Origin Server Operation . . . . . . . . . . 41 149 8.4. Host . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 150 8.5. TE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 151 8.6. Trailer . . . . . . . . . . . . . . . . . . . . . . . . . 44 152 8.7. Transfer-Encoding . . . . . . . . . . . . . . . . . . . . 44 153 8.8. Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . 45 154 8.9. Via . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 155 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 47 156 9.1. Message Header Registration . . . . . . . . . . . . . . . 47 157 9.2. URI Scheme Registration . . . . . . . . . . . . . . . . . 48 158 9.3. Internet Media Type Registrations . . . . . . . . . . . . 48 159 9.3.1. Internet Media Type message/http . . . . . . . . . . . 48 160 9.3.2. Internet Media Type application/http . . . . . . . . . 49 161 10. Security Considerations . . . . . . . . . . . . . . . . . . . 50 162 10.1. Personal Information . . . . . . . . . . . . . . . . . . . 51 163 10.2. Abuse of Server Log Information . . . . . . . . . . . . . 51 164 10.3. Attacks Based On File and Path Names . . . . . . . . . . . 51 165 10.4. DNS Spoofing . . . . . . . . . . . . . . . . . . . . . . . 51 166 10.5. Proxies and Caching . . . . . . . . . . . . . . . . . . . 52 167 10.6. Denial of Service Attacks on Proxies . . . . . . . . . . . 53 168 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 53 169 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 54 170 12.1. Normative References . . . . . . . . . . . . . . . . . . . 54 171 12.2. Informative References . . . . . . . . . . . . . . . . . . 55 172 Appendix A. Tolerant Applications . . . . . . . . . . . . . . . . 57 173 Appendix B. Compatibility with Previous Versions . . . . . . . . 58 174 B.1. Changes from HTTP/1.0 . . . . . . . . . . . . . . . . . . 59 175 B.1.1. Changes to Simplify Multi-homed Web Servers and 176 Conserve IP Addresses . . . . . . . . . . . . . . . . 59 177 B.2. Compatibility with HTTP/1.0 Persistent Connections . . . . 59 178 B.3. Changes from RFC 2068 . . . . . . . . . . . . . . . . . . 60 179 B.4. Changes from RFC 2616 . . . . . . . . . . . . . . . . . . 61 180 Appendix C. Terminology . . . . . . . . . . . . . . . . . . . . . 61 181 Appendix D. Collected ABNF . . . . . . . . . . . . . . . . . . . 64 182 Appendix E. Change Log (to be removed by RFC Editor before 183 publication) . . . . . . . . . . . . . . . . . . . . 69 184 E.1. Since RFC2616 . . . . . . . . . . . . . . . . . . . . . . 69 185 E.2. Since draft-ietf-httpbis-p1-messaging-00 . . . . . . . . . 69 186 E.3. Since draft-ietf-httpbis-p1-messaging-01 . . . . . . . . . 70 187 E.4. Since draft-ietf-httpbis-p1-messaging-02 . . . . . . . . . 71 188 E.5. Since draft-ietf-httpbis-p1-messaging-03 . . . . . . . . . 72 189 E.6. Since draft-ietf-httpbis-p1-messaging-04 . . . . . . . . . 72 190 E.7. Since draft-ietf-httpbis-p1-messaging-05 . . . . . . . . . 73 191 E.8. Since draft-ietf-httpbis-p1-messaging-06 . . . . . . . . . 74 192 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 193 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 78 195 1. Introduction 197 The Hypertext Transfer Protocol (HTTP) is an application-level 198 request/response protocol that uses extensible semantics and MIME- 199 like message payloads for flexible interaction with network-based 200 hypertext information systems. HTTP relies upon the Uniform Resource 201 Identifier (URI) standard [RFC3986] to indicate request targets and 202 relationships between resources. Messages are passed in a format 203 similar to that used by Internet mail [RFC5322] and the Multipurpose 204 Internet Mail Extensions (MIME) [RFC2045] (see Appendix A of [Part3] 205 for the differences between HTTP and MIME messages). 207 HTTP is a generic interface protocol for information systems. It is 208 designed to hide the details of how a service is implemented by 209 presenting a uniform interface to clients that is independent of the 210 types of resources provided. Likewise, servers do not need to be 211 aware of each client's purpose: an HTTP request can be considered in 212 isolation rather than being associated with a specific type of client 213 or a predetermined sequence of application steps. The result is a 214 protocol that can be used effectively in many different contexts and 215 for which implementations can evolve independently over time. 217 HTTP is also designed for use as a generic protocol for translating 218 communication to and from other Internet information systems. HTTP 219 proxies and gateways provide access to alternative information 220 services by translating their diverse protocols into a hypertext 221 format that can be viewed and manipulated by clients in the same way 222 as HTTP services. 224 One consequence of HTTP flexibility is that the protocol cannot be 225 defined in terms of what occurs behind the interface. Instead, we 226 are limited to defining the syntax of communication, the intent of 227 received communication, and the expected behavior of recipients. If 228 the communication is considered in isolation, then successful actions 229 should be reflected in corresponding changes to the observable 230 interface provided by servers. However, since multiple clients may 231 act in parallel and perhaps at cross-purposes, we cannot require that 232 such changes be observable beyond the scope of a single response. 234 This document is Part 1 of the seven-part specification of HTTP, 235 defining the protocol referred to as "HTTP/1.1" and obsoleting 236 [RFC2616]. Part 1 describes the architectural elements that are used 237 or referred to in HTTP and defines the URI schemes specific to HTTP- 238 based resources, overall network operation, connection management, 239 and HTTP message framing and forwarding requirements. Our goal is to 240 define all of the mechanisms necessary for HTTP message handling that 241 are independent of message semantics, thereby defining the complete 242 set of requirements for message parsers and message-forwarding 243 intermediaries. 245 1.1. Requirements 247 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 248 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 249 document are to be interpreted as described in [RFC2119]. 251 An implementation is not compliant if it fails to satisfy one or more 252 of the MUST or REQUIRED level requirements for the protocols it 253 implements. An implementation that satisfies all the MUST or 254 REQUIRED level and all the SHOULD level requirements for its 255 protocols is said to be "unconditionally compliant"; one that 256 satisfies all the MUST level requirements but not all the SHOULD 257 level requirements for its protocols is said to be "conditionally 258 compliant." 260 1.2. Syntax Notation 262 This specification uses the Augmented Backus-Naur Form (ABNF) 263 notation of [RFC5234]. 265 The following core rules are included by reference, as defined in 266 [RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF 267 (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), 268 HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any 8-bit 269 sequence of data), SP (space), VCHAR (any visible [USASCII] 270 character), and WSP (whitespace). 272 1.2.1. ABNF Extension: #rule 274 One extension to the ABNF rules of [RFC5234] is used to improve 275 readability. 277 A construct "#" is defined, similar to "*", for defining lists of 278 elements. The full form is "#element" indicating at least 279 and at most elements, each separated by a single comma (",") and 280 optional whitespace (OWS). 282 Thus, 284 1#element => element *( OWS "," OWS element ) 286 and: 288 #element => [ 1#element ] 290 and for n >= 1 and m > 1: 292 #element => element *( OWS "," OWS element ) 294 For compatibility with legacy list rules, recipients SHOULD accept 295 empty list elements. In other words, consumers would follow the list 296 productions: 298 #element => [ ( "," / element ) *( OWS "," [ OWS element ] ) ] 300 1#element => *( "," OWS ) element *( OWS "," [ OWS element ] ) 302 Appendix D shows the collected ABNF, with the list rules expanded as 303 explained above. 305 1.2.2. Basic Rules 307 HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all 308 protocol elements except the entity-body (see Appendix A for tolerant 309 applications). The end-of-line marker within an entity-body is 310 defined by its associated media type, as described in Section 2.3 of 311 [Part3]. 313 This specification uses three rules to denote the use of linear 314 whitespace: OWS (optional whitespace), RWS (required whitespace), and 315 BWS ("bad" whitespace). 317 The OWS rule is used where zero or more linear whitespace characters 318 may appear. OWS SHOULD either not be produced or be produced as a 319 single SP character. Multiple OWS characters that occur within 320 field-content SHOULD be replaced with a single SP before interpreting 321 the field value or forwarding the message downstream. 323 RWS is used when at least one linear whitespace character is required 324 to separate field tokens. RWS SHOULD be produced as a single SP 325 character. Multiple RWS characters that occur within field-content 326 SHOULD be replaced with a single SP before interpreting the field 327 value or forwarding the message downstream. 329 BWS is used where the grammar allows optional whitespace for 330 historical reasons but senders SHOULD NOT produce it in messages. 331 HTTP/1.1 recipients MUST accept such bad optional whitespace and 332 remove it before interpreting the field value or forwarding the 333 message downstream. 335 OWS = *( [ obs-fold ] WSP ) 336 ; "optional" whitespace 337 RWS = 1*( [ obs-fold ] WSP ) 338 ; "required" whitespace 339 BWS = OWS 340 ; "bad" whitespace 341 obs-fold = CRLF 342 ; see Section 4.2 344 Many HTTP/1.1 header field values consist of words separated by 345 whitespace or special characters. These special characters MUST be 346 in a quoted string to be used within a parameter value (as defined in 347 Section 3.3). 349 tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" 350 / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" 351 / DIGIT / ALPHA 353 token = 1*tchar 355 A string of text is parsed as a single word if it is quoted using 356 double-quote marks. 358 quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE 359 qdtext = OWS / %x21 / %x23-5B / %x5D-7E / obs-text 360 ; OWS / / obs-text 361 obs-text = %x80-FF 363 The backslash character ("\") MAY be used as a single-character 364 quoting mechanism only within quoted-string and comment constructs. 366 quoted-text = %x01-09 / 367 %x0B-0C / 368 %x0E-FF ; Characters excluding NUL, CR and LF 369 quoted-pair = "\" quoted-text 371 1.2.3. ABNF Rules defined in other Parts of the Specification 373 The ABNF rules below are defined in other parts: 375 request-header = 376 response-header = 378 entity-body = 379 entity-header = 380 Cache-Control = 381 Pragma = 382 Warning = 384 2. HTTP architecture 386 HTTP was created with a specific architecture in mind, the World Wide 387 Web, and has evolved over time to support the scalability needs of a 388 worldwide hypertext system. Much of that architecture is reflected 389 in the terminology and syntax productions used to define HTTP. 391 2.1. Uniform Resource Identifiers 393 Uniform Resource Identifiers (URIs) [RFC3986] are used throughout 394 HTTP as the means for identifying resources. URI references are used 395 to target requests, redirect responses, and define relationships. 396 HTTP does not limit what a resource may be; it merely defines an 397 interface that can be used to interact with a resource via HTTP. 398 More information on the scope of URIs and resources can be found in 399 [RFC3986]. 401 This specification adopts the definitions of "URI-reference", 402 "absolute-URI", "relative-part", "fragment", "port", "host", "path- 403 abempty", "path-absolute", "query", and "authority" from [RFC3986]. 404 In addition, we define a partial-URI rule for protocol elements that 405 allow a relative URI without a fragment. 407 URI = 408 URI-reference = 409 absolute-URI = 410 relative-part = 411 authority = 412 fragment = 413 path-abempty = 414 path-absolute = 415 port = 416 query = 417 uri-host = 419 partial-URI = relative-part [ "?" query ] 421 Each protocol element in HTTP that allows a URI reference will 422 indicate in its ABNF production whether the element allows only a URI 423 in absolute form (absolute-URI), any relative reference (relative- 424 ref), or some other subset of the URI-reference grammar. Unless 425 otherwise indicated, URI references are parsed relative to the 426 request target (the default base URI for both the request and its 427 corresponding response). 429 2.1.1. http URI scheme 431 The "http" scheme is used to locate network resources via the HTTP 432 protocol. 434 http-URI = "http:" "//" authority path-abempty [ "?" query ] 436 If the port is empty or not given, port 80 is assumed. The semantics 437 are that the identified resource is located at the server listening 438 for TCP connections on that port of that host, and the request-target 439 for the resource is path-absolute (Section 5.1.2). The use of IP 440 addresses in URLs SHOULD be avoided whenever possible (see 441 [RFC1900]). If the path-absolute is not present in the URL, it MUST 442 be given as "/" when used as a request-target for a resource 443 (Section 5.1.2). If a proxy receives a host name which is not a 444 fully qualified domain name, it MAY add its domain to the host name 445 it received. If a proxy receives a fully qualified domain name, the 446 proxy MUST NOT change the host name. 448 2.1.2. https URI scheme 450 [[anchor1: TBD: Define and explain purpose of https scheme.]] 452 Note: the "https" scheme is defined in [RFC2818]. 454 2.1.3. URI Comparison 456 When comparing two URIs to decide if they match or not, a client 457 SHOULD use a case-sensitive octet-by-octet comparison of the entire 458 URIs, with these exceptions: 460 o A port that is empty or not given is equivalent to the default 461 port for that URI-reference; 463 o Comparisons of host names MUST be case-insensitive; 465 o Comparisons of scheme names MUST be case-insensitive; 467 o An empty path-absolute is equivalent to a path-absolute of "/". 469 o Characters other than those in the "reserved" set are equivalent 470 to their percent-encoded octets (see [RFC3986], Section 2.1). 472 For example, the following three URIs are equivalent: 474 http://example.com:80/~smith/home.html 475 http://EXAMPLE.com/%7Esmith/home.html 476 http://EXAMPLE.com:/%7esmith/home.html 478 2.1.4. Scheme aliases considered harmful 480 2.2. Overall Operation 482 HTTP is a request/response protocol. A client sends a request to the 483 server in the form of a request method, URI, and protocol version, 484 followed by a MIME-like message containing request modifiers, client 485 information, and possible body content over a connection with a 486 server. The server responds with a status line, including the 487 message's protocol version and a success or error code, followed by a 488 MIME-like message containing server information, entity 489 metainformation, and possible entity-body content. 491 Most HTTP communication is initiated by a user agent and consists of 492 a request to be applied to a resource on some origin server. In the 493 simplest case, this may be accomplished via a single connection (v) 494 between the user agent (UA) and the origin server (O). 496 request chain ------------------------> 497 UA -------------------v------------------- O 498 <----------------------- response chain 500 A more complicated situation occurs when one or more intermediaries 501 are present in the request/response chain. There are three common 502 forms of intermediary: proxy, gateway, and tunnel. A proxy is a 503 forwarding agent, receiving requests for a URI in its absolute form, 504 rewriting all or part of the message, and forwarding the reformatted 505 request toward the server identified by the URI. A gateway is a 506 receiving agent, acting as a layer above some other server(s) and, if 507 necessary, translating the requests to the underlying server's 508 protocol. A tunnel acts as a relay point between two connections 509 without changing the messages; tunnels are used when the 510 communication needs to pass through an intermediary (such as a 511 firewall) even when the intermediary cannot understand the contents 512 of the messages. 514 request chain --------------------------------------> 515 UA -----v----- A -----v----- B -----v----- C -----v----- O 516 <------------------------------------- response chain 518 The figure above shows three intermediaries (A, B, and C) between the 519 user agent and origin server. A request or response message that 520 travels the whole chain will pass through four separate connections. 521 This distinction is important because some HTTP communication options 522 may apply only to the connection with the nearest, non-tunnel 523 neighbor, only to the end-points of the chain, or to all connections 524 along the chain. Although the diagram is linear, each participant 525 may be engaged in multiple, simultaneous communications. For 526 example, B may be receiving requests from many clients other than A, 527 and/or forwarding requests to servers other than C, at the same time 528 that it is handling A's request. 530 Any party to the communication which is not acting as a tunnel may 531 employ an internal cache for handling requests. The effect of a 532 cache is that the request/response chain is shortened if one of the 533 participants along the chain has a cached response applicable to that 534 request. The following illustrates the resulting chain if B has a 535 cached copy of an earlier response from O (via C) for a request which 536 has not been cached by UA or A. 538 request chain ----------> 539 UA -----v----- A -----v----- B - - - - - - C - - - - - - O 540 <--------- response chain 542 Not all responses are usefully cacheable, and some requests may 543 contain modifiers which place special requirements on cache behavior. 544 HTTP requirements for cache behavior and cacheable responses are 545 defined in Section 1 of [Part6]. 547 In fact, there are a wide variety of architectures and configurations 548 of caches and proxies currently being experimented with or deployed 549 across the World Wide Web. These systems include national hierarchies 550 of proxy caches to save transoceanic bandwidth, systems that 551 broadcast or multicast cache entries, organizations that distribute 552 subsets of cached data via CD-ROM, and so on. HTTP systems are used 553 in corporate intranets over high-bandwidth links, and for access via 554 PDAs with low-power radio links and intermittent connectivity. The 555 goal of HTTP/1.1 is to support the wide diversity of configurations 556 already deployed while introducing protocol constructs that meet the 557 needs of those who build web applications that require high 558 reliability and, failing that, at least reliable indications of 559 failure. 561 HTTP communication usually takes place over TCP/IP connections. The 562 default port is TCP 80 563 (), but other ports can 564 be used. This does not preclude HTTP from being implemented on top 565 of any other protocol on the Internet, or on other networks. HTTP 566 only presumes a reliable transport; any protocol that provides such 567 guarantees can be used; the mapping of the HTTP/1.1 request and 568 response structures onto the transport data units of the protocol in 569 question is outside the scope of this specification. 571 In HTTP/1.0, most implementations used a new connection for each 572 request/response exchange. In HTTP/1.1, a connection may be used for 573 one or more request/response exchanges, although connections may be 574 closed for a variety of reasons (see Section 7.1). 576 2.3. Use of HTTP for proxy communication 578 [[anchor2: TBD: Configured to use HTTP to proxy HTTP or other 579 protocols.]] 581 2.4. Interception of HTTP for access control 583 [[anchor3: TBD: Interception of HTTP traffic for initiating access 584 control.]] 586 2.5. Use of HTTP by other protocols 588 [[anchor4: TBD: Profiles of HTTP defined by other protocol. 589 Extensions of HTTP like WebDAV.]] 591 2.6. Use of HTTP by media type specification 593 [[anchor5: TBD: Instructions on composing HTTP requests via hypertext 594 formats.]] 596 3. Protocol Parameters 598 3.1. HTTP Version 600 HTTP uses a "." numbering scheme to indicate versions 601 of the protocol. The protocol versioning policy is intended to allow 602 the sender to indicate the format of a message and its capacity for 603 understanding further HTTP communication, rather than the features 604 obtained via that communication. No change is made to the version 605 number for the addition of message components which do not affect 606 communication behavior or which only add to extensible field values. 607 The number is incremented when the changes made to the 608 protocol add features which do not change the general message parsing 609 algorithm, but which may add to the message semantics and imply 610 additional capabilities of the sender. The number is 611 incremented when the format of a message within the protocol is 612 changed. See [RFC2145] for a fuller explanation. 614 The version of an HTTP message is indicated by an HTTP-Version field 615 in the first line of the message. HTTP-Version is case-sensitive. 617 HTTP-Version = HTTP-Prot-Name "/" 1*DIGIT "." 1*DIGIT 618 HTTP-Prot-Name = %x48.54.54.50 ; "HTTP", case-sensitive 620 Note that the major and minor numbers MUST be treated as separate 621 integers and that each MAY be incremented higher than a single digit. 622 Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is 623 lower than HTTP/12.3. Leading zeros MUST be ignored by recipients 624 and MUST NOT be sent. 626 An application that sends a request or response message that includes 627 HTTP-Version of "HTTP/1.1" MUST be at least conditionally compliant 628 with this specification. Applications that are at least 629 conditionally compliant with this specification SHOULD use an HTTP- 630 Version of "HTTP/1.1" in their messages, and MUST do so for any 631 message that is not compatible with HTTP/1.0. For more details on 632 when to send specific HTTP-Version values, see [RFC2145]. 634 The HTTP version of an application is the highest HTTP version for 635 which the application is at least conditionally compliant. 637 Proxy and gateway applications need to be careful when forwarding 638 messages in protocol versions different from that of the application. 639 Since the protocol version indicates the protocol capability of the 640 sender, a proxy/gateway MUST NOT send a message with a version 641 indicator which is greater than its actual version. If a higher 642 version request is received, the proxy/gateway MUST either downgrade 643 the request version, or respond with an error, or switch to tunnel 644 behavior. 646 Due to interoperability problems with HTTP/1.0 proxies discovered 647 since the publication of [RFC2068], caching proxies MUST, gateways 648 MAY, and tunnels MUST NOT upgrade the request to the highest version 649 they support. The proxy/gateway's response to that request MUST be 650 in the same major version as the request. 652 Note: Converting between versions of HTTP may involve modification 653 of header fields required or forbidden by the versions involved. 655 3.2. Date/Time Formats: Full Date 657 HTTP applications have historically allowed three different formats 658 for the representation of date/time stamps: 660 Sun, 06 Nov 1994 08:49:37 GMT ; RFC 1123 661 Sunday, 06-Nov-94 08:49:37 GMT ; obsolete RFC 850 format 662 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format 664 The first format is preferred as an Internet standard and represents 665 a fixed-length subset of that defined by [RFC1123]. The other 666 formats are described here only for compatibility with obsolete 667 implementations. HTTP/1.1 clients and servers that parse the date 668 value MUST accept all three formats (for compatibility with 669 HTTP/1.0), though they MUST only generate the RFC 1123 format for 670 representing HTTP-date values in header fields. See Appendix A for 671 further information. 673 All HTTP date/time stamps MUST be represented in Greenwich Mean Time 674 (GMT), without exception. For the purposes of HTTP, GMT is exactly 675 equal to UTC (Coordinated Universal Time). This is indicated in the 676 first two formats by the inclusion of "GMT" as the three-letter 677 abbreviation for time zone, and MUST be assumed when reading the 678 asctime format. HTTP-date is case sensitive and MUST NOT include 679 additional whitespace beyond that specifically included as SP in the 680 grammar. 682 HTTP-date = rfc1123-date / obs-date 684 Preferred format: 686 rfc1123-date = day-name "," SP date1 SP time-of-day SP GMT 688 day-name = %x4D.6F.6E ; "Mon", case-sensitive 689 / %x54.75.65 ; "Tue", case-sensitive 690 / %x57.65.64 ; "Wed", case-sensitive 691 / %x54.68.75 ; "Thu", case-sensitive 692 / %x46.72.69 ; "Fri", case-sensitive 693 / %x53.61.74 ; "Sat", case-sensitive 694 / %x53.75.6E ; "Sun", case-sensitive 696 date1 = day SP month SP year 697 ; e.g., 02 Jun 1982 699 day = 2DIGIT 700 month = %x4A.61.6E ; "Jan", case-sensitive 701 / %x46.65.62 ; "Feb", case-sensitive 702 / %x4D.61.72 ; "Mar", case-sensitive 703 / %x41.70.72 ; "Apr", case-sensitive 704 / %x4D.61.79 ; "May", case-sensitive 705 / %x4A.75.6E ; "Jun", case-sensitive 706 / %x4A.75.6C ; "Jul", case-sensitive 707 / %x41.75.67 ; "Aug", case-sensitive 708 / %x53.65.70 ; "Sep", case-sensitive 709 / %x4F.63.74 ; "Oct", case-sensitive 710 / %x4E.6F.76 ; "Nov", case-sensitive 711 / %x44.65.63 ; "Dec", case-sensitive 712 year = 4DIGIT 714 GMT = %x47.4D.54 ; "GMT", case-sensitive 716 time-of-day = hour ":" minute ":" second 717 ; 00:00:00 - 23:59:59 719 hour = 2DIGIT 720 minute = 2DIGIT 721 second = 2DIGIT 723 The semantics of day-name, day, month, year, and time-of-day are the 724 same as those defined for the RFC 5322 constructs with the 725 corresponding name ([RFC5322], Section 3.3). 727 Obsolete formats: 729 obs-date = rfc850-date / asctime-date 730 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 731 date2 = day "-" month "-" 2DIGIT 732 ; day-month-year (e.g., 02-Jun-82) 734 day-name-l = %x4D.6F.6E.64.61.79 ; "Monday", case-sensitive 735 / %x54.75.65.73.64.61.79 ; "Tuesday", case-sensitive 736 / %x57.65.64.6E.65.73.64.61.79 ; "Wednesday", case-sensitive 737 / %x54.68.75.72.73.64.61.79 ; "Thursday", case-sensitive 738 / %x46.72.69.64.61.79 ; "Friday", case-sensitive 739 / %x53.61.74.75.72.64.61.79 ; "Saturday", case-sensitive 740 / %x53.75.6E.64.61.79 ; "Sunday", case-sensitive 742 asctime-date = day-name SP date3 SP time-of-day SP year 743 date3 = month SP ( 2DIGIT / ( SP 1DIGIT )) 744 ; month day (e.g., Jun 2) 746 Note: Recipients of date values are encouraged to be robust in 747 accepting date values that may have been sent by non-HTTP 748 applications, as is sometimes the case when retrieving or posting 749 messages via proxies/gateways to SMTP or NNTP. 751 Note: HTTP requirements for the date/time stamp format apply only 752 to their usage within the protocol stream. Clients and servers 753 are not required to use these formats for user presentation, 754 request logging, etc. 756 3.3. Transfer Codings 758 Transfer-coding values are used to indicate an encoding 759 transformation that has been, can be, or may need to be applied to an 760 entity-body in order to ensure "safe transport" through the network. 761 This differs from a content coding in that the transfer-coding is a 762 property of the message, not of the original entity. 764 transfer-coding = "chunked" / transfer-extension 765 transfer-extension = token *( OWS ";" OWS transfer-parameter ) 767 Parameters are in the form of attribute/value pairs. 769 transfer-parameter = attribute BWS "=" BWS value 770 attribute = token 771 value = token / quoted-string 773 All transfer-coding values are case-insensitive. HTTP/1.1 uses 774 transfer-coding values in the TE header field (Section 8.5) and in 775 the Transfer-Encoding header field (Section 8.7). 777 Whenever a transfer-coding is applied to a message-body, the set of 778 transfer-codings MUST include "chunked", unless the message indicates 779 it is terminated by closing the connection. When the "chunked" 780 transfer-coding is used, it MUST be the last transfer-coding applied 781 to the message-body. The "chunked" transfer-coding MUST NOT be 782 applied more than once to a message-body. These rules allow the 783 recipient to determine the transfer-length of the message 784 (Section 4.4). 786 Transfer-codings are analogous to the Content-Transfer-Encoding 787 values of MIME [RFC2045], which were designed to enable safe 788 transport of binary data over a 7-bit transport service. However, 789 safe transport has a different focus for an 8bit-clean transfer 790 protocol. In HTTP, the only unsafe characteristic of message-bodies 791 is the difficulty in determining the exact body length (Section 4.4), 792 or the desire to encrypt data over a shared transport. 794 The Internet Assigned Numbers Authority (IANA) acts as a registry for 795 transfer-coding value tokens. Initially, the registry contains the 796 following tokens: "chunked" (Section 3.3.1), "gzip", "compress", and 797 "deflate" (Section 2.2 of [Part3]). 799 New transfer-coding value tokens SHOULD be registered in the same way 800 as new content-coding value tokens (Section 2.2 of [Part3]). 802 A server which receives an entity-body with a transfer-coding it does 803 not understand SHOULD return 501 (Not Implemented), and close the 804 connection. A server MUST NOT send transfer-codings to an HTTP/1.0 805 client. 807 3.3.1. Chunked Transfer Coding 809 The chunked encoding modifies the body of a message in order to 810 transfer it as a series of chunks, each with its own size indicator, 811 followed by an OPTIONAL trailer containing entity-header fields. 812 This allows dynamically produced content to be transferred along with 813 the information necessary for the recipient to verify that it has 814 received the full message. 816 Chunked-Body = *chunk 817 last-chunk 818 trailer-part 819 CRLF 821 chunk = chunk-size *WSP [ chunk-ext ] CRLF 822 chunk-data CRLF 823 chunk-size = 1*HEXDIG 824 last-chunk = 1*("0") *WSP [ chunk-ext ] CRLF 826 chunk-ext = *( ";" *WSP chunk-ext-name 827 [ "=" chunk-ext-val ] *WSP ) 828 chunk-ext-name = token 829 chunk-ext-val = token / quoted-string 830 chunk-data = 1*OCTET ; a sequence of chunk-size octets 831 trailer-part = *( entity-header CRLF ) 833 The chunk-size field is a string of hex digits indicating the size of 834 the chunk-data in octets. The chunked encoding is ended by any chunk 835 whose size is zero, followed by the trailer, which is terminated by 836 an empty line. 838 The trailer allows the sender to include additional HTTP header 839 fields at the end of the message. The Trailer header field can be 840 used to indicate which header fields are included in a trailer (see 841 Section 8.6). 843 A server using chunked transfer-coding in a response MUST NOT use the 844 trailer for any header fields unless at least one of the following is 845 true: 847 1. the request included a TE header field that indicates "trailers" 848 is acceptable in the transfer-coding of the response, as 849 described in Section 8.5; or, 851 2. the server is the origin server for the response, the trailer 852 fields consist entirely of optional metadata, and the recipient 853 could use the message (in a manner acceptable to the origin 854 server) without receiving this metadata. In other words, the 855 origin server is willing to accept the possibility that the 856 trailer fields might be silently discarded along the path to the 857 client. 859 This requirement prevents an interoperability failure when the 860 message is being received by an HTTP/1.1 (or later) proxy and 861 forwarded to an HTTP/1.0 recipient. It avoids a situation where 862 compliance with the protocol would have necessitated a possibly 863 infinite buffer on the proxy. 865 A process for decoding the "chunked" transfer-coding can be 866 represented in pseudo-code as: 868 length := 0 869 read chunk-size, chunk-ext (if any) and CRLF 870 while (chunk-size > 0) { 871 read chunk-data and CRLF 872 append chunk-data to entity-body 873 length := length + chunk-size 874 read chunk-size and CRLF 875 } 876 read entity-header 877 while (entity-header not empty) { 878 append entity-header to existing header fields 879 read entity-header 880 } 881 Content-Length := length 882 Remove "chunked" from Transfer-Encoding 884 All HTTP/1.1 applications MUST be able to receive and decode the 885 "chunked" transfer-coding, and MUST ignore chunk-ext extensions they 886 do not understand. 888 3.4. Product Tokens 890 Product tokens are used to allow communicating applications to 891 identify themselves by software name and version. Most fields using 892 product tokens also allow sub-products which form a significant part 893 of the application to be listed, separated by whitespace. By 894 convention, the products are listed in order of their significance 895 for identifying the application. 897 product = token ["/" product-version] 898 product-version = token 900 Examples: 902 User-Agent: CERN-LineMode/2.15 libwww/2.17b3 903 Server: Apache/0.8.4 905 Product tokens SHOULD be short and to the point. They MUST NOT be 906 used for advertising or other non-essential information. Although 907 any token character MAY appear in a product-version, this token 908 SHOULD only be used for a version identifier (i.e., successive 909 versions of the same product SHOULD only differ in the product- 910 version portion of the product value). 912 3.5. Quality Values 914 Both transfer codings (TE request header, Section 8.5) and content 915 negotiation (Section 4 of [Part3]) use short "floating point" numbers 916 to indicate the relative importance ("weight") of various negotiable 917 parameters. A weight is normalized to a real number in the range 0 918 through 1, where 0 is the minimum and 1 the maximum value. If a 919 parameter has a quality value of 0, then content with this parameter 920 is `not acceptable' for the client. HTTP/1.1 applications MUST NOT 921 generate more than three digits after the decimal point. User 922 configuration of these values SHOULD also be limited in this fashion. 924 qvalue = ( "0" [ "." 0*3DIGIT ] ) 925 / ( "1" [ "." 0*3("0") ] ) 927 Note: "Quality values" is a misnomer, since these values merely 928 represent relative degradation in desired quality. 930 4. HTTP Message 932 4.1. Message Types 934 HTTP messages consist of requests from client to server and responses 935 from server to client. 937 HTTP-message = Request / Response ; HTTP/1.1 messages 939 Request (Section 5) and Response (Section 6) messages use the generic 940 message format of [RFC5322] for transferring entities (the payload of 941 the message). Both types of message consist of a start-line, zero or 942 more header fields (also known as "headers"), an empty line (i.e., a 943 line with nothing preceding the CRLF) indicating the end of the 944 header fields, and possibly a message-body. 946 generic-message = start-line 947 *( message-header CRLF ) 948 CRLF 949 [ message-body ] 950 start-line = Request-Line / Status-Line 952 In the interest of robustness, servers SHOULD ignore any empty 953 line(s) received where a Request-Line is expected. In other words, 954 if the server is reading the protocol stream at the beginning of a 955 message and receives a CRLF first, it should ignore the CRLF. 957 Certain buggy HTTP/1.0 client implementations generate extra CRLF's 958 after a POST request. To restate what is explicitly forbidden by the 959 BNF, an HTTP/1.1 client MUST NOT preface or follow a request with an 960 extra CRLF. 962 Whitespace (WSP) MUST NOT be sent between the start-line and the 963 first header field. The presence of whitespace might be an attempt 964 to trick a noncompliant implementation of HTTP into ignoring that 965 field or processing the next line as a new request, either of which 966 may result in security issues when implementations within the request 967 chain interpret the same message differently. HTTP/1.1 servers MUST 968 reject such a message with a 400 (Bad Request) response. 970 4.2. Message Headers 972 HTTP header fields follow the same general format as Internet 973 messages in Section 2.1 of [RFC5322]. Each header field consists of 974 a name followed by a colon (":"), optional whitespace, and the field 975 value. Field names are case-insensitive. 977 message-header = field-name ":" OWS [ field-value ] OWS 978 field-name = token 979 field-value = *( field-content / OWS ) 980 field-content = *( WSP / VCHAR / obs-text ) 982 Historically, HTTP has allowed field-content with text in the ISO- 983 8859-1 [ISO-8859-1] character encoding (allowing other character sets 984 through use of [RFC2047] encoding). In practice, most HTTP header 985 field-values use only a subset of the US-ASCII charset [USASCII]. 986 Newly defined header fields SHOULD constrain their field-values to 987 US-ASCII characters. Recipients SHOULD treat other (obs-text) octets 988 in field-content as opaque data. 990 No whitespace is allowed between the header field-name and colon. 991 For security reasons, any request message received containing such 992 whitespace MUST be rejected with a response code of 400 (Bad Request) 993 and any such whitespace in a response message MUST be removed. 995 The field value MAY be preceded by optional whitespace; a single SP 996 is preferred. The field-value does not include any leading or 997 trailing white space: OWS occurring before the first non-whitespace 998 character of the field-value or after the last non-whitespace 999 character of the field-value is ignored and MAY be removed without 1000 changing the meaning of the header field. 1002 Historically, HTTP header field values could be extended over 1003 multiple lines by preceding each extra line with at least one space 1004 or horizontal tab character (line folding). This specification 1005 deprecates such line folding except within the message/http media 1006 type (Section 9.3.1). HTTP/1.1 senders MUST NOT produce messages 1007 that include line folding (i.e., that contain any field-content that 1008 matches the obs-fold rule) unless the message is intended for 1009 packaging within the message/http media type. HTTP/1.1 recipients 1010 SHOULD accept line folding and replace any embedded obs-fold 1011 whitespace with a single SP prior to interpreting the field value or 1012 forwarding the message downstream. 1014 Comments can be included in some HTTP header fields by surrounding 1015 the comment text with parentheses. Comments are only allowed in 1016 fields containing "comment" as part of their field value definition. 1017 In all other fields, parentheses are considered part of the field 1018 value. 1020 comment = "(" *( ctext / quoted-pair / comment ) ")" 1021 ctext = OWS / %x21-27 / %x2A-5B / %x5D-7E / obs-text 1022 ; OWS / / obs-text 1024 The order in which header fields with differing field names are 1025 received is not significant. However, it is "good practice" to send 1026 general-header fields first, followed by request-header or response- 1027 header fields, and ending with the entity-header fields. 1029 Multiple message-header fields with the same field-name MAY be 1030 present in a message if and only if the entire field-value for that 1031 header field is defined as a comma-separated list [i.e., #(values)]. 1032 It MUST be possible to combine the multiple header fields into one 1033 "field-name: field-value" pair, without changing the semantics of the 1034 message, by appending each subsequent field-value to the first, each 1035 separated by a comma. The order in which header fields with the same 1036 field-name are received is therefore significant to the 1037 interpretation of the combined field value, and thus a proxy MUST NOT 1038 change the order of these field values when a message is forwarded. 1040 Note: the "Set-Cookie" header as implemented in practice (as 1041 opposed to how it is specified in [RFC2109]) can occur multiple 1042 times, but does not use the list syntax, and thus cannot be 1043 combined into a single line. (See Appendix A.2.3 of [Kri2001] for 1044 details.) Also note that the Set-Cookie2 header specified in 1045 [RFC2965] does not share this problem. 1047 4.3. Message Body 1049 The message-body (if any) of an HTTP message is used to carry the 1050 entity-body associated with the request or response. The message- 1051 body differs from the entity-body only when a transfer-coding has 1052 been applied, as indicated by the Transfer-Encoding header field 1053 (Section 8.7). 1055 message-body = entity-body 1056 / 1058 Transfer-Encoding MUST be used to indicate any transfer-codings 1059 applied by an application to ensure safe and proper transfer of the 1060 message. Transfer-Encoding is a property of the message, not of the 1061 entity, and thus MAY be added or removed by any application along the 1062 request/response chain. (However, Section 3.3 places restrictions on 1063 when certain transfer-codings may be used.) 1065 The rules for when a message-body is allowed in a message differ for 1066 requests and responses. 1068 The presence of a message-body in a request is signaled by the 1069 inclusion of a Content-Length or Transfer-Encoding header field in 1070 the request's message-headers. When a request message contains both 1071 a message-body of non-zero length and a method that does not define 1072 any semantics for that request message-body, then an origin server 1073 SHOULD either ignore the message-body or respond with an appropriate 1074 error message (e.g., 413). A proxy or gateway, when presented the 1075 same request, SHOULD either forward the request inbound with the 1076 message-body or ignore the message-body when determining a response. 1078 For response messages, whether or not a message-body is included with 1079 a message is dependent on both the request method and the response 1080 status code (Section 6.1.1). All responses to the HEAD request 1081 method MUST NOT include a message-body, even though the presence of 1082 entity-header fields might lead one to believe they do. All 1xx 1083 (informational), 204 (No Content), and 304 (Not Modified) responses 1084 MUST NOT include a message-body. All other responses do include a 1085 message-body, although it MAY be of zero length. 1087 4.4. Message Length 1089 The transfer-length of a message is the length of the message-body as 1090 it appears in the message; that is, after any transfer-codings have 1091 been applied. When a message-body is included with a message, the 1092 transfer-length of that body is determined by one of the following 1093 (in order of precedence): 1095 1. Any response message which "MUST NOT" include a message-body 1096 (such as the 1xx, 204, and 304 responses and any response to a 1097 HEAD request) is always terminated by the first empty line after 1098 the header fields, regardless of the entity-header fields present 1099 in the message. 1101 2. If a Transfer-Encoding header field (Section 8.7) is present and 1102 the "chunked" transfer-coding (Section 3.3) is used, the 1103 transfer-length is defined by the use of this transfer-coding. 1104 If a Transfer-Encoding header field is present and the "chunked" 1105 transfer-coding is not present, the transfer-length is defined by 1106 the sender closing the connection. 1108 3. If a Content-Length header field (Section 8.2) is present, its 1109 value in OCTETs represents both the entity-length and the 1110 transfer-length. The Content-Length header field MUST NOT be 1111 sent if these two lengths are different (i.e., if a Transfer- 1112 Encoding header field is present). If a message is received with 1113 both a Transfer-Encoding header field and a Content-Length header 1114 field, the latter MUST be ignored. 1116 4. If the message uses the media type "multipart/byteranges", and 1117 the transfer-length is not otherwise specified, then this self- 1118 delimiting media type defines the transfer-length. This media 1119 type MUST NOT be used unless the sender knows that the recipient 1120 can parse it; the presence in a request of a Range header with 1121 multiple byte-range specifiers from a 1.1 client implies that the 1122 client can parse multipart/byteranges responses. 1124 A range header might be forwarded by a 1.0 proxy that does not 1125 understand multipart/byteranges; in this case the server MUST 1126 delimit the message using methods defined in items 1, 3 or 5 1127 of this section. 1129 5. By the server closing the connection. (Closing the connection 1130 cannot be used to indicate the end of a request body, since that 1131 would leave no possibility for the server to send back a 1132 response.) 1134 For compatibility with HTTP/1.0 applications, HTTP/1.1 requests 1135 containing a message-body MUST include a valid Content-Length header 1136 field unless the server is known to be HTTP/1.1 compliant. If a 1137 request contains a message-body and a Content-Length is not given, 1138 the server SHOULD respond with 400 (Bad Request) if it cannot 1139 determine the length of the message, or with 411 (Length Required) if 1140 it wishes to insist on receiving a valid Content-Length. 1142 All HTTP/1.1 applications that receive entities MUST accept the 1143 "chunked" transfer-coding (Section 3.3), thus allowing this mechanism 1144 to be used for messages when the message length cannot be determined 1145 in advance. 1147 Messages MUST NOT include both a Content-Length header field and a 1148 transfer-coding. If the message does include a transfer-coding, the 1149 Content-Length MUST be ignored. 1151 When a Content-Length is given in a message where a message-body is 1152 allowed, its field value MUST exactly match the number of OCTETs in 1153 the message-body. HTTP/1.1 user agents MUST notify the user when an 1154 invalid length is received and detected. 1156 4.5. General Header Fields 1158 There are a few header fields which have general applicability for 1159 both request and response messages, but which do not apply to the 1160 entity being transferred. These header fields apply only to the 1161 message being transmitted. 1163 general-header = Cache-Control ; [Part6], Section 3.2 1164 / Connection ; Section 8.1 1165 / Date ; Section 8.3 1166 / Pragma ; [Part6], Section 3.4 1167 / Trailer ; Section 8.6 1168 / Transfer-Encoding ; Section 8.7 1169 / Upgrade ; Section 8.8 1170 / Via ; Section 8.9 1171 / Warning ; [Part6], Section 3.6 1173 General-header field names can be extended reliably only in 1174 combination with a change in the protocol version. However, new or 1175 experimental header fields may be given the semantics of general 1176 header fields if all parties in the communication recognize them to 1177 be general-header fields. Unrecognized header fields are treated as 1178 entity-header fields. 1180 5. Request 1182 A request message from a client to a server includes, within the 1183 first line of that message, the method to be applied to the resource, 1184 the identifier of the resource, and the protocol version in use. 1186 Request = Request-Line ; Section 5.1 1187 *(( general-header ; Section 4.5 1188 / request-header ; [Part2], Section 3 1189 / entity-header ) CRLF ) ; [Part3], Section 3.1 1190 CRLF 1191 [ message-body ] ; Section 4.3 1193 5.1. Request-Line 1195 The Request-Line begins with a method token, followed by the request- 1196 target and the protocol version, and ending with CRLF. The elements 1197 are separated by SP characters. No CR or LF is allowed except in the 1198 final CRLF sequence. 1200 Request-Line = Method SP request-target SP HTTP-Version CRLF 1202 5.1.1. Method 1204 The Method token indicates the method to be performed on the resource 1205 identified by the request-target. The method is case-sensitive. 1207 Method = token 1209 5.1.2. request-target 1211 The request-target identifies the resource upon which to apply the 1212 request. 1214 request-target = "*" 1215 / absolute-URI 1216 / ( path-absolute [ "?" query ] ) 1217 / authority 1219 The four options for request-target are dependent on the nature of 1220 the request. The asterisk "*" means that the request does not apply 1221 to a particular resource, but to the server itself, and is only 1222 allowed when the method used does not necessarily apply to a 1223 resource. One example would be 1225 OPTIONS * HTTP/1.1 1227 The absolute-URI form is REQUIRED when the request is being made to a 1228 proxy. The proxy is requested to forward the request or service it 1229 from a valid cache, and return the response. Note that the proxy MAY 1230 forward the request on to another proxy or directly to the server 1231 specified by the absolute-URI. In order to avoid request loops, a 1232 proxy MUST be able to recognize all of its server names, including 1233 any aliases, local variations, and the numeric IP address. An 1234 example Request-Line would be: 1236 GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 1238 To allow for transition to absolute-URIs in all requests in future 1239 versions of HTTP, all HTTP/1.1 servers MUST accept the absolute-URI 1240 form in requests, even though HTTP/1.1 clients will only generate 1241 them in requests to proxies. 1243 The authority form is only used by the CONNECT method (Section 7.9 of 1244 [Part2]). 1246 The most common form of request-target is that used to identify a 1247 resource on an origin server or gateway. In this case the absolute 1248 path of the URI MUST be transmitted (see Section 2.1.1, path- 1249 absolute) as the request-target, and the network location of the URI 1250 (authority) MUST be transmitted in a Host header field. For example, 1251 a client wishing to retrieve the resource above directly from the 1252 origin server would create a TCP connection to port 80 of the host 1253 "www.example.org" and send the lines: 1255 GET /pub/WWW/TheProject.html HTTP/1.1 1256 Host: www.example.org 1258 followed by the remainder of the Request. Note that the absolute 1259 path cannot be empty; if none is present in the original URI, it MUST 1260 be given as "/" (the server root). 1262 If a proxy receives a request without any path in the request-target 1263 and the method specified is capable of supporting the asterisk form 1264 of request-target, then the last proxy on the request chain MUST 1265 forward the request with "*" as the final request-target. 1267 For example, the request 1269 OPTIONS http://www.example.org:8001 HTTP/1.1 1271 would be forwarded by the proxy as 1273 OPTIONS * HTTP/1.1 1274 Host: www.example.org:8001 1276 after connecting to port 8001 of host "www.example.org". 1278 The request-target is transmitted in the format specified in 1279 Section 2.1.1. If the request-target is percent-encoded ([RFC3986], 1280 Section 2.1), the origin server MUST decode the request-target in 1281 order to properly interpret the request. Servers SHOULD respond to 1282 invalid request-targets with an appropriate status code. 1284 A transparent proxy MUST NOT rewrite the "path-absolute" part of the 1285 received request-target when forwarding it to the next inbound 1286 server, except as noted above to replace a null path-absolute with 1287 "/". 1289 Note: The "no rewrite" rule prevents the proxy from changing the 1290 meaning of the request when the origin server is improperly using 1291 a non-reserved URI character for a reserved purpose. Implementors 1292 should be aware that some pre-HTTP/1.1 proxies have been known to 1293 rewrite the request-target. 1295 HTTP does not place a pre-defined limit on the length of a request- 1296 target. A server MUST be prepared to receive URIs of unbounded 1297 length and respond with the 414 (URI Too Long) status if the received 1298 request-target would be longer than the server wishes to handle (see 1299 Section 8.4.15 of [Part2]). 1301 Various ad-hoc limitations on request-target length are found in 1302 practice. It is RECOMMENDED that all HTTP senders and recipients 1303 support request-target lengths of 8000 or more OCTETs. 1305 5.2. The Resource Identified by a Request 1307 The exact resource identified by an Internet request is determined by 1308 examining both the request-target and the Host header field. 1310 An origin server that does not allow resources to differ by the 1311 requested host MAY ignore the Host header field value when 1312 determining the resource identified by an HTTP/1.1 request. (But see 1313 Appendix B.1.1 for other requirements on Host support in HTTP/1.1.) 1315 An origin server that does differentiate resources based on the host 1316 requested (sometimes referred to as virtual hosts or vanity host 1317 names) MUST use the following rules for determining the requested 1318 resource on an HTTP/1.1 request: 1320 1. If request-target is an absolute-URI, the host is part of the 1321 request-target. Any Host header field value in the request MUST 1322 be ignored. 1324 2. If the request-target is not an absolute-URI, and the request 1325 includes a Host header field, the host is determined by the Host 1326 header field value. 1328 3. If the host as determined by rule 1 or 2 is not a valid host on 1329 the server, the response MUST be a 400 (Bad Request) error 1330 message. 1332 Recipients of an HTTP/1.0 request that lacks a Host header field MAY 1333 attempt to use heuristics (e.g., examination of the URI path for 1334 something unique to a particular host) in order to determine what 1335 exact resource is being requested. 1337 6. Response 1339 After receiving and interpreting a request message, a server responds 1340 with an HTTP response message. 1342 Response = Status-Line ; Section 6.1 1343 *(( general-header ; Section 4.5 1344 / response-header ; [Part2], Section 5 1345 / entity-header ) CRLF ) ; [Part3], Section 3.1 1346 CRLF 1347 [ message-body ] ; Section 4.3 1349 6.1. Status-Line 1351 The first line of a Response message is the Status-Line, consisting 1352 of the protocol version followed by a numeric status code and its 1353 associated textual phrase, with each element separated by SP 1354 characters. No CR or LF is allowed except in the final CRLF 1355 sequence. 1357 Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF 1359 6.1.1. Status Code and Reason Phrase 1361 The Status-Code element is a 3-digit integer result code of the 1362 attempt to understand and satisfy the request. These codes are fully 1363 defined in Section 8 of [Part2]. The Reason Phrase exists for the 1364 sole purpose of providing a textual description associated with the 1365 numeric status code, out of deference to earlier Internet application 1366 protocols that were more frequently used with interactive text 1367 clients. A client SHOULD ignore the content of the Reason Phrase. 1369 The first digit of the Status-Code defines the class of response. 1370 The last two digits do not have any categorization role. There are 5 1371 values for the first digit: 1373 o 1xx: Informational - Request received, continuing process 1375 o 2xx: Success - The action was successfully received, understood, 1376 and accepted 1378 o 3xx: Redirection - Further action must be taken in order to 1379 complete the request 1381 o 4xx: Client Error - The request contains bad syntax or cannot be 1382 fulfilled 1384 o 5xx: Server Error - The server failed to fulfill an apparently 1385 valid request 1387 Status-Code = 3DIGIT 1388 Reason-Phrase = *( WSP / VCHAR / obs-text ) 1390 7. Connections 1392 7.1. Persistent Connections 1394 7.1.1. Purpose 1396 Prior to persistent connections, a separate TCP connection was 1397 established to fetch each URL, increasing the load on HTTP servers 1398 and causing congestion on the Internet. The use of inline images and 1399 other associated data often require a client to make multiple 1400 requests of the same server in a short amount of time. Analysis of 1401 these performance problems and results from a prototype 1402 implementation are available [Pad1995] [Spe]. Implementation 1403 experience and measurements of actual HTTP/1.1 implementations show 1404 good results [Nie1997]. Alternatives have also been explored, for 1405 example, T/TCP [Tou1998]. 1407 Persistent HTTP connections have a number of advantages: 1409 o By opening and closing fewer TCP connections, CPU time is saved in 1410 routers and hosts (clients, servers, proxies, gateways, tunnels, 1411 or caches), and memory used for TCP protocol control blocks can be 1412 saved in hosts. 1414 o HTTP requests and responses can be pipelined on a connection. 1415 Pipelining allows a client to make multiple requests without 1416 waiting for each response, allowing a single TCP connection to be 1417 used much more efficiently, with much lower elapsed time. 1419 o Network congestion is reduced by reducing the number of packets 1420 caused by TCP opens, and by allowing TCP sufficient time to 1421 determine the congestion state of the network. 1423 o Latency on subsequent requests is reduced since there is no time 1424 spent in TCP's connection opening handshake. 1426 o HTTP can evolve more gracefully, since errors can be reported 1427 without the penalty of closing the TCP connection. Clients using 1428 future versions of HTTP might optimistically try a new feature, 1429 but if communicating with an older server, retry with old 1430 semantics after an error is reported. 1432 HTTP implementations SHOULD implement persistent connections. 1434 7.1.2. Overall Operation 1436 A significant difference between HTTP/1.1 and earlier versions of 1437 HTTP is that persistent connections are the default behavior of any 1438 HTTP connection. That is, unless otherwise indicated, the client 1439 SHOULD assume that the server will maintain a persistent connection, 1440 even after error responses from the server. 1442 Persistent connections provide a mechanism by which a client and a 1443 server can signal the close of a TCP connection. This signaling 1444 takes place using the Connection header field (Section 8.1). Once a 1445 close has been signaled, the client MUST NOT send any more requests 1446 on that connection. 1448 7.1.2.1. Negotiation 1450 An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to 1451 maintain a persistent connection unless a Connection header including 1452 the connection-token "close" was sent in the request. If the server 1453 chooses to close the connection immediately after sending the 1454 response, it SHOULD send a Connection header including the 1455 connection-token close. 1457 An HTTP/1.1 client MAY expect a connection to remain open, but would 1458 decide to keep it open based on whether the response from a server 1459 contains a Connection header with the connection-token close. In 1460 case the client does not want to maintain a connection for more than 1461 that request, it SHOULD send a Connection header including the 1462 connection-token close. 1464 If either the client or the server sends the close token in the 1465 Connection header, that request becomes the last one for the 1466 connection. 1468 Clients and servers SHOULD NOT assume that a persistent connection is 1469 maintained for HTTP versions less than 1.1 unless it is explicitly 1470 signaled. See Appendix B.2 for more information on backward 1471 compatibility with HTTP/1.0 clients. 1473 In order to remain persistent, all messages on the connection MUST 1474 have a self-defined message length (i.e., one not defined by closure 1475 of the connection), as described in Section 4.4. 1477 7.1.2.2. Pipelining 1479 A client that supports persistent connections MAY "pipeline" its 1480 requests (i.e., send multiple requests without waiting for each 1481 response). A server MUST send its responses to those requests in the 1482 same order that the requests were received. 1484 Clients which assume persistent connections and pipeline immediately 1485 after connection establishment SHOULD be prepared to retry their 1486 connection if the first pipelined attempt fails. If a client does 1487 such a retry, it MUST NOT pipeline before it knows the connection is 1488 persistent. Clients MUST also be prepared to resend their requests 1489 if the server closes the connection before sending all of the 1490 corresponding responses. 1492 Clients SHOULD NOT pipeline requests using non-idempotent methods or 1493 non-idempotent sequences of methods (see Section 7.1.2 of [Part2]). 1494 Otherwise, a premature termination of the transport connection could 1495 lead to indeterminate results. A client wishing to send a non- 1496 idempotent request SHOULD wait to send that request until it has 1497 received the response status for the previous request. 1499 7.1.3. Proxy Servers 1501 It is especially important that proxies correctly implement the 1502 properties of the Connection header field as specified in 1503 Section 8.1. 1505 The proxy server MUST signal persistent connections separately with 1506 its clients and the origin servers (or other proxy servers) that it 1507 connects to. Each persistent connection applies to only one 1508 transport link. 1510 A proxy server MUST NOT establish a HTTP/1.1 persistent connection 1511 with an HTTP/1.0 client (but see Section 19.7.1 of [RFC2068] for 1512 information and discussion of the problems with the Keep-Alive header 1513 implemented by many HTTP/1.0 clients). 1515 7.1.4. Practical Considerations 1517 Servers will usually have some time-out value beyond which they will 1518 no longer maintain an inactive connection. Proxy servers might make 1519 this a higher value since it is likely that the client will be making 1520 more connections through the same server. The use of persistent 1521 connections places no requirements on the length (or existence) of 1522 this time-out for either the client or the server. 1524 When a client or server wishes to time-out it SHOULD issue a graceful 1525 close on the transport connection. Clients and servers SHOULD both 1526 constantly watch for the other side of the transport close, and 1527 respond to it as appropriate. If a client or server does not detect 1528 the other side's close promptly it could cause unnecessary resource 1529 drain on the network. 1531 A client, server, or proxy MAY close the transport connection at any 1532 time. For example, a client might have started to send a new request 1533 at the same time that the server has decided to close the "idle" 1534 connection. From the server's point of view, the connection is being 1535 closed while it was idle, but from the client's point of view, a 1536 request is in progress. 1538 This means that clients, servers, and proxies MUST be able to recover 1539 from asynchronous close events. Client software SHOULD reopen the 1540 transport connection and retransmit the aborted sequence of requests 1541 without user interaction so long as the request sequence is 1542 idempotent (see Section 7.1.2 of [Part2]). Non-idempotent methods or 1543 sequences MUST NOT be automatically retried, although user agents MAY 1544 offer a human operator the choice of retrying the request(s). 1545 Confirmation by user-agent software with semantic understanding of 1546 the application MAY substitute for user confirmation. The automatic 1547 retry SHOULD NOT be repeated if the second sequence of requests 1548 fails. 1550 Servers SHOULD always respond to at least one request per connection, 1551 if at all possible. Servers SHOULD NOT close a connection in the 1552 middle of transmitting a response, unless a network or client failure 1553 is suspected. 1555 Clients that use persistent connections SHOULD limit the number of 1556 simultaneous connections that they maintain to a given server. A 1557 single-user client SHOULD NOT maintain more than 2 connections with 1558 any server or proxy. A proxy SHOULD use up to 2*N connections to 1559 another server or proxy, where N is the number of simultaneously 1560 active users. These guidelines are intended to improve HTTP response 1561 times and avoid congestion. 1563 7.2. Message Transmission Requirements 1565 7.2.1. Persistent Connections and Flow Control 1567 HTTP/1.1 servers SHOULD maintain persistent connections and use TCP's 1568 flow control mechanisms to resolve temporary overloads, rather than 1569 terminating connections with the expectation that clients will retry. 1570 The latter technique can exacerbate network congestion. 1572 7.2.2. Monitoring Connections for Error Status Messages 1574 An HTTP/1.1 (or later) client sending a message-body SHOULD monitor 1575 the network connection for an error status while it is transmitting 1576 the request. If the client sees an error status, it SHOULD 1577 immediately cease transmitting the body. If the body is being sent 1578 using a "chunked" encoding (Section 3.3), a zero length chunk and 1579 empty trailer MAY be used to prematurely mark the end of the message. 1580 If the body was preceded by a Content-Length header, the client MUST 1581 close the connection. 1583 7.2.3. Use of the 100 (Continue) Status 1585 The purpose of the 100 (Continue) status (see Section 8.1.1 of 1586 [Part2]) is to allow a client that is sending a request message with 1587 a request body to determine if the origin server is willing to accept 1588 the request (based on the request headers) before the client sends 1589 the request body. In some cases, it might either be inappropriate or 1590 highly inefficient for the client to send the body if the server will 1591 reject the message without looking at the body. 1593 Requirements for HTTP/1.1 clients: 1595 o If a client will wait for a 100 (Continue) response before sending 1596 the request body, it MUST send an Expect request-header field 1597 (Section 9.2 of [Part2]) with the "100-continue" expectation. 1599 o A client MUST NOT send an Expect request-header field (Section 9.2 1600 of [Part2]) with the "100-continue" expectation if it does not 1601 intend to send a request body. 1603 Because of the presence of older implementations, the protocol allows 1604 ambiguous situations in which a client may send "Expect: 100- 1605 continue" without receiving either a 417 (Expectation Failed) status 1606 or a 100 (Continue) status. Therefore, when a client sends this 1607 header field to an origin server (possibly via a proxy) from which it 1608 has never seen a 100 (Continue) status, the client SHOULD NOT wait 1609 for an indefinite period before sending the request body. 1611 Requirements for HTTP/1.1 origin servers: 1613 o Upon receiving a request which includes an Expect request-header 1614 field with the "100-continue" expectation, an origin server MUST 1615 either respond with 100 (Continue) status and continue to read 1616 from the input stream, or respond with a final status code. The 1617 origin server MUST NOT wait for the request body before sending 1618 the 100 (Continue) response. If it responds with a final status 1619 code, it MAY close the transport connection or it MAY continue to 1620 read and discard the rest of the request. It MUST NOT perform the 1621 requested method if it returns a final status code. 1623 o An origin server SHOULD NOT send a 100 (Continue) response if the 1624 request message does not include an Expect request-header field 1625 with the "100-continue" expectation, and MUST NOT send a 100 1626 (Continue) response if such a request comes from an HTTP/1.0 (or 1627 earlier) client. There is an exception to this rule: for 1628 compatibility with [RFC2068], a server MAY send a 100 (Continue) 1629 status in response to an HTTP/1.1 PUT or POST request that does 1630 not include an Expect request-header field with the "100-continue" 1631 expectation. This exception, the purpose of which is to minimize 1632 any client processing delays associated with an undeclared wait 1633 for 100 (Continue) status, applies only to HTTP/1.1 requests, and 1634 not to requests with any other HTTP-version value. 1636 o An origin server MAY omit a 100 (Continue) response if it has 1637 already received some or all of the request body for the 1638 corresponding request. 1640 o An origin server that sends a 100 (Continue) response MUST 1641 ultimately send a final status code, once the request body is 1642 received and processed, unless it terminates the transport 1643 connection prematurely. 1645 o If an origin server receives a request that does not include an 1646 Expect request-header field with the "100-continue" expectation, 1647 the request includes a request body, and the server responds with 1648 a final status code before reading the entire request body from 1649 the transport connection, then the server SHOULD NOT close the 1650 transport connection until it has read the entire request, or 1651 until the client closes the connection. Otherwise, the client 1652 might not reliably receive the response message. However, this 1653 requirement is not be construed as preventing a server from 1654 defending itself against denial-of-service attacks, or from badly 1655 broken client implementations. 1657 Requirements for HTTP/1.1 proxies: 1659 o If a proxy receives a request that includes an Expect request- 1660 header field with the "100-continue" expectation, and the proxy 1661 either knows that the next-hop server complies with HTTP/1.1 or 1662 higher, or does not know the HTTP version of the next-hop server, 1663 it MUST forward the request, including the Expect header field. 1665 o If the proxy knows that the version of the next-hop server is 1666 HTTP/1.0 or lower, it MUST NOT forward the request, and it MUST 1667 respond with a 417 (Expectation Failed) status. 1669 o Proxies SHOULD maintain a cache recording the HTTP version numbers 1670 received from recently-referenced next-hop servers. 1672 o A proxy MUST NOT forward a 100 (Continue) response if the request 1673 message was received from an HTTP/1.0 (or earlier) client and did 1674 not include an Expect request-header field with the "100-continue" 1675 expectation. This requirement overrides the general rule for 1676 forwarding of 1xx responses (see Section 8.1 of [Part2]). 1678 7.2.4. Client Behavior if Server Prematurely Closes Connection 1680 If an HTTP/1.1 client sends a request which includes a request body, 1681 but which does not include an Expect request-header field with the 1682 "100-continue" expectation, and if the client is not directly 1683 connected to an HTTP/1.1 origin server, and if the client sees the 1684 connection close before receiving any status from the server, the 1685 client SHOULD retry the request. If the client does retry this 1686 request, it MAY use the following "binary exponential backoff" 1687 algorithm to be assured of obtaining a reliable response: 1689 1. Initiate a new connection to the server 1691 2. Transmit the request-headers 1693 3. Initialize a variable R to the estimated round-trip time to the 1694 server (e.g., based on the time it took to establish the 1695 connection), or to a constant value of 5 seconds if the round- 1696 trip time is not available. 1698 4. Compute T = R * (2**N), where N is the number of previous retries 1699 of this request. 1701 5. Wait either for an error response from the server, or for T 1702 seconds (whichever comes first) 1704 6. If no error response is received, after T seconds transmit the 1705 body of the request. 1707 7. If client sees that the connection is closed prematurely, repeat 1708 from step 1 until the request is accepted, an error response is 1709 received, or the user becomes impatient and terminates the retry 1710 process. 1712 If at any point an error status is received, the client 1714 o SHOULD NOT continue and 1716 o SHOULD close the connection if it has not completed sending the 1717 request message. 1719 8. Header Field Definitions 1721 This section defines the syntax and semantics of HTTP/1.1 header 1722 fields related to message framing and transport protocols. 1724 For entity-header fields, both sender and recipient refer to either 1725 the client or the server, depending on who sends and who receives the 1726 entity. 1728 8.1. Connection 1730 The general-header field "Connection" allows the sender to specify 1731 options that are desired for that particular connection and MUST NOT 1732 be communicated by proxies over further connections. 1734 The Connection header's value has the following grammar: 1736 Connection = "Connection" ":" OWS Connection-v 1737 Connection-v = 1#connection-token 1738 connection-token = token 1740 HTTP/1.1 proxies MUST parse the Connection header field before a 1741 message is forwarded and, for each connection-token in this field, 1742 remove any header field(s) from the message with the same name as the 1743 connection-token. Connection options are signaled by the presence of 1744 a connection-token in the Connection header field, not by any 1745 corresponding additional header field(s), since the additional header 1746 field may not be sent if there are no parameters associated with that 1747 connection option. 1749 Message headers listed in the Connection header MUST NOT include end- 1750 to-end headers, such as Cache-Control. 1752 HTTP/1.1 defines the "close" connection option for the sender to 1753 signal that the connection will be closed after completion of the 1754 response. For example, 1756 Connection: close 1758 in either the request or the response header fields indicates that 1759 the connection SHOULD NOT be considered `persistent' (Section 7.1) 1760 after the current request/response is complete. 1762 An HTTP/1.1 client that does not support persistent connections MUST 1763 include the "close" connection option in every request message. 1765 An HTTP/1.1 server that does not support persistent connections MUST 1766 include the "close" connection option in every response message that 1767 does not have a 1xx (informational) status code. 1769 A system receiving an HTTP/1.0 (or lower-version) message that 1770 includes a Connection header MUST, for each connection-token in this 1771 field, remove and ignore any header field(s) from the message with 1772 the same name as the connection-token. This protects against 1773 mistaken forwarding of such header fields by pre-HTTP/1.1 proxies. 1774 See Appendix B.2. 1776 8.2. Content-Length 1778 The entity-header field "Content-Length" indicates the size of the 1779 entity-body, in number of OCTETs, sent to the recipient or, in the 1780 case of the HEAD method, the size of the entity-body that would have 1781 been sent had the request been a GET. 1783 Content-Length = "Content-Length" ":" OWS 1*Content-Length-v 1784 Content-Length-v = 1*DIGIT 1786 An example is 1788 Content-Length: 3495 1790 Applications SHOULD use this field to indicate the transfer-length of 1791 the message-body, unless this is prohibited by the rules in 1792 Section 4.4. 1794 Any Content-Length greater than or equal to zero is a valid value. 1795 Section 4.4 describes how to determine the length of a message-body 1796 if a Content-Length is not given. 1798 Note that the meaning of this field is significantly different from 1799 the corresponding definition in MIME, where it is an optional field 1800 used within the "message/external-body" content-type. In HTTP, it 1801 SHOULD be sent whenever the message's length can be determined prior 1802 to being transferred, unless this is prohibited by the rules in 1803 Section 4.4. 1805 8.3. Date 1807 The general-header field "Date" represents the date and time at which 1808 the message was originated, having the same semantics as orig-date in 1809 Section 3.6.1 of [RFC5322]. The field value is an HTTP-date, as 1810 described in Section 3.2; it MUST be sent in rfc1123-date format. 1812 Date = "Date" ":" OWS Date-v 1813 Date-v = HTTP-date 1815 An example is 1817 Date: Tue, 15 Nov 1994 08:12:31 GMT 1819 Origin servers MUST include a Date header field in all responses, 1820 except in these cases: 1822 1. If the response status code is 100 (Continue) or 101 (Switching 1823 Protocols), the response MAY include a Date header field, at the 1824 server's option. 1826 2. If the response status code conveys a server error, e.g. 500 1827 (Internal Server Error) or 503 (Service Unavailable), and it is 1828 inconvenient or impossible to generate a valid Date. 1830 3. If the server does not have a clock that can provide a reasonable 1831 approximation of the current time, its responses MUST NOT include 1832 a Date header field. In this case, the rules in Section 8.3.1 1833 MUST be followed. 1835 A received message that does not have a Date header field MUST be 1836 assigned one by the recipient if the message will be cached by that 1837 recipient or gatewayed via a protocol which requires a Date. An HTTP 1838 implementation without a clock MUST NOT cache responses without 1839 revalidating them on every use. An HTTP cache, especially a shared 1840 cache, SHOULD use a mechanism, such as NTP [RFC1305], to synchronize 1841 its clock with a reliable external standard. 1843 Clients SHOULD only send a Date header field in messages that include 1844 an entity-body, as in the case of the PUT and POST requests, and even 1845 then it is optional. A client without a clock MUST NOT send a Date 1846 header field in a request. 1848 The HTTP-date sent in a Date header SHOULD NOT represent a date and 1849 time subsequent to the generation of the message. It SHOULD 1850 represent the best available approximation of the date and time of 1851 message generation, unless the implementation has no means of 1852 generating a reasonably accurate date and time. In theory, the date 1853 ought to represent the moment just before the entity is generated. 1854 In practice, the date can be generated at any time during the message 1855 origination without affecting its semantic value. 1857 8.3.1. Clockless Origin Server Operation 1859 Some origin server implementations might not have a clock available. 1860 An origin server without a clock MUST NOT assign Expires or Last- 1861 Modified values to a response, unless these values were associated 1862 with the resource by a system or user with a reliable clock. It MAY 1863 assign an Expires value that is known, at or before server 1864 configuration time, to be in the past (this allows "pre-expiration" 1865 of responses without storing separate Expires values for each 1866 resource). 1868 8.4. Host 1870 The request-header field "Host" specifies the Internet host and port 1871 number of the resource being requested, as obtained from the original 1872 URI given by the user or referring resource (generally an http URI, 1873 as described in Section 2.1.1). The Host field value MUST represent 1874 the naming authority of the origin server or gateway given by the 1875 original URL. This allows the origin server or gateway to 1876 differentiate between internally-ambiguous URLs, such as the root "/" 1877 URL of a server for multiple host names on a single IP address. 1879 Host = "Host" ":" OWS Host-v 1880 Host-v = uri-host [ ":" port ] ; Section 2.1.1 1882 A "host" without any trailing port information implies the default 1883 port for the service requested (e.g., "80" for an HTTP URL). For 1884 example, a request on the origin server for 1885 would properly include: 1887 GET /pub/WWW/ HTTP/1.1 1888 Host: www.example.org 1890 A client MUST include a Host header field in all HTTP/1.1 request 1891 messages. If the requested URI does not include an Internet host 1892 name for the service being requested, then the Host header field MUST 1893 be given with an empty value. An HTTP/1.1 proxy MUST ensure that any 1894 request message it forwards does contain an appropriate Host header 1895 field that identifies the service being requested by the proxy. All 1896 Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request) 1897 status code to any HTTP/1.1 request message which lacks a Host header 1898 field. 1900 See Sections 5.2 and B.1.1 for other requirements relating to Host. 1902 8.5. TE 1904 The request-header field "TE" indicates what extension transfer- 1905 codings it is willing to accept in the response and whether or not it 1906 is willing to accept trailer fields in a chunked transfer-coding. 1907 Its value may consist of the keyword "trailers" and/or a comma- 1908 separated list of extension transfer-coding names with optional 1909 accept parameters (as described in Section 3.3). 1911 TE = "TE" ":" OWS TE-v 1912 TE-v = #t-codings 1913 t-codings = "trailers" / ( transfer-extension [ te-params ] ) 1914 te-params = OWS ";" OWS "q=" qvalue *( te-ext ) 1915 te-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 1917 The presence of the keyword "trailers" indicates that the client is 1918 willing to accept trailer fields in a chunked transfer-coding, as 1919 defined in Section 3.3.1. This keyword is reserved for use with 1920 transfer-coding values even though it does not itself represent a 1921 transfer-coding. 1923 Examples of its use are: 1925 TE: deflate 1926 TE: 1927 TE: trailers, deflate;q=0.5 1929 The TE header field only applies to the immediate connection. 1930 Therefore, the keyword MUST be supplied within a Connection header 1931 field (Section 8.1) whenever TE is present in an HTTP/1.1 message. 1933 A server tests whether a transfer-coding is acceptable, according to 1934 a TE field, using these rules: 1936 1. The "chunked" transfer-coding is always acceptable. If the 1937 keyword "trailers" is listed, the client indicates that it is 1938 willing to accept trailer fields in the chunked response on 1939 behalf of itself and any downstream clients. The implication is 1940 that, if given, the client is stating that either all downstream 1941 clients are willing to accept trailer fields in the forwarded 1942 response, or that it will attempt to buffer the response on 1943 behalf of downstream recipients. 1945 Note: HTTP/1.1 does not define any means to limit the size of a 1946 chunked response such that a client can be assured of buffering 1947 the entire response. 1949 2. If the transfer-coding being tested is one of the transfer- 1950 codings listed in the TE field, then it is acceptable unless it 1951 is accompanied by a qvalue of 0. (As defined in Section 3.5, a 1952 qvalue of 0 means "not acceptable.") 1954 3. If multiple transfer-codings are acceptable, then the acceptable 1955 transfer-coding with the highest non-zero qvalue is preferred. 1956 The "chunked" transfer-coding always has a qvalue of 1. 1958 If the TE field-value is empty or if no TE field is present, the only 1959 transfer-coding is "chunked". A message with no transfer-coding is 1960 always acceptable. 1962 8.6. Trailer 1964 The general field "Trailer" indicates that the given set of header 1965 fields is present in the trailer of a message encoded with chunked 1966 transfer-coding. 1968 Trailer = "Trailer" ":" OWS Trailer-v 1969 Trailer-v = 1#field-name 1971 An HTTP/1.1 message SHOULD include a Trailer header field in a 1972 message using chunked transfer-coding with a non-empty trailer. 1973 Doing so allows the recipient to know which header fields to expect 1974 in the trailer. 1976 If no Trailer header field is present, the trailer SHOULD NOT include 1977 any header fields. See Section 3.3.1 for restrictions on the use of 1978 trailer fields in a "chunked" transfer-coding. 1980 Message header fields listed in the Trailer header field MUST NOT 1981 include the following header fields: 1983 o Transfer-Encoding 1985 o Content-Length 1987 o Trailer 1989 8.7. Transfer-Encoding 1991 The general-header "Transfer-Encoding" field indicates what (if any) 1992 type of transformation has been applied to the message body in order 1993 to safely transfer it between the sender and the recipient. This 1994 differs from the content-coding in that the transfer-coding is a 1995 property of the message, not of the entity. 1997 Transfer-Encoding = "Transfer-Encoding" ":" OWS 1998 Transfer-Encoding-v 1999 Transfer-Encoding-v = 1#transfer-coding 2001 Transfer-codings are defined in Section 3.3. An example is: 2003 Transfer-Encoding: chunked 2005 If multiple encodings have been applied to an entity, the transfer- 2006 codings MUST be listed in the order in which they were applied. 2007 Additional information about the encoding parameters MAY be provided 2008 by other entity-header fields not defined by this specification. 2010 Many older HTTP/1.0 applications do not understand the Transfer- 2011 Encoding header. 2013 8.8. Upgrade 2015 The general-header "Upgrade" allows the client to specify what 2016 additional communication protocols it supports and would like to use 2017 if the server finds it appropriate to switch protocols. The server 2018 MUST use the Upgrade header field within a 101 (Switching Protocols) 2019 response to indicate which protocol(s) are being switched. 2021 Upgrade = "Upgrade" ":" OWS Upgrade-v 2022 Upgrade-v = 1#product 2024 For example, 2026 Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11 2028 The Upgrade header field is intended to provide a simple mechanism 2029 for transition from HTTP/1.1 to some other, incompatible protocol. 2030 It does so by allowing the client to advertise its desire to use 2031 another protocol, such as a later version of HTTP with a higher major 2032 version number, even though the current request has been made using 2033 HTTP/1.1. This eases the difficult transition between incompatible 2034 protocols by allowing the client to initiate a request in the more 2035 commonly supported protocol while indicating to the server that it 2036 would like to use a "better" protocol if available (where "better" is 2037 determined by the server, possibly according to the nature of the 2038 method and/or resource being requested). 2040 The Upgrade header field only applies to switching application-layer 2041 protocols upon the existing transport-layer connection. Upgrade 2042 cannot be used to insist on a protocol change; its acceptance and use 2043 by the server is optional. The capabilities and nature of the 2044 application-layer communication after the protocol change is entirely 2045 dependent upon the new protocol chosen, although the first action 2046 after changing the protocol MUST be a response to the initial HTTP 2047 request containing the Upgrade header field. 2049 The Upgrade header field only applies to the immediate connection. 2050 Therefore, the upgrade keyword MUST be supplied within a Connection 2051 header field (Section 8.1) whenever Upgrade is present in an HTTP/1.1 2052 message. 2054 The Upgrade header field cannot be used to indicate a switch to a 2055 protocol on a different connection. For that purpose, it is more 2056 appropriate to use a 301, 302, 303, or 305 redirection response. 2058 This specification only defines the protocol name "HTTP" for use by 2059 the family of Hypertext Transfer Protocols, as defined by the HTTP 2060 version rules of Section 3.1 and future updates to this 2061 specification. Any token can be used as a protocol name; however, it 2062 will only be useful if both the client and server associate the name 2063 with the same protocol. 2065 8.9. Via 2067 The general-header field "Via" MUST be used by gateways and proxies 2068 to indicate the intermediate protocols and recipients between the 2069 user agent and the server on requests, and between the origin server 2070 and the client on responses. It is analogous to the "Received" field 2071 defined in Section 3.6.7 of [RFC5322] and is intended to be used for 2072 tracking message forwards, avoiding request loops, and identifying 2073 the protocol capabilities of all senders along the request/response 2074 chain. 2076 Via = "Via" ":" OWS Via-v 2077 Via-v = 1#( received-protocol RWS received-by 2078 [ RWS comment ] ) 2079 received-protocol = [ protocol-name "/" ] protocol-version 2080 protocol-name = token 2081 protocol-version = token 2082 received-by = ( uri-host [ ":" port ] ) / pseudonym 2083 pseudonym = token 2085 The received-protocol indicates the protocol version of the message 2086 received by the server or client along each segment of the request/ 2087 response chain. The received-protocol version is appended to the Via 2088 field value when the message is forwarded so that information about 2089 the protocol capabilities of upstream applications remains visible to 2090 all recipients. 2092 The protocol-name is optional if and only if it would be "HTTP". The 2093 received-by field is normally the host and optional port number of a 2094 recipient server or client that subsequently forwarded the message. 2095 However, if the real host is considered to be sensitive information, 2096 it MAY be replaced by a pseudonym. If the port is not given, it MAY 2097 be assumed to be the default port of the received-protocol. 2099 Multiple Via field values represents each proxy or gateway that has 2100 forwarded the message. Each recipient MUST append its information 2101 such that the end result is ordered according to the sequence of 2102 forwarding applications. 2104 Comments MAY be used in the Via header field to identify the software 2105 of the recipient proxy or gateway, analogous to the User-Agent and 2106 Server header fields. However, all comments in the Via field are 2107 optional and MAY be removed by any recipient prior to forwarding the 2108 message. 2110 For example, a request message could be sent from an HTTP/1.0 user 2111 agent to an internal proxy code-named "fred", which uses HTTP/1.1 to 2112 forward the request to a public proxy at p.example.net, which 2113 completes the request by forwarding it to the origin server at 2114 www.example.com. The request received by www.example.com would then 2115 have the following Via header field: 2117 Via: 1.0 fred, 1.1 p.example.net (Apache/1.1) 2119 Proxies and gateways used as a portal through a network firewall 2120 SHOULD NOT, by default, forward the names and ports of hosts within 2121 the firewall region. This information SHOULD only be propagated if 2122 explicitly enabled. If not enabled, the received-by host of any host 2123 behind the firewall SHOULD be replaced by an appropriate pseudonym 2124 for that host. 2126 For organizations that have strong privacy requirements for hiding 2127 internal structures, a proxy MAY combine an ordered subsequence of 2128 Via header field entries with identical received-protocol values into 2129 a single such entry. For example, 2131 Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy 2133 could be collapsed to 2135 Via: 1.0 ricky, 1.1 mertz, 1.0 lucy 2137 Applications SHOULD NOT combine multiple entries unless they are all 2138 under the same organizational control and the hosts have already been 2139 replaced by pseudonyms. Applications MUST NOT combine entries which 2140 have different received-protocol values. 2142 9. IANA Considerations 2144 9.1. Message Header Registration 2146 The Message Header Registry located at should be 2148 updated with the permanent registrations below (see [RFC3864]): 2150 +-------------------+----------+----------+-------------+ 2151 | Header Field Name | Protocol | Status | Reference | 2152 +-------------------+----------+----------+-------------+ 2153 | Connection | http | standard | Section 8.1 | 2154 | Content-Length | http | standard | Section 8.2 | 2155 | Date | http | standard | Section 8.3 | 2156 | Host | http | standard | Section 8.4 | 2157 | TE | http | standard | Section 8.5 | 2158 | Trailer | http | standard | Section 8.6 | 2159 | Transfer-Encoding | http | standard | Section 8.7 | 2160 | Upgrade | http | standard | Section 8.8 | 2161 | Via | http | standard | Section 8.9 | 2162 +-------------------+----------+----------+-------------+ 2164 The change controller is: "IETF (iesg@ietf.org) - Internet 2165 Engineering Task Force". 2167 9.2. URI Scheme Registration 2169 The entry for the "http" URI Scheme in the registry located at 2170 should be updated 2171 to point to Section 2.1.1 of this document (see [RFC4395]). 2173 9.3. Internet Media Type Registrations 2175 This document serves as the specification for the Internet media 2176 types "message/http" and "application/http". The following is to be 2177 registered with IANA (see [RFC4288]). 2179 9.3.1. Internet Media Type message/http 2181 The message/http type can be used to enclose a single HTTP request or 2182 response message, provided that it obeys the MIME restrictions for 2183 all "message" types regarding line length and encodings. 2185 Type name: message 2187 Subtype name: http 2189 Required parameters: none 2191 Optional parameters: version, msgtype 2193 version: The HTTP-Version number of the enclosed message (e.g., 2194 "1.1"). If not present, the version can be determined from the 2195 first line of the body. 2197 msgtype: The message type -- "request" or "response". If not 2198 present, the type can be determined from the first line of the 2199 body. 2201 Encoding considerations: only "7bit", "8bit", or "binary" are 2202 permitted 2204 Security considerations: none 2206 Interoperability considerations: none 2208 Published specification: This specification (see Section 9.3.1). 2210 Applications that use this media type: 2212 Additional information: 2214 Magic number(s): none 2216 File extension(s): none 2218 Macintosh file type code(s): none 2220 Person and email address to contact for further information: See 2221 Authors Section. 2223 Intended usage: COMMON 2225 Restrictions on usage: none 2227 Author/Change controller: IESG 2229 9.3.2. Internet Media Type application/http 2231 The application/http type can be used to enclose a pipeline of one or 2232 more HTTP request or response messages (not intermixed). 2234 Type name: application 2236 Subtype name: http 2238 Required parameters: none 2240 Optional parameters: version, msgtype 2241 version: The HTTP-Version number of the enclosed messages (e.g., 2242 "1.1"). If not present, the version can be determined from the 2243 first line of the body. 2245 msgtype: The message type -- "request" or "response". If not 2246 present, the type can be determined from the first line of the 2247 body. 2249 Encoding considerations: HTTP messages enclosed by this type are in 2250 "binary" format; use of an appropriate Content-Transfer-Encoding 2251 is required when transmitted via E-mail. 2253 Security considerations: none 2255 Interoperability considerations: none 2257 Published specification: This specification (see Section 9.3.2). 2259 Applications that use this media type: 2261 Additional information: 2263 Magic number(s): none 2265 File extension(s): none 2267 Macintosh file type code(s): none 2269 Person and email address to contact for further information: See 2270 Authors Section. 2272 Intended usage: COMMON 2274 Restrictions on usage: none 2276 Author/Change controller: IESG 2278 10. Security Considerations 2280 This section is meant to inform application developers, information 2281 providers, and users of the security limitations in HTTP/1.1 as 2282 described by this document. The discussion does not include 2283 definitive solutions to the problems revealed, though it does make 2284 some suggestions for reducing security risks. 2286 10.1. Personal Information 2288 HTTP clients are often privy to large amounts of personal information 2289 (e.g. the user's name, location, mail address, passwords, encryption 2290 keys, etc.), and SHOULD be very careful to prevent unintentional 2291 leakage of this information. We very strongly recommend that a 2292 convenient interface be provided for the user to control 2293 dissemination of such information, and that designers and 2294 implementors be particularly careful in this area. History shows 2295 that errors in this area often create serious security and/or privacy 2296 problems and generate highly adverse publicity for the implementor's 2297 company. 2299 10.2. Abuse of Server Log Information 2301 A server is in the position to save personal data about a user's 2302 requests which might identify their reading patterns or subjects of 2303 interest. This information is clearly confidential in nature and its 2304 handling can be constrained by law in certain countries. People 2305 using HTTP to provide data are responsible for ensuring that such 2306 material is not distributed without the permission of any individuals 2307 that are identifiable by the published results. 2309 10.3. Attacks Based On File and Path Names 2311 Implementations of HTTP origin servers SHOULD be careful to restrict 2312 the documents returned by HTTP requests to be only those that were 2313 intended by the server administrators. If an HTTP server translates 2314 HTTP URIs directly into file system calls, the server MUST take 2315 special care not to serve files that were not intended to be 2316 delivered to HTTP clients. For example, UNIX, Microsoft Windows, and 2317 other operating systems use ".." as a path component to indicate a 2318 directory level above the current one. On such a system, an HTTP 2319 server MUST disallow any such construct in the request-target if it 2320 would otherwise allow access to a resource outside those intended to 2321 be accessible via the HTTP server. Similarly, files intended for 2322 reference only internally to the server (such as access control 2323 files, configuration files, and script code) MUST be protected from 2324 inappropriate retrieval, since they might contain sensitive 2325 information. Experience has shown that minor bugs in such HTTP 2326 server implementations have turned into security risks. 2328 10.4. DNS Spoofing 2330 Clients using HTTP rely heavily on the Domain Name Service, and are 2331 thus generally prone to security attacks based on the deliberate mis- 2332 association of IP addresses and DNS names. Clients need to be 2333 cautious in assuming the continuing validity of an IP number/DNS name 2334 association. 2336 In particular, HTTP clients SHOULD rely on their name resolver for 2337 confirmation of an IP number/DNS name association, rather than 2338 caching the result of previous host name lookups. Many platforms 2339 already can cache host name lookups locally when appropriate, and 2340 they SHOULD be configured to do so. It is proper for these lookups 2341 to be cached, however, only when the TTL (Time To Live) information 2342 reported by the name server makes it likely that the cached 2343 information will remain useful. 2345 If HTTP clients cache the results of host name lookups in order to 2346 achieve a performance improvement, they MUST observe the TTL 2347 information reported by DNS. 2349 If HTTP clients do not observe this rule, they could be spoofed when 2350 a previously-accessed server's IP address changes. As network 2351 renumbering is expected to become increasingly common [RFC1900], the 2352 possibility of this form of attack will grow. Observing this 2353 requirement thus reduces this potential security vulnerability. 2355 This requirement also improves the load-balancing behavior of clients 2356 for replicated servers using the same DNS name and reduces the 2357 likelihood of a user's experiencing failure in accessing sites which 2358 use that strategy. 2360 10.5. Proxies and Caching 2362 By their very nature, HTTP proxies are men-in-the-middle, and 2363 represent an opportunity for man-in-the-middle attacks. Compromise 2364 of the systems on which the proxies run can result in serious 2365 security and privacy problems. Proxies have access to security- 2366 related information, personal information about individual users and 2367 organizations, and proprietary information belonging to users and 2368 content providers. A compromised proxy, or a proxy implemented or 2369 configured without regard to security and privacy considerations, 2370 might be used in the commission of a wide range of potential attacks. 2372 Proxy operators should protect the systems on which proxies run as 2373 they would protect any system that contains or transports sensitive 2374 information. In particular, log information gathered at proxies 2375 often contains highly sensitive personal information, and/or 2376 information about organizations. Log information should be carefully 2377 guarded, and appropriate guidelines for use developed and followed. 2378 (Section 10.2). 2380 Proxy implementors should consider the privacy and security 2381 implications of their design and coding decisions, and of the 2382 configuration options they provide to proxy operators (especially the 2383 default configuration). 2385 Users of a proxy need to be aware that they are no trustworthier than 2386 the people who run the proxy; HTTP itself cannot solve this problem. 2388 The judicious use of cryptography, when appropriate, may suffice to 2389 protect against a broad range of security and privacy attacks. Such 2390 cryptography is beyond the scope of the HTTP/1.1 specification. 2392 10.6. Denial of Service Attacks on Proxies 2394 They exist. They are hard to defend against. Research continues. 2395 Beware. 2397 11. Acknowledgments 2399 HTTP has evolved considerably over the years. It has benefited from 2400 a large and active developer community--the many people who have 2401 participated on the www-talk mailing list--and it is that community 2402 which has been most responsible for the success of HTTP and of the 2403 World-Wide Web in general. Marc Andreessen, Robert Cailliau, Daniel 2404 W. Connolly, Bob Denny, John Franks, Jean-Francois Groff, Phillip M. 2405 Hallam-Baker, Hakon W. Lie, Ari Luotonen, Rob McCool, Lou Montulli, 2406 Dave Raggett, Tony Sanders, and Marc VanHeyningen deserve special 2407 recognition for their efforts in defining early aspects of the 2408 protocol. 2410 This document has benefited greatly from the comments of all those 2411 participating in the HTTP-WG. In addition to those already 2412 mentioned, the following individuals have contributed to this 2413 specification: 2415 Gary Adams, Harald Tveit Alvestrand, Keith Ball, Brian Behlendorf, 2416 Paul Burchard, Maurizio Codogno, Mike Cowlishaw, Roman Czyborra, 2417 Michael A. Dolan, Daniel DuBois, David J. Fiander, Alan Freier, Marc 2418 Hedlund, Greg Herlihy, Koen Holtman, Alex Hopmann, Bob Jernigan, Shel 2419 Kaphan, Rohit Khare, John Klensin, Martijn Koster, Alexei Kosut, 2420 David M. Kristol, Daniel LaLiberte, Ben Laurie, Paul J. Leach, Albert 2421 Lunde, John C. Mallery, Jean-Philippe Martin-Flatin, Mitra, David 2422 Morris, Gavin Nicol, Ross Patterson, Bill Perry, Jeffrey Perry, Scott 2423 Powers, Owen Rees, Luigi Rizzo, David Robinson, Marc Salomon, Rich 2424 Salz, Allan M. Schiffman, Jim Seidman, Chuck Shotton, Eric W. Sink, 2425 Simon E. Spero, Richard N. Taylor, Robert S. Thau, Bill (BearHeart) 2426 Weinman, Francois Yergeau, Mary Ellen Zurko, Josh Cohen. 2428 Thanks to the "cave men" of Palo Alto. You know who you are. 2430 Jim Gettys (the editor of [RFC2616]) wishes particularly to thank Roy 2431 Fielding, the editor of [RFC2068], along with John Klensin, Jeff 2432 Mogul, Paul Leach, Dave Kristol, Koen Holtman, John Franks, Josh 2433 Cohen, Alex Hopmann, Scott Lawrence, and Larry Masinter for their 2434 help. And thanks go particularly to Jeff Mogul and Scott Lawrence 2435 for performing the "MUST/MAY/SHOULD" audit. 2437 The Apache Group, Anselm Baird-Smith, author of Jigsaw, and Henrik 2438 Frystyk implemented RFC 2068 early, and we wish to thank them for the 2439 discovery of many of the problems that this document attempts to 2440 rectify. 2442 This specification makes heavy use of the augmented BNF and generic 2443 constructs defined by David H. Crocker for [RFC5234]. Similarly, it 2444 reuses many of the definitions provided by Nathaniel Borenstein and 2445 Ned Freed for MIME [RFC2045]. We hope that their inclusion in this 2446 specification will help reduce past confusion over the relationship 2447 between HTTP and Internet mail message formats. 2449 12. References 2451 12.1. Normative References 2453 [ISO-8859-1] 2454 International Organization for Standardization, 2455 "Information technology -- 8-bit single-byte coded graphic 2456 character sets -- Part 1: Latin alphabet No. 1", ISO/ 2457 IEC 8859-1:1998, 1998. 2459 [Part2] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., 2460 Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., 2461 and J. Reschke, Ed., "HTTP/1.1, part 2: Message 2462 Semantics", draft-ietf-httpbis-p2-semantics-07 (work in 2463 progress), July 2009. 2465 [Part3] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., 2466 Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., 2467 and J. Reschke, Ed., "HTTP/1.1, part 3: Message Payload 2468 and Content Negotiation", draft-ietf-httpbis-p3-payload-07 2469 (work in progress), July 2009. 2471 [Part5] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., 2472 Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., 2473 and J. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and 2474 Partial Responses", draft-ietf-httpbis-p5-range-07 (work 2475 in progress), July 2009. 2477 [Part6] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., 2478 Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., 2479 Nottingham, M., Ed., and J. Reschke, Ed., "HTTP/1.1, part 2480 6: Caching", draft-ietf-httpbis-p6-cache-07 (work in 2481 progress), July 2009. 2483 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2484 Requirement Levels", BCP 14, RFC 2119, March 1997. 2486 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2487 Resource Identifier (URI): Generic Syntax", RFC 3986, 2488 STD 66, January 2005. 2490 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 2491 Specifications: ABNF", STD 68, RFC 5234, January 2008. 2493 [USASCII] American National Standards Institute, "Coded Character 2494 Set -- 7-bit American Standard Code for Information 2495 Interchange", ANSI X3.4, 1986. 2497 12.2. Informative References 2499 [Kri2001] Kristol, D., "HTTP Cookies: Standards, Privacy, and 2500 Politics", ACM Transactions on Internet Technology Vol. 1, 2501 #2, November 2001, . 2503 [Nie1997] Nielsen, H., Gettys, J., Prud'hommeaux, E., Lie, H., and 2504 C. Lilley, "Network Performance Effects of HTTP/1.1, CSS1, 2505 and PNG", ACM Proceedings of the ACM SIGCOMM '97 2506 conference on Applications, technologies, architectures, 2507 and protocols for computer communication SIGCOMM '97, 2508 September 1997, 2509 . 2511 [Pad1995] Padmanabhan, V. and J. Mogul, "Improving HTTP Latency", 2512 Computer Networks and ISDN Systems v. 28, pp. 25-35, 2513 December 1995, 2514 . 2516 [RFC1123] Braden, R., "Requirements for Internet Hosts - Application 2517 and Support", STD 3, RFC 1123, October 1989. 2519 [RFC1305] Mills, D., "Network Time Protocol (Version 3) 2520 Specification, Implementation", RFC 1305, March 1992. 2522 [RFC1900] Carpenter, B. and Y. Rekhter, "Renumbering Needs Work", 2523 RFC 1900, February 1996. 2525 [RFC1945] Berners-Lee, T., Fielding, R., and H. Nielsen, "Hypertext 2526 Transfer Protocol -- HTTP/1.0", RFC 1945, May 1996. 2528 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 2529 Extensions (MIME) Part One: Format of Internet Message 2530 Bodies", RFC 2045, November 1996. 2532 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 2533 Part Three: Message Header Extensions for Non-ASCII Text", 2534 RFC 2047, November 1996. 2536 [RFC2068] Fielding, R., Gettys, J., Mogul, J., Nielsen, H., and T. 2537 Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", 2538 RFC 2068, January 1997. 2540 [RFC2109] Kristol, D. and L. Montulli, "HTTP State Management 2541 Mechanism", RFC 2109, February 1997. 2543 [RFC2145] Mogul, J., Fielding, R., Gettys, J., and H. Nielsen, "Use 2544 and Interpretation of HTTP Version Numbers", RFC 2145, 2545 May 1997. 2547 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 2548 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 2549 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 2551 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 2553 [RFC2965] Kristol, D. and L. Montulli, "HTTP State Management 2554 Mechanism", RFC 2965, October 2000. 2556 [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration 2557 Procedures for Message Header Fields", BCP 90, RFC 3864, 2558 September 2004. 2560 [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and 2561 Registration Procedures", BCP 13, RFC 4288, December 2005. 2563 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 2564 Registration Procedures for New URI Schemes", BCP 115, 2565 RFC 4395, February 2006. 2567 [RFC5322] Resnick, P., "Internet Message Format", RFC 5322, 2568 October 2008. 2570 [Spe] Spero, S., "Analysis of HTTP Performance Problems", 2571 . 2573 [Tou1998] Touch, J., Heidemann, J., and K. Obraczka, "Analysis of 2574 HTTP Performance", ISI Research Report ISI/RR-98-463, 2575 Aug 1998, . 2577 (original report dated Aug. 1996) 2579 Appendix A. Tolerant Applications 2581 Although this document specifies the requirements for the generation 2582 of HTTP/1.1 messages, not all applications will be correct in their 2583 implementation. We therefore recommend that operational applications 2584 be tolerant of deviations whenever those deviations can be 2585 interpreted unambiguously. 2587 Clients SHOULD be tolerant in parsing the Status-Line and servers 2588 tolerant when parsing the Request-Line. In particular, they SHOULD 2589 accept any amount of WSP characters between fields, even though only 2590 a single SP is required. 2592 The line terminator for message-header fields is the sequence CRLF. 2593 However, we recommend that applications, when parsing such headers, 2594 recognize a single LF as a line terminator and ignore the leading CR. 2596 The character set of an entity-body SHOULD be labeled as the lowest 2597 common denominator of the character codes used within that body, with 2598 the exception that not labeling the entity is preferred over labeling 2599 the entity with the labels US-ASCII or ISO-8859-1. See [Part3]. 2601 Additional rules for requirements on parsing and encoding of dates 2602 and other potential problems with date encodings include: 2604 o HTTP/1.1 clients and caches SHOULD assume that an RFC-850 date 2605 which appears to be more than 50 years in the future is in fact in 2606 the past (this helps solve the "year 2000" problem). 2608 o An HTTP/1.1 implementation MAY internally represent a parsed 2609 Expires date as earlier than the proper value, but MUST NOT 2610 internally represent a parsed Expires date as later than the 2611 proper value. 2613 o All expiration-related calculations MUST be done in GMT. The 2614 local time zone MUST NOT influence the calculation or comparison 2615 of an age or expiration time. 2617 o If an HTTP header incorrectly carries a date value with a time 2618 zone other than GMT, it MUST be converted into GMT using the most 2619 conservative possible conversion. 2621 Appendix B. Compatibility with Previous Versions 2623 HTTP has been in use by the World-Wide Web global information 2624 initiative since 1990. The first version of HTTP, later referred to 2625 as HTTP/0.9, was a simple protocol for hypertext data transfer across 2626 the Internet with only a single method and no metadata. HTTP/1.0, as 2627 defined by [RFC1945], added a range of request methods and MIME-like 2628 messaging that could include metadata about the data transferred and 2629 modifiers on the request/response semantics. However, HTTP/1.0 did 2630 not sufficiently take into consideration the effects of hierarchical 2631 proxies, caching, the need for persistent connections, or name-based 2632 virtual hosts. The proliferation of incompletely-implemented 2633 applications calling themselves "HTTP/1.0" further necessitated a 2634 protocol version change in order for two communicating applications 2635 to determine each other's true capabilities. 2637 HTTP/1.1 remains compatible with HTTP/1.0 by including more stringent 2638 requirements that enable reliable implementations, adding only those 2639 new features that will either be safely ignored by an HTTP/1.0 2640 recipient or only sent when communicating with a party advertising 2641 compliance with HTTP/1.1. 2643 It is beyond the scope of a protocol specification to mandate 2644 compliance with previous versions. HTTP/1.1 was deliberately 2645 designed, however, to make supporting previous versions easy. It is 2646 worth noting that, at the time of composing this specification 2647 (1996), we would expect commercial HTTP/1.1 servers to: 2649 o recognize the format of the Request-Line for HTTP/0.9, 1.0, and 2650 1.1 requests; 2652 o understand any valid request in the format of HTTP/0.9, 1.0, or 2653 1.1; 2655 o respond appropriately with a message in the same major version 2656 used by the client. 2658 And we would expect HTTP/1.1 clients to: 2660 o recognize the format of the Status-Line for HTTP/1.0 and 1.1 2661 responses; 2663 o understand any valid response in the format of HTTP/0.9, 1.0, or 2664 1.1. 2666 For most implementations of HTTP/1.0, each connection is established 2667 by the client prior to the request and closed by the server after 2668 sending the response. Some implementations implement the Keep-Alive 2669 version of persistent connections described in Section 19.7.1 of 2670 [RFC2068]. 2672 B.1. Changes from HTTP/1.0 2674 This section summarizes major differences between versions HTTP/1.0 2675 and HTTP/1.1. 2677 B.1.1. Changes to Simplify Multi-homed Web Servers and Conserve IP 2678 Addresses 2680 The requirements that clients and servers support the Host request- 2681 header, report an error if the Host request-header (Section 8.4) is 2682 missing from an HTTP/1.1 request, and accept absolute URIs 2683 (Section 5.1.2) are among the most important changes defined by this 2684 specification. 2686 Older HTTP/1.0 clients assumed a one-to-one relationship of IP 2687 addresses and servers; there was no other established mechanism for 2688 distinguishing the intended server of a request than the IP address 2689 to which that request was directed. The changes outlined above will 2690 allow the Internet, once older HTTP clients are no longer common, to 2691 support multiple Web sites from a single IP address, greatly 2692 simplifying large operational Web servers, where allocation of many 2693 IP addresses to a single host has created serious problems. The 2694 Internet will also be able to recover the IP addresses that have been 2695 allocated for the sole purpose of allowing special-purpose domain 2696 names to be used in root-level HTTP URLs. Given the rate of growth 2697 of the Web, and the number of servers already deployed, it is 2698 extremely important that all implementations of HTTP (including 2699 updates to existing HTTP/1.0 applications) correctly implement these 2700 requirements: 2702 o Both clients and servers MUST support the Host request-header. 2704 o A client that sends an HTTP/1.1 request MUST send a Host header. 2706 o Servers MUST report a 400 (Bad Request) error if an HTTP/1.1 2707 request does not include a Host request-header. 2709 o Servers MUST accept absolute URIs. 2711 B.2. Compatibility with HTTP/1.0 Persistent Connections 2713 Some clients and servers might wish to be compatible with some 2714 previous implementations of persistent connections in HTTP/1.0 2715 clients and servers. Persistent connections in HTTP/1.0 are 2716 explicitly negotiated as they are not the default behavior. HTTP/1.0 2717 experimental implementations of persistent connections are faulty, 2718 and the new facilities in HTTP/1.1 are designed to rectify these 2719 problems. The problem was that some existing 1.0 clients may be 2720 sending Keep-Alive to a proxy server that doesn't understand 2721 Connection, which would then erroneously forward it to the next 2722 inbound server, which would establish the Keep-Alive connection and 2723 result in a hung HTTP/1.0 proxy waiting for the close on the 2724 response. The result is that HTTP/1.0 clients must be prevented from 2725 using Keep-Alive when talking to proxies. 2727 However, talking to proxies is the most important use of persistent 2728 connections, so that prohibition is clearly unacceptable. Therefore, 2729 we need some other mechanism for indicating a persistent connection 2730 is desired, which is safe to use even when talking to an old proxy 2731 that ignores Connection. Persistent connections are the default for 2732 HTTP/1.1 messages; we introduce a new keyword (Connection: close) for 2733 declaring non-persistence. See Section 8.1. 2735 The original HTTP/1.0 form of persistent connections (the Connection: 2736 Keep-Alive and Keep-Alive header) is documented in Section 19.7.1 of 2737 [RFC2068]. 2739 B.3. Changes from RFC 2068 2741 This specification has been carefully audited to correct and 2742 disambiguate key word usage; RFC 2068 had many problems in respect to 2743 the conventions laid out in [RFC2119]. 2745 Transfer-coding and message lengths all interact in ways that 2746 required fixing exactly when chunked encoding is used (to allow for 2747 transfer encoding that may not be self delimiting); it was important 2748 to straighten out exactly how message lengths are computed. 2749 (Sections 3.3, 4.4, 8.2, see also [Part3], [Part5] and [Part6]) 2751 The use and interpretation of HTTP version numbers has been clarified 2752 by [RFC2145]. Require proxies to upgrade requests to highest 2753 protocol version they support to deal with problems discovered in 2754 HTTP/1.0 implementations (Section 3.1) 2756 Quality Values of zero should indicate that "I don't want something" 2757 to allow clients to refuse a representation. (Section 3.5) 2759 Transfer-coding had significant problems, particularly with 2760 interactions with chunked encoding. The solution is that transfer- 2761 codings become as full fledged as content-codings. This involves 2762 adding an IANA registry for transfer-codings (separate from content 2763 codings), a new header field (TE) and enabling trailer headers in the 2764 future. Transfer encoding is a major performance benefit, so it was 2765 worth fixing [Nie1997]. TE also solves another, obscure, downward 2766 interoperability problem that could have occurred due to interactions 2767 between authentication trailers, chunked encoding and HTTP/1.0 2768 clients.(Section 3.3, 3.3.1, and 8.5) 2770 B.4. Changes from RFC 2616 2772 Empty list elements in list productions have been deprecated. 2773 (Section 1.2.1) 2775 Rules about implicit linear whitespace between certain grammar 2776 productions have been removed; now it's only allowed when 2777 specifically pointed out in the ABNF. The NUL character is no longer 2778 allowed in comment and quoted-string text. The quoted-pair rule no 2779 longer allows escaping NUL, CR or LF. Non-ASCII content in header 2780 fields and reason phrase has been obsoleted and made opaque (the TEXT 2781 rule was removed) (Section 1.2.2) 2783 Clarify that HTTP-Version is case sensitive. (Section 3.1) 2785 Remove reference to non-existant identity transfer-coding value 2786 tokens. (Sections 3.3 and 4.4) 2788 Clarification that the chunk length does not include the count of the 2789 octets in the chunk header and trailer. (Section 3.3.1) 2791 Require that invalid whitespace around field-names be rejected. 2792 (Section 4.2) 2794 Update use of abs_path production from RFC1808 to the path-absolute + 2795 query components of RFC3986. (Section 5.1.2) 2797 Clarify exactly when close connection options must be sent. 2798 (Section 8.1) 2800 Appendix C. Terminology 2802 This specification uses a number of terms to refer to the roles 2803 played by participants in, and objects of, the HTTP communication. 2805 cache 2807 A program's local store of response messages and the subsystem 2808 that controls its message storage, retrieval, and deletion. A 2809 cache stores cacheable responses in order to reduce the response 2810 time and network bandwidth consumption on future, equivalent 2811 requests. Any client or server may include a cache, though a 2812 cache cannot be used by a server that is acting as a tunnel. 2814 cacheable 2816 A response is cacheable if a cache is allowed to store a copy of 2817 the response message for use in answering subsequent requests. 2818 The rules for determining the cacheability of HTTP responses are 2819 defined in Section 1 of [Part6]. Even if a resource is cacheable, 2820 there may be additional constraints on whether a cache can use the 2821 cached copy for a particular request. 2823 client 2825 A program that establishes connections for the purpose of sending 2826 requests. 2828 connection 2830 A transport layer virtual circuit established between two programs 2831 for the purpose of communication. 2833 content negotiation 2835 The mechanism for selecting the appropriate representation when 2836 servicing a request, as described in Section 4 of [Part3]. The 2837 representation of entities in any response can be negotiated 2838 (including error responses). 2840 entity 2842 The information transferred as the payload of a request or 2843 response. An entity consists of metainformation in the form of 2844 entity-header fields and content in the form of an entity-body, as 2845 described in Section 3 of [Part3]. 2847 gateway 2849 A server which acts as an intermediary for some other server. 2850 Unlike a proxy, a gateway receives requests as if it were the 2851 origin server for the requested resource; the requesting client 2852 may not be aware that it is communicating with a gateway. 2854 inbound/outbound 2856 Inbound and outbound refer to the request and response paths for 2857 messages: "inbound" means "traveling toward the origin server", 2858 and "outbound" means "traveling toward the user agent" 2860 message 2862 The basic unit of HTTP communication, consisting of a structured 2863 sequence of octets matching the syntax defined in Section 4 and 2864 transmitted via the connection. 2866 origin server 2868 The server on which a given resource resides or is to be created. 2870 proxy 2872 An intermediary program which acts as both a server and a client 2873 for the purpose of making requests on behalf of other clients. 2874 Requests are serviced internally or by passing them on, with 2875 possible translation, to other servers. A proxy MUST implement 2876 both the client and server requirements of this specification. A 2877 "transparent proxy" is a proxy that does not modify the request or 2878 response beyond what is required for proxy authentication and 2879 identification. A "non-transparent proxy" is a proxy that 2880 modifies the request or response in order to provide some added 2881 service to the user agent, such as group annotation services, 2882 media type transformation, protocol reduction, or anonymity 2883 filtering. Except where either transparent or non-transparent 2884 behavior is explicitly stated, the HTTP proxy requirements apply 2885 to both types of proxies. 2887 request 2889 An HTTP request message, as defined in Section 5. 2891 resource 2893 A network data object or service that can be identified by a URI, 2894 as defined in Section 2.1. Resources may be available in multiple 2895 representations (e.g. multiple languages, data formats, size, and 2896 resolutions) or vary in other ways. 2898 response 2900 An HTTP response message, as defined in Section 6. 2902 representation 2904 An entity included with a response that is subject to content 2905 negotiation, as described in Section 4 of [Part3]. There may 2906 exist multiple representations associated with a particular 2907 response status. 2909 server 2911 An application program that accepts connections in order to 2912 service requests by sending back responses. Any given program may 2913 be capable of being both a client and a server; our use of these 2914 terms refers only to the role being performed by the program for a 2915 particular connection, rather than to the program's capabilities 2916 in general. Likewise, any server may act as an origin server, 2917 proxy, gateway, or tunnel, switching behavior based on the nature 2918 of each request. 2920 tunnel 2922 An intermediary program which is acting as a blind relay between 2923 two connections. Once active, a tunnel is not considered a party 2924 to the HTTP communication, though the tunnel may have been 2925 initiated by an HTTP request. The tunnel ceases to exist when 2926 both ends of the relayed connections are closed. 2928 upstream/downstream 2930 Upstream and downstream describe the flow of a message: all 2931 messages flow from upstream to downstream. 2933 user agent 2935 The client which initiates a request. These are often browsers, 2936 editors, spiders (web-traversing robots), or other end user tools. 2938 variant 2940 A resource may have one, or more than one, representation(s) 2941 associated with it at any given instant. Each of these 2942 representations is termed a `variant'. Use of the term `variant' 2943 does not necessarily imply that the resource is subject to content 2944 negotiation. 2946 Appendix D. Collected ABNF 2948 BWS = OWS 2950 Cache-Control = 2951 Chunked-Body = *chunk last-chunk trailer-part CRLF 2952 Connection = "Connection:" OWS Connection-v 2953 Connection-v = *( "," OWS ) connection-token *( OWS "," [ OWS 2954 connection-token ] ) 2955 Content-Length = "Content-Length:" OWS 1*Content-Length-v 2956 Content-Length-v = 1*DIGIT 2958 Date = "Date:" OWS Date-v 2959 Date-v = HTTP-date 2961 GMT = %x47.4D.54 ; GMT 2963 HTTP-Prot-Name = %x48.54.54.50 ; HTTP 2964 HTTP-Version = HTTP-Prot-Name "/" 1*DIGIT "." 1*DIGIT 2965 HTTP-date = rfc1123-date / obs-date 2966 HTTP-message = Request / Response 2967 Host = "Host:" OWS Host-v 2968 Host-v = uri-host [ ":" port ] 2970 Method = token 2972 OWS = *( [ obs-fold ] WSP ) 2974 Pragma = 2976 RWS = 1*( [ obs-fold ] WSP ) 2977 Reason-Phrase = *( WSP / VCHAR / obs-text ) 2978 Request = Request-Line *( ( general-header / request-header / 2979 entity-header ) CRLF ) CRLF [ message-body ] 2980 Request-Line = Method SP request-target SP HTTP-Version CRLF 2981 Response = Status-Line *( ( general-header / response-header / 2982 entity-header ) CRLF ) CRLF [ message-body ] 2984 Status-Code = 3DIGIT 2985 Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF 2987 TE = "TE:" OWS TE-v 2988 TE-v = [ ( "," / t-codings ) *( OWS "," [ OWS t-codings ] ) ] 2989 Trailer = "Trailer:" OWS Trailer-v 2990 Trailer-v = *( "," OWS ) field-name *( OWS "," [ OWS field-name ] ) 2991 Transfer-Encoding = "Transfer-Encoding:" OWS Transfer-Encoding-v 2992 Transfer-Encoding-v = *( "," OWS ) transfer-coding *( OWS "," [ OWS 2993 transfer-coding ] ) 2995 URI = 2996 URI-reference = 2997 Upgrade = "Upgrade:" OWS Upgrade-v 2998 Upgrade-v = *( "," OWS ) product *( OWS "," [ OWS product ] ) 3000 Via = "Via:" OWS Via-v 3001 Via-v = *( "," OWS ) received-protocol RWS received-by [ RWS comment 3002 ] *( OWS "," [ OWS received-protocol RWS received-by [ RWS comment ] 3003 ] ) 3005 Warning = 3007 absolute-URI = 3008 asctime-date = day-name SP date3 SP time-of-day SP year 3009 attribute = token 3010 authority = 3012 chunk = chunk-size *WSP [ chunk-ext ] CRLF chunk-data CRLF 3013 chunk-data = 1*OCTET 3014 chunk-ext = *( ";" *WSP chunk-ext-name [ "=" chunk-ext-val ] *WSP ) 3015 chunk-ext-name = token 3016 chunk-ext-val = token / quoted-string 3017 chunk-size = 1*HEXDIG 3018 comment = "(" *( ctext / quoted-pair / comment ) ")" 3019 connection-token = token 3020 ctext = OWS / %x21-27 ; '!'-''' 3021 / %x2A-5B ; '*'-'[' 3022 / %x5D-7E ; ']'-'~' 3023 / obs-text 3025 date1 = day SP month SP year 3026 date2 = day "-" month "-" 2DIGIT 3027 date3 = month SP ( 2DIGIT / ( SP DIGIT ) ) 3028 day = 2DIGIT 3029 day-name = %x4D.6F.6E ; Mon 3030 / %x54.75.65 ; Tue 3031 / %x57.65.64 ; Wed 3032 / %x54.68.75 ; Thu 3033 / %x46.72.69 ; Fri 3034 / %x53.61.74 ; Sat 3035 / %x53.75.6E ; Sun 3036 day-name-l = %x4D.6F.6E.64.61.79 ; Monday 3037 / %x54.75.65.73.64.61.79 ; Tuesday 3038 / %x57.65.64.6E.65.73.64.61.79 ; Wednesday 3039 / %x54.68.75.72.73.64.61.79 ; Thursday 3040 / %x46.72.69.64.61.79 ; Friday 3041 / %x53.61.74.75.72.64.61.79 ; Saturday 3042 / %x53.75.6E.64.61.79 ; Sunday 3044 entity-body = 3045 entity-header = 3047 field-content = *( WSP / VCHAR / obs-text ) 3048 field-name = token 3049 field-value = *( field-content / OWS ) 3050 fragment = 3051 general-header = Cache-Control / Connection / Date / Pragma / Trailer 3052 / Transfer-Encoding / Upgrade / Via / Warning 3053 generic-message = start-line *( message-header CRLF ) CRLF [ 3054 message-body ] 3056 hour = 2DIGIT 3057 http-URI = "http://" authority path-abempty [ "?" query ] 3059 last-chunk = 1*"0" *WSP [ chunk-ext ] CRLF 3061 message-body = entity-body / 3062 3063 message-header = field-name ":" OWS [ field-value ] OWS 3064 minute = 2DIGIT 3065 month = %x4A.61.6E ; Jan 3066 / %x46.65.62 ; Feb 3067 / %x4D.61.72 ; Mar 3068 / %x41.70.72 ; Apr 3069 / %x4D.61.79 ; May 3070 / %x4A.75.6E ; Jun 3071 / %x4A.75.6C ; Jul 3072 / %x41.75.67 ; Aug 3073 / %x53.65.70 ; Sep 3074 / %x4F.63.74 ; Oct 3075 / %x4E.6F.76 ; Nov 3076 / %x44.65.63 ; Dec 3078 obs-date = rfc850-date / asctime-date 3079 obs-fold = CRLF 3080 obs-text = %x80-FF 3082 partial-URI = relative-part [ "?" query ] 3083 path-abempty = 3084 path-absolute = 3085 port = 3086 product = token [ "/" product-version ] 3087 product-version = token 3088 protocol-name = token 3089 protocol-version = token 3090 pseudonym = token 3092 qdtext = OWS / "!" / %x23-5B ; '#'-'[' 3093 / %x5D-7E ; ']'-'~' 3094 / obs-text 3095 query = 3096 quoted-pair = "\" quoted-text 3097 quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE 3098 quoted-text = %x01-09 / %x0B-0C / %x0E-FF 3099 qvalue = ( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] ) 3101 received-by = ( uri-host [ ":" port ] ) / pseudonym 3102 received-protocol = [ protocol-name "/" ] protocol-version 3103 relative-part = 3104 request-header = 3105 request-target = "*" / absolute-URI / ( path-absolute [ "?" query ] ) 3106 / authority 3107 response-header = 3108 rfc1123-date = day-name "," SP date1 SP time-of-day SP GMT 3109 rfc850-date = day-name-l "," SP date2 SP time-of-day SP GMT 3111 second = 2DIGIT 3112 start-line = Request-Line / Status-Line 3114 t-codings = "trailers" / ( transfer-extension [ te-params ] ) 3115 tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / 3116 "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA 3117 te-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] 3118 te-params = OWS ";" OWS "q=" qvalue *te-ext 3119 time-of-day = hour ":" minute ":" second 3120 token = 1*tchar 3121 trailer-part = *( entity-header CRLF ) 3122 transfer-coding = "chunked" / transfer-extension 3123 transfer-extension = token *( OWS ";" OWS transfer-parameter ) 3124 transfer-parameter = attribute BWS "=" BWS value 3126 uri-host = 3128 value = token / quoted-string 3130 year = 4DIGIT 3132 ABNF diagnostics: 3134 ; Chunked-Body defined but not used 3135 ; Content-Length defined but not used 3136 ; HTTP-message defined but not used 3137 ; Host defined but not used 3138 ; TE defined but not used 3139 ; URI defined but not used 3140 ; URI-reference defined but not used 3141 ; fragment defined but not used 3142 ; generic-message defined but not used 3143 ; http-URI defined but not used 3144 ; partial-URI defined but not used 3146 Appendix E. Change Log (to be removed by RFC Editor before publication) 3148 E.1. Since RFC2616 3150 Extracted relevant partitions from [RFC2616]. 3152 E.2. Since draft-ietf-httpbis-p1-messaging-00 3154 Closed issues: 3156 o : "HTTP Version 3157 should be case sensitive" 3158 () 3160 o : "'unsafe' 3161 characters" () 3163 o : "Chunk Size 3164 Definition" () 3166 o : "Message Length" 3167 () 3169 o : "Media Type 3170 Registrations" () 3172 o : "URI includes 3173 query" () 3175 o : "No close on 3176 1xx responses" () 3178 o : "Remove 3179 'identity' token references" 3180 () 3182 o : "Import query 3183 BNF" 3185 o : "qdtext BNF" 3187 o : "Normative and 3188 Informative references" 3190 o : "RFC2606 3191 Compliance" 3193 o : "RFC977 3194 reference" 3196 o : "RFC1700 3197 references" 3199 o : "inconsistency 3200 in date format explanation" 3202 o : "Date reference 3203 typo" 3205 o : "Informative 3206 references" 3208 o : "ISO-8859-1 3209 Reference" 3211 o : "Normative up- 3212 to-date references" 3214 Other changes: 3216 o Update media type registrations to use RFC4288 template. 3218 o Use names of RFC4234 core rules DQUOTE and WSP, fix broken ABNF 3219 for chunk-data (work in progress on 3220 ) 3222 E.3. Since draft-ietf-httpbis-p1-messaging-01 3224 Closed issues: 3226 o : "Bodies on GET 3227 (and other) requests" 3229 o : "Updating to 3230 RFC4288" 3232 o : "Status Code 3233 and Reason Phrase" 3235 o : "rel_path not 3236 used" 3238 Ongoing work on ABNF conversion 3239 (): 3241 o Get rid of duplicate BNF rule names ("host" -> "uri-host", 3242 "trailer" -> "trailer-part"). 3244 o Avoid underscore character in rule names ("http_URL" -> "http- 3245 URL", "abs_path" -> "path-absolute"). 3247 o Add rules for terms imported from URI spec ("absoluteURI", 3248 "authority", "path-absolute", "port", "query", "relativeURI", 3249 "host) -- these will have to be updated when switching over to 3250 RFC3986. 3252 o Synchronize core rules with RFC5234. 3254 o Get rid of prose rules that span multiple lines. 3256 o Get rid of unused rules LOALPHA and UPALPHA. 3258 o Move "Product Tokens" section (back) into Part 1, as "token" is 3259 used in the definition of the Upgrade header. 3261 o Add explicit references to BNF syntax and rules imported from 3262 other parts of the specification. 3264 o Rewrite prose rule "token" in terms of "tchar", rewrite prose rule 3265 "TEXT". 3267 E.4. Since draft-ietf-httpbis-p1-messaging-02 3269 Closed issues: 3271 o : "HTTP-date vs. 3272 rfc1123-date" 3274 o : "WS in quoted- 3275 pair" 3277 Ongoing work on IANA Message Header Registration 3278 (): 3280 o Reference RFC 3984, and update header registrations for headers 3281 defined in this document. 3283 Ongoing work on ABNF conversion 3284 (): 3286 o Replace string literals when the string really is case-sensitive 3287 (HTTP-Version). 3289 E.5. Since draft-ietf-httpbis-p1-messaging-03 3291 Closed issues: 3293 o : "Connection 3294 closing" 3296 o : "Move 3297 registrations and registry information to IANA Considerations" 3299 o : "need new URL 3300 for PAD1995 reference" 3302 o : "IANA 3303 Considerations: update HTTP URI scheme registration" 3305 o : "Cite HTTPS 3306 URI scheme definition" 3308 o : "List-type 3309 headers vs Set-Cookie" 3311 Ongoing work on ABNF conversion 3312 (): 3314 o Replace string literals when the string really is case-sensitive 3315 (HTTP-Date). 3317 o Replace HEX by HEXDIG for future consistence with RFC 5234's core 3318 rules. 3320 E.6. Since draft-ietf-httpbis-p1-messaging-04 3322 Closed issues: 3324 o : "Out-of-date 3325 reference for URIs" 3327 o : "RFC 2822 is 3328 updated by RFC 5322" 3330 Ongoing work on ABNF conversion 3331 (): 3333 o Use "/" instead of "|" for alternatives. 3335 o Get rid of RFC822 dependency; use RFC5234 plus extensions instead. 3337 o Only reference RFC 5234's core rules. 3339 o Introduce new ABNF rules for "bad" whitespace ("BWS"), optional 3340 whitespace ("OWS") and required whitespace ("RWS"). 3342 o Rewrite ABNFs to spell out whitespace rules, factor out header 3343 value format definitions. 3345 E.7. Since draft-ietf-httpbis-p1-messaging-05 3347 Closed issues: 3349 o : "Header LWS" 3351 o : "Sort 1.3 3352 Terminology" 3354 o : "RFC2047 3355 encoded words" 3357 o : "Character 3358 Encodings in TEXT" 3360 o : "Line Folding" 3362 o : "OPTIONS * and 3363 proxies" 3365 o : "Reason-Phrase 3366 BNF" 3368 o : "Use of TEXT" 3370 o : "Join 3371 "Differences Between HTTP Entities and RFC 2045 Entities"?" 3373 o : "RFC822 3374 reference left in discussion of date formats" 3376 Final work on ABNF conversion 3377 (): 3379 o Rewrite definition of list rules, deprecate empty list elements. 3381 o Add appendix containing collected and expanded ABNF. 3383 Other changes: 3385 o Rewrite introduction; add mostly new Architecture Section. 3387 o Move definition of quality values from Part 3 into Part 1; make TE 3388 request header grammar independent of accept-params (defined in 3389 Part 3). 3391 E.8. Since draft-ietf-httpbis-p1-messaging-06 3393 Closed issues: 3395 o : "base for 3396 numeric protocol elements" 3398 o : "comment ABNF" 3400 Partly resolved issues: 3402 o : "205 Bodies" 3403 (took out language that implied that there may be methods for 3404 which a request body MUST NOT be included) 3406 o : "editorial 3407 improvements around HTTP-date" 3409 Index 3411 A 3412 application/http Media Type 49 3414 C 3415 cache 61 3416 cacheable 62 3417 client 62 3418 connection 62 3419 Connection header 39 3420 content negotiation 62 3421 Content-Length header 40 3423 D 3424 Date header 40 3425 downstream 64 3427 E 3428 entity 62 3430 G 3431 gateway 62 3432 Grammar 3433 absolute-URI 10 3434 ALPHA 7 3435 asctime-date 18 3436 attribute 18 3437 authority 10 3438 BWS 9 3439 chunk 20 3440 chunk-data 20 3441 chunk-ext 20 3442 chunk-ext-name 20 3443 chunk-ext-val 20 3444 chunk-size 20 3445 Chunked-Body 20 3446 comment 24 3447 Connection 39 3448 connection-token 39 3449 Connection-v 39 3450 Content-Length 40 3451 Content-Length-v 40 3452 CR 7 3453 CRLF 7 3454 ctext 24 3455 CTL 7 3456 Date 40 3457 Date-v 40 3458 date1 17 3459 date2 18 3460 date3 18 3461 day 17 3462 day-name 17 3463 day-name-l 17 3464 DIGIT 7 3465 DQUOTE 7 3466 extension-code 31 3467 extension-method 28 3468 field-content 23 3469 field-name 23 3470 field-value 23 3471 general-header 27 3472 generic-message 22 3473 GMT 17 3474 HEXDIG 7 3475 Host 42 3476 Host-v 42 3477 hour 17 3478 HTTP-date 16 3479 HTTP-message 22 3480 HTTP-Prot-Name 14 3481 http-URI 11 3482 HTTP-Version 14 3483 last-chunk 20 3484 LF 7 3485 message-body 25 3486 message-header 23 3487 Method 28 3488 minute 17 3489 month 17 3490 obs-date 17 3491 obs-text 9 3492 OCTET 7 3493 OWS 9 3494 path-absolute 10 3495 port 10 3496 product 21 3497 product-version 21 3498 protocol-name 46 3499 protocol-version 46 3500 pseudonym 46 3501 qdtext 9 3502 query 10 3503 quoted-pair 9 3504 quoted-string 9 3505 quoted-text 9 3506 qvalue 22 3507 Reason-Phrase 31 3508 received-by 46 3509 received-protocol 46 3510 Request 27 3511 Request-Line 28 3512 request-target 28 3513 Response 31 3514 rfc850-date 18 3515 rfc1123-date 17 3516 RWS 9 3517 second 17 3518 SP 7 3519 start-line 22 3520 Status-Code 31 3521 Status-Line 31 3522 t-codings 42 3523 tchar 9 3524 TE 42 3525 te-ext 42 3526 te-params 42 3527 TE-v 42 3528 time-of-day 17 3529 token 9 3530 Trailer 44 3531 trailer-part 20 3532 Trailer-v 44 3533 transfer-coding 18 3534 Transfer-Encoding 44 3535 Transfer-Encoding-v 44 3536 transfer-extension 18 3537 transfer-parameter 18 3538 Upgrade 45 3539 Upgrade-v 45 3540 uri-host 10 3541 URI-reference 10 3542 value 18 3543 VCHAR 7 3544 Via 46 3545 Via-v 46 3546 WSP 7 3547 year 17 3549 H 3550 Headers 3551 Connection 39 3552 Content-Length 40 3553 Date 40 3554 Host 42 3555 TE 42 3556 Trailer 44 3557 Transfer-Encoding 44 3558 Upgrade 45 3559 Via 46 3560 Host header 42 3561 http URI scheme 11 3562 https URI scheme 11 3564 I 3565 inbound 62 3567 M 3568 Media Type 3569 application/http 49 3570 message/http 48 3571 message 63 3572 message/http Media Type 48 3574 O 3575 origin server 63 3576 outbound 62 3578 P 3579 proxy 63 3581 R 3582 representation 63 3583 request 63 3584 resource 63 3585 response 63 3587 S 3588 server 64 3590 T 3591 TE header 42 3592 Trailer header 44 3593 Transfer-Encoding header 44 3594 tunnel 64 3596 U 3597 Upgrade header 45 3598 upstream 64 3599 URI scheme 3600 http 11 3601 https 11 3602 user agent 64 3604 V 3605 variant 64 3606 Via header 46 3608 Authors' Addresses 3610 Roy T. Fielding (editor) 3611 Day Software 3612 23 Corporate Plaza DR, Suite 280 3613 Newport Beach, CA 92660 3614 USA 3616 Phone: +1-949-706-5300 3617 Fax: +1-949-706-5305 3618 Email: fielding@gbiv.com 3619 URI: http://roy.gbiv.com/ 3620 Jim Gettys 3621 One Laptop per Child 3622 21 Oak Knoll Road 3623 Carlisle, MA 01741 3624 USA 3626 Email: jg@laptop.org 3627 URI: http://www.laptop.org/ 3629 Jeffrey C. Mogul 3630 Hewlett-Packard Company 3631 HP Labs, Large Scale Systems Group 3632 1501 Page Mill Road, MS 1177 3633 Palo Alto, CA 94304 3634 USA 3636 Email: JeffMogul@acm.org 3638 Henrik Frystyk Nielsen 3639 Microsoft Corporation 3640 1 Microsoft Way 3641 Redmond, WA 98052 3642 USA 3644 Email: henrikn@microsoft.com 3646 Larry Masinter 3647 Adobe Systems, Incorporated 3648 345 Park Ave 3649 San Jose, CA 95110 3650 USA 3652 Email: LMM@acm.org 3653 URI: http://larry.masinter.net/ 3655 Paul J. Leach 3656 Microsoft Corporation 3657 1 Microsoft Way 3658 Redmond, WA 98052 3660 Email: paulle@microsoft.com 3661 Tim Berners-Lee 3662 World Wide Web Consortium 3663 MIT Computer Science and Artificial Intelligence Laboratory 3664 The Stata Center, Building 32 3665 32 Vassar Street 3666 Cambridge, MA 02139 3667 USA 3669 Email: timbl@w3.org 3670 URI: http://www.w3.org/People/Berners-Lee/ 3672 Yves Lafon (editor) 3673 World Wide Web Consortium 3674 W3C / ERCIM 3675 2004, rte des Lucioles 3676 Sophia-Antipolis, AM 06902 3677 France 3679 Email: ylafon@w3.org 3680 URI: http://www.raubacapeu.net/people/yves/ 3682 Julian F. Reschke (editor) 3683 greenbytes GmbH 3684 Hafenweg 16 3685 Muenster, NW 48155 3686 Germany 3688 Phone: +49 251 2807760 3689 Fax: +49 251 2807761 3690 Email: julian.reschke@greenbytes.de 3691 URI: http://greenbytes.de/tech/webdav/