Changeset 2726 for draft-ietf-httpbis/19
- Timestamp:
- 14/06/14 11:20:37 (9 years ago)
- Location:
- draft-ietf-httpbis/19
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
draft-ietf-httpbis/19/p1-messaging.html
r1592 r2726 2 2 PUBLIC "-//W3C//DTD HTML 4.01//EN"> 3 3 <html lang="en"> 4 <head profile="http:// www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">4 <head profile="http://dublincore.org/documents/2008/08/04/dc-html/"> 5 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 6 6 <title>HTTP/1.1, part 1: URIs, Connections, and Message Parsing</title><script> 7 7 var buttonsAdded = false; 8 8 9 function init () {9 function initFeedback() { 10 10 var fb = document.createElement("div"); 11 11 fb.className = "feedback noprint"; … … 22 22 toggleButtonsToElementsByName("h3"); 23 23 toggleButtonsToElementsByName("h4"); 24 24 25 25 buttonsAdded = !buttonsAdded; 26 26 } … … 35 35 function toggleButton(node) { 36 36 if (! buttonsAdded) { 37 37 38 38 // docname 39 39 var template = "mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&body=<{ref}>:"; … … 58 58 ref += "#" + id; 59 59 } 60 60 61 61 // docname 62 62 var docname = "draft-ietf-httpbis-p1-messaging-19"; … … 65 65 var section = node.textContent; 66 66 section = section.replace("\u00a0", " "); 67 67 68 68 // build URI from template 69 69 var uri = template.replace("{docname}", encodeURIComponent(docname)); 70 70 uri = uri.replace("{section}", encodeURIComponent(section)); 71 71 uri = uri.replace("{ref}", encodeURIComponent(ref)); 72 72 73 73 var button = document.createElement("a"); 74 74 button.className = "fbbutton noprint"; … … 106 106 body { 107 107 color: black; 108 font-family: verdana, helvetica, arial, sans-serif; 109 font-size: 10pt; 108 font-family: cambria, helvetica, arial, sans-serif; 109 font-size: 11pt; 110 margin-right: 2em; 110 111 } 111 112 cite { … … 115 116 margin-left: 2em; 116 117 } 117 dd {118 margin-right: 2em;119 }120 118 dl { 121 119 margin-left: 2em; 122 120 } 123 124 121 ul.empty { 125 122 list-style-type: none; … … 135 132 } 136 133 h1 { 137 font-size: 1 4pt;134 font-size: 130%; 138 135 line-height: 21pt; 139 136 page-break-after: avoid; … … 142 139 page-break-before: always; 143 140 } 144 h1 a {145 color: #333333;146 }147 141 h2 { 148 font-size: 12 pt;142 font-size: 120%; 149 143 line-height: 15pt; 150 144 page-break-after: avoid; 151 145 } 152 h3 , h4, h5, h6{153 font-size: 1 0pt;146 h3 { 147 font-size: 110%; 154 148 page-break-after: avoid; 155 149 } 156 h2 a, h3 a, h4 a, h5 a, h6 a { 150 h4, h5, h6 { 151 page-break-after: avoid; 152 } 153 h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { 157 154 color: black; 158 155 } … … 162 159 li { 163 160 margin-left: 2em; 164 margin-right: 2em;165 161 } 166 162 ol { 167 163 margin-left: 2em; 168 margin-right: 2em;169 164 } 170 165 ol.la { … … 179 174 p { 180 175 margin-left: 2em; 181 margin-right: 2em;182 176 } 183 177 pre { … … 185 179 background-color: lightyellow; 186 180 padding: .25em; 181 page-break-inside: avoid; 187 182 } 188 183 pre.text2 { … … 213 208 table.tt { 214 209 vertical-align: top; 210 border-color: gray; 211 } 212 table.tt th { 213 border-color: gray; 214 } 215 table.tt td { 216 border-color: gray; 217 } 218 table.all { 219 border-style: solid; 220 border-width: 2px; 215 221 } 216 222 table.full { 217 border-style: outset; 218 border-width: 1px; 219 } 220 table.headers { 221 border-style: outset; 222 border-width: 1px; 223 border-style: solid; 224 border-width: 2px; 223 225 } 224 226 table.tt td { 225 227 vertical-align: top; 226 228 } 229 table.all td { 230 border-style: solid; 231 border-width: 1px; 232 } 227 233 table.full td { 228 border-style: inset;234 border-style: none solid; 229 235 border-width: 1px; 230 236 } … … 232 238 vertical-align: top; 233 239 } 240 table.all th { 241 border-style: solid; 242 border-width: 1px; 243 } 234 244 table.full th { 235 border-style: inset;236 border-width: 1px ;245 border-style: solid; 246 border-width: 1px 1px 2px 1px; 237 247 } 238 248 table.headers th { 239 border-style: none none insetnone;240 border-width: 1px;249 border-style: none none solid none; 250 border-width: 2px; 241 251 } 242 252 table.left { … … 253 263 caption-side: bottom; 254 264 font-weight: bold; 255 font-size: 9pt;265 font-size: 10pt; 256 266 margin-top: .5em; 257 267 } … … 260 270 border-spacing: 1px; 261 271 width: 95%; 262 font-size: 1 0pt;272 font-size: 11pt; 263 273 color: white; 264 274 } … … 268 278 td.topnowrap { 269 279 vertical-align: top; 270 white-space: nowrap; 280 white-space: nowrap; 271 281 } 272 282 table.header td { … … 288 298 list-style: none; 289 299 margin-left: 1.5em; 290 margin-right: 0em;291 300 padding-left: 0em; 292 301 } … … 294 303 line-height: 150%; 295 304 font-weight: bold; 296 font-size: 10pt;297 305 margin-left: 0em; 298 margin-right: 0em;299 306 } 300 307 ul.toc li li { 301 308 line-height: normal; 302 309 font-weight: normal; 303 font-size: 9pt;310 font-size: 10pt; 304 311 margin-left: 0em; 305 margin-right: 0em;306 312 } 307 313 li.excluded { … … 310 316 ul p { 311 317 margin-left: 0em; 318 } 319 .title, .filename, h1, h2, h3, h4 { 320 font-family: candara, helvetica, arial, sans-serif; 321 } 322 samp, tt, code, pre { 323 font: consolas, monospace; 312 324 } 313 325 ul.ind, ul.ind ul { 314 326 list-style: none; 315 327 margin-left: 1.5em; 316 margin-right: 0em;317 328 padding-left: 0em; 318 329 page-break-before: avoid; … … 322 333 line-height: 200%; 323 334 margin-left: 0em; 324 margin-right: 0em;325 335 } 326 336 ul.ind li li { … … 328 338 line-height: 150%; 329 339 margin-left: 0em; 330 margin-right: 0em;331 340 } 332 341 .avoidbreak { … … 352 361 font-weight: bold; 353 362 text-align: center; 354 font-size: 9pt;363 font-size: 10pt; 355 364 } 356 365 .filename { 357 366 color: #333333; 367 font-size: 75%; 358 368 font-weight: bold; 359 font-size: 12pt;360 369 line-height: 21pt; 361 370 text-align: center; … … 364 373 font-weight: bold; 365 374 } 366 .hidden {367 display: none;368 }369 375 .left { 370 376 text-align: left; … … 374 380 } 375 381 .title { 376 color: #990000;377 font-size: 1 8pt;382 color: green; 383 font-size: 150%; 378 384 line-height: 18pt; 379 385 font-weight: bold; … … 381 387 margin-top: 36pt; 382 388 } 383 .vcardline {384 display: block;385 }386 389 .warning { 387 font-size: 1 4pt;390 font-size: 130%; 388 391 background-color: yellow; 389 392 } … … 413 416 display: none; 414 417 } 415 418 416 419 a { 417 420 color: black; … … 428 431 background-color: white; 429 432 vertical-align: top; 430 font-size: 1 2pt;433 font-size: 110%; 431 434 } 432 435 433 ul.toc a: :after {436 ul.toc a:nth-child(2)::after { 434 437 content: leader('.') target-counter(attr(href), page); 435 438 } 436 439 437 440 ul.ind li li a { 438 441 content: target-counter(attr(href), page); 439 442 } 440 443 441 444 .print2col { 442 445 column-count: 2; … … 448 451 @page { 449 452 @top-left { 450 content: "Internet-Draft"; 451 } 453 content: "Internet-Draft"; 454 } 452 455 @top-right { 453 content: "March 2012"; 454 } 456 content: "March 2012"; 457 } 455 458 @top-center { 456 content: "HTTP/1.1, Part 1"; 457 } 459 content: "HTTP/1.1, Part 1"; 460 } 458 461 @bottom-left { 459 content: "Fielding, et al."; 460 } 462 content: "Fielding, et al."; 463 } 461 464 @bottom-center { 462 content: "Expires September 13, 2012"; 463 } 465 content: "Expires September 13, 2012"; 466 } 464 467 @bottom-right { 465 content: "[Page " counter(page) "]"; 466 } 467 } 468 469 @page:first { 468 content: "[Page " counter(page) "]"; 469 } 470 } 471 472 @page:first { 470 473 @top-left { 471 474 content: normal; … … 496 499 <link rel="Appendix" title="C Change Log (to be removed by RFC Editor before publication)" href="#rfc.section.C"> 497 500 <link href="p2-semantics.html" rel="next"> 498 <meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1. 570, 2012-02-13 19:17:35, XSLT vendor: SAXON 8.9 from Saxonica http://www.saxonica.com/">501 <meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.640, 2014/06/13 12:42:58, XSLT vendor: SAXON 8.9 from Saxonica http://www.saxonica.com/"> 499 502 <link rel="schema.dct" href="http://purl.org/dc/terms/"> 500 503 <meta name="dct.creator" content="Fielding, R."> … … 508 511 <meta name="description" content="The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypertext information systems. HTTP has been in use by the World Wide Web global information initiative since 1990. This document is Part 1 of the seven-part specification that defines the protocol referred to as "HTTP/1.1" and, taken together, obsoletes RFC 2616 and moves it to historic status, along with its predecessor RFC 2068. Part 1 provides an overview of HTTP and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the generic message syntax and parsing requirements for HTTP message frames, and describes general security concerns for implementations. This part also obsoletes RFCs 2145 (on HTTP version numbers) and 2817 (on using CONNECT for TLS upgrades) and moves them to historic status."> 509 512 </head> 510 <body onload="init ();">513 <body onload="initFeedback();"> 511 514 <table class="header"> 512 515 <tbody> … … 520 523 </tr> 521 524 <tr> 522 <td class="left">Obsoletes: <a href="http ://tools.ietf.org/html/rfc2145">2145</a>, <a href="http://tools.ietf.org/html/rfc2616">2616</a> (if approved)525 <td class="left">Obsoletes: <a href="https://tools.ietf.org/html/rfc2145">2145</a>, <a href="https://tools.ietf.org/html/rfc2616">2616</a> (if approved) 523 526 </td> 524 527 <td class="right">Y. Lafon, Editor</td> 525 528 </tr> 526 529 <tr> 527 <td class="left">Updates: <a href="http ://tools.ietf.org/html/rfc2817">2817</a> (if approved)530 <td class="left">Updates: <a href="https://tools.ietf.org/html/rfc2817">2817</a> (if approved) 528 531 </td> 529 532 <td class="right">W3C</td> … … 544 547 </table> 545 548 <p class="title">HTTP/1.1, part 1: URIs, Connections, and Message Parsing<br><span class="filename">draft-ietf-httpbis-p1-messaging-19</span></p> 546 <h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1> 549 <h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1> 547 550 <p>The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypertext information 548 551 systems. HTTP has been in use by the World Wide Web global information initiative since 1990. This document is Part 1 of the 549 552 seven-part specification that defines the protocol referred to as "HTTP/1.1" and, taken together, obsoletes <cite title="Hypertext Transfer Protocol -- HTTP/1.1" id="rfc.xref.RFC2616.1">RFC 2616</cite> and moves it to historic status, along with its predecessor <cite title="Hypertext Transfer Protocol -- HTTP/1.1" id="rfc.xref.RFC2068.1">RFC 2068</cite>. 550 </p> 553 </p> 551 554 <p>Part 1 provides an overview of HTTP and its associated terminology, defines the "http" and "https" Uniform Resource Identifier 552 555 (URI) schemes, defines the generic message syntax and parsing requirements for HTTP message frames, and describes general 553 556 security concerns for implementations. 554 </p> 557 </p> 555 558 <p>This part also obsoletes RFCs <cite title="Use and Interpretation of HTTP Version Numbers" id="rfc.xref.RFC2145.1">2145</cite> (on HTTP version numbers) and <cite title="Upgrading to TLS Within HTTP/1.1" id="rfc.xref.RFC2817.1">2817</cite> (on using CONNECT for TLS upgrades) and moves them to historic status. 556 </p> 557 <h1 id="rfc.note.1"><a href="#rfc.note.1">Editorial Note (To be removed by RFC Editor)</a></h1> 559 </p> 560 <h1 id="rfc.note.1"><a href="#rfc.note.1">Editorial Note (To be removed by RFC Editor)</a></h1> 558 561 <p>Discussion of this draft should take place on the HTTPBIS working group mailing list (ietf-http-wg@w3.org), which is archived 559 562 at <<a href="http://lists.w3.org/Archives/Public/ietf-http-wg/">http://lists.w3.org/Archives/Public/ietf-http-wg/</a>>. 560 </p> 563 </p> 561 564 <p>The current issues list is at <<a href="http://tools.ietf.org/wg/httpbis/trac/report/3">http://tools.ietf.org/wg/httpbis/trac/report/3</a>> and related documents (including fancy diffs) can be found at <<a href="http://tools.ietf.org/wg/httpbis/">http://tools.ietf.org/wg/httpbis/</a>>. 562 </p> 565 </p> 563 566 <p>The changes in this draft are summarized in <a href="#changes.since.18" title="Since draft-ietf-httpbis-p1-messaging-18">Appendix C.20</a>. 564 </p>565 <h1><a id="rfc.status" href="#rfc.status">Status of This Memo</a></h1>566 <p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p>567 <p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute568 working documents as Internet-Drafts. The list of current Internet-Drafts is at <a href="http://datatracker.ietf.org/drafts/current/">http://datatracker.ietf.org/drafts/current/</a>.569 567 </p> 570 <p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other 571 documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work 572 in progress”. 573 </p> 574 <p>This Internet-Draft will expire on September 13, 2012.</p> 575 <h1><a id="rfc.copyrightnotice" href="#rfc.copyrightnotice">Copyright Notice</a></h1> 576 <p>Copyright © 2012 IETF Trust and the persons identified as the document authors. All rights reserved.</p> 577 <p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights 578 and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License 579 text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified 580 BSD License. 581 </p> 582 <p>This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 583 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to 584 allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) 585 controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative 586 works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate 587 it into languages other than English. 588 </p> 568 <div id="rfc.status"> 569 <h1><a href="#rfc.status">Status of This Memo</a></h1> 570 <p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p> 571 <p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute 572 working documents as Internet-Drafts. The list of current Internet-Drafts is at <a href="http://datatracker.ietf.org/drafts/current/">http://datatracker.ietf.org/drafts/current/</a>. 573 </p> 574 <p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other 575 documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work 576 in progress”. 577 </p> 578 <p>This Internet-Draft will expire on September 13, 2012.</p> 579 </div> 580 <div id="rfc.copyrightnotice"> 581 <h1><a href="#rfc.copyrightnotice">Copyright Notice</a></h1> 582 <p>Copyright © 2012 IETF Trust and the persons identified as the document authors. All rights reserved.</p> 583 <p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights 584 and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License 585 text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified 586 BSD License. 587 </p> 588 <p>This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 589 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to 590 allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) 591 controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative 592 works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate 593 it into languages other than English. 594 </p> 595 </div> 589 596 <hr class="noprint"> 590 597 <h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1> 591 598 <ul class="toc"> 592 <li> 1. <a href="#introduction">Introduction</a><ul>593 <li> 1.1 <a href="#intro.requirements">Requirement Notation</a></li>594 <li> 1.2 <a href="#notation">Syntax Notation</a></li>599 <li><a href="#rfc.section.1">1.</a> <a href="#introduction">Introduction</a><ul> 600 <li><a href="#rfc.section.1.1">1.1</a> <a href="#intro.requirements">Requirement Notation</a></li> 601 <li><a href="#rfc.section.1.2">1.2</a> <a href="#notation">Syntax Notation</a></li> 595 602 </ul> 596 603 </li> 597 <li> 2. <a href="#architecture">Architecture</a><ul>598 <li> 2.1 <a href="#operation">Client/Server Messaging</a></li>599 <li> 2.2 <a href="#transport-independence">Connections and Transport Independence</a></li>600 <li> 2.3 <a href="#intermediaries">Intermediaries</a></li>601 <li> 2.4 <a href="#caches">Caches</a></li>602 <li> 2.5 <a href="#intro.conformance.and.error.handling">Conformance and Error Handling</a></li>603 <li> 2.6 <a href="#http.version">Protocol Versioning</a></li>604 <li> 2.7 <a href="#uri">Uniform Resource Identifiers</a><ul>605 <li> 2.7.1 <a href="#http.uri">http URI scheme</a></li>606 <li> 2.7.2 <a href="#https.uri">https URI scheme</a></li>607 <li> 2.7.3 <a href="#uri.comparison">http and https URI Normalization and Comparison</a></li>604 <li><a href="#rfc.section.2">2.</a> <a href="#architecture">Architecture</a><ul> 605 <li><a href="#rfc.section.2.1">2.1</a> <a href="#operation">Client/Server Messaging</a></li> 606 <li><a href="#rfc.section.2.2">2.2</a> <a href="#transport-independence">Connections and Transport Independence</a></li> 607 <li><a href="#rfc.section.2.3">2.3</a> <a href="#intermediaries">Intermediaries</a></li> 608 <li><a href="#rfc.section.2.4">2.4</a> <a href="#caches">Caches</a></li> 609 <li><a href="#rfc.section.2.5">2.5</a> <a href="#intro.conformance.and.error.handling">Conformance and Error Handling</a></li> 610 <li><a href="#rfc.section.2.6">2.6</a> <a href="#http.version">Protocol Versioning</a></li> 611 <li><a href="#rfc.section.2.7">2.7</a> <a href="#uri">Uniform Resource Identifiers</a><ul> 612 <li><a href="#rfc.section.2.7.1">2.7.1</a> <a href="#http.uri">http URI scheme</a></li> 613 <li><a href="#rfc.section.2.7.2">2.7.2</a> <a href="#https.uri">https URI scheme</a></li> 614 <li><a href="#rfc.section.2.7.3">2.7.3</a> <a href="#uri.comparison">http and https URI Normalization and Comparison</a></li> 608 615 </ul> 609 616 </li> 610 617 </ul> 611 618 </li> 612 <li> 3. <a href="#http.message">Message Format</a><ul>613 <li> 3.1 <a href="#start.line">Start Line</a><ul>614 <li> 3.1.1 <a href="#request.line">Request Line</a></li>615 <li> 3.1.2 <a href="#status.line">Status Line</a></li>619 <li><a href="#rfc.section.3">3.</a> <a href="#http.message">Message Format</a><ul> 620 <li><a href="#rfc.section.3.1">3.1</a> <a href="#start.line">Start Line</a><ul> 621 <li><a href="#rfc.section.3.1.1">3.1.1</a> <a href="#request.line">Request Line</a></li> 622 <li><a href="#rfc.section.3.1.2">3.1.2</a> <a href="#status.line">Status Line</a></li> 616 623 </ul> 617 624 </li> 618 <li> 3.2 <a href="#header.fields">Header Fields</a><ul>619 <li> 3.2.1 <a href="#whitespace">Whitespace</a></li>620 <li> 3.2.2 <a href="#field.parsing">Field Parsing</a></li>621 <li> 3.2.3 <a href="#field.length">Field Length</a></li>622 <li> 3.2.4 <a href="#field.components">Field value components</a></li>623 <li> 3.2.5 <a href="#abnf.extension">ABNF list extension: #rule</a></li>625 <li><a href="#rfc.section.3.2">3.2</a> <a href="#header.fields">Header Fields</a><ul> 626 <li><a href="#rfc.section.3.2.1">3.2.1</a> <a href="#whitespace">Whitespace</a></li> 627 <li><a href="#rfc.section.3.2.2">3.2.2</a> <a href="#field.parsing">Field Parsing</a></li> 628 <li><a href="#rfc.section.3.2.3">3.2.3</a> <a href="#field.length">Field Length</a></li> 629 <li><a href="#rfc.section.3.2.4">3.2.4</a> <a href="#field.components">Field value components</a></li> 630 <li><a href="#rfc.section.3.2.5">3.2.5</a> <a href="#abnf.extension">ABNF list extension: #rule</a></li> 624 631 </ul> 625 632 </li> 626 <li> 3.3 <a href="#message.body">Message Body</a><ul>627 <li> 3.3.1 <a href="#header.transfer-encoding">Transfer-Encoding</a></li>628 <li> 3.3.2 <a href="#header.content-length">Content-Length</a></li>629 <li> 3.3.3 <a href="#message.body.length">Message Body Length</a></li>633 <li><a href="#rfc.section.3.3">3.3</a> <a href="#message.body">Message Body</a><ul> 634 <li><a href="#rfc.section.3.3.1">3.3.1</a> <a href="#header.transfer-encoding">Transfer-Encoding</a></li> 635 <li><a href="#rfc.section.3.3.2">3.3.2</a> <a href="#header.content-length">Content-Length</a></li> 636 <li><a href="#rfc.section.3.3.3">3.3.3</a> <a href="#message.body.length">Message Body Length</a></li> 630 637 </ul> 631 638 </li> 632 <li> 3.4 <a href="#incomplete.messages">Handling Incomplete Messages</a></li>633 <li> 3.5 <a href="#message.robustness">Message Parsing Robustness</a></li>639 <li><a href="#rfc.section.3.4">3.4</a> <a href="#incomplete.messages">Handling Incomplete Messages</a></li> 640 <li><a href="#rfc.section.3.5">3.5</a> <a href="#message.robustness">Message Parsing Robustness</a></li> 634 641 </ul> 635 642 </li> 636 <li> 4. <a href="#transfer.codings">Transfer Codings</a><ul>637 <li> 4.1 <a href="#chunked.encoding">Chunked Transfer Coding</a></li>638 <li> 4.2 <a href="#compression.codings">Compression Codings</a><ul>639 <li> 4.2.1 <a href="#compress.coding">Compress Coding</a></li>640 <li> 4.2.2 <a href="#deflate.coding">Deflate Coding</a></li>641 <li> 4.2.3 <a href="#gzip.coding">Gzip Coding</a></li>643 <li><a href="#rfc.section.4">4.</a> <a href="#transfer.codings">Transfer Codings</a><ul> 644 <li><a href="#rfc.section.4.1">4.1</a> <a href="#chunked.encoding">Chunked Transfer Coding</a></li> 645 <li><a href="#rfc.section.4.2">4.2</a> <a href="#compression.codings">Compression Codings</a><ul> 646 <li><a href="#rfc.section.4.2.1">4.2.1</a> <a href="#compress.coding">Compress Coding</a></li> 647 <li><a href="#rfc.section.4.2.2">4.2.2</a> <a href="#deflate.coding">Deflate Coding</a></li> 648 <li><a href="#rfc.section.4.2.3">4.2.3</a> <a href="#gzip.coding">Gzip Coding</a></li> 642 649 </ul> 643 650 </li> 644 <li> 4.3 <a href="#header.te">TE</a><ul>645 <li> 4.3.1 <a href="#quality.values">Quality Values</a></li>651 <li><a href="#rfc.section.4.3">4.3</a> <a href="#header.te">TE</a><ul> 652 <li><a href="#rfc.section.4.3.1">4.3.1</a> <a href="#quality.values">Quality Values</a></li> 646 653 </ul> 647 654 </li> 648 <li> 4.4 <a href="#header.trailer">Trailer</a></li>655 <li><a href="#rfc.section.4.4">4.4</a> <a href="#header.trailer">Trailer</a></li> 649 656 </ul> 650 657 </li> 651 <li> 5. <a href="#message.routing">Message Routing</a><ul>652 <li> 5.1 <a href="#target-resource">Identifying a Target Resource</a></li>653 <li> 5.2 <a href="#connecting.inbound">Connecting Inbound</a></li>654 <li> 5.3 <a href="#request-target">Request Target</a></li>655 <li> 5.4 <a href="#header.host">Host</a></li>656 <li> 5.5 <a href="#effective.request.uri">Effective Request URI</a></li>657 <li> 5.6 <a href="#intermediary.forwarding">Intermediary Forwarding</a><ul>658 <li> 5.6.1 <a href="#end-to-end.and.hop-by-hop.header-fields">End-to-end and Hop-by-hop Header Fields</a></li>659 <li> 5.6.2 <a href="#non-modifiable.header-fields">Non-modifiable Header Fields</a></li>658 <li><a href="#rfc.section.5">5.</a> <a href="#message.routing">Message Routing</a><ul> 659 <li><a href="#rfc.section.5.1">5.1</a> <a href="#target-resource">Identifying a Target Resource</a></li> 660 <li><a href="#rfc.section.5.2">5.2</a> <a href="#connecting.inbound">Connecting Inbound</a></li> 661 <li><a href="#rfc.section.5.3">5.3</a> <a href="#request-target">Request Target</a></li> 662 <li><a href="#rfc.section.5.4">5.4</a> <a href="#header.host">Host</a></li> 663 <li><a href="#rfc.section.5.5">5.5</a> <a href="#effective.request.uri">Effective Request URI</a></li> 664 <li><a href="#rfc.section.5.6">5.6</a> <a href="#intermediary.forwarding">Intermediary Forwarding</a><ul> 665 <li><a href="#rfc.section.5.6.1">5.6.1</a> <a href="#end-to-end.and.hop-by-hop.header-fields">End-to-end and Hop-by-hop Header Fields</a></li> 666 <li><a href="#rfc.section.5.6.2">5.6.2</a> <a href="#non-modifiable.header-fields">Non-modifiable Header Fields</a></li> 660 667 </ul> 661 668 </li> 662 <li> 5.7 <a href="#associating.response.to.request">Associating a Response to a Request</a></li>669 <li><a href="#rfc.section.5.7">5.7</a> <a href="#associating.response.to.request">Associating a Response to a Request</a></li> 663 670 </ul> 664 671 </li> 665 <li>6. <a href="#connection.management">Connection Management</a><ul> 666 <li>6.1 <a href="#header.connection">Connection</a></li> 667 <li>6.2 <a href="#header.via">Via</a></li> 668 <li>6.3 <a href="#persistent.connections">Persistent Connections</a><ul> 669 <li>6.3.1 <a href="#persistent.purpose">Purpose</a></li> 670 <li>6.3.2 <a href="#persistent.overall">Overall Operation</a><ul> 671 <li>6.3.2.1 <a href="#persistent.negotiation">Negotiation</a></li> 672 <li>6.3.2.2 <a href="#pipelining">Pipelining</a></li> 673 </ul> 674 </li> 675 <li>6.3.3 <a href="#persistent.practical">Practical Considerations</a></li> 676 <li>6.3.4 <a href="#persistent.retrying.requests">Retrying Requests</a></li> 672 <li><a href="#rfc.section.6">6.</a> <a href="#connection.management">Connection Management</a><ul> 673 <li><a href="#rfc.section.6.1">6.1</a> <a href="#header.connection">Connection</a></li> 674 <li><a href="#rfc.section.6.2">6.2</a> <a href="#header.via">Via</a></li> 675 <li><a href="#rfc.section.6.3">6.3</a> <a href="#persistent.connections">Persistent Connections</a><ul> 676 <li><a href="#rfc.section.6.3.1">6.3.1</a> <a href="#persistent.purpose">Purpose</a></li> 677 <li><a href="#rfc.section.6.3.2">6.3.2</a> <a href="#persistent.overall">Overall Operation</a></li> 678 <li><a href="#rfc.section.6.3.3">6.3.3</a> <a href="#persistent.practical">Practical Considerations</a></li> 679 <li><a href="#rfc.section.6.3.4">6.3.4</a> <a href="#persistent.retrying.requests">Retrying Requests</a></li> 677 680 </ul> 678 681 </li> 679 <li> 6.4 <a href="#message.transmission.requirements">Message Transmission Requirements</a><ul>680 <li> 6.4.1 <a href="#persistent.flow">Persistent Connections and Flow Control</a></li>681 <li> 6.4.2 <a href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></li>682 <li> 6.4.3 <a href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></li>683 <li> 6.4.4 <a href="#closing.connections.on.error">Closing Connections on Error</a></li>682 <li><a href="#rfc.section.6.4">6.4</a> <a href="#message.transmission.requirements">Message Transmission Requirements</a><ul> 683 <li><a href="#rfc.section.6.4.1">6.4.1</a> <a href="#persistent.flow">Persistent Connections and Flow Control</a></li> 684 <li><a href="#rfc.section.6.4.2">6.4.2</a> <a href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></li> 685 <li><a href="#rfc.section.6.4.3">6.4.3</a> <a href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></li> 686 <li><a href="#rfc.section.6.4.4">6.4.4</a> <a href="#closing.connections.on.error">Closing Connections on Error</a></li> 684 687 </ul> 685 688 </li> 686 <li> 6.5 <a href="#header.upgrade">Upgrade</a></li>689 <li><a href="#rfc.section.6.5">6.5</a> <a href="#header.upgrade">Upgrade</a></li> 687 690 </ul> 688 691 </li> 689 <li> 7. <a href="#IANA.considerations">IANA Considerations</a><ul>690 <li> 7.1 <a href="#header.field.registration">Header Field Registration</a></li>691 <li> 7.2 <a href="#uri.scheme.registration">URI Scheme Registration</a></li>692 <li> 7.3 <a href="#internet.media.type.http">Internet Media Type Registrations</a><ul>693 <li> 7.3.1 <a href="#internet.media.type.message.http">Internet Media Type message/http</a></li>694 <li> 7.3.2 <a href="#internet.media.type.application.http">Internet Media Type application/http</a></li>692 <li><a href="#rfc.section.7">7.</a> <a href="#IANA.considerations">IANA Considerations</a><ul> 693 <li><a href="#rfc.section.7.1">7.1</a> <a href="#header.field.registration">Header Field Registration</a></li> 694 <li><a href="#rfc.section.7.2">7.2</a> <a href="#uri.scheme.registration">URI Scheme Registration</a></li> 695 <li><a href="#rfc.section.7.3">7.3</a> <a href="#internet.media.type.http">Internet Media Type Registrations</a><ul> 696 <li><a href="#rfc.section.7.3.1">7.3.1</a> <a href="#internet.media.type.message.http">Internet Media Type message/http</a></li> 697 <li><a href="#rfc.section.7.3.2">7.3.2</a> <a href="#internet.media.type.application.http">Internet Media Type application/http</a></li> 695 698 </ul> 696 699 </li> 697 <li> 7.4 <a href="#transfer.coding.registry">Transfer Coding Registry</a></li>698 <li> 7.5 <a href="#transfer.coding.registration">Transfer Coding Registrations</a></li>699 <li> 7.6 <a href="#upgrade.token.registry">Upgrade Token Registry</a></li>700 <li> 7.7 <a href="#upgrade.token.registration">Upgrade Token Registration</a></li>700 <li><a href="#rfc.section.7.4">7.4</a> <a href="#transfer.coding.registry">Transfer Coding Registry</a></li> 701 <li><a href="#rfc.section.7.5">7.5</a> <a href="#transfer.coding.registration">Transfer Coding Registrations</a></li> 702 <li><a href="#rfc.section.7.6">7.6</a> <a href="#upgrade.token.registry">Upgrade Token Registry</a></li> 703 <li><a href="#rfc.section.7.7">7.7</a> <a href="#upgrade.token.registration">Upgrade Token Registration</a></li> 701 704 </ul> 702 705 </li> 703 <li> 8. <a href="#security.considerations">Security Considerations</a><ul>704 <li> 8.1 <a href="#personal.information">Personal Information</a></li>705 <li> 8.2 <a href="#abuse.of.server.log.information">Abuse of Server Log Information</a></li>706 <li> 8.3 <a href="#attack.pathname">Attacks Based On File and Path Names</a></li>707 <li> 8.4 <a href="#dns.related.attacks">DNS-related Attacks</a></li>708 <li> 8.5 <a href="#attack.intermediaries">Intermediaries and Caching</a></li>709 <li> 8.6 <a href="#attack.protocol.element.size.overflows">Protocol Element Size Overflows</a></li>706 <li><a href="#rfc.section.8">8.</a> <a href="#security.considerations">Security Considerations</a><ul> 707 <li><a href="#rfc.section.8.1">8.1</a> <a href="#personal.information">Personal Information</a></li> 708 <li><a href="#rfc.section.8.2">8.2</a> <a href="#abuse.of.server.log.information">Abuse of Server Log Information</a></li> 709 <li><a href="#rfc.section.8.3">8.3</a> <a href="#attack.pathname">Attacks Based On File and Path Names</a></li> 710 <li><a href="#rfc.section.8.4">8.4</a> <a href="#dns.related.attacks">DNS-related Attacks</a></li> 711 <li><a href="#rfc.section.8.5">8.5</a> <a href="#attack.intermediaries">Intermediaries and Caching</a></li> 712 <li><a href="#rfc.section.8.6">8.6</a> <a href="#attack.protocol.element.size.overflows">Protocol Element Size Overflows</a></li> 710 713 </ul> 711 714 </li> 712 <li> 9. <a href="#acks">Acknowledgments</a></li>713 <li> 10. <a href="#rfc.references">References</a><ul>714 <li> 10.1 <a href="#rfc.references.1">Normative References</a></li>715 <li> 10.2 <a href="#rfc.references.2">Informative References</a></li>715 <li><a href="#rfc.section.9">9.</a> <a href="#acks">Acknowledgments</a></li> 716 <li><a href="#rfc.section.10">10.</a> <a href="#rfc.references">References</a><ul> 717 <li><a href="#rfc.section.10.1">10.1</a> <a href="#rfc.references.1">Normative References</a></li> 718 <li><a href="#rfc.section.10.2">10.2</a> <a href="#rfc.references.2">Informative References</a></li> 716 719 </ul> 717 720 </li> 718 <li><a href="#rfc.authors">Authors' Addresses</a></li> 719 <li>A. <a href="#compatibility">HTTP Version History</a><ul> 720 <li>A.1 <a href="#changes.from.1.0">Changes from HTTP/1.0</a><ul> 721 <li>A.1.1 <a href="#changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses">Multi-homed Web Servers</a></li> 722 <li>A.1.2 <a href="#compatibility.with.http.1.0.persistent.connections">Keep-Alive Connections</a></li> 721 <li><a href="#rfc.section.A">A.</a> <a href="#compatibility">HTTP Version History</a><ul> 722 <li><a href="#rfc.section.A.1">A.1</a> <a href="#changes.from.1.0">Changes from HTTP/1.0</a><ul> 723 <li><a href="#rfc.section.A.1.1">A.1.1</a> <a href="#changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses">Multi-homed Web Servers</a></li> 724 <li><a href="#rfc.section.A.1.2">A.1.2</a> <a href="#compatibility.with.http.1.0.persistent.connections">Keep-Alive Connections</a></li> 723 725 </ul> 724 726 </li> 725 <li> A.2 <a href="#changes.from.rfc.2616">Changes from RFC 2616</a></li>726 <li> A.3 <a href="#changes.from.rfc.2817">Changes from RFC 2817</a></li>727 <li><a href="#rfc.section.A.2">A.2</a> <a href="#changes.from.rfc.2616">Changes from RFC 2616</a></li> 728 <li><a href="#rfc.section.A.3">A.3</a> <a href="#changes.from.rfc.2817">Changes from RFC 2817</a></li> 727 729 </ul> 728 730 </li> 729 <li> B. <a href="#collected.abnf">Collected ABNF</a></li>730 <li> C. <a href="#change.log">Change Log (to be removed by RFC Editor before publication)</a><ul>731 <li> C.1 <a href="#rfc.section.C.1">Since RFC 2616</a></li>732 <li> C.2 <a href="#rfc.section.C.2">Since draft-ietf-httpbis-p1-messaging-00</a></li>733 <li> C.3 <a href="#rfc.section.C.3">Since draft-ietf-httpbis-p1-messaging-01</a></li>734 <li> C.4 <a href="#changes.since.02">Since draft-ietf-httpbis-p1-messaging-02</a></li>735 <li> C.5 <a href="#changes.since.03">Since draft-ietf-httpbis-p1-messaging-03</a></li>736 <li> C.6 <a href="#changes.since.04">Since draft-ietf-httpbis-p1-messaging-04</a></li>737 <li> C.7 <a href="#changes.since.05">Since draft-ietf-httpbis-p1-messaging-05</a></li>738 <li> C.8 <a href="#changes.since.06">Since draft-ietf-httpbis-p1-messaging-06</a></li>739 <li> C.9 <a href="#changes.since.07">Since draft-ietf-httpbis-p1-messaging-07</a></li>740 <li> C.10 <a href="#changes.since.08">Since draft-ietf-httpbis-p1-messaging-08</a></li>741 <li> C.11 <a href="#changes.since.09">Since draft-ietf-httpbis-p1-messaging-09</a></li>742 <li> C.12 <a href="#changes.since.10">Since draft-ietf-httpbis-p1-messaging-10</a></li>743 <li> C.13 <a href="#changes.since.11">Since draft-ietf-httpbis-p1-messaging-11</a></li>744 <li> C.14 <a href="#changes.since.12">Since draft-ietf-httpbis-p1-messaging-12</a></li>745 <li> C.15 <a href="#changes.since.13">Since draft-ietf-httpbis-p1-messaging-13</a></li>746 <li> C.16 <a href="#changes.since.14">Since draft-ietf-httpbis-p1-messaging-14</a></li>747 <li> C.17 <a href="#changes.since.15">Since draft-ietf-httpbis-p1-messaging-15</a></li>748 <li> C.18 <a href="#changes.since.16">Since draft-ietf-httpbis-p1-messaging-16</a></li>749 <li> C.19 <a href="#changes.since.17">Since draft-ietf-httpbis-p1-messaging-17</a></li>750 <li> C.20 <a href="#changes.since.18">Since draft-ietf-httpbis-p1-messaging-18</a></li>731 <li><a href="#rfc.section.B">B.</a> <a href="#collected.abnf">Collected ABNF</a></li> 732 <li><a href="#rfc.section.C">C.</a> <a href="#change.log">Change Log (to be removed by RFC Editor before publication)</a><ul> 733 <li><a href="#rfc.section.C.1">C.1</a> <a href="#rfc.section.C.1">Since RFC 2616</a></li> 734 <li><a href="#rfc.section.C.2">C.2</a> <a href="#rfc.section.C.2">Since draft-ietf-httpbis-p1-messaging-00</a></li> 735 <li><a href="#rfc.section.C.3">C.3</a> <a href="#rfc.section.C.3">Since draft-ietf-httpbis-p1-messaging-01</a></li> 736 <li><a href="#rfc.section.C.4">C.4</a> <a href="#changes.since.02">Since draft-ietf-httpbis-p1-messaging-02</a></li> 737 <li><a href="#rfc.section.C.5">C.5</a> <a href="#changes.since.03">Since draft-ietf-httpbis-p1-messaging-03</a></li> 738 <li><a href="#rfc.section.C.6">C.6</a> <a href="#changes.since.04">Since draft-ietf-httpbis-p1-messaging-04</a></li> 739 <li><a href="#rfc.section.C.7">C.7</a> <a href="#changes.since.05">Since draft-ietf-httpbis-p1-messaging-05</a></li> 740 <li><a href="#rfc.section.C.8">C.8</a> <a href="#changes.since.06">Since draft-ietf-httpbis-p1-messaging-06</a></li> 741 <li><a href="#rfc.section.C.9">C.9</a> <a href="#changes.since.07">Since draft-ietf-httpbis-p1-messaging-07</a></li> 742 <li><a href="#rfc.section.C.10">C.10</a> <a href="#changes.since.08">Since draft-ietf-httpbis-p1-messaging-08</a></li> 743 <li><a href="#rfc.section.C.11">C.11</a> <a href="#changes.since.09">Since draft-ietf-httpbis-p1-messaging-09</a></li> 744 <li><a href="#rfc.section.C.12">C.12</a> <a href="#changes.since.10">Since draft-ietf-httpbis-p1-messaging-10</a></li> 745 <li><a href="#rfc.section.C.13">C.13</a> <a href="#changes.since.11">Since draft-ietf-httpbis-p1-messaging-11</a></li> 746 <li><a href="#rfc.section.C.14">C.14</a> <a href="#changes.since.12">Since draft-ietf-httpbis-p1-messaging-12</a></li> 747 <li><a href="#rfc.section.C.15">C.15</a> <a href="#changes.since.13">Since draft-ietf-httpbis-p1-messaging-13</a></li> 748 <li><a href="#rfc.section.C.16">C.16</a> <a href="#changes.since.14">Since draft-ietf-httpbis-p1-messaging-14</a></li> 749 <li><a href="#rfc.section.C.17">C.17</a> <a href="#changes.since.15">Since draft-ietf-httpbis-p1-messaging-15</a></li> 750 <li><a href="#rfc.section.C.18">C.18</a> <a href="#changes.since.16">Since draft-ietf-httpbis-p1-messaging-16</a></li> 751 <li><a href="#rfc.section.C.19">C.19</a> <a href="#changes.since.17">Since draft-ietf-httpbis-p1-messaging-17</a></li> 752 <li><a href="#rfc.section.C.20">C.20</a> <a href="#changes.since.18">Since draft-ietf-httpbis-p1-messaging-18</a></li> 751 753 </ul> 752 754 </li> 753 755 <li><a href="#rfc.index">Index</a></li> 756 <li><a href="#rfc.authors">Authors' Addresses</a></li> 754 757 </ul> 755 <h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a> <a id="introduction" href="#introduction">Introduction</a></h1> 756 <p id="rfc.section.1.p.1">The Hypertext Transfer Protocol (HTTP) is an application-level request/response protocol that uses extensible semantics and 757 MIME-like message payloads for flexible interaction with network-based hypertext information systems. HTTP relies upon the 758 Uniform Resource Identifier (URI) standard <a href="#RFC3986" id="rfc.xref.RFC3986.1"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> to indicate the target resource (<a href="#target-resource" title="Identifying a Target Resource">Section 5.1</a>) and relationships between resources. Messages are passed in a format similar to that used by Internet mail <a href="#RFC5322" id="rfc.xref.RFC5322.1"><cite title="Internet Message Format">[RFC5322]</cite></a> and the Multipurpose Internet Mail Extensions (MIME) <a href="#RFC2045" id="rfc.xref.RFC2045.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a> (see <a href="p3-payload.html#differences.between.http.and.mime" title="Differences between HTTP and MIME">Appendix A</a> of <a href="#Part3" id="rfc.xref.Part3.1"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a> for the differences between HTTP and MIME messages). 759 </p> 760 <p id="rfc.section.1.p.2">HTTP is a generic interface protocol for information systems. It is designed to hide the details of how a service is implemented 761 by presenting a uniform interface to clients that is independent of the types of resources provided. Likewise, servers do 762 not need to be aware of each client's purpose: an HTTP request can be considered in isolation rather than being associated 763 with a specific type of client or a predetermined sequence of application steps. The result is a protocol that can be used 764 effectively in many different contexts and for which implementations can evolve independently over time. 765 </p> 766 <p id="rfc.section.1.p.3">HTTP is also designed for use as an intermediation protocol for translating communication to and from non-HTTP information 767 systems. HTTP proxies and gateways can provide access to alternative information services by translating their diverse protocols 768 into a hypertext format that can be viewed and manipulated by clients in the same way as HTTP services. 769 </p> 770 <p id="rfc.section.1.p.4">One consequence of HTTP flexibility is that the protocol cannot be defined in terms of what occurs behind the interface. Instead, 771 we are limited to defining the syntax of communication, the intent of received communication, and the expected behavior of 772 recipients. If the communication is considered in isolation, then successful actions ought to be reflected in corresponding 773 changes to the observable interface provided by servers. However, since multiple clients might act in parallel and perhaps 774 at cross-purposes, we cannot require that such changes be observable beyond the scope of a single response. 775 </p> 776 <p id="rfc.section.1.p.5">This document is Part 1 of the seven-part specification of HTTP, defining the protocol referred to as "HTTP/1.1", obsoleting <a href="#RFC2616" id="rfc.xref.RFC2616.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a> and <a href="#RFC2145" id="rfc.xref.RFC2145.2"><cite title="Use and Interpretation of HTTP Version Numbers">[RFC2145]</cite></a>. Part 1 describes the architectural elements that are used or referred to in HTTP, defines the "http" and "https" URI schemes, 777 describes overall network operation and connection management, and defines HTTP message framing and forwarding requirements. 778 Our goal is to define all of the mechanisms necessary for HTTP message handling that are independent of message semantics, 779 thereby defining the complete set of requirements for message parsers and message-forwarding intermediaries. 780 </p> 781 <h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a> <a id="intro.requirements" href="#intro.requirements">Requirement Notation</a></h2> 782 <p id="rfc.section.1.1.p.1">The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" 783 in this document are to be interpreted as described in <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>. 784 </p> 785 <div id="rfc.iref.g.1"></div> 786 <div id="rfc.iref.g.2"></div> 787 <div id="rfc.iref.g.3"></div> 788 <div id="rfc.iref.g.4"></div> 789 <div id="rfc.iref.g.5"></div> 790 <div id="rfc.iref.g.6"></div> 791 <div id="rfc.iref.g.7"></div> 792 <div id="rfc.iref.g.8"></div> 793 <div id="rfc.iref.g.9"></div> 794 <div id="rfc.iref.g.10"></div> 795 <div id="rfc.iref.g.11"></div> 796 <div id="rfc.iref.g.12"></div> 797 <h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a> <a id="notation" href="#notation">Syntax Notation</a></h2> 798 <p id="rfc.section.1.2.p.1">This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with the list rule extension defined in <a href="#abnf.extension" title="ABNF list extension: #rule">Section 3.2.5</a>. <a href="#collected.abnf" title="Collected ABNF">Appendix B</a> shows the collected ABNF with the list rule expanded. 799 </p> 800 <div id="core.rules"> 801 <p id="rfc.section.1.2.p.2"> The following core rules are included by reference, as defined in <a href="#RFC5234" id="rfc.xref.RFC5234.2"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a>, <a href="http://tools.ietf.org/html/rfc5234#appendix-B.1">Appendix B.1</a>: ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), HEXDIG 802 (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR 803 (any visible <a href="#USASCII" id="rfc.xref.USASCII.1"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a> character). 758 <div id="introduction"> 759 <h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a> <a href="#introduction">Introduction</a></h1> 760 <p id="rfc.section.1.p.1">The Hypertext Transfer Protocol (HTTP) is an application-level request/response protocol that uses extensible semantics and 761 MIME-like message payloads for flexible interaction with network-based hypertext information systems. HTTP relies upon the 762 Uniform Resource Identifier (URI) standard <a href="#RFC3986" id="rfc.xref.RFC3986.1"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> to indicate the target resource (<a href="#target-resource" title="Identifying a Target Resource">Section 5.1</a>) and relationships between resources. Messages are passed in a format similar to that used by Internet mail <a href="#RFC5322" id="rfc.xref.RFC5322.1"><cite title="Internet Message Format">[RFC5322]</cite></a> and the Multipurpose Internet Mail Extensions (MIME) <a href="#RFC2045" id="rfc.xref.RFC2045.1"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a> (see <a href="p3-payload.html#differences.between.http.and.mime" title="Differences between HTTP and MIME">Appendix A</a> of <a href="#Part3" id="rfc.xref.Part3.1"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a> for the differences between HTTP and MIME messages). 804 763 </p> 764 <p id="rfc.section.1.p.2">HTTP is a generic interface protocol for information systems. It is designed to hide the details of how a service is implemented 765 by presenting a uniform interface to clients that is independent of the types of resources provided. Likewise, servers do 766 not need to be aware of each client's purpose: an HTTP request can be considered in isolation rather than being associated 767 with a specific type of client or a predetermined sequence of application steps. The result is a protocol that can be used 768 effectively in many different contexts and for which implementations can evolve independently over time. 769 </p> 770 <p id="rfc.section.1.p.3">HTTP is also designed for use as an intermediation protocol for translating communication to and from non-HTTP information 771 systems. HTTP proxies and gateways can provide access to alternative information services by translating their diverse protocols 772 into a hypertext format that can be viewed and manipulated by clients in the same way as HTTP services. 773 </p> 774 <p id="rfc.section.1.p.4">One consequence of HTTP flexibility is that the protocol cannot be defined in terms of what occurs behind the interface. Instead, 775 we are limited to defining the syntax of communication, the intent of received communication, and the expected behavior of 776 recipients. If the communication is considered in isolation, then successful actions ought to be reflected in corresponding 777 changes to the observable interface provided by servers. However, since multiple clients might act in parallel and perhaps 778 at cross-purposes, we cannot require that such changes be observable beyond the scope of a single response. 779 </p> 780 <p id="rfc.section.1.p.5">This document is Part 1 of the seven-part specification of HTTP, defining the protocol referred to as "HTTP/1.1", obsoleting <a href="#RFC2616" id="rfc.xref.RFC2616.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a> and <a href="#RFC2145" id="rfc.xref.RFC2145.2"><cite title="Use and Interpretation of HTTP Version Numbers">[RFC2145]</cite></a>. Part 1 describes the architectural elements that are used or referred to in HTTP, defines the "http" and "https" URI schemes, 781 describes overall network operation and connection management, and defines HTTP message framing and forwarding requirements. 782 Our goal is to define all of the mechanisms necessary for HTTP message handling that are independent of message semantics, 783 thereby defining the complete set of requirements for message parsers and message-forwarding intermediaries. 784 </p> 785 <div id="intro.requirements"> 786 <h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a> <a href="#intro.requirements">Requirement Notation</a></h2> 787 <p id="rfc.section.1.1.p.1">The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" 788 in this document are to be interpreted as described in <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>. 789 </p> 790 </div> 791 <div id="notation"> 792 <div id="rfc.iref.g.1"></div> 793 <div id="rfc.iref.g.2"></div> 794 <div id="rfc.iref.g.3"></div> 795 <div id="rfc.iref.g.4"></div> 796 <div id="rfc.iref.g.5"></div> 797 <div id="rfc.iref.g.6"></div> 798 <div id="rfc.iref.g.7"></div> 799 <div id="rfc.iref.g.8"></div> 800 <div id="rfc.iref.g.9"></div> 801 <div id="rfc.iref.g.10"></div> 802 <div id="rfc.iref.g.11"></div> 803 <div id="rfc.iref.g.12"></div> 804 <h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a> <a href="#notation">Syntax Notation</a></h2> 805 <p id="rfc.section.1.2.p.1">This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with the list rule extension defined in <a href="#abnf.extension" title="ABNF list extension: #rule">Section 3.2.5</a>. <a href="#collected.abnf" title="Collected ABNF">Appendix B</a> shows the collected ABNF with the list rule expanded. 806 </p> 807 <div id="core.rules"> 808 <p id="rfc.section.1.2.p.2"> The following core rules are included by reference, as defined in <a href="#RFC5234" id="rfc.xref.RFC5234.2"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a>, <a href="https://tools.ietf.org/html/rfc5234#appendix-B.1">Appendix B.1</a>: ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE (double quote), HEXDIG 809 (hexadecimal 0-9/A-F/a-f), HTAB (horizontal tab), LF (line feed), OCTET (any 8-bit sequence of data), SP (space), and VCHAR 810 (any visible <a href="#USASCII" id="rfc.xref.USASCII.1"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a> character). 811 </p> 812 </div> 813 <p id="rfc.section.1.2.p.3">As a convention, ABNF rule names prefixed with "obs-" denote "obsolete" grammar rules that appear for historical reasons.</p> 814 </div> 805 815 </div> 806 <p id="rfc.section.1.2.p.3">As a convention, ABNF rule names prefixed with "obs-" denote "obsolete" grammar rules that appear for historical reasons.</p> 807 <h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a> <a id="architecture" href="#architecture">Architecture</a></h1> 808 <p id="rfc.section.2.p.1">HTTP was created for the World Wide Web architecture and has evolved over time to support the scalability needs of a worldwide 809 hypertext system. Much of that architecture is reflected in the terminology and syntax productions used to define HTTP. 810 </p> 811 <div id="rfc.iref.c.1"></div> 812 <div id="rfc.iref.s.1"></div> 813 <div id="rfc.iref.c.2"></div> 814 <h2 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1</a> <a id="operation" href="#operation">Client/Server Messaging</a></h2> 815 <p id="rfc.section.2.1.p.1">HTTP is a stateless request/response protocol that operates by exchanging <dfn>messages</dfn> (<a href="#http.message" title="Message Format">Section 3</a>) across a reliable transport or session-layer "<dfn>connection</dfn>". An HTTP "<dfn>client</dfn>" is a program that establishes a connection to a server for the purpose of sending one or more HTTP requests. An HTTP "<dfn>server</dfn>" is a program that accepts connections in order to service HTTP requests by sending HTTP responses. 816 </p> 817 <div id="rfc.iref.u.1"></div> 818 <div id="rfc.iref.o.1"></div> 819 <div id="rfc.iref.b.1"></div> 820 <div id="rfc.iref.s.2"></div> 821 <div id="rfc.iref.s.3"></div> 822 <div id="rfc.iref.r.1"></div> 823 <p id="rfc.section.2.1.p.2">Note that the terms client and server refer only to the roles that these programs perform for a particular connection. The 824 same program might act as a client on some connections and a server on others. We use the term "<dfn>user agent</dfn>" to refer to the program that initiates a request, such as a WWW browser, editor, or spider (web-traversing robot), and the 825 term "<dfn>origin server</dfn>" to refer to the program that can originate authoritative responses to a request. For general requirements, we use the term 826 "<dfn>sender</dfn>" to refer to whichever component sent a given message and the term "<dfn>recipient</dfn>" to refer to any component that receives the message. 827 </p> 828 <div class="note" id="rfc.section.2.1.p.3"> 829 <p> <b>Note:</b> The term 'user agent' covers both those situations where there is a user (human) interacting with the software agent (and 830 for which user interface or interactive suggestions might be made, e.g., warning the user or given the user an option in the 831 case of security or privacy options) and also those where the software agent may act autonomously. 832 </p> 833 </div> 834 <p id="rfc.section.2.1.p.4">Most HTTP communication consists of a retrieval request (GET) for a representation of some resource identified by a URI. In 835 the simplest case, this might be accomplished via a single bidirectional connection (===) between the user agent (UA) and 836 the origin server (O). 837 </p> 838 <div id="rfc.figure.u.1"></div><pre class="drawing"> request > 816 <div id="architecture"> 817 <h1 id="rfc.section.2"><a href="#rfc.section.2">2.</a> <a href="#architecture">Architecture</a></h1> 818 <p id="rfc.section.2.p.1">HTTP was created for the World Wide Web architecture and has evolved over time to support the scalability needs of a worldwide 819 hypertext system. Much of that architecture is reflected in the terminology and syntax productions used to define HTTP. 820 </p> 821 <div id="operation"> 822 <div id="rfc.iref.c.1"></div> 823 <div id="rfc.iref.s.1"></div> 824 <div id="rfc.iref.c.2"></div> 825 <h2 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1</a> <a href="#operation">Client/Server Messaging</a></h2> 826 <p id="rfc.section.2.1.p.1">HTTP is a stateless request/response protocol that operates by exchanging <dfn>messages</dfn> (<a href="#http.message" title="Message Format">Section 3</a>) across a reliable transport or session-layer "<dfn>connection</dfn>". An HTTP "<dfn>client</dfn>" is a program that establishes a connection to a server for the purpose of sending one or more HTTP requests. An HTTP "<dfn>server</dfn>" is a program that accepts connections in order to service HTTP requests by sending HTTP responses. 827 </p> 828 <div id="rfc.iref.u.1"></div> 829 <div id="rfc.iref.o.1"></div> 830 <div id="rfc.iref.b.1"></div> 831 <div id="rfc.iref.s.2"></div> 832 <div id="rfc.iref.s.3"></div> 833 <div id="rfc.iref.r.1"></div> 834 <p id="rfc.section.2.1.p.2">Note that the terms client and server refer only to the roles that these programs perform for a particular connection. The 835 same program might act as a client on some connections and a server on others. We use the term "<dfn>user agent</dfn>" to refer to the program that initiates a request, such as a WWW browser, editor, or spider (web-traversing robot), and the 836 term "<dfn>origin server</dfn>" to refer to the program that can originate authoritative responses to a request. For general requirements, we use the term 837 "<dfn>sender</dfn>" to refer to whichever component sent a given message and the term "<dfn>recipient</dfn>" to refer to any component that receives the message. 838 </p> 839 <div class="note" id="rfc.section.2.1.p.3"> 840 <p><b>Note:</b> The term 'user agent' covers both those situations where there is a user (human) interacting with the software agent (and 841 for which user interface or interactive suggestions might be made, e.g., warning the user or given the user an option in the 842 case of security or privacy options) and also those where the software agent may act autonomously. 843 </p> 844 </div> 845 <p id="rfc.section.2.1.p.4">Most HTTP communication consists of a retrieval request (GET) for a representation of some resource identified by a URI. In 846 the simplest case, this might be accomplished via a single bidirectional connection (===) between the user agent (UA) and 847 the origin server (O). 848 </p> 849 <div id="rfc.figure.u.1"></div><pre class="drawing"> request > 839 850 UA ======================================= O 840 851 < response 841 852 </pre><div id="rfc.iref.m.1"></div> 842 <div id="rfc.iref.r.2"></div>843 <div id="rfc.iref.r.3"></div>844 <p id="rfc.section.2.1.p.6">A client sends an HTTP request to the server in the form of a <dfn>request</dfn> message, beginning with a request-line that includes a method, URI, and protocol version (<a href="#request.line" title="Request Line">Section 3.1.1</a>), followed by MIME-like header fields containing request modifiers, client information, and representation metadata (<a href="#header.fields" title="Header Fields">Section 3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section 3.3</a>).845 </p>846 <p id="rfc.section.2.1.p.7">A server responds to the client's request by sending one or more HTTP <dfn>response</dfn> messages, each beginning with a status line that includes the protocol version, a success or error code, and textual reason847 phrase (<a href="#status.line" title="Status Line">Section 3.1.2</a>), possibly followed by MIME-like header fields containing server information, resource metadata, and representation metadata848 (<a href="#header.fields" title="Header Fields">Section 3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section 3.3</a>).849 </p>850 <p id="rfc.section.2.1.p.8">The following example illustrates a typical message exchange for a GET request on the URI "http://www.example.com/hello.txt":</p>851 <div id="rfc.figure.u.2"></div>852 <p>client request:</p><pre class="text2">GET /hello.txt HTTP/1.1853 <div id="rfc.iref.r.2"></div> 854 <div id="rfc.iref.r.3"></div> 855 <p id="rfc.section.2.1.p.6">A client sends an HTTP request to the server in the form of a <dfn>request</dfn> message, beginning with a request-line that includes a method, URI, and protocol version (<a href="#request.line" title="Request Line">Section 3.1.1</a>), followed by MIME-like header fields containing request modifiers, client information, and representation metadata (<a href="#header.fields" title="Header Fields">Section 3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section 3.3</a>). 856 </p> 857 <p id="rfc.section.2.1.p.7">A server responds to the client's request by sending one or more HTTP <dfn>response</dfn> messages, each beginning with a status line that includes the protocol version, a success or error code, and textual reason 858 phrase (<a href="#status.line" title="Status Line">Section 3.1.2</a>), possibly followed by MIME-like header fields containing server information, resource metadata, and representation metadata 859 (<a href="#header.fields" title="Header Fields">Section 3.2</a>), an empty line to indicate the end of the header section, and finally a message body containing the payload body (if any, <a href="#message.body" title="Message Body">Section 3.3</a>). 860 </p> 861 <p id="rfc.section.2.1.p.8">The following example illustrates a typical message exchange for a GET request on the URI "http://www.example.com/hello.txt":</p> 862 <div id="rfc.figure.u.2"></div> 863 <p>client request:</p><pre class="text2">GET /hello.txt HTTP/1.1 853 864 User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 854 865 Host: www.example.com … … 856 867 857 868 </pre><div id="rfc.figure.u.3"></div> 858 <p>server response:</p><pre class="text">HTTP/1.1 200 OK869 <p>server response:</p><pre class="text">HTTP/1.1 200 OK 859 870 Date: Mon, 27 Jul 2009 12:28:53 GMT 860 871 Server: Apache … … 867 878 868 879 <span id="exbody">Hello World! 869 </span></pre><h2 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2</a> <a id="transport-independence" href="#transport-independence">Connections and Transport Independence</a></h2> 870 <p id="rfc.section.2.2.p.1">HTTP messaging is independent of the underlying transport or session-layer connection protocol(s). HTTP only presumes a reliable 871 transport with in-order delivery of requests and the corresponding in-order delivery of responses. The mapping of HTTP request 872 and response structures onto the data units of the underlying transport protocol is outside the scope of this specification. 873 </p> 874 <p id="rfc.section.2.2.p.2">The specific connection protocols to be used for an interaction are determined by client configuration and the target URI 875 (<a href="#target-resource" title="Identifying a Target Resource">Section 5.1</a>). For example, the "http" URI scheme (<a href="#http.uri" title="http URI scheme">Section 2.7.1</a>) indicates a default connection of TCP over IP, with a default TCP port of 80, but the client might be configured to use 876 a proxy via some other connection port or protocol instead of using the defaults. 877 </p> 878 <p id="rfc.section.2.2.p.3">A connection might be used for multiple HTTP request/response exchanges, as defined in <a href="#persistent.connections" title="Persistent Connections">Section 6.3</a>. 879 </p> 880 <div id="rfc.iref.i.1"></div> 881 <h2 id="rfc.section.2.3"><a href="#rfc.section.2.3">2.3</a> <a id="intermediaries" href="#intermediaries">Intermediaries</a></h2> 882 <p id="rfc.section.2.3.p.1">HTTP enables the use of intermediaries to satisfy requests through a chain of connections. There are three common forms of 883 HTTP <dfn>intermediary</dfn>: proxy, gateway, and tunnel. In some cases, a single intermediary might act as an origin server, proxy, gateway, or tunnel, 884 switching behavior based on the nature of each request. 885 </p> 886 <div id="rfc.figure.u.4"></div><pre class="drawing"> > > > > 880 </span></pre></div> 881 <div id="transport-independence"> 882 <h2 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2</a> <a href="#transport-independence">Connections and Transport Independence</a></h2> 883 <p id="rfc.section.2.2.p.1">HTTP messaging is independent of the underlying transport or session-layer connection protocol(s). HTTP only presumes a reliable 884 transport with in-order delivery of requests and the corresponding in-order delivery of responses. The mapping of HTTP request 885 and response structures onto the data units of the underlying transport protocol is outside the scope of this specification. 886 </p> 887 <p id="rfc.section.2.2.p.2">The specific connection protocols to be used for an interaction are determined by client configuration and the target URI 888 (<a href="#target-resource" title="Identifying a Target Resource">Section 5.1</a>). For example, the "http" URI scheme (<a href="#http.uri" title="http URI scheme">Section 2.7.1</a>) indicates a default connection of TCP over IP, with a default TCP port of 80, but the client might be configured to use 889 a proxy via some other connection port or protocol instead of using the defaults. 890 </p> 891 <p id="rfc.section.2.2.p.3">A connection might be used for multiple HTTP request/response exchanges, as defined in <a href="#persistent.connections" title="Persistent Connections">Section 6.3</a>. 892 </p> 893 </div> 894 <div id="intermediaries"> 895 <div id="rfc.iref.i.1"></div> 896 <h2 id="rfc.section.2.3"><a href="#rfc.section.2.3">2.3</a> <a href="#intermediaries">Intermediaries</a></h2> 897 <p id="rfc.section.2.3.p.1">HTTP enables the use of intermediaries to satisfy requests through a chain of connections. There are three common forms of 898 HTTP <dfn>intermediary</dfn>: proxy, gateway, and tunnel. In some cases, a single intermediary might act as an origin server, proxy, gateway, or tunnel, 899 switching behavior based on the nature of each request. 900 </p> 901 <div id="rfc.figure.u.4"></div><pre class="drawing"> > > > > 887 902 <b>UA</b> =========== <b>A</b> =========== <b>B</b> =========== <b>C</b> =========== <b>O</b> 888 903 < < < < 889 904 </pre><p id="rfc.section.2.3.p.3">The figure above shows three intermediaries (A, B, and C) between the user agent and origin server. A request or response 890 message that travels the whole chain will pass through four separate connections. Some HTTP communication options might apply 891 only to the connection with the nearest, non-tunnel neighbor, only to the end-points of the chain, or to all connections along 892 the chain. Although the diagram is linear, each participant might be engaged in multiple, simultaneous communications. For 893 example, B might be receiving requests from many clients other than A, and/or forwarding requests to servers other than C, 894 at the same time that it is handling A's request. 895 </p> 896 <p id="rfc.section.2.3.p.4"> <span id="rfc.iref.u.2"></span><span id="rfc.iref.d.1"></span> <span id="rfc.iref.i.2"></span><span id="rfc.iref.o.2"></span> We use the terms "<dfn>upstream</dfn>" and "<dfn>downstream</dfn>" to describe various requirements in relation to the directional flow of a message: all messages flow from upstream to downstream. 897 Likewise, we use the terms inbound and outbound to refer to directions in relation to the request path: "<dfn>inbound</dfn>" means toward the origin server and "<dfn>outbound</dfn>" means toward the user agent. 898 </p> 899 <p id="rfc.section.2.3.p.5"><span id="rfc.iref.p.1"></span> A "<dfn>proxy</dfn>" is a message forwarding agent that is selected by the client, usually via local configuration rules, to receive requests 900 for some type(s) of absolute URI and attempt to satisfy those requests via translation through the HTTP interface. Some translations 901 are minimal, such as for proxy requests for "http" URIs, whereas other requests might require translation to and from entirely 902 different application-layer protocols. Proxies are often used to group an organization's HTTP requests through a common intermediary 903 for the sake of security, annotation services, or shared caching. 904 </p> 905 <p id="rfc.section.2.3.p.6"> <span id="rfc.iref.t.1"></span> <span id="rfc.iref.n.1"></span> An HTTP-to-HTTP proxy is called a "<dfn>transforming proxy</dfn>" if it is designed or configured to modify request or response messages in a semantically meaningful way (i.e., modifications, 906 beyond those required by normal HTTP processing, that change the message in a way that would be significant to the original 907 sender or potentially significant to downstream recipients). For example, a transforming proxy might be acting as a shared 908 annotation server (modifying responses to include references to a local annotation database), a malware filter, a format transcoder, 909 or an intranet-to-Internet privacy filter. Such transformations are presumed to be desired by the client (or client organization) 910 that selected the proxy and are beyond the scope of this specification. However, when a proxy is not intended to transform 911 a given message, we use the term "<dfn>non-transforming proxy</dfn>" to target requirements that preserve HTTP message semantics. See <a href="p2-semantics.html#status.203" title="203 Non-Authoritative Information">Section 7.2.4</a> of <a href="#Part2" id="rfc.xref.Part2.1"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a> and <a href="p6-cache.html#header.warning" title="Warning">Section 3.6</a> of <a href="#Part6" id="rfc.xref.Part6.1"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a> for status and warning codes related to transformations. 912 </p> 913 <p id="rfc.section.2.3.p.7"><span id="rfc.iref.g.13"></span><span id="rfc.iref.r.4"></span> <span id="rfc.iref.a.1"></span> A "<dfn>gateway</dfn>" (a.k.a., "<dfn>reverse proxy</dfn>") is a receiving agent that acts as a layer above some other server(s) and translates the received requests to the underlying 914 server's protocol. Gateways are often used to encapsulate legacy or untrusted information services, to improve server performance 915 through "<dfn>accelerator</dfn>" caching, and to enable partitioning or load-balancing of HTTP services across multiple machines. 916 </p> 917 <p id="rfc.section.2.3.p.8">A gateway behaves as an origin server on its outbound connection and as a user agent on its inbound connection. All HTTP requirements 918 applicable to an origin server also apply to the outbound communication of a gateway. A gateway communicates with inbound 919 servers using any protocol that it desires, including private extensions to HTTP that are outside the scope of this specification. 920 However, an HTTP-to-HTTP gateway that wishes to interoperate with third-party HTTP servers <em class="bcp14">MUST</em> conform to HTTP user agent requirements on the gateway's inbound connection and <em class="bcp14">MUST</em> implement the Connection (<a href="#header.connection" id="rfc.xref.header.connection.1" title="Connection">Section 6.1</a>) and Via (<a href="#header.via" id="rfc.xref.header.via.1" title="Via">Section 6.2</a>) header fields for both connections. 921 </p> 922 <p id="rfc.section.2.3.p.9"><span id="rfc.iref.t.2"></span> A "<dfn>tunnel</dfn>" acts as a blind relay between two connections without changing the messages. Once active, a tunnel is not considered a party 923 to the HTTP communication, though the tunnel might have been initiated by an HTTP request. A tunnel ceases to exist when both 924 ends of the relayed connection are closed. Tunnels are used to extend a virtual connection through an intermediary, such as 925 when transport-layer security is used to establish private communication through a shared firewall proxy. 926 </p> 927 <p id="rfc.section.2.3.p.10"><span id="rfc.iref.i.3"></span><span id="rfc.iref.t.3"></span> <span id="rfc.iref.c.3"></span> In addition, there may exist network intermediaries that are not considered part of the HTTP communication but nevertheless 928 act as filters or redirecting agents (usually violating HTTP semantics, causing security problems, and otherwise making a 929 mess of things). Such a network intermediary, often referred to as an "<dfn>interception proxy</dfn>" <a href="#RFC3040" id="rfc.xref.RFC3040.1"><cite title="Internet Web Replication and Caching Taxonomy">[RFC3040]</cite></a>, "<dfn>transparent proxy</dfn>" <a href="#RFC1919" id="rfc.xref.RFC1919.1"><cite title="Classical versus Transparent IP Proxies">[RFC1919]</cite></a>, or "<dfn>captive portal</dfn>", differs from an HTTP proxy because it has not been selected by the client. Instead, the network intermediary redirects 930 outgoing TCP port 80 packets (and occasionally other common port traffic) to an internal HTTP server. Interception proxies 931 are commonly found on public network access points, as a means of enforcing account subscription prior to allowing use of 932 non-local Internet services, and within corporate firewalls to enforce network usage policies. They are indistinguishable 933 from a man-in-the-middle attack. 934 </p> 935 <p id="rfc.section.2.3.p.11">HTTP is defined as a stateless protocol, meaning that each request message can be understood in isolation. Many implementations 936 depend on HTTP's stateless design in order to reuse proxied connections or dynamically load balance requests across multiple 937 servers. Hence, servers <em class="bcp14">MUST NOT</em> assume that two requests on the same connection are from the same user agent unless the connection is secured and specific 938 to that agent. Some non-standard HTTP extensions (e.g., <a href="#RFC4559" id="rfc.xref.RFC4559.1"><cite title="SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows">[RFC4559]</cite></a>) have been known to violate this requirement, resulting in security and interoperability problems. 939 </p> 940 <div id="rfc.iref.c.4"></div> 941 <h2 id="rfc.section.2.4"><a href="#rfc.section.2.4">2.4</a> <a id="caches" href="#caches">Caches</a></h2> 942 <p id="rfc.section.2.4.p.1">A "<dfn>cache</dfn>" is a local store of previous response messages and the subsystem that controls its message storage, retrieval, and deletion. 943 A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent 944 requests. Any client or server <em class="bcp14">MAY</em> employ a cache, though a cache cannot be used by a server while it is acting as a tunnel. 945 </p> 946 <p id="rfc.section.2.4.p.2">The effect of a cache is that the request/response chain is shortened if one of the participants along the chain has a cached 947 response applicable to that request. The following illustrates the resulting chain if B has a cached copy of an earlier response 948 from O (via C) for a request which has not been cached by UA or A. 949 </p> 950 <div id="rfc.figure.u.5"></div><pre class="drawing"> > > 905 message that travels the whole chain will pass through four separate connections. Some HTTP communication options might apply 906 only to the connection with the nearest, non-tunnel neighbor, only to the end-points of the chain, or to all connections along 907 the chain. Although the diagram is linear, each participant might be engaged in multiple, simultaneous communications. For 908 example, B might be receiving requests from many clients other than A, and/or forwarding requests to servers other than C, 909 at the same time that it is handling A's request. 910 </p> 911 <p id="rfc.section.2.3.p.4"><span id="rfc.iref.u.2"></span><span id="rfc.iref.d.1"></span> <span id="rfc.iref.i.2"></span><span id="rfc.iref.o.2"></span> We use the terms "<dfn>upstream</dfn>" and "<dfn>downstream</dfn>" to describe various requirements in relation to the directional flow of a message: all messages flow from upstream to downstream. 912 Likewise, we use the terms inbound and outbound to refer to directions in relation to the request path: "<dfn>inbound</dfn>" means toward the origin server and "<dfn>outbound</dfn>" means toward the user agent. 913 </p> 914 <p id="rfc.section.2.3.p.5"><span id="rfc.iref.p.1"></span> A "<dfn>proxy</dfn>" is a message forwarding agent that is selected by the client, usually via local configuration rules, to receive requests 915 for some type(s) of absolute URI and attempt to satisfy those requests via translation through the HTTP interface. Some translations 916 are minimal, such as for proxy requests for "http" URIs, whereas other requests might require translation to and from entirely 917 different application-layer protocols. Proxies are often used to group an organization's HTTP requests through a common intermediary 918 for the sake of security, annotation services, or shared caching. 919 </p> 920 <p id="rfc.section.2.3.p.6"><span id="rfc.iref.t.1"></span> <span id="rfc.iref.n.1"></span> An HTTP-to-HTTP proxy is called a "<dfn>transforming proxy</dfn>" if it is designed or configured to modify request or response messages in a semantically meaningful way (i.e., modifications, 921 beyond those required by normal HTTP processing, that change the message in a way that would be significant to the original 922 sender or potentially significant to downstream recipients). For example, a transforming proxy might be acting as a shared 923 annotation server (modifying responses to include references to a local annotation database), a malware filter, a format transcoder, 924 or an intranet-to-Internet privacy filter. Such transformations are presumed to be desired by the client (or client organization) 925 that selected the proxy and are beyond the scope of this specification. However, when a proxy is not intended to transform 926 a given message, we use the term "<dfn>non-transforming proxy</dfn>" to target requirements that preserve HTTP message semantics. See <a href="p2-semantics.html#status.203" title="203 Non-Authoritative Information">Section 7.2.4</a> of <a href="#Part2" id="rfc.xref.Part2.1"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a> and <a href="p6-cache.html#header.warning" title="Warning">Section 3.6</a> of <a href="#Part6" id="rfc.xref.Part6.1"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a> for status and warning codes related to transformations. 927 </p> 928 <p id="rfc.section.2.3.p.7"><span id="rfc.iref.g.13"></span><span id="rfc.iref.r.4"></span> <span id="rfc.iref.a.1"></span> A "<dfn>gateway</dfn>" (a.k.a., "<dfn>reverse proxy</dfn>") is a receiving agent that acts as a layer above some other server(s) and translates the received requests to the underlying 929 server's protocol. Gateways are often used to encapsulate legacy or untrusted information services, to improve server performance 930 through "<dfn>accelerator</dfn>" caching, and to enable partitioning or load-balancing of HTTP services across multiple machines. 931 </p> 932 <p id="rfc.section.2.3.p.8">A gateway behaves as an origin server on its outbound connection and as a user agent on its inbound connection. All HTTP requirements 933 applicable to an origin server also apply to the outbound communication of a gateway. A gateway communicates with inbound 934 servers using any protocol that it desires, including private extensions to HTTP that are outside the scope of this specification. 935 However, an HTTP-to-HTTP gateway that wishes to interoperate with third-party HTTP servers <em class="bcp14">MUST</em> conform to HTTP user agent requirements on the gateway's inbound connection and <em class="bcp14">MUST</em> implement the Connection (<a href="#header.connection" id="rfc.xref.header.connection.1" title="Connection">Section 6.1</a>) and Via (<a href="#header.via" id="rfc.xref.header.via.1" title="Via">Section 6.2</a>) header fields for both connections. 936 </p> 937 <p id="rfc.section.2.3.p.9"><span id="rfc.iref.t.2"></span> A "<dfn>tunnel</dfn>" acts as a blind relay between two connections without changing the messages. Once active, a tunnel is not considered a party 938 to the HTTP communication, though the tunnel might have been initiated by an HTTP request. A tunnel ceases to exist when both 939 ends of the relayed connection are closed. Tunnels are used to extend a virtual connection through an intermediary, such as 940 when transport-layer security is used to establish private communication through a shared firewall proxy. 941 </p> 942 <p id="rfc.section.2.3.p.10"><span id="rfc.iref.i.3"></span><span id="rfc.iref.t.3"></span> <span id="rfc.iref.c.3"></span> In addition, there may exist network intermediaries that are not considered part of the HTTP communication but nevertheless 943 act as filters or redirecting agents (usually violating HTTP semantics, causing security problems, and otherwise making a 944 mess of things). Such a network intermediary, often referred to as an "<dfn>interception proxy</dfn>" <a href="#RFC3040" id="rfc.xref.RFC3040.1"><cite title="Internet Web Replication and Caching Taxonomy">[RFC3040]</cite></a>, "<dfn>transparent proxy</dfn>" <a href="#RFC1919" id="rfc.xref.RFC1919.1"><cite title="Classical versus Transparent IP Proxies">[RFC1919]</cite></a>, or "<dfn>captive portal</dfn>", differs from an HTTP proxy because it has not been selected by the client. Instead, the network intermediary redirects 945 outgoing TCP port 80 packets (and occasionally other common port traffic) to an internal HTTP server. Interception proxies 946 are commonly found on public network access points, as a means of enforcing account subscription prior to allowing use of 947 non-local Internet services, and within corporate firewalls to enforce network usage policies. They are indistinguishable 948 from a man-in-the-middle attack. 949 </p> 950 <p id="rfc.section.2.3.p.11">HTTP is defined as a stateless protocol, meaning that each request message can be understood in isolation. Many implementations 951 depend on HTTP's stateless design in order to reuse proxied connections or dynamically load balance requests across multiple 952 servers. Hence, servers <em class="bcp14">MUST NOT</em> assume that two requests on the same connection are from the same user agent unless the connection is secured and specific 953 to that agent. Some non-standard HTTP extensions (e.g., <a href="#RFC4559" id="rfc.xref.RFC4559.1"><cite title="SPNEGO-based Kerberos and NTLM HTTP Authentication in Microsoft Windows">[RFC4559]</cite></a>) have been known to violate this requirement, resulting in security and interoperability problems. 954 </p> 955 </div> 956 <div id="caches"> 957 <div id="rfc.iref.c.4"></div> 958 <h2 id="rfc.section.2.4"><a href="#rfc.section.2.4">2.4</a> <a href="#caches">Caches</a></h2> 959 <p id="rfc.section.2.4.p.1">A "<dfn>cache</dfn>" is a local store of previous response messages and the subsystem that controls its message storage, retrieval, and deletion. 960 A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent 961 requests. Any client or server <em class="bcp14">MAY</em> employ a cache, though a cache cannot be used by a server while it is acting as a tunnel. 962 </p> 963 <p id="rfc.section.2.4.p.2">The effect of a cache is that the request/response chain is shortened if one of the participants along the chain has a cached 964 response applicable to that request. The following illustrates the resulting chain if B has a cached copy of an earlier response 965 from O (via C) for a request which has not been cached by UA or A. 966 </p> 967 <div id="rfc.figure.u.5"></div><pre class="drawing"> > > 951 968 UA =========== A =========== B - - - - - - C - - - - - - O 952 969 < < 953 970 </pre><p id="rfc.section.2.4.p.4"><span id="rfc.iref.c.5"></span> A response is "<dfn>cacheable</dfn>" if a cache is allowed to store a copy of the response message for use in answering subsequent requests. Even when a response 954 is cacheable, there might be additional constraints placed by the client or by the origin server on when that cached response 955 can be used for a particular request. HTTP requirements for cache behavior and cacheable responses are defined in <a href="p6-cache.html#caching.overview" title="Cache Operation">Section 2</a> of <a href="#Part6" id="rfc.xref.Part6.2"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>. 956 </p> 957 <p id="rfc.section.2.4.p.5">There are a wide variety of architectures and configurations of caches and proxies deployed across the World Wide Web and 958 inside large organizations. These systems include national hierarchies of proxy caches to save transoceanic bandwidth, systems 959 that broadcast or multicast cache entries, organizations that distribute subsets of cached data via optical media, and so 960 on. 961 </p> 962 <h2 id="rfc.section.2.5"><a href="#rfc.section.2.5">2.5</a> <a id="intro.conformance.and.error.handling" href="#intro.conformance.and.error.handling">Conformance and Error Handling</a></h2> 963 <p id="rfc.section.2.5.p.1">This specification targets conformance criteria according to the role of a participant in HTTP communication. Hence, HTTP 964 requirements are placed on senders, recipients, clients, servers, user agents, intermediaries, origin servers, proxies, gateways, 965 or caches, depending on what behavior is being constrained by the requirement. 966 </p> 967 <p id="rfc.section.2.5.p.2">An implementation is considered conformant if it complies with all of the requirements associated with the roles it partakes 968 in HTTP. 969 </p> 970 <p id="rfc.section.2.5.p.3">Senders <em class="bcp14">MUST NOT</em> generate protocol elements that do not match the grammar defined by the ABNF rules for those protocol elements. 971 </p> 972 <p id="rfc.section.2.5.p.4">Unless otherwise noted, recipients <em class="bcp14">MAY</em> attempt to recover a usable protocol element from an invalid construct. HTTP does not define specific error handling mechanisms 973 except when they have a direct impact on security, since different applications of the protocol require different error handling 974 strategies. For example, a Web browser might wish to transparently recover from a response where the Location header field 975 doesn't parse according to the ABNF, whereas a systems control client might consider any form of error recovery to be dangerous. 976 </p> 977 <h2 id="rfc.section.2.6"><a href="#rfc.section.2.6">2.6</a> <a id="http.version" href="#http.version">Protocol Versioning</a></h2> 978 <p id="rfc.section.2.6.p.1">HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of the protocol. This specification defines version "1.1". 979 The protocol version as a whole indicates the sender's conformance with the set of requirements laid out in that version's 980 corresponding specification of HTTP. 981 </p> 982 <p id="rfc.section.2.6.p.2">The version of an HTTP message is indicated by an HTTP-version field in the first line of the message. HTTP-version is case-sensitive.</p> 983 <div id="rfc.figure.u.6"></div><pre class="inline"><span id="rfc.iref.g.14"></span><span id="rfc.iref.g.15"></span> <a href="#http.version" class="smpl">HTTP-version</a> = <a href="#http.version" class="smpl">HTTP-name</a> "/" <a href="#core.rules" class="smpl">DIGIT</a> "." <a href="#core.rules" class="smpl">DIGIT</a> 971 is cacheable, there might be additional constraints placed by the client or by the origin server on when that cached response 972 can be used for a particular request. HTTP requirements for cache behavior and cacheable responses are defined in <a href="p6-cache.html#caching.overview" title="Cache Operation">Section 2</a> of <a href="#Part6" id="rfc.xref.Part6.2"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>. 973 </p> 974 <p id="rfc.section.2.4.p.5">There are a wide variety of architectures and configurations of caches and proxies deployed across the World Wide Web and 975 inside large organizations. These systems include national hierarchies of proxy caches to save transoceanic bandwidth, systems 976 that broadcast or multicast cache entries, organizations that distribute subsets of cached data via optical media, and so 977 on. 978 </p> 979 </div> 980 <div id="intro.conformance.and.error.handling"> 981 <h2 id="rfc.section.2.5"><a href="#rfc.section.2.5">2.5</a> <a href="#intro.conformance.and.error.handling">Conformance and Error Handling</a></h2> 982 <p id="rfc.section.2.5.p.1">This specification targets conformance criteria according to the role of a participant in HTTP communication. Hence, HTTP 983 requirements are placed on senders, recipients, clients, servers, user agents, intermediaries, origin servers, proxies, gateways, 984 or caches, depending on what behavior is being constrained by the requirement. 985 </p> 986 <p id="rfc.section.2.5.p.2">An implementation is considered conformant if it complies with all of the requirements associated with the roles it partakes 987 in HTTP. 988 </p> 989 <p id="rfc.section.2.5.p.3">Senders <em class="bcp14">MUST NOT</em> generate protocol elements that do not match the grammar defined by the ABNF rules for those protocol elements. 990 </p> 991 <p id="rfc.section.2.5.p.4">Unless otherwise noted, recipients <em class="bcp14">MAY</em> attempt to recover a usable protocol element from an invalid construct. HTTP does not define specific error handling mechanisms 992 except when they have a direct impact on security, since different applications of the protocol require different error handling 993 strategies. For example, a Web browser might wish to transparently recover from a response where the Location header field 994 doesn't parse according to the ABNF, whereas a systems control client might consider any form of error recovery to be dangerous. 995 </p> 996 </div> 997 <div id="http.version"> 998 <h2 id="rfc.section.2.6"><a href="#rfc.section.2.6">2.6</a> <a href="#http.version">Protocol Versioning</a></h2> 999 <p id="rfc.section.2.6.p.1">HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of the protocol. This specification defines version "1.1". 1000 The protocol version as a whole indicates the sender's conformance with the set of requirements laid out in that version's 1001 corresponding specification of HTTP. 1002 </p> 1003 <p id="rfc.section.2.6.p.2">The version of an HTTP message is indicated by an HTTP-version field in the first line of the message. HTTP-version is case-sensitive.</p> 1004 <div id="rfc.figure.u.6"></div><pre class="inline"><span id="rfc.iref.g.14"></span><span id="rfc.iref.g.15"></span> <a href="#http.version" class="smpl">HTTP-version</a> = <a href="#http.version" class="smpl">HTTP-name</a> "/" <a href="#core.rules" class="smpl">DIGIT</a> "." <a href="#core.rules" class="smpl">DIGIT</a> 984 1005 <a href="#http.version" class="smpl">HTTP-name</a> = %x48.54.54.50 ; "HTTP", case-sensitive 985 1006 </pre><p id="rfc.section.2.6.p.4">The HTTP version number consists of two decimal digits separated by a "." (period or decimal point). The first digit ("major 986 version") indicates the HTTP messaging syntax, whereas the second digit ("minor version") indicates the highest minor version 987 to which the sender is conformant and able to understand for future communication. The minor version advertises the sender's 988 communication capabilities even when the sender is only using a backwards-compatible subset of the protocol, thereby letting 989 the recipient know that more advanced features can be used in response (by servers) or in future requests (by clients). 990 </p> 991 <p id="rfc.section.2.6.p.5">When an HTTP/1.1 message is sent to an HTTP/1.0 recipient <a href="#RFC1945" id="rfc.xref.RFC1945.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[RFC1945]</cite></a> or a recipient whose version is unknown, the HTTP/1.1 message is constructed such that it can be interpreted as a valid HTTP/1.0 992 message if all of the newer features are ignored. This specification places recipient-version requirements on some new features 993 so that a conformant sender will only use compatible features until it has determined, through configuration or the receipt 994 of a message, that the recipient supports HTTP/1.1. 995 </p> 996 <p id="rfc.section.2.6.p.6">The interpretation of a header field does not change between minor versions of the same major HTTP version, though the default 997 behavior of a recipient in the absence of such a field can change. Unless specified otherwise, header fields defined in HTTP/1.1 998 are defined for all versions of HTTP/1.x. In particular, the Host and Connection header fields ought to be implemented by 999 all HTTP/1.x implementations whether or not they advertise conformance with HTTP/1.1. 1000 </p> 1001 <p id="rfc.section.2.6.p.7">New header fields can be defined such that, when they are understood by a recipient, they might override or enhance the interpretation 1002 of previously defined header fields. When an implementation receives an unrecognized header field, the recipient <em class="bcp14">MUST</em> ignore that header field for local processing regardless of the message's HTTP version. An unrecognized header field received 1003 by a proxy <em class="bcp14">MUST</em> be forwarded downstream unless the header field's field-name is listed in the message's Connection header-field (see <a href="#header.connection" id="rfc.xref.header.connection.2" title="Connection">Section 6.1</a>). These requirements allow HTTP's functionality to be enhanced without requiring prior update of deployed intermediaries. 1004 </p> 1005 <p id="rfc.section.2.6.p.8">Intermediaries that process HTTP messages (i.e., all intermediaries other than those acting as tunnels) <em class="bcp14">MUST</em> send their own HTTP-version in forwarded messages. In other words, they <em class="bcp14">MUST NOT</em> blindly forward the first line of an HTTP message without ensuring that the protocol version in that message matches a version 1006 to which that intermediary is conformant for both the receiving and sending of messages. Forwarding an HTTP message without 1007 rewriting the HTTP-version might result in communication errors when downstream recipients use the message sender's version 1008 to determine what features are safe to use for later communication with that sender. 1009 </p> 1010 <p id="rfc.section.2.6.p.9">An HTTP client <em class="bcp14">SHOULD</em> send a request version equal to the highest version to which the client is conformant and whose major version is no higher 1011 than the highest version supported by the server, if this is known. An HTTP client <em class="bcp14">MUST NOT</em> send a version to which it is not conformant. 1012 </p> 1013 <p id="rfc.section.2.6.p.10">An HTTP client <em class="bcp14">MAY</em> send a lower request version if it is known that the server incorrectly implements the HTTP specification, but only after 1014 the client has attempted at least one normal request and determined from the response status or header fields (e.g., Server) 1015 that the server improperly handles higher request versions. 1016 </p> 1017 <p id="rfc.section.2.6.p.11">An HTTP server <em class="bcp14">SHOULD</em> send a response version equal to the highest version to which the server is conformant and whose major version is less than 1018 or equal to the one received in the request. An HTTP server <em class="bcp14">MUST NOT</em> send a version to which it is not conformant. A server <em class="bcp14">MAY</em> send a 505 (HTTP Version Not Supported) response if it cannot send a response using the major version used in the client's 1019 request. 1020 </p> 1021 <p id="rfc.section.2.6.p.12">An HTTP server <em class="bcp14">MAY</em> send an HTTP/1.0 response to an HTTP/1.0 request if it is known or suspected that the client incorrectly implements the HTTP 1022 specification and is incapable of correctly processing later version responses, such as when a client fails to parse the version 1023 number correctly or when an intermediary is known to blindly forward the HTTP-version even when it doesn't conform to the 1024 given minor version of the protocol. Such protocol downgrades <em class="bcp14">SHOULD NOT</em> be performed unless triggered by specific client attributes, such as when one or more of the request header fields (e.g., 1025 User-Agent) uniquely match the values sent by a client known to be in error. 1026 </p> 1027 <p id="rfc.section.2.6.p.13">The intention of HTTP's versioning design is that the major number will only be incremented if an incompatible message syntax 1028 is introduced, and that the minor number will only be incremented when changes made to the protocol have the effect of adding 1029 to the message semantics or implying additional capabilities of the sender. However, the minor version was not incremented 1030 for the changes introduced between <a href="#RFC2068" id="rfc.xref.RFC2068.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> and <a href="#RFC2616" id="rfc.xref.RFC2616.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a>, and this revision is specifically avoiding any such changes to the protocol. 1031 </p> 1032 <div id="rfc.iref.r.5"></div> 1033 <h2 id="rfc.section.2.7"><a href="#rfc.section.2.7">2.7</a> <a id="uri" href="#uri">Uniform Resource Identifiers</a></h2> 1034 <p id="rfc.section.2.7.p.1">Uniform Resource Identifiers (URIs) <a href="#RFC3986" id="rfc.xref.RFC3986.2"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> are used throughout HTTP as the means for identifying resources. URI references are used to target requests, indicate redirects, 1035 and define relationships. HTTP does not limit what a resource might be; it merely defines an interface that can be used to 1036 interact with a resource via HTTP. More information on the scope of URIs and resources can be found in <a href="#RFC3986" id="rfc.xref.RFC3986.3"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>. 1037 </p> 1038 <p id="rfc.section.2.7.p.2">This specification adopts the definitions of "URI-reference", "absolute-URI", "relative-part", "port", "host", "path-abempty", 1039 "path-absolute", "query", and "authority" from the URI generic syntax <a href="#RFC3986" id="rfc.xref.RFC3986.4"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>. In addition, we define a partial-URI rule for protocol elements that allow a relative URI but not a fragment. 1040 </p> 1041 <div id="rfc.figure.u.7"></div><pre class="inline"><span id="rfc.iref.g.16"></span><span id="rfc.iref.g.17"></span><span id="rfc.iref.g.18"></span><span id="rfc.iref.g.19"></span><span id="rfc.iref.g.20"></span><span id="rfc.iref.g.21"></span><span id="rfc.iref.g.22"></span> <a href="#uri" class="smpl">URI-reference</a> = <URI-reference, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.5"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-4.1">Section 4.1</a>> 1042 <a href="#uri" class="smpl">absolute-URI</a> = <absolute-URI, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.6"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-4.3">Section 4.3</a>> 1043 <a href="#uri" class="smpl">relative-part</a> = <relative-part, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.7"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-4.2">Section 4.2</a>> 1044 <a href="#uri" class="smpl">authority</a> = <authority, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.8"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.2">Section 3.2</a>> 1045 <a href="#uri" class="smpl">path-abempty</a> = <path-abempty, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.9"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.3">Section 3.3</a>> 1046 <a href="#uri" class="smpl">path-absolute</a> = <path-absolute, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.10"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.3">Section 3.3</a>> 1047 <a href="#uri" class="smpl">port</a> = <port, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.11"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.2.3">Section 3.2.3</a>> 1048 <a href="#uri" class="smpl">query</a> = <query, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.12"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.4">Section 3.4</a>> 1049 <a href="#uri" class="smpl">uri-host</a> = <host, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.13"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.2.2">Section 3.2.2</a>> 1007 version") indicates the HTTP messaging syntax, whereas the second digit ("minor version") indicates the highest minor version 1008 to which the sender is conformant and able to understand for future communication. The minor version advertises the sender's 1009 communication capabilities even when the sender is only using a backwards-compatible subset of the protocol, thereby letting 1010 the recipient know that more advanced features can be used in response (by servers) or in future requests (by clients). 1011 </p> 1012 <p id="rfc.section.2.6.p.5">When an HTTP/1.1 message is sent to an HTTP/1.0 recipient <a href="#RFC1945" id="rfc.xref.RFC1945.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[RFC1945]</cite></a> or a recipient whose version is unknown, the HTTP/1.1 message is constructed such that it can be interpreted as a valid HTTP/1.0 1013 message if all of the newer features are ignored. This specification places recipient-version requirements on some new features 1014 so that a conformant sender will only use compatible features until it has determined, through configuration or the receipt 1015 of a message, that the recipient supports HTTP/1.1. 1016 </p> 1017 <p id="rfc.section.2.6.p.6">The interpretation of a header field does not change between minor versions of the same major HTTP version, though the default 1018 behavior of a recipient in the absence of such a field can change. Unless specified otherwise, header fields defined in HTTP/1.1 1019 are defined for all versions of HTTP/1.x. In particular, the Host and Connection header fields ought to be implemented by 1020 all HTTP/1.x implementations whether or not they advertise conformance with HTTP/1.1. 1021 </p> 1022 <p id="rfc.section.2.6.p.7">New header fields can be defined such that, when they are understood by a recipient, they might override or enhance the interpretation 1023 of previously defined header fields. When an implementation receives an unrecognized header field, the recipient <em class="bcp14">MUST</em> ignore that header field for local processing regardless of the message's HTTP version. An unrecognized header field received 1024 by a proxy <em class="bcp14">MUST</em> be forwarded downstream unless the header field's field-name is listed in the message's Connection header-field (see <a href="#header.connection" id="rfc.xref.header.connection.2" title="Connection">Section 6.1</a>). These requirements allow HTTP's functionality to be enhanced without requiring prior update of deployed intermediaries. 1025 </p> 1026 <p id="rfc.section.2.6.p.8">Intermediaries that process HTTP messages (i.e., all intermediaries other than those acting as tunnels) <em class="bcp14">MUST</em> send their own HTTP-version in forwarded messages. In other words, they <em class="bcp14">MUST NOT</em> blindly forward the first line of an HTTP message without ensuring that the protocol version in that message matches a version 1027 to which that intermediary is conformant for both the receiving and sending of messages. Forwarding an HTTP message without 1028 rewriting the HTTP-version might result in communication errors when downstream recipients use the message sender's version 1029 to determine what features are safe to use for later communication with that sender. 1030 </p> 1031 <p id="rfc.section.2.6.p.9">An HTTP client <em class="bcp14">SHOULD</em> send a request version equal to the highest version to which the client is conformant and whose major version is no higher 1032 than the highest version supported by the server, if this is known. An HTTP client <em class="bcp14">MUST NOT</em> send a version to which it is not conformant. 1033 </p> 1034 <p id="rfc.section.2.6.p.10">An HTTP client <em class="bcp14">MAY</em> send a lower request version if it is known that the server incorrectly implements the HTTP specification, but only after 1035 the client has attempted at least one normal request and determined from the response status or header fields (e.g., Server) 1036 that the server improperly handles higher request versions. 1037 </p> 1038 <p id="rfc.section.2.6.p.11">An HTTP server <em class="bcp14">SHOULD</em> send a response version equal to the highest version to which the server is conformant and whose major version is less than 1039 or equal to the one received in the request. An HTTP server <em class="bcp14">MUST NOT</em> send a version to which it is not conformant. A server <em class="bcp14">MAY</em> send a 505 (HTTP Version Not Supported) response if it cannot send a response using the major version used in the client's 1040 request. 1041 </p> 1042 <p id="rfc.section.2.6.p.12">An HTTP server <em class="bcp14">MAY</em> send an HTTP/1.0 response to an HTTP/1.0 request if it is known or suspected that the client incorrectly implements the HTTP 1043 specification and is incapable of correctly processing later version responses, such as when a client fails to parse the version 1044 number correctly or when an intermediary is known to blindly forward the HTTP-version even when it doesn't conform to the 1045 given minor version of the protocol. Such protocol downgrades <em class="bcp14">SHOULD NOT</em> be performed unless triggered by specific client attributes, such as when one or more of the request header fields (e.g., 1046 User-Agent) uniquely match the values sent by a client known to be in error. 1047 </p> 1048 <p id="rfc.section.2.6.p.13">The intention of HTTP's versioning design is that the major number will only be incremented if an incompatible message syntax 1049 is introduced, and that the minor number will only be incremented when changes made to the protocol have the effect of adding 1050 to the message semantics or implying additional capabilities of the sender. However, the minor version was not incremented 1051 for the changes introduced between <a href="#RFC2068" id="rfc.xref.RFC2068.2"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> and <a href="#RFC2616" id="rfc.xref.RFC2616.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2616]</cite></a>, and this revision is specifically avoiding any such changes to the protocol. 1052 </p> 1053 </div> 1054 <div id="uri"> 1055 <div id="rfc.iref.r.5"></div> 1056 <h2 id="rfc.section.2.7"><a href="#rfc.section.2.7">2.7</a> <a href="#uri">Uniform Resource Identifiers</a></h2> 1057 <p id="rfc.section.2.7.p.1">Uniform Resource Identifiers (URIs) <a href="#RFC3986" id="rfc.xref.RFC3986.2"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a> are used throughout HTTP as the means for identifying resources. URI references are used to target requests, indicate redirects, 1058 and define relationships. HTTP does not limit what a resource might be; it merely defines an interface that can be used to 1059 interact with a resource via HTTP. More information on the scope of URIs and resources can be found in <a href="#RFC3986" id="rfc.xref.RFC3986.3"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>. 1060 </p> 1061 <p id="rfc.section.2.7.p.2">This specification adopts the definitions of "URI-reference", "absolute-URI", "relative-part", "port", "host", "path-abempty", 1062 "path-absolute", "query", and "authority" from the URI generic syntax <a href="#RFC3986" id="rfc.xref.RFC3986.4"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>. In addition, we define a partial-URI rule for protocol elements that allow a relative URI but not a fragment. 1063 </p> 1064 <div id="rfc.figure.u.7"></div><pre class="inline"><span id="rfc.iref.g.16"></span><span id="rfc.iref.g.17"></span><span id="rfc.iref.g.18"></span><span id="rfc.iref.g.19"></span><span id="rfc.iref.g.20"></span><span id="rfc.iref.g.21"></span><span id="rfc.iref.g.22"></span> <a href="#uri" class="smpl">URI-reference</a> = <URI-reference, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.5"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.1">Section 4.1</a>> 1065 <a href="#uri" class="smpl">absolute-URI</a> = <absolute-URI, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.6"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.3">Section 4.3</a>> 1066 <a href="#uri" class="smpl">relative-part</a> = <relative-part, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.7"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-4.2">Section 4.2</a>> 1067 <a href="#uri" class="smpl">authority</a> = <authority, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.8"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2">Section 3.2</a>> 1068 <a href="#uri" class="smpl">path-abempty</a> = <path-abempty, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.9"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.3">Section 3.3</a>> 1069 <a href="#uri" class="smpl">path-absolute</a> = <path-absolute, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.10"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.3">Section 3.3</a>> 1070 <a href="#uri" class="smpl">port</a> = <port, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.11"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.3">Section 3.2.3</a>> 1071 <a href="#uri" class="smpl">query</a> = <query, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.12"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.4">Section 3.4</a>> 1072 <a href="#uri" class="smpl">uri-host</a> = <host, defined in <a href="#RFC3986" id="rfc.xref.RFC3986.13"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.2">Section 3.2.2</a>> 1050 1073 1051 1074 <a href="#uri" class="smpl">partial-URI</a> = relative-part [ "?" query ] 1052 1075 </pre><p id="rfc.section.2.7.p.4">Each protocol element in HTTP that allows a URI reference will indicate in its ABNF production whether the element allows 1053 any form of reference (URI-reference), only a URI in absolute form (absolute-URI), only the path and optional query components, 1054 or some combination of the above. Unless otherwise indicated, URI references are parsed relative to the effective request 1055 URI (<a href="#effective.request.uri" title="Effective Request URI">Section 5.5</a>). 1056 </p> 1057 <h3 id="rfc.section.2.7.1"><a href="#rfc.section.2.7.1">2.7.1</a> <a id="http.uri" href="#http.uri">http URI scheme</a></h3> 1058 <div id="rfc.iref.h.1"></div> 1059 <div id="rfc.iref.u.3"></div> 1060 <p id="rfc.section.2.7.1.p.1">The "http" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical 1061 namespace governed by a potential HTTP origin server listening for TCP connections on a given port. 1062 </p> 1063 <div id="rfc.figure.u.8"></div><pre class="inline"><span id="rfc.iref.g.23"></span> <a href="#http.uri" class="smpl">http-URI</a> = "http:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 1064 </pre><p id="rfc.section.2.7.1.p.3">The HTTP origin server is identified by the generic syntax's <a href="#uri" class="smpl">authority</a> component, which includes a host identifier and optional TCP port (<a href="#RFC3986" id="rfc.xref.RFC3986.14"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.2.2">Section 3.2.2</a>). The remainder of the URI, consisting of both the hierarchical path component and optional query component, serves as an 1065 identifier for a potential resource within that origin server's name space. 1066 </p> 1067 <p id="rfc.section.2.7.1.p.4">If the host identifier is provided as an IP literal or IPv4 address, then the origin server is any listener on the indicated 1068 TCP port at that IP address. If host is a registered name, then that name is considered an indirect identifier and the recipient 1069 might use a name resolution service, such as DNS, to find the address of a listener for that host. The host <em class="bcp14">MUST NOT</em> be empty; if an "http" URI is received with an empty host, then it <em class="bcp14">MUST</em> be rejected as invalid. If the port subcomponent is empty or not given, then TCP port 80 is assumed (the default reserved 1070 port for WWW services). 1071 </p> 1072 <p id="rfc.section.2.7.1.p.5">Regardless of the form of host identifier, access to that host is not implied by the mere presence of its name or address. 1073 The host might or might not exist and, even when it does exist, might or might not be running an HTTP server or listening 1074 to the indicated port. The "http" URI scheme makes use of the delegated nature of Internet names and addresses to establish 1075 a naming authority (whatever entity has the ability to place an HTTP server at that Internet name or address) and allows that 1076 authority to determine which names are valid and how they might be used. 1077 </p> 1078 <p id="rfc.section.2.7.1.p.6">When an "http" URI is used within a context that calls for access to the indicated resource, a client <em class="bcp14">MAY</em> attempt access by resolving the host to an IP address, establishing a TCP connection to that address on the indicated port, 1079 and sending an HTTP request message (<a href="#http.message" title="Message Format">Section 3</a>) containing the URI's identifying data (<a href="#message.routing" title="Message Routing">Section 5</a>) to the server. If the server responds to that request with a non-interim HTTP response message, as described in <a href="p2-semantics.html#status.code.and.reason.phrase" title="Status Code and Reason Phrase">Section 4</a> of <a href="#Part2" id="rfc.xref.Part2.2"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>, then that response is considered an authoritative answer to the client's request. 1080 </p> 1081 <p id="rfc.section.2.7.1.p.7">Although HTTP is independent of the transport protocol, the "http" scheme is specific to TCP-based services because the name 1082 delegation process depends on TCP for establishing authority. An HTTP service based on some other underlying connection protocol 1083 would presumably be identified using a different URI scheme, just as the "https" scheme (below) is used for servers that require 1084 an SSL/TLS transport layer on a connection. Other protocols might also be used to provide access to "http" identified resources 1085 — it is only the authoritative interface used for mapping the namespace that is specific to TCP. 1086 </p> 1087 <p id="rfc.section.2.7.1.p.8">The URI generic syntax for authority also includes a deprecated userinfo subcomponent (<a href="#RFC3986" id="rfc.xref.RFC3986.15"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.2.1">Section 3.2.1</a>) for including user authentication information in the URI. Some implementations make use of the userinfo component for internal 1088 configuration of authentication information, such as within command invocation options, configuration files, or bookmark lists, 1089 even though such usage might expose a user identifier or password. Senders <em class="bcp14">MUST NOT</em> include a userinfo subcomponent (and its "@" delimiter) when transmitting an "http" URI in a message. Recipients of HTTP messages 1090 that contain a URI reference <em class="bcp14">SHOULD</em> parse for the existence of userinfo and treat its presence as an error, likely indicating that the deprecated subcomponent 1091 is being used to obscure the authority for the sake of phishing attacks. 1092 </p> 1093 <h3 id="rfc.section.2.7.2"><a href="#rfc.section.2.7.2">2.7.2</a> <a id="https.uri" href="#https.uri">https URI scheme</a></h3> 1094 <div id="rfc.iref.h.2"></div> 1095 <div id="rfc.iref.u.4"></div> 1096 <p id="rfc.section.2.7.2.p.1">The "https" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical 1097 namespace governed by a potential HTTP origin server listening for SSL/TLS-secured connections on a given TCP port. 1098 </p> 1099 <p id="rfc.section.2.7.2.p.2">All of the requirements listed above for the "http" scheme are also requirements for the "https" scheme, except that a default 1100 TCP port of 443 is assumed if the port subcomponent is empty or not given, and the TCP connection <em class="bcp14">MUST</em> be secured for privacy through the use of strong encryption prior to sending the first HTTP request. 1101 </p> 1102 <div id="rfc.figure.u.9"></div><pre class="inline"><span id="rfc.iref.g.24"></span> <a href="#https.uri" class="smpl">https-URI</a> = "https:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 1076 any form of reference (URI-reference), only a URI in absolute form (absolute-URI), only the path and optional query components, 1077 or some combination of the above. Unless otherwise indicated, URI references are parsed relative to the effective request 1078 URI (<a href="#effective.request.uri" title="Effective Request URI">Section 5.5</a>). 1079 </p> 1080 <div id="http.uri"> 1081 <h3 id="rfc.section.2.7.1"><a href="#rfc.section.2.7.1">2.7.1</a> <a href="#http.uri">http URI scheme</a></h3> 1082 <div id="rfc.iref.h.1"></div> 1083 <div id="rfc.iref.u.3"></div> 1084 <p id="rfc.section.2.7.1.p.1">The "http" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical 1085 namespace governed by a potential HTTP origin server listening for TCP connections on a given port. 1086 </p> 1087 <div id="rfc.figure.u.8"></div><pre class="inline"><span id="rfc.iref.g.23"></span> <a href="#http.uri" class="smpl">http-URI</a> = "http:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 1088 </pre><p id="rfc.section.2.7.1.p.3">The HTTP origin server is identified by the generic syntax's <a href="#uri" class="smpl">authority</a> component, which includes a host identifier and optional TCP port (<a href="#RFC3986" id="rfc.xref.RFC3986.14"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.2">Section 3.2.2</a>). The remainder of the URI, consisting of both the hierarchical path component and optional query component, serves as an 1089 identifier for a potential resource within that origin server's name space. 1090 </p> 1091 <p id="rfc.section.2.7.1.p.4">If the host identifier is provided as an IP literal or IPv4 address, then the origin server is any listener on the indicated 1092 TCP port at that IP address. If host is a registered name, then that name is considered an indirect identifier and the recipient 1093 might use a name resolution service, such as DNS, to find the address of a listener for that host. The host <em class="bcp14">MUST NOT</em> be empty; if an "http" URI is received with an empty host, then it <em class="bcp14">MUST</em> be rejected as invalid. If the port subcomponent is empty or not given, then TCP port 80 is assumed (the default reserved 1094 port for WWW services). 1095 </p> 1096 <p id="rfc.section.2.7.1.p.5">Regardless of the form of host identifier, access to that host is not implied by the mere presence of its name or address. 1097 The host might or might not exist and, even when it does exist, might or might not be running an HTTP server or listening 1098 to the indicated port. The "http" URI scheme makes use of the delegated nature of Internet names and addresses to establish 1099 a naming authority (whatever entity has the ability to place an HTTP server at that Internet name or address) and allows that 1100 authority to determine which names are valid and how they might be used. 1101 </p> 1102 <p id="rfc.section.2.7.1.p.6">When an "http" URI is used within a context that calls for access to the indicated resource, a client <em class="bcp14">MAY</em> attempt access by resolving the host to an IP address, establishing a TCP connection to that address on the indicated port, 1103 and sending an HTTP request message (<a href="#http.message" title="Message Format">Section 3</a>) containing the URI's identifying data (<a href="#message.routing" title="Message Routing">Section 5</a>) to the server. If the server responds to that request with a non-interim HTTP response message, as described in <a href="p2-semantics.html#status.code.and.reason.phrase" title="Status Code and Reason Phrase">Section 4</a> of <a href="#Part2" id="rfc.xref.Part2.2"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>, then that response is considered an authoritative answer to the client's request. 1104 </p> 1105 <p id="rfc.section.2.7.1.p.7">Although HTTP is independent of the transport protocol, the "http" scheme is specific to TCP-based services because the name 1106 delegation process depends on TCP for establishing authority. An HTTP service based on some other underlying connection protocol 1107 would presumably be identified using a different URI scheme, just as the "https" scheme (below) is used for servers that require 1108 an SSL/TLS transport layer on a connection. Other protocols might also be used to provide access to "http" identified resources 1109 — it is only the authoritative interface used for mapping the namespace that is specific to TCP. 1110 </p> 1111 <p id="rfc.section.2.7.1.p.8">The URI generic syntax for authority also includes a deprecated userinfo subcomponent (<a href="#RFC3986" id="rfc.xref.RFC3986.15"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.2.1">Section 3.2.1</a>) for including user authentication information in the URI. Some implementations make use of the userinfo component for internal 1112 configuration of authentication information, such as within command invocation options, configuration files, or bookmark lists, 1113 even though such usage might expose a user identifier or password. Senders <em class="bcp14">MUST NOT</em> include a userinfo subcomponent (and its "@" delimiter) when transmitting an "http" URI in a message. Recipients of HTTP messages 1114 that contain a URI reference <em class="bcp14">SHOULD</em> parse for the existence of userinfo and treat its presence as an error, likely indicating that the deprecated subcomponent 1115 is being used to obscure the authority for the sake of phishing attacks. 1116 </p> 1117 </div> 1118 <div id="https.uri"> 1119 <h3 id="rfc.section.2.7.2"><a href="#rfc.section.2.7.2">2.7.2</a> <a href="#https.uri">https URI scheme</a></h3> 1120 <div id="rfc.iref.h.2"></div> 1121 <div id="rfc.iref.u.4"></div> 1122 <p id="rfc.section.2.7.2.p.1">The "https" URI scheme is hereby defined for the purpose of minting identifiers according to their association with the hierarchical 1123 namespace governed by a potential HTTP origin server listening for SSL/TLS-secured connections on a given TCP port. 1124 </p> 1125 <p id="rfc.section.2.7.2.p.2">All of the requirements listed above for the "http" scheme are also requirements for the "https" scheme, except that a default 1126 TCP port of 443 is assumed if the port subcomponent is empty or not given, and the TCP connection <em class="bcp14">MUST</em> be secured for privacy through the use of strong encryption prior to sending the first HTTP request. 1127 </p> 1128 <div id="rfc.figure.u.9"></div><pre class="inline"><span id="rfc.iref.g.24"></span> <a href="#https.uri" class="smpl">https-URI</a> = "https:" "//" <a href="#uri" class="smpl">authority</a> <a href="#uri" class="smpl">path-abempty</a> [ "?" <a href="#uri" class="smpl">query</a> ] 1103 1129 </pre><p id="rfc.section.2.7.2.p.4">Unlike the "http" scheme, responses to "https" identified requests are never "public" and thus <em class="bcp14">MUST NOT</em> be reused for shared caching. They can, however, be reused in a private cache if the message is cacheable by default in HTTP 1104 or specifically indicated as such by the Cache-Control header field (<a href="p6-cache.html#header.cache-control" title="Cache-Control">Section 3.2</a> of <a href="#Part6" id="rfc.xref.Part6.3"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>). 1105 </p> 1106 <p id="rfc.section.2.7.2.p.5">Resources made available via the "https" scheme have no shared identity with the "http" scheme even if their resource identifiers 1107 indicate the same authority (the same host listening to the same TCP port). They are distinct name spaces and are considered 1108 to be distinct origin servers. However, an extension to HTTP that is defined to apply to entire host domains, such as the 1109 Cookie protocol <a href="#RFC6265" id="rfc.xref.RFC6265.1"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>, can allow information set by one service to impact communication with other services within a matching group of host domains. 1110 </p> 1111 <p id="rfc.section.2.7.2.p.6">The process for authoritative access to an "https" identified resource is defined in <a href="#RFC2818" id="rfc.xref.RFC2818.1"><cite title="HTTP Over TLS">[RFC2818]</cite></a>. 1112 </p> 1113 <h3 id="rfc.section.2.7.3"><a href="#rfc.section.2.7.3">2.7.3</a> <a id="uri.comparison" href="#uri.comparison">http and https URI Normalization and Comparison</a></h3> 1114 <p id="rfc.section.2.7.3.p.1">Since the "http" and "https" schemes conform to the URI generic syntax, such URIs are normalized and compared according to 1115 the algorithm defined in <a href="#RFC3986" id="rfc.xref.RFC3986.16"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-6">Section 6</a>, using the defaults described above for each scheme. 1116 </p> 1117 <p id="rfc.section.2.7.3.p.2">If the port is equal to the default port for a scheme, the normal form is to elide the port subcomponent. Likewise, an empty 1118 path component is equivalent to an absolute path of "/", so the normal form is to provide a path of "/" instead. The scheme 1119 and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner. 1120 Characters other than those in the "reserved" set are equivalent to their percent-encoded octets (see <a href="#RFC3986" id="rfc.xref.RFC3986.17"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-2.1">Section 2.1</a>): the normal form is to not encode them. 1121 </p> 1122 <p id="rfc.section.2.7.3.p.3">For example, the following three URIs are equivalent:</p> 1123 <div id="rfc.figure.u.10"></div><pre class="text"> http://example.com:80/~smith/home.html 1130 or specifically indicated as such by the Cache-Control header field (<a href="p6-cache.html#header.cache-control" title="Cache-Control">Section 3.2</a> of <a href="#Part6" id="rfc.xref.Part6.3"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>). 1131 </p> 1132 <p id="rfc.section.2.7.2.p.5">Resources made available via the "https" scheme have no shared identity with the "http" scheme even if their resource identifiers 1133 indicate the same authority (the same host listening to the same TCP port). They are distinct name spaces and are considered 1134 to be distinct origin servers. However, an extension to HTTP that is defined to apply to entire host domains, such as the 1135 Cookie protocol <a href="#RFC6265" id="rfc.xref.RFC6265.1"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>, can allow information set by one service to impact communication with other services within a matching group of host domains. 1136 </p> 1137 <p id="rfc.section.2.7.2.p.6">The process for authoritative access to an "https" identified resource is defined in <a href="#RFC2818" id="rfc.xref.RFC2818.1"><cite title="HTTP Over TLS">[RFC2818]</cite></a>. 1138 </p> 1139 </div> 1140 <div id="uri.comparison"> 1141 <h3 id="rfc.section.2.7.3"><a href="#rfc.section.2.7.3">2.7.3</a> <a href="#uri.comparison">http and https URI Normalization and Comparison</a></h3> 1142 <p id="rfc.section.2.7.3.p.1">Since the "http" and "https" schemes conform to the URI generic syntax, such URIs are normalized and compared according to 1143 the algorithm defined in <a href="#RFC3986" id="rfc.xref.RFC3986.16"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-6">Section 6</a>, using the defaults described above for each scheme. 1144 </p> 1145 <p id="rfc.section.2.7.3.p.2">If the port is equal to the default port for a scheme, the normal form is to elide the port subcomponent. Likewise, an empty 1146 path component is equivalent to an absolute path of "/", so the normal form is to provide a path of "/" instead. The scheme 1147 and host are case-insensitive and normally provided in lowercase; all other components are compared in a case-sensitive manner. 1148 Characters other than those in the "reserved" set are equivalent to their percent-encoded octets (see <a href="#RFC3986" id="rfc.xref.RFC3986.17"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-2.1">Section 2.1</a>): the normal form is to not encode them. 1149 </p> 1150 <p id="rfc.section.2.7.3.p.3">For example, the following three URIs are equivalent:</p> 1151 <div id="rfc.figure.u.10"></div><pre class="text"> http://example.com:80/~smith/home.html 1124 1152 http://EXAMPLE.com/%7Esmith/home.html 1125 1153 http://EXAMPLE.com:/%7esmith/home.html 1126 </pre><h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a> <a id="http.message" href="#http.message">Message Format</a></h1> 1127 <div id="rfc.iref.h.3"></div> 1128 <div id="rfc.iref.h.4"></div> 1129 <div id="rfc.iref.h.5"></div> 1130 <p id="rfc.section.3.p.1">All HTTP/1.1 messages consist of a start-line followed by a sequence of octets in a format similar to the Internet Message 1131 Format <a href="#RFC5322" id="rfc.xref.RFC5322.2"><cite title="Internet Message Format">[RFC5322]</cite></a>: zero or more header fields (collectively referred to as the "headers" or the "header section"), an empty line indicating 1132 the end of the header section, and an optional message body. 1133 </p> 1134 <div id="rfc.figure.u.11"></div><pre class="inline"><span id="rfc.iref.g.25"></span> <a href="#http.message" class="smpl">HTTP-message</a> = <a href="#http.message" class="smpl">start-line</a> 1154 </pre></div> 1155 </div> 1156 </div> 1157 <div id="http.message"> 1158 <h1 id="rfc.section.3"><a href="#rfc.section.3">3.</a> <a href="#http.message">Message Format</a></h1> 1159 <div id="rfc.iref.h.3"></div> 1160 <div id="rfc.iref.h.4"></div> 1161 <div id="rfc.iref.h.5"></div> 1162 <p id="rfc.section.3.p.1">All HTTP/1.1 messages consist of a start-line followed by a sequence of octets in a format similar to the Internet Message 1163 Format <a href="#RFC5322" id="rfc.xref.RFC5322.2"><cite title="Internet Message Format">[RFC5322]</cite></a>: zero or more header fields (collectively referred to as the "headers" or the "header section"), an empty line indicating 1164 the end of the header section, and an optional message body. 1165 </p> 1166 <div id="rfc.figure.u.11"></div><pre class="inline"><span id="rfc.iref.g.25"></span> <a href="#http.message" class="smpl">HTTP-message</a> = <a href="#http.message" class="smpl">start-line</a> 1135 1167 *( <a href="#header.fields" class="smpl">header-field</a> <a href="#core.rules" class="smpl">CRLF</a> ) 1136 1168 <a href="#core.rules" class="smpl">CRLF</a> 1137 1169 [ <a href="#message.body" class="smpl">message-body</a> ] 1138 1170 </pre><p id="rfc.section.3.p.3">The normal procedure for parsing an HTTP message is to read the start-line into a structure, read each header field into a 1139 hash table by field name until the empty line, and then use the parsed data to determine if a message body is expected. If 1140 a message body has been indicated, then it is read as a stream until an amount of octets equal to the message body length 1141 is read or the connection is closed. 1142 </p> 1143 <p id="rfc.section.3.p.4">Recipients <em class="bcp14">MUST</em> parse an HTTP message as a sequence of octets in an encoding that is a superset of US-ASCII <a href="#USASCII" id="rfc.xref.USASCII.2"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Parsing an HTTP message as a stream of Unicode characters, without regard for the specific encoding, creates security vulnerabilities 1144 due to the varying ways that string processing libraries handle invalid multibyte character sequences that contain the octet 1145 LF (%x0A). String-based parsers can only be safely used within protocol elements after the element has been extracted from 1146 the message, such as within a header field-value after message parsing has delineated the individual fields. 1147 </p> 1148 <p id="rfc.section.3.p.5">An HTTP message can be parsed as a stream for incremental processing or forwarding downstream. However, recipients cannot 1149 rely on incremental delivery of partial messages, since some implementations will buffer or delay message forwarding for the 1150 sake of network efficiency, security checks, or payload transformations. 1151 </p> 1152 <h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a> <a id="start.line" href="#start.line">Start Line</a></h2> 1153 <p id="rfc.section.3.1.p.1">An HTTP message can either be a request from client to server or a response from server to client. Syntactically, the two 1154 types of message differ only in the start-line, which is either a request-line (for requests) or a status-line (for responses), 1155 and in the algorithm for determining the length of the message body (<a href="#message.body" title="Message Body">Section 3.3</a>). In theory, a client could receive requests and a server could receive responses, distinguishing them by their different 1156 start-line formats, but in practice servers are implemented to only expect a request (a response is interpreted as an unknown 1157 or invalid request method) and clients are implemented to only expect a response. 1158 </p> 1159 <div id="rfc.figure.u.12"></div><pre class="inline"><span id="rfc.iref.g.26"></span> <a href="#http.message" class="smpl">start-line</a> = <a href="#request.line" class="smpl">request-line</a> / <a href="#status.line" class="smpl">status-line</a> 1171 hash table by field name until the empty line, and then use the parsed data to determine if a message body is expected. If 1172 a message body has been indicated, then it is read as a stream until an amount of octets equal to the message body length 1173 is read or the connection is closed. 1174 </p> 1175 <p id="rfc.section.3.p.4">Recipients <em class="bcp14">MUST</em> parse an HTTP message as a sequence of octets in an encoding that is a superset of US-ASCII <a href="#USASCII" id="rfc.xref.USASCII.2"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Parsing an HTTP message as a stream of Unicode characters, without regard for the specific encoding, creates security vulnerabilities 1176 due to the varying ways that string processing libraries handle invalid multibyte character sequences that contain the octet 1177 LF (%x0A). String-based parsers can only be safely used within protocol elements after the element has been extracted from 1178 the message, such as within a header field-value after message parsing has delineated the individual fields. 1179 </p> 1180 <p id="rfc.section.3.p.5">An HTTP message can be parsed as a stream for incremental processing or forwarding downstream. However, recipients cannot 1181 rely on incremental delivery of partial messages, since some implementations will buffer or delay message forwarding for the 1182 sake of network efficiency, security checks, or payload transformations. 1183 </p> 1184 <div id="start.line"> 1185 <h2 id="rfc.section.3.1"><a href="#rfc.section.3.1">3.1</a> <a href="#start.line">Start Line</a></h2> 1186 <p id="rfc.section.3.1.p.1">An HTTP message can either be a request from client to server or a response from server to client. Syntactically, the two 1187 types of message differ only in the start-line, which is either a request-line (for requests) or a status-line (for responses), 1188 and in the algorithm for determining the length of the message body (<a href="#message.body" title="Message Body">Section 3.3</a>). In theory, a client could receive requests and a server could receive responses, distinguishing them by their different 1189 start-line formats, but in practice servers are implemented to only expect a request (a response is interpreted as an unknown 1190 or invalid request method) and clients are implemented to only expect a response. 1191 </p> 1192 <div id="rfc.figure.u.12"></div><pre class="inline"><span id="rfc.iref.g.26"></span> <a href="#http.message" class="smpl">start-line</a> = <a href="#request.line" class="smpl">request-line</a> / <a href="#status.line" class="smpl">status-line</a> 1160 1193 </pre><p id="rfc.section.3.1.p.4">Implementations <em class="bcp14">MUST NOT</em> send whitespace between the start-line and the first header field. The presence of such whitespace in a request might be an 1161 attempt to trick a server into ignoring that field or processing the line after it as a new request, either of which might 1162 result in a security vulnerability if other implementations within the request chain interpret the same message differently. 1163 Likewise, the presence of such whitespace in a response might be ignored by some clients or cause others to cease parsing. 1164 </p> 1165 <h3 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1</a> <a id="request.line" href="#request.line">Request Line</a></h3> 1166 <p id="rfc.section.3.1.1.p.1">A request-line begins with a method token, followed by a single space (SP), the request-target, another single space (SP), 1167 the protocol version, and ending with CRLF. 1168 </p> 1169 <div id="rfc.figure.u.13"></div><pre class="inline"><span id="rfc.iref.g.27"></span> <a href="#request.line" class="smpl">request-line</a> = <a href="#method" class="smpl">method</a> <a href="#core.rules" class="smpl">SP</a> <a href="#request-target" class="smpl">request-target</a> <a href="#core.rules" class="smpl">SP</a> <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">CRLF</a> 1194 attempt to trick a server into ignoring that field or processing the line after it as a new request, either of which might 1195 result in a security vulnerability if other implementations within the request chain interpret the same message differently. 1196 Likewise, the presence of such whitespace in a response might be ignored by some clients or cause others to cease parsing. 1197 </p> 1198 <div id="request.line"> 1199 <h3 id="rfc.section.3.1.1"><a href="#rfc.section.3.1.1">3.1.1</a> <a href="#request.line">Request Line</a></h3> 1200 <p id="rfc.section.3.1.1.p.1">A request-line begins with a method token, followed by a single space (SP), the request-target, another single space (SP), 1201 the protocol version, and ending with CRLF. 1202 </p> 1203 <div id="rfc.figure.u.13"></div><pre class="inline"><span id="rfc.iref.g.27"></span> <a href="#request.line" class="smpl">request-line</a> = <a href="#method" class="smpl">method</a> <a href="#core.rules" class="smpl">SP</a> <a href="#request-target" class="smpl">request-target</a> <a href="#core.rules" class="smpl">SP</a> <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">CRLF</a> 1170 1204 </pre><div id="rfc.iref.m.2"></div> 1171 <div id="method">1172 <p id="rfc.section.3.1.1.p.3">The method token indicates the request method to be performed on the target resource. The request method is case-sensitive.</p>1173 </div>1174 <div id="rfc.figure.u.14"></div><pre class="inline"><span id="rfc.iref.g.28"></span> <a href="#method" class="smpl">method</a> = <a href="#rule.token.separators" class="smpl">token</a>1205 <div id="method"> 1206 <p id="rfc.section.3.1.1.p.3">The method token indicates the request method to be performed on the target resource. The request method is case-sensitive.</p> 1207 </div> 1208 <div id="rfc.figure.u.14"></div><pre class="inline"><span id="rfc.iref.g.28"></span> <a href="#method" class="smpl">method</a> = <a href="#rule.token.separators" class="smpl">token</a> 1175 1209 </pre><p id="rfc.section.3.1.1.p.5">The methods defined by this specification can be found in <a href="p2-semantics.html#method" title="Method">Section 2</a> of <a href="#Part2" id="rfc.xref.Part2.3"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>, along with information regarding the HTTP method registry and considerations for defining new methods. 1176 </p> 1177 <div id="rfc.iref.r.6"></div> 1178 <p id="rfc.section.3.1.1.p.6">The request-target identifies the target resource upon which to apply the request, as defined in <a href="#request-target" title="Request Target">Section 5.3</a>. 1179 </p> 1180 <p id="rfc.section.3.1.1.p.7">No whitespace is allowed inside the method, request-target, and protocol version. Hence, recipients typically parse the request-line 1181 into its component parts by splitting on the SP characters. 1182 </p> 1183 <p id="rfc.section.3.1.1.p.8">Unfortunately, some user agents fail to properly encode hypertext references that have embedded whitespace, sending the characters 1184 directly instead of properly percent-encoding the disallowed characters. Recipients of an invalid request-line <em class="bcp14">SHOULD</em> respond with either a 400 (Bad Request) error or a 301 (Moved Permanently) redirect with the request-target properly encoded. 1185 Recipients <em class="bcp14">SHOULD NOT</em> attempt to autocorrect and then process the request without a redirect, since the invalid request-line might be deliberately 1186 crafted to bypass security filters along the request chain. 1187 </p> 1188 <p id="rfc.section.3.1.1.p.9">HTTP does not place a pre-defined limit on the length of a request-line. A server that receives a method longer than any that 1189 it implements <em class="bcp14">SHOULD</em> respond with either a 404 (Not Allowed), if it is an origin server, or a 501 (Not Implemented) status code. A server <em class="bcp14">MUST</em> be prepared to receive URIs of unbounded length and respond with the 414 (URI Too Long) status code if the received request-target 1190 would be longer than the server wishes to handle (see <a href="p2-semantics.html#status.414" title="414 URI Too Long">Section 7.4.12</a> of <a href="#Part2" id="rfc.xref.Part2.4"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). 1191 </p> 1192 <p id="rfc.section.3.1.1.p.10">Various ad-hoc limitations on request-line length are found in practice. It is <em class="bcp14">RECOMMENDED</em> that all HTTP senders and recipients support, at a minimum, request-line lengths of up to 8000 octets. 1193 </p> 1194 <h3 id="rfc.section.3.1.2"><a href="#rfc.section.3.1.2">3.1.2</a> <a id="status.line" href="#status.line">Status Line</a></h3> 1195 <p id="rfc.section.3.1.2.p.1">The first line of a response message is the status-line, consisting of the protocol version, a space (SP), the status code, 1196 another space, a possibly-empty textual phrase describing the status code, and ending with CRLF. 1197 </p> 1198 <div id="rfc.figure.u.15"></div><pre class="inline"><span id="rfc.iref.g.29"></span> <a href="#status.line" class="smpl">status-line</a> = <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">SP</a> <a href="#status-code" class="smpl">status-code</a> <a href="#core.rules" class="smpl">SP</a> <a href="#reason-phrase" class="smpl">reason-phrase</a> <a href="#core.rules" class="smpl">CRLF</a> 1210 </p> 1211 <div id="rfc.iref.r.6"></div> 1212 <p id="rfc.section.3.1.1.p.6">The request-target identifies the target resource upon which to apply the request, as defined in <a href="#request-target" title="Request Target">Section 5.3</a>. 1213 </p> 1214 <p id="rfc.section.3.1.1.p.7">No whitespace is allowed inside the method, request-target, and protocol version. Hence, recipients typically parse the request-line 1215 into its component parts by splitting on the SP characters. 1216 </p> 1217 <p id="rfc.section.3.1.1.p.8">Unfortunately, some user agents fail to properly encode hypertext references that have embedded whitespace, sending the characters 1218 directly instead of properly percent-encoding the disallowed characters. Recipients of an invalid request-line <em class="bcp14">SHOULD</em> respond with either a 400 (Bad Request) error or a 301 (Moved Permanently) redirect with the request-target properly encoded. 1219 Recipients <em class="bcp14">SHOULD NOT</em> attempt to autocorrect and then process the request without a redirect, since the invalid request-line might be deliberately 1220 crafted to bypass security filters along the request chain. 1221 </p> 1222 <p id="rfc.section.3.1.1.p.9">HTTP does not place a pre-defined limit on the length of a request-line. A server that receives a method longer than any that 1223 it implements <em class="bcp14">SHOULD</em> respond with either a 404 (Not Allowed), if it is an origin server, or a 501 (Not Implemented) status code. A server <em class="bcp14">MUST</em> be prepared to receive URIs of unbounded length and respond with the 414 (URI Too Long) status code if the received request-target 1224 would be longer than the server wishes to handle (see <a href="p2-semantics.html#status.414" title="414 URI Too Long">Section 7.4.12</a> of <a href="#Part2" id="rfc.xref.Part2.4"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). 1225 </p> 1226 <p id="rfc.section.3.1.1.p.10">Various ad-hoc limitations on request-line length are found in practice. It is <em class="bcp14">RECOMMENDED</em> that all HTTP senders and recipients support, at a minimum, request-line lengths of up to 8000 octets. 1227 </p> 1228 </div> 1229 <div id="status.line"> 1230 <h3 id="rfc.section.3.1.2"><a href="#rfc.section.3.1.2">3.1.2</a> <a href="#status.line">Status Line</a></h3> 1231 <p id="rfc.section.3.1.2.p.1">The first line of a response message is the status-line, consisting of the protocol version, a space (SP), the status code, 1232 another space, a possibly-empty textual phrase describing the status code, and ending with CRLF. 1233 </p> 1234 <div id="rfc.figure.u.15"></div><pre class="inline"><span id="rfc.iref.g.29"></span> <a href="#status.line" class="smpl">status-line</a> = <a href="#http.version" class="smpl">HTTP-version</a> <a href="#core.rules" class="smpl">SP</a> <a href="#status-code" class="smpl">status-code</a> <a href="#core.rules" class="smpl">SP</a> <a href="#reason-phrase" class="smpl">reason-phrase</a> <a href="#core.rules" class="smpl">CRLF</a> 1199 1235 </pre><div id="status-code"> 1200 <p id="rfc.section.3.1.2.p.3">The status-code element is a 3-digit integer result code of the attempt to understand and satisfy the request. See <a href="p2-semantics.html#status.code.and.reason.phrase" title="Status Code and Reason Phrase">Section 4</a> of <a href="#Part2" id="rfc.xref.Part2.5"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a> for further information, such as the list of status codes defined by this specification, the IANA registry, and considerations1201 for new status codes.1202 </p>1203 </div>1204 <div id="rfc.figure.u.16"></div><pre class="inline"><span id="rfc.iref.g.30"></span> <a href="#status-code" class="smpl">status-code</a> = 3<a href="#core.rules" class="smpl">DIGIT</a>1236 <p id="rfc.section.3.1.2.p.3">The status-code element is a 3-digit integer result code of the attempt to understand and satisfy the request. See <a href="p2-semantics.html#status.code.and.reason.phrase" title="Status Code and Reason Phrase">Section 4</a> of <a href="#Part2" id="rfc.xref.Part2.5"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a> for further information, such as the list of status codes defined by this specification, the IANA registry, and considerations 1237 for new status codes. 1238 </p> 1239 </div> 1240 <div id="rfc.figure.u.16"></div><pre class="inline"><span id="rfc.iref.g.30"></span> <a href="#status-code" class="smpl">status-code</a> = 3<a href="#core.rules" class="smpl">DIGIT</a> 1205 1241 </pre><div id="reason-phrase"> 1206 <p id="rfc.section.3.1.2.p.5">The reason-phrase element exists for the sole purpose of providing a textual description associated with the numeric status 1207 code, mostly out of deference to earlier Internet application protocols that were more frequently used with interactive text 1208 clients. A client <em class="bcp14">SHOULD</em> ignore the reason-phrase content. 1209 </p> 1210 </div> 1211 <div id="rfc.figure.u.17"></div><pre class="inline"><span id="rfc.iref.g.31"></span> <a href="#reason-phrase" class="smpl">reason-phrase</a> = *( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> ) 1212 </pre><h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a> <a id="header.fields" href="#header.fields">Header Fields</a></h2> 1213 <p id="rfc.section.3.2.p.1">Each HTTP header field consists of a case-insensitive field name followed by a colon (":"), optional whitespace, and the field 1214 value. 1215 </p> 1216 <div id="rfc.figure.u.18"></div><pre class="inline"><span id="rfc.iref.g.32"></span><span id="rfc.iref.g.33"></span><span id="rfc.iref.g.34"></span><span id="rfc.iref.g.35"></span><span id="rfc.iref.g.36"></span> <a href="#header.fields" class="smpl">header-field</a> = <a href="#header.fields" class="smpl">field-name</a> ":" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#header.fields" class="smpl">field-value</a> <a href="#rule.whitespace" class="smpl">BWS</a> 1242 <p id="rfc.section.3.1.2.p.5">The reason-phrase element exists for the sole purpose of providing a textual description associated with the numeric status 1243 code, mostly out of deference to earlier Internet application protocols that were more frequently used with interactive text 1244 clients. A client <em class="bcp14">SHOULD</em> ignore the reason-phrase content. 1245 </p> 1246 </div> 1247 <div id="rfc.figure.u.17"></div><pre class="inline"><span id="rfc.iref.g.31"></span> <a href="#reason-phrase" class="smpl">reason-phrase</a> = *( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> ) 1248 </pre></div> 1249 </div> 1250 <div id="header.fields"> 1251 <h2 id="rfc.section.3.2"><a href="#rfc.section.3.2">3.2</a> <a href="#header.fields">Header Fields</a></h2> 1252 <p id="rfc.section.3.2.p.1">Each HTTP header field consists of a case-insensitive field name followed by a colon (":"), optional whitespace, and the field 1253 value. 1254 </p> 1255 <div id="rfc.figure.u.18"></div><pre class="inline"><span id="rfc.iref.g.32"></span><span id="rfc.iref.g.33"></span><span id="rfc.iref.g.34"></span><span id="rfc.iref.g.35"></span><span id="rfc.iref.g.36"></span> <a href="#header.fields" class="smpl">header-field</a> = <a href="#header.fields" class="smpl">field-name</a> ":" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#header.fields" class="smpl">field-value</a> <a href="#rule.whitespace" class="smpl">BWS</a> 1217 1256 <a href="#header.fields" class="smpl">field-name</a> = <a href="#rule.token.separators" class="smpl">token</a> 1218 1257 <a href="#header.fields" class="smpl">field-value</a> = *( <a href="#header.fields" class="smpl">field-content</a> / <a href="#header.fields" class="smpl">obs-fold</a> ) … … 1222 1261 ; see <a href="#field.parsing" title="Field Parsing">Section 3.2.2</a> 1223 1262 </pre><p id="rfc.section.3.2.p.3">The field-name token labels the corresponding field-value as having the semantics defined by that header field. For example, 1224 the Date header field is defined in <a href="p2-semantics.html#header.date" title="Date">Section 10.2</a> of <a href="#Part2" id="rfc.xref.Part2.6"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a> as containing the origination timestamp for the message in which it appears. 1225 </p> 1226 <p id="rfc.section.3.2.p.4">HTTP header fields are fully extensible: there is no limit on the introduction of new field names, each presumably defining 1227 new semantics, or on the number of header fields used in a given message. Existing fields are defined in each part of this 1228 specification and in many other specifications outside the standards process. New header fields can be introduced without 1229 changing the protocol version if their defined semantics allow them to be safely ignored by recipients that do not recognize 1230 them. 1231 </p> 1232 <p id="rfc.section.3.2.p.5">New HTTP header fields <em class="bcp14">SHOULD</em> be registered with IANA according to the procedures in <a href="p2-semantics.html#considerations.for.creating.header.fields" title="Considerations for Creating Header Fields">Section 3.1</a> of <a href="#Part2" id="rfc.xref.Part2.7"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>. Unrecognized header fields <em class="bcp14">MUST</em> be forwarded by a proxy unless the field-name is listed in the Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.3" title="Connection">Section 6.1</a>) or the proxy is specifically configured to block or otherwise transform such fields. Unrecognized header fields <em class="bcp14">SHOULD</em> be ignored by other recipients. 1233 </p> 1234 <p id="rfc.section.3.2.p.6">The order in which header fields with differing field names are received is not significant. However, it is "good practice" 1235 to send header fields that contain control data first, such as Host on requests and Date on responses, so that implementations 1236 can decide when not to handle a message as early as possible. A server <em class="bcp14">MUST</em> wait until the entire header section is received before interpreting a request message, since later header fields might include 1237 conditionals, authentication credentials, or deliberately misleading duplicate header fields that would impact request processing. 1238 </p> 1239 <p id="rfc.section.3.2.p.7">Multiple header fields with the same field name <em class="bcp14">MUST NOT</em> be sent in a message unless the entire field value for that header field is defined as a comma-separated list [i.e., #(values)]. 1240 Multiple header fields with the same field name can be combined into one "field-name: field-value" pair, without changing 1241 the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by 1242 a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation 1243 of the combined field value; a proxy <em class="bcp14">MUST NOT</em> change the order of these field values when forwarding a message. 1244 </p> 1245 <div class="note" id="rfc.section.3.2.p.8"> 1246 <p> <b>Note:</b> The "Set-Cookie" header field as implemented in practice can occur multiple times, but does not use the list syntax, and thus 1247 cannot be combined into a single line (<a href="#RFC6265" id="rfc.xref.RFC6265.2"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>). (See Appendix A.2.3 of <a href="#Kri2001" id="rfc.xref.Kri2001.1"><cite title="HTTP Cookies: Standards, Privacy, and Politics">[Kri2001]</cite></a> for details.) Also note that the Set-Cookie2 header field specified in <a href="#RFC2965" id="rfc.xref.RFC2965.1"><cite title="HTTP State Management Mechanism">[RFC2965]</cite></a> does not share this problem. 1248 </p> 1249 </div> 1250 <h3 id="rfc.section.3.2.1"><a href="#rfc.section.3.2.1">3.2.1</a> <a id="whitespace" href="#whitespace">Whitespace</a></h3> 1251 <div id="rule.LWS"> 1252 <p id="rfc.section.3.2.1.p.1">This specification uses three rules to denote the use of linear whitespace: OWS (optional whitespace), RWS (required whitespace), 1253 and BWS ("bad" whitespace). 1254 </p> 1255 </div> 1256 <div id="rule.OWS"> 1257 <p id="rfc.section.3.2.1.p.2">The OWS rule is used where zero or more linear whitespace octets might appear. OWS <em class="bcp14">SHOULD</em> either not be produced or be produced as a single SP. Multiple OWS octets that occur within field-content <em class="bcp14">SHOULD</em> either be replaced with a single SP or transformed to all SP octets (each octet other than SP replaced with SP) before interpreting 1258 the field value or forwarding the message downstream. 1259 </p> 1260 </div> 1261 <div id="rule.RWS"> 1262 <p id="rfc.section.3.2.1.p.3">RWS is used when at least one linear whitespace octet is required to separate field tokens. RWS <em class="bcp14">SHOULD</em> be produced as a single SP. Multiple RWS octets that occur within field-content <em class="bcp14">SHOULD</em> either be replaced with a single SP or transformed to all SP octets before interpreting the field value or forwarding the 1263 message downstream. 1264 </p> 1265 </div> 1266 <div id="rule.BWS"> 1267 <p id="rfc.section.3.2.1.p.4">BWS is used where the grammar allows optional whitespace for historical reasons but senders <em class="bcp14">SHOULD NOT</em> produce it in messages. HTTP/1.1 recipients <em class="bcp14">MUST</em> accept such bad optional whitespace and remove it before interpreting the field value or forwarding the message downstream. 1268 </p> 1269 </div> 1270 <div id="rule.whitespace"> 1271 <p id="rfc.section.3.2.1.p.5"> </p> 1272 </div> 1273 <div id="rfc.figure.u.19"></div><pre class="inline"><span id="rfc.iref.g.37"></span><span id="rfc.iref.g.38"></span><span id="rfc.iref.g.39"></span> <a href="#rule.whitespace" class="smpl">OWS</a> = *( <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">HTAB</a> ) 1263 the Date header field is defined in <a href="p2-semantics.html#header.date" title="Date">Section 10.2</a> of <a href="#Part2" id="rfc.xref.Part2.6"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a> as containing the origination timestamp for the message in which it appears. 1264 </p> 1265 <p id="rfc.section.3.2.p.4">HTTP header fields are fully extensible: there is no limit on the introduction of new field names, each presumably defining 1266 new semantics, or on the number of header fields used in a given message. Existing fields are defined in each part of this 1267 specification and in many other specifications outside the standards process. New header fields can be introduced without 1268 changing the protocol version if their defined semantics allow them to be safely ignored by recipients that do not recognize 1269 them. 1270 </p> 1271 <p id="rfc.section.3.2.p.5">New HTTP header fields <em class="bcp14">SHOULD</em> be registered with IANA according to the procedures in <a href="p2-semantics.html#considerations.for.creating.header.fields" title="Considerations for Creating Header Fields">Section 3.1</a> of <a href="#Part2" id="rfc.xref.Part2.7"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>. Unrecognized header fields <em class="bcp14">MUST</em> be forwarded by a proxy unless the field-name is listed in the Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.3" title="Connection">Section 6.1</a>) or the proxy is specifically configured to block or otherwise transform such fields. Unrecognized header fields <em class="bcp14">SHOULD</em> be ignored by other recipients. 1272 </p> 1273 <p id="rfc.section.3.2.p.6">The order in which header fields with differing field names are received is not significant. However, it is "good practice" 1274 to send header fields that contain control data first, such as Host on requests and Date on responses, so that implementations 1275 can decide when not to handle a message as early as possible. A server <em class="bcp14">MUST</em> wait until the entire header section is received before interpreting a request message, since later header fields might include 1276 conditionals, authentication credentials, or deliberately misleading duplicate header fields that would impact request processing. 1277 </p> 1278 <p id="rfc.section.3.2.p.7">Multiple header fields with the same field name <em class="bcp14">MUST NOT</em> be sent in a message unless the entire field value for that header field is defined as a comma-separated list [i.e., #(values)]. 1279 Multiple header fields with the same field name can be combined into one "field-name: field-value" pair, without changing 1280 the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by 1281 a comma. The order in which header fields with the same field name are received is therefore significant to the interpretation 1282 of the combined field value; a proxy <em class="bcp14">MUST NOT</em> change the order of these field values when forwarding a message. 1283 </p> 1284 <div class="note" id="rfc.section.3.2.p.8"> 1285 <p><b>Note:</b> The "Set-Cookie" header field as implemented in practice can occur multiple times, but does not use the list syntax, and thus 1286 cannot be combined into a single line (<a href="#RFC6265" id="rfc.xref.RFC6265.2"><cite title="HTTP State Management Mechanism">[RFC6265]</cite></a>). (See Appendix A.2.3 of <a href="#Kri2001" id="rfc.xref.Kri2001.1"><cite title="HTTP Cookies: Standards, Privacy, and Politics">[Kri2001]</cite></a> for details.) Also note that the Set-Cookie2 header field specified in <a href="#RFC2965" id="rfc.xref.RFC2965.1"><cite title="HTTP State Management Mechanism">[RFC2965]</cite></a> does not share this problem. 1287 </p> 1288 </div> 1289 <div id="whitespace"> 1290 <h3 id="rfc.section.3.2.1"><a href="#rfc.section.3.2.1">3.2.1</a> <a href="#whitespace">Whitespace</a></h3> 1291 <div id="rule.LWS"> 1292 <p id="rfc.section.3.2.1.p.1">This specification uses three rules to denote the use of linear whitespace: OWS (optional whitespace), RWS (required whitespace), 1293 and BWS ("bad" whitespace). 1294 </p> 1295 </div> 1296 <div id="rule.OWS"> 1297 <p id="rfc.section.3.2.1.p.2">The OWS rule is used where zero or more linear whitespace octets might appear. OWS <em class="bcp14">SHOULD</em> either not be produced or be produced as a single SP. Multiple OWS octets that occur within field-content <em class="bcp14">SHOULD</em> either be replaced with a single SP or transformed to all SP octets (each octet other than SP replaced with SP) before interpreting 1298 the field value or forwarding the message downstream. 1299 </p> 1300 </div> 1301 <div id="rule.RWS"> 1302 <p id="rfc.section.3.2.1.p.3">RWS is used when at least one linear whitespace octet is required to separate field tokens. RWS <em class="bcp14">SHOULD</em> be produced as a single SP. Multiple RWS octets that occur within field-content <em class="bcp14">SHOULD</em> either be replaced with a single SP or transformed to all SP octets before interpreting the field value or forwarding the 1303 message downstream. 1304 </p> 1305 </div> 1306 <div id="rule.BWS"> 1307 <p id="rfc.section.3.2.1.p.4">BWS is used where the grammar allows optional whitespace for historical reasons but senders <em class="bcp14">SHOULD NOT</em> produce it in messages. HTTP/1.1 recipients <em class="bcp14">MUST</em> accept such bad optional whitespace and remove it before interpreting the field value or forwarding the message downstream. 1308 </p> 1309 </div> 1310 <div id="rule.whitespace"> 1311 <p id="rfc.section.3.2.1.p.5"> </p> 1312 </div> 1313 <div id="rfc.figure.u.19"></div><pre class="inline"><span id="rfc.iref.g.37"></span><span id="rfc.iref.g.38"></span><span id="rfc.iref.g.39"></span> <a href="#rule.whitespace" class="smpl">OWS</a> = *( <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">HTAB</a> ) 1274 1314 ; "optional" whitespace 1275 1315 <a href="#rule.whitespace" class="smpl">RWS</a> = 1*( <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">HTAB</a> ) … … 1277 1317 <a href="#rule.whitespace" class="smpl">BWS</a> = <a href="#rule.whitespace" class="smpl">OWS</a> 1278 1318 ; "bad" whitespace 1279 </pre><h3 id="rfc.section.3.2.2"><a href="#rfc.section.3.2.2">3.2.2</a> <a id="field.parsing" href="#field.parsing">Field Parsing</a></h3> 1280 <p id="rfc.section.3.2.2.p.1">No whitespace is allowed between the header field-name and colon. In the past, differences in the handling of such whitespace 1281 have led to security vulnerabilities in request routing and response handling. Any received request message that contains 1282 whitespace between a header field-name and colon <em class="bcp14">MUST</em> be rejected with a response code of 400 (Bad Request). A proxy <em class="bcp14">MUST</em> remove any such whitespace from a response message before forwarding the message downstream. 1283 </p> 1284 <p id="rfc.section.3.2.2.p.2">A field value <em class="bcp14">MAY</em> be preceded by optional whitespace (OWS); a single SP is preferred. The field value does not include any leading or trailing 1285 white space: OWS occurring before the first non-whitespace octet of the field value or after the last non-whitespace octet 1286 of the field value is ignored and <em class="bcp14">SHOULD</em> be removed before further processing (as this does not change the meaning of the header field). 1287 </p> 1288 <p id="rfc.section.3.2.2.p.3">Historically, HTTP header field values could be extended over multiple lines by preceding each extra line with at least one 1289 space or horizontal tab (obs-fold). This specification deprecates such line folding except within the message/http media type 1290 (<a href="#internet.media.type.message.http" title="Internet Media Type message/http">Section 7.3.1</a>). HTTP senders <em class="bcp14">MUST NOT</em> produce messages that include line folding (i.e., that contain any field-value that matches the obs-fold rule) unless the 1291 message is intended for packaging within the message/http media type. HTTP recipients <em class="bcp14">SHOULD</em> accept line folding and replace any embedded obs-fold whitespace with either a single SP or a matching number of SP octets 1292 (to avoid buffer copying) prior to interpreting the field value or forwarding the message downstream. 1293 </p> 1294 <p id="rfc.section.3.2.2.p.4">Historically, HTTP has allowed field content with text in the ISO-8859-1 <a href="#ISO-8859-1" id="rfc.xref.ISO-8859-1.1"><cite title="Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1">[ISO-8859-1]</cite></a> character encoding and supported other character sets only through use of <a href="#RFC2047" id="rfc.xref.RFC2047.1"><cite title="MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text">[RFC2047]</cite></a> encoding. In practice, most HTTP header field values use only a subset of the US-ASCII character encoding <a href="#USASCII" id="rfc.xref.USASCII.3"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Newly defined header fields <em class="bcp14">SHOULD</em> limit their field values to US-ASCII octets. Recipients <em class="bcp14">SHOULD</em> treat other (obs-text) octets in field content as opaque data. 1295 </p> 1296 <h3 id="rfc.section.3.2.3"><a href="#rfc.section.3.2.3">3.2.3</a> <a id="field.length" href="#field.length">Field Length</a></h3> 1297 <p id="rfc.section.3.2.3.p.1">HTTP does not place a pre-defined limit on the length of header fields, either in isolation or as a set. A server <em class="bcp14">MUST</em> be prepared to receive request header fields of unbounded length and respond with a 4xx status code if the received header 1298 field(s) would be longer than the server wishes to handle. 1299 </p> 1300 <p id="rfc.section.3.2.3.p.2">A client that receives response headers that are longer than it wishes to handle can only treat it as a server error.</p> 1301 <p id="rfc.section.3.2.3.p.3">Various ad-hoc limitations on header length are found in practice. It is <em class="bcp14">RECOMMENDED</em> that all HTTP senders and recipients support messages whose combined header fields have 4000 or more octets. 1302 </p> 1303 <h3 id="rfc.section.3.2.4"><a href="#rfc.section.3.2.4">3.2.4</a> <a id="field.components" href="#field.components">Field value components</a></h3> 1304 <div id="rule.token.separators"> 1305 <p id="rfc.section.3.2.4.p.1"> Many HTTP/1.1 header field values consist of words (token or quoted-string) separated by whitespace or special characters. 1306 These special characters <em class="bcp14">MUST</em> be in a quoted string to be used within a parameter value (as defined in <a href="#transfer.codings" title="Transfer Codings">Section 4</a>). 1307 </p> 1308 </div> 1309 <div id="rfc.figure.u.20"></div><pre class="inline"><span id="rfc.iref.g.40"></span><span id="rfc.iref.g.41"></span><span id="rfc.iref.g.42"></span><span id="rfc.iref.g.43"></span> <a href="#rule.token.separators" class="smpl">word</a> = <a href="#rule.token.separators" class="smpl">token</a> / <a href="#rule.quoted-string" class="smpl">quoted-string</a> 1319 </pre></div> 1320 <div id="field.parsing"> 1321 <h3 id="rfc.section.3.2.2"><a href="#rfc.section.3.2.2">3.2.2</a> <a href="#field.parsing">Field Parsing</a></h3> 1322 <p id="rfc.section.3.2.2.p.1">No whitespace is allowed between the header field-name and colon. In the past, differences in the handling of such whitespace 1323 have led to security vulnerabilities in request routing and response handling. Any received request message that contains 1324 whitespace between a header field-name and colon <em class="bcp14">MUST</em> be rejected with a response code of 400 (Bad Request). A proxy <em class="bcp14">MUST</em> remove any such whitespace from a response message before forwarding the message downstream. 1325 </p> 1326 <p id="rfc.section.3.2.2.p.2">A field value <em class="bcp14">MAY</em> be preceded by optional whitespace (OWS); a single SP is preferred. The field value does not include any leading or trailing 1327 white space: OWS occurring before the first non-whitespace octet of the field value or after the last non-whitespace octet 1328 of the field value is ignored and <em class="bcp14">SHOULD</em> be removed before further processing (as this does not change the meaning of the header field). 1329 </p> 1330 <p id="rfc.section.3.2.2.p.3">Historically, HTTP header field values could be extended over multiple lines by preceding each extra line with at least one 1331 space or horizontal tab (obs-fold). This specification deprecates such line folding except within the message/http media type 1332 (<a href="#internet.media.type.message.http" title="Internet Media Type message/http">Section 7.3.1</a>). HTTP senders <em class="bcp14">MUST NOT</em> produce messages that include line folding (i.e., that contain any field-value that matches the obs-fold rule) unless the 1333 message is intended for packaging within the message/http media type. HTTP recipients <em class="bcp14">SHOULD</em> accept line folding and replace any embedded obs-fold whitespace with either a single SP or a matching number of SP octets 1334 (to avoid buffer copying) prior to interpreting the field value or forwarding the message downstream. 1335 </p> 1336 <p id="rfc.section.3.2.2.p.4">Historically, HTTP has allowed field content with text in the ISO-8859-1 <a href="#ISO-8859-1" id="rfc.xref.ISO-8859-1.1"><cite title="Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1">[ISO-8859-1]</cite></a> character encoding and supported other character sets only through use of <a href="#RFC2047" id="rfc.xref.RFC2047.1"><cite title="MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text">[RFC2047]</cite></a> encoding. In practice, most HTTP header field values use only a subset of the US-ASCII character encoding <a href="#USASCII" id="rfc.xref.USASCII.3"><cite title="Coded Character Set -- 7-bit American Standard Code for Information Interchange">[USASCII]</cite></a>. Newly defined header fields <em class="bcp14">SHOULD</em> limit their field values to US-ASCII octets. Recipients <em class="bcp14">SHOULD</em> treat other (obs-text) octets in field content as opaque data. 1337 </p> 1338 </div> 1339 <div id="field.length"> 1340 <h3 id="rfc.section.3.2.3"><a href="#rfc.section.3.2.3">3.2.3</a> <a href="#field.length">Field Length</a></h3> 1341 <p id="rfc.section.3.2.3.p.1">HTTP does not place a pre-defined limit on the length of header fields, either in isolation or as a set. A server <em class="bcp14">MUST</em> be prepared to receive request header fields of unbounded length and respond with a 4xx status code if the received header 1342 field(s) would be longer than the server wishes to handle. 1343 </p> 1344 <p id="rfc.section.3.2.3.p.2">A client that receives response headers that are longer than it wishes to handle can only treat it as a server error.</p> 1345 <p id="rfc.section.3.2.3.p.3">Various ad-hoc limitations on header length are found in practice. It is <em class="bcp14">RECOMMENDED</em> that all HTTP senders and recipients support messages whose combined header fields have 4000 or more octets. 1346 </p> 1347 </div> 1348 <div id="field.components"> 1349 <h3 id="rfc.section.3.2.4"><a href="#rfc.section.3.2.4">3.2.4</a> <a href="#field.components">Field value components</a></h3> 1350 <div id="rule.token.separators"> 1351 <p id="rfc.section.3.2.4.p.1"> Many HTTP/1.1 header field values consist of words (token or quoted-string) separated by whitespace or special characters. 1352 These special characters <em class="bcp14">MUST</em> be in a quoted string to be used within a parameter value (as defined in <a href="#transfer.codings" title="Transfer Codings">Section 4</a>). 1353 </p> 1354 </div> 1355 <div id="rfc.figure.u.20"></div><pre class="inline"><span id="rfc.iref.g.40"></span><span id="rfc.iref.g.41"></span><span id="rfc.iref.g.42"></span><span id="rfc.iref.g.43"></span> <a href="#rule.token.separators" class="smpl">word</a> = <a href="#rule.token.separators" class="smpl">token</a> / <a href="#rule.quoted-string" class="smpl">quoted-string</a> 1310 1356 1311 1357 <a href="#rule.token.separators" class="smpl">token</a> = 1*<a href="#rule.token.separators" class="smpl">tchar</a> … … 1320 1366 / "]" / "?" / "=" / "{" / "}" 1321 1367 </pre><div id="rule.quoted-string"> 1322 <p id="rfc.section.3.2.4.p.3">A string of text is parsed as a single word if it is quoted using double-quote marks.</p>1323 </div>1324 <div id="rfc.figure.u.21"></div><pre class="inline"><span id="rfc.iref.g.44"></span><span id="rfc.iref.g.45"></span><span id="rfc.iref.g.46"></span> <a href="#rule.quoted-string" class="smpl">quoted-string</a> = <a href="#core.rules" class="smpl">DQUOTE</a> *( <a href="#rule.quoted-string" class="smpl">qdtext</a> / <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> ) <a href="#core.rules" class="smpl">DQUOTE</a>1368 <p id="rfc.section.3.2.4.p.3"> A string of text is parsed as a single word if it is quoted using double-quote marks.</p> 1369 </div> 1370 <div id="rfc.figure.u.21"></div><pre class="inline"><span id="rfc.iref.g.44"></span><span id="rfc.iref.g.45"></span><span id="rfc.iref.g.46"></span> <a href="#rule.quoted-string" class="smpl">quoted-string</a> = <a href="#core.rules" class="smpl">DQUOTE</a> *( <a href="#rule.quoted-string" class="smpl">qdtext</a> / <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> ) <a href="#core.rules" class="smpl">DQUOTE</a> 1325 1371 <a href="#rule.quoted-string" class="smpl">qdtext</a> = <a href="#rule.whitespace" class="smpl">OWS</a> / %x21 / %x23-5B / %x5D-7E / <a href="#rule.quoted-string" class="smpl">obs-text</a> 1326 1372 <a href="#rule.quoted-string" class="smpl">obs-text</a> = %x80-FF 1327 1373 </pre><div id="rule.quoted-pair"> 1328 <p id="rfc.section.3.2.4.p.5">The backslash octet ("\") can be used as a single-octet quoting mechanism within quoted-string constructs:</p>1329 </div>1330 <div id="rfc.figure.u.22"></div><pre class="inline"><span id="rfc.iref.g.47"></span> <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> = "\" ( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> )1374 <p id="rfc.section.3.2.4.p.5"> The backslash octet ("\") can be used as a single-octet quoting mechanism within quoted-string constructs:</p> 1375 </div> 1376 <div id="rfc.figure.u.22"></div><pre class="inline"><span id="rfc.iref.g.47"></span> <a href="#rule.quoted-pair" class="smpl">quoted-pair</a> = "\" ( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> ) 1331 1377 </pre><p id="rfc.section.3.2.4.p.7">Recipients that process the value of the quoted-string <em class="bcp14">MUST</em> handle a quoted-pair as if it were replaced by the octet following the backslash. 1332 </p>1333 <p id="rfc.section.3.2.4.p.8">Senders <em class="bcp14">SHOULD NOT</em> escape octets in quoted-strings that do not require escaping (i.e., other than DQUOTE and the backslash octet).1334 </p>1335 <div id="rule.comment">1336 <p id="rfc.section.3.2.4.p.9">Comments can be included in some HTTP header fields by surrounding the comment text with parentheses. Comments are only allowed1337 in fields containing "comment" as part of their field value definition.1338 </p>1339 </div>1340 <div id="rfc.figure.u.23"></div><pre class="inline"><span id="rfc.iref.g.48"></span><span id="rfc.iref.g.49"></span> <a href="#rule.comment" class="smpl">comment</a> = "(" *( <a href="#rule.comment" class="smpl">ctext</a> / <a href="#rule.quoted-cpair" class="smpl">quoted-cpair</a> / <a href="#rule.comment" class="smpl">comment</a> ) ")"1378 </p> 1379 <p id="rfc.section.3.2.4.p.8">Senders <em class="bcp14">SHOULD NOT</em> escape octets in quoted-strings that do not require escaping (i.e., other than DQUOTE and the backslash octet). 1380 </p> 1381 <div id="rule.comment"> 1382 <p id="rfc.section.3.2.4.p.9"> Comments can be included in some HTTP header fields by surrounding the comment text with parentheses. Comments are only allowed 1383 in fields containing "comment" as part of their field value definition. 1384 </p> 1385 </div> 1386 <div id="rfc.figure.u.23"></div><pre class="inline"><span id="rfc.iref.g.48"></span><span id="rfc.iref.g.49"></span> <a href="#rule.comment" class="smpl">comment</a> = "(" *( <a href="#rule.comment" class="smpl">ctext</a> / <a href="#rule.quoted-cpair" class="smpl">quoted-cpair</a> / <a href="#rule.comment" class="smpl">comment</a> ) ")" 1341 1387 <a href="#rule.comment" class="smpl">ctext</a> = <a href="#rule.whitespace" class="smpl">OWS</a> / %x21-27 / %x2A-5B / %x5D-7E / <a href="#rule.quoted-string" class="smpl">obs-text</a> 1342 1388 </pre><div id="rule.quoted-cpair"> 1343 <p id="rfc.section.3.2.4.p.11">The backslash octet ("\") can be used as a single-octet quoting mechanism within comment constructs:</p>1344 </div>1345 <div id="rfc.figure.u.24"></div><pre class="inline"><span id="rfc.iref.g.50"></span> <a href="#rule.quoted-cpair" class="smpl">quoted-cpair</a> = "\" ( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> )1389 <p id="rfc.section.3.2.4.p.11"> The backslash octet ("\") can be used as a single-octet quoting mechanism within comment constructs:</p> 1390 </div> 1391 <div id="rfc.figure.u.24"></div><pre class="inline"><span id="rfc.iref.g.50"></span> <a href="#rule.quoted-cpair" class="smpl">quoted-cpair</a> = "\" ( <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / <a href="#core.rules" class="smpl">VCHAR</a> / <a href="#rule.quoted-string" class="smpl">obs-text</a> ) 1346 1392 </pre><p id="rfc.section.3.2.4.p.13">Senders <em class="bcp14">SHOULD NOT</em> escape octets in comments that do not require escaping (i.e., other than the backslash octet "\" and the parentheses "(" and 1347 ")"). 1348 </p> 1349 <h3 id="rfc.section.3.2.5"><a href="#rfc.section.3.2.5">3.2.5</a> <a id="abnf.extension" href="#abnf.extension">ABNF list extension: #rule</a></h3> 1350 <p id="rfc.section.3.2.5.p.1">A #rule extension to the ABNF rules of <a href="#RFC5234" id="rfc.xref.RFC5234.3"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> is used to improve readability in the definitions of some header field values. 1351 </p> 1352 <p id="rfc.section.3.2.5.p.2">A construct "#" is defined, similar to "*", for defining comma-delimited lists of elements. The full form is "<n>#<m>element" 1353 indicating at least <n> and at most <m> elements, each separated by a single comma (",") and optional whitespace (OWS). 1354 </p> 1355 <div id="rfc.figure.u.25"></div> 1356 <p>Thus,</p><pre class="text"> 1#element => element *( OWS "," OWS element ) 1393 ")"). 1394 </p> 1395 </div> 1396 <div id="abnf.extension"> 1397 <h3 id="rfc.section.3.2.5"><a href="#rfc.section.3.2.5">3.2.5</a> <a href="#abnf.extension">ABNF list extension: #rule</a></h3> 1398 <p id="rfc.section.3.2.5.p.1">A #rule extension to the ABNF rules of <a href="#RFC5234" id="rfc.xref.RFC5234.3"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> is used to improve readability in the definitions of some header field values. 1399 </p> 1400 <p id="rfc.section.3.2.5.p.2">A construct "#" is defined, similar to "*", for defining comma-delimited lists of elements. The full form is "<n>#<m>element" 1401 indicating at least <n> and at most <m> elements, each separated by a single comma (",") and optional whitespace (OWS). 1402 </p> 1403 <div id="rfc.figure.u.25"></div> 1404 <p>Thus,</p><pre class="text"> 1#element => element *( OWS "," OWS element ) 1357 1405 </pre><div id="rfc.figure.u.26"></div> 1358 <p>and:</p><pre class="text"> #element => [ 1#element ]1406 <p>and:</p><pre class="text"> #element => [ 1#element ] 1359 1407 </pre><div id="rfc.figure.u.27"></div> 1360 <p>and for n >= 1 and m > 1:</p><pre class="text"> <n>#<m>element => element <n-1>*<m-1>( OWS "," OWS element )1408 <p>and for n >= 1 and m > 1:</p><pre class="text"> <n>#<m>element => element <n-1>*<m-1>( OWS "," OWS element ) 1361 1409 </pre><p id="rfc.section.3.2.5.p.6">For compatibility with legacy list rules, recipients <em class="bcp14">SHOULD</em> accept empty list elements. In other words, consumers would follow the list productions: 1362 </p>1363 <div id="rfc.figure.u.28"></div><pre class="text"> #element => [ ( "," / element ) *( OWS "," [ OWS element ] ) ]1410 </p> 1411 <div id="rfc.figure.u.28"></div><pre class="text"> #element => [ ( "," / element ) *( OWS "," [ OWS element ] ) ] 1364 1412 1365 1413 1#element => *( "," OWS ) element *( OWS "," [ OWS element ] ) 1366 1414 </pre><p id="rfc.section.3.2.5.p.8">Note that empty elements do not contribute to the count of elements present, though.</p> 1367 <p id="rfc.section.3.2.5.p.9">For example, given these ABNF productions:</p>1368 <div id="rfc.figure.u.29"></div><pre class="text"> example-list = 1#example-list-elmt1415 <p id="rfc.section.3.2.5.p.9">For example, given these ABNF productions:</p> 1416 <div id="rfc.figure.u.29"></div><pre class="text"> example-list = 1#example-list-elmt 1369 1417 example-list-elmt = token ; see <a href="#field.components" title="Field value components">Section 3.2.4</a> 1370 1418 </pre><p id="rfc.section.3.2.5.p.11">Then these are valid values for example-list (not including the double quotes, which are present for delimitation only):</p> 1371 <div id="rfc.figure.u.30"></div><pre class="text"> "foo,bar"1419 <div id="rfc.figure.u.30"></div><pre class="text"> "foo,bar" 1372 1420 "foo ,bar," 1373 1421 "foo , ,bar,charlie " 1374 1422 </pre><p id="rfc.section.3.2.5.p.13">But these values would be invalid, as at least one non-empty element is required:</p> 1375 <div id="rfc.figure.u.31"></div><pre class="text"> ""1423 <div id="rfc.figure.u.31"></div><pre class="text"> "" 1376 1424 "," 1377 1425 ", ," 1378 </pre><p id="rfc.section.3.2.5.p.15"> <a href="#collected.abnf" title="Collected ABNF">Appendix B</a> shows the collected ABNF, with the list rules expanded as explained above. 1379 </p> 1380 <h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3</a> <a id="message.body" href="#message.body">Message Body</a></h2> 1381 <p id="rfc.section.3.3.p.1">The message body (if any) of an HTTP message is used to carry the payload body of that request or response. The message body 1382 is identical to the payload body unless a transfer coding has been applied, as described in <a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.1" title="Transfer-Encoding">Section 3.3.1</a>. 1383 </p> 1384 <div id="rfc.figure.u.32"></div><pre class="inline"><span id="rfc.iref.g.51"></span> <a href="#message.body" class="smpl">message-body</a> = *OCTET 1426 </pre><p id="rfc.section.3.2.5.p.15"><a href="#collected.abnf" title="Collected ABNF">Appendix B</a> shows the collected ABNF, with the list rules expanded as explained above. 1427 </p> 1428 </div> 1429 </div> 1430 <div id="message.body"> 1431 <h2 id="rfc.section.3.3"><a href="#rfc.section.3.3">3.3</a> <a href="#message.body">Message Body</a></h2> 1432 <p id="rfc.section.3.3.p.1">The message body (if any) of an HTTP message is used to carry the payload body of that request or response. The message body 1433 is identical to the payload body unless a transfer coding has been applied, as described in <a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.1" title="Transfer-Encoding">Section 3.3.1</a>. 1434 </p> 1435 <div id="rfc.figure.u.32"></div><pre class="inline"><span id="rfc.iref.g.51"></span> <a href="#message.body" class="smpl">message-body</a> = *OCTET 1385 1436 </pre><p id="rfc.section.3.3.p.3">The rules for when a message body is allowed in a message differ for requests and responses.</p> 1386 <p id="rfc.section.3.3.p.4">The presence of a message body in a request is signaled by a a Content-Length or Transfer-Encoding header field. Request message 1387 framing is independent of method semantics, even if the method does not define any use for a message body. 1388 </p> 1389 <p id="rfc.section.3.3.p.5">The presence of a message body in a response depends on both the request method to which it is responding and the response 1390 status code (<a href="#status-code">Paragraph 3</a>). Responses to the HEAD request method never include a message body because the associated response header fields (e.g., 1391 Transfer-Encoding, Content-Length, etc.) only indicate what their values would have been if the request method had been GET. 1392 Successful (2xx) responses to CONNECT switch to tunnel mode instead of having a message body. All 1xx (Informational), 204 1393 (No Content), and 304 (Not Modified) responses <em class="bcp14">MUST NOT</em> include a message body. All other responses do include a message body, although the body <em class="bcp14">MAY</em> be of zero length. 1394 </p> 1395 <div id="rfc.iref.t.4"></div> 1396 <div id="rfc.iref.h.6"></div> 1397 <h3 id="rfc.section.3.3.1"><a href="#rfc.section.3.3.1">3.3.1</a> <a id="header.transfer-encoding" href="#header.transfer-encoding">Transfer-Encoding</a></h3> 1398 <p id="rfc.section.3.3.1.p.1">When one or more transfer codings are applied to a payload body in order to form the message body, a Transfer-Encoding header 1399 field <em class="bcp14">MUST</em> be sent in the message and <em class="bcp14">MUST</em> contain the list of corresponding transfer-coding names in the same order that they were applied. Transfer codings are defined 1400 in <a href="#transfer.codings" title="Transfer Codings">Section 4</a>. 1401 </p> 1402 <div id="rfc.figure.u.33"></div><pre class="inline"><span id="rfc.iref.g.52"></span> <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> = 1#<a href="#transfer.codings" class="smpl">transfer-coding</a> 1437 <p id="rfc.section.3.3.p.4">The presence of a message body in a request is signaled by a a Content-Length or Transfer-Encoding header field. Request message 1438 framing is independent of method semantics, even if the method does not define any use for a message body. 1439 </p> 1440 <p id="rfc.section.3.3.p.5">The presence of a message body in a response depends on both the request method to which it is responding and the response 1441 status code (<a href="#status-code">Paragraph 3</a>). Responses to the HEAD request method never include a message body because the associated response header fields (e.g., 1442 Transfer-Encoding, Content-Length, etc.) only indicate what their values would have been if the request method had been GET. 1443 Successful (2xx) responses to CONNECT switch to tunnel mode instead of having a message body. All 1xx (Informational), 204 1444 (No Content), and 304 (Not Modified) responses <em class="bcp14">MUST NOT</em> include a message body. All other responses do include a message body, although the body <em class="bcp14">MAY</em> be of zero length. 1445 </p> 1446 <div id="header.transfer-encoding"> 1447 <div id="rfc.iref.t.4"></div> 1448 <div id="rfc.iref.h.6"></div> 1449 <h3 id="rfc.section.3.3.1"><a href="#rfc.section.3.3.1">3.3.1</a> <a href="#header.transfer-encoding">Transfer-Encoding</a></h3> 1450 <p id="rfc.section.3.3.1.p.1">When one or more transfer codings are applied to a payload body in order to form the message body, a Transfer-Encoding header 1451 field <em class="bcp14">MUST</em> be sent in the message and <em class="bcp14">MUST</em> contain the list of corresponding transfer-coding names in the same order that they were applied. Transfer codings are defined 1452 in <a href="#transfer.codings" title="Transfer Codings">Section 4</a>. 1453 </p> 1454 <div id="rfc.figure.u.33"></div><pre class="inline"><span id="rfc.iref.g.52"></span> <a href="#header.transfer-encoding" class="smpl">Transfer-Encoding</a> = 1#<a href="#transfer.codings" class="smpl">transfer-coding</a> 1403 1455 </pre><p id="rfc.section.3.3.1.p.3">Transfer-Encoding is analogous to the Content-Transfer-Encoding field of MIME, which was designed to enable safe transport 1404 of binary data over a 7-bit transport service (<a href="#RFC2045" id="rfc.xref.RFC2045.2"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a>, <a href="http://tools.ietf.org/html/rfc2045#section-6">Section 6</a>). However, safe transport has a different focus for an 8bit-clean transfer protocol. In HTTP's case, Transfer-Encoding is1405 primarily intended to accurately delimit a dynamically generated payload and to distinguish payload encodings that are only1406 applied for transport efficiency or security from those that are characteristics of the target resource.1407 </p>1408 <p id="rfc.section.3.3.1.p.4">The "chunked" transfer-coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a>) <em class="bcp14">MUST</em> be implemented by all HTTP/1.1 recipients because it plays a crucial role in delimiting messages when the payload body size1409 is not known in advance. When the "chunked" transfer-coding is used, it <em class="bcp14">MUST</em> be the last transfer-coding applied to form the message body and <em class="bcp14">MUST NOT</em> be applied more than once in a message body. If any transfer-coding is applied to a request payload body, the final transfer-coding1410 applied <em class="bcp14">MUST</em> be "chunked". If any transfer-coding is applied to a response payload body, then either the final transfer-coding applied <em class="bcp14">MUST</em> be "chunked" or the message <em class="bcp14">MUST</em> be terminated by closing the connection.1411 </p>1412 <div id="rfc.figure.u.34"></div>1413 <p>For example,</p><pre class="text"> Transfer-Encoding: gzip, chunked1456 of binary data over a 7-bit transport service (<a href="#RFC2045" id="rfc.xref.RFC2045.2"><cite title="Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies">[RFC2045]</cite></a>, <a href="https://tools.ietf.org/html/rfc2045#section-6">Section 6</a>). However, safe transport has a different focus for an 8bit-clean transfer protocol. In HTTP's case, Transfer-Encoding is 1457 primarily intended to accurately delimit a dynamically generated payload and to distinguish payload encodings that are only 1458 applied for transport efficiency or security from those that are characteristics of the target resource. 1459 </p> 1460 <p id="rfc.section.3.3.1.p.4">The "chunked" transfer-coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a>) <em class="bcp14">MUST</em> be implemented by all HTTP/1.1 recipients because it plays a crucial role in delimiting messages when the payload body size 1461 is not known in advance. When the "chunked" transfer-coding is used, it <em class="bcp14">MUST</em> be the last transfer-coding applied to form the message body and <em class="bcp14">MUST NOT</em> be applied more than once in a message body. If any transfer-coding is applied to a request payload body, the final transfer-coding 1462 applied <em class="bcp14">MUST</em> be "chunked". If any transfer-coding is applied to a response payload body, then either the final transfer-coding applied <em class="bcp14">MUST</em> be "chunked" or the message <em class="bcp14">MUST</em> be terminated by closing the connection. 1463 </p> 1464 <div id="rfc.figure.u.34"></div> 1465 <p>For example,</p><pre class="text"> Transfer-Encoding: gzip, chunked 1414 1466 </pre><p>indicates that the payload body has been compressed using the gzip coding and then chunked using the chunked coding while 1415 forming the message body. 1416 </p> 1417 <p id="rfc.section.3.3.1.p.6">If more than one Transfer-Encoding header field is present in a message, the multiple field-values <em class="bcp14">MUST</em> be combined into one field-value, according to the algorithm defined in <a href="#header.fields" title="Header Fields">Section 3.2</a>, before determining the message body length. 1418 </p> 1419 <p id="rfc.section.3.3.1.p.7">Unlike Content-Encoding (<a href="p3-payload.html#content.codings" title="Content Codings">Section 2.2</a> of <a href="#Part3" id="rfc.xref.Part3.2"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a>), Transfer-Encoding is a property of the message, not of the payload, and thus <em class="bcp14">MAY</em> be added or removed by any implementation along the request/response chain. Additional information about the encoding parameters <em class="bcp14">MAY</em> be provided by other header fields not defined by this specification. 1420 </p> 1421 <p id="rfc.section.3.3.1.p.8">Transfer-Encoding <em class="bcp14">MAY</em> be sent in a response to a HEAD request or in a 304 response to a GET request, neither of which includes a message body, to 1422 indicate that the origin server would have applied a transfer coding to the message body if the request had been an unconditional 1423 GET. This indication is not required, however, because any recipient on the response chain (including the origin server) can 1424 remove transfer codings when they are not needed. 1425 </p> 1426 <p id="rfc.section.3.3.1.p.9">Transfer-Encoding was added in HTTP/1.1. It is generally assumed that implementations advertising only HTTP/1.0 support will 1427 not understand how to process a transfer-encoded payload. A client <em class="bcp14">MUST NOT</em> send a request containing Transfer-Encoding unless it knows the server will handle HTTP/1.1 (or later) requests; such knowledge 1428 might be in the form of specific user configuration or by remembering the version of a prior received response. A server <em class="bcp14">MUST NOT</em> send a response containing Transfer-Encoding unless the corresponding request indicates HTTP/1.1 (or later). 1429 </p> 1430 <p id="rfc.section.3.3.1.p.10">A server that receives a request message with a transfer-coding it does not understand <em class="bcp14">SHOULD</em> respond with 501 (Not Implemented) and then close the connection. 1431 </p> 1432 <div id="rfc.iref.c.6"></div> 1433 <div id="rfc.iref.h.7"></div> 1434 <h3 id="rfc.section.3.3.2"><a href="#rfc.section.3.3.2">3.3.2</a> <a id="header.content-length" href="#header.content-length">Content-Length</a></h3> 1435 <p id="rfc.section.3.3.2.p.1">When a message does not have a Transfer-Encoding header field and the payload body length can be determined prior to being 1436 transferred, a Content-Length header field <em class="bcp14">SHOULD</em> be sent to indicate the length of the payload body that is either present as the message body, for requests and non-HEAD responses 1437 other than 304, or would have been present had the request been an unconditional GET. The length is expressed as a decimal 1438 number of octets. 1439 </p> 1440 <div id="rfc.figure.u.35"></div><pre class="inline"><span id="rfc.iref.g.53"></span> <a href="#header.content-length" class="smpl">Content-Length</a> = 1*<a href="#core.rules" class="smpl">DIGIT</a> 1467 forming the message body. 1468 </p> 1469 <p id="rfc.section.3.3.1.p.6">If more than one Transfer-Encoding header field is present in a message, the multiple field-values <em class="bcp14">MUST</em> be combined into one field-value, according to the algorithm defined in <a href="#header.fields" title="Header Fields">Section 3.2</a>, before determining the message body length. 1470 </p> 1471 <p id="rfc.section.3.3.1.p.7">Unlike Content-Encoding (<a href="p3-payload.html#content.codings" title="Content Codings">Section 2.2</a> of <a href="#Part3" id="rfc.xref.Part3.2"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a>), Transfer-Encoding is a property of the message, not of the payload, and thus <em class="bcp14">MAY</em> be added or removed by any implementation along the request/response chain. Additional information about the encoding parameters <em class="bcp14">MAY</em> be provided by other header fields not defined by this specification. 1472 </p> 1473 <p id="rfc.section.3.3.1.p.8">Transfer-Encoding <em class="bcp14">MAY</em> be sent in a response to a HEAD request or in a 304 response to a GET request, neither of which includes a message body, to 1474 indicate that the origin server would have applied a transfer coding to the message body if the request had been an unconditional 1475 GET. This indication is not required, however, because any recipient on the response chain (including the origin server) can 1476 remove transfer codings when they are not needed. 1477 </p> 1478 <p id="rfc.section.3.3.1.p.9">Transfer-Encoding was added in HTTP/1.1. It is generally assumed that implementations advertising only HTTP/1.0 support will 1479 not understand how to process a transfer-encoded payload. A client <em class="bcp14">MUST NOT</em> send a request containing Transfer-Encoding unless it knows the server will handle HTTP/1.1 (or later) requests; such knowledge 1480 might be in the form of specific user configuration or by remembering the version of a prior received response. A server <em class="bcp14">MUST NOT</em> send a response containing Transfer-Encoding unless the corresponding request indicates HTTP/1.1 (or later). 1481 </p> 1482 <p id="rfc.section.3.3.1.p.10">A server that receives a request message with a transfer-coding it does not understand <em class="bcp14">SHOULD</em> respond with 501 (Not Implemented) and then close the connection. 1483 </p> 1484 </div> 1485 <div id="header.content-length"> 1486 <div id="rfc.iref.c.6"></div> 1487 <div id="rfc.iref.h.7"></div> 1488 <h3 id="rfc.section.3.3.2"><a href="#rfc.section.3.3.2">3.3.2</a> <a href="#header.content-length">Content-Length</a></h3> 1489 <p id="rfc.section.3.3.2.p.1">When a message does not have a Transfer-Encoding header field and the payload body length can be determined prior to being 1490 transferred, a Content-Length header field <em class="bcp14">SHOULD</em> be sent to indicate the length of the payload body that is either present as the message body, for requests and non-HEAD responses 1491 other than 304, or would have been present had the request been an unconditional GET. The length is expressed as a decimal 1492 number of octets. 1493 </p> 1494 <div id="rfc.figure.u.35"></div><pre class="inline"><span id="rfc.iref.g.53"></span> <a href="#header.content-length" class="smpl">Content-Length</a> = 1*<a href="#core.rules" class="smpl">DIGIT</a> 1441 1495 </pre><p id="rfc.section.3.3.2.p.3">An example is</p> 1442 <div id="rfc.figure.u.36"></div><pre class="text"> Content-Length: 34951496 <div id="rfc.figure.u.36"></div><pre class="text"> Content-Length: 3495 1443 1497 </pre><p id="rfc.section.3.3.2.p.5">In the case of a response to a HEAD request, Content-Length indicates the size of the payload body (without any potential 1444 transfer-coding) that would have been sent had the request been a GET. In the case of a 304 (Not Modified) response to a GET 1445 request, Content-Length indicates the size of the payload body (without any potential transfer-coding) that would have been 1446 sent in a 200 (OK) response. 1447 </p> 1448 <p id="rfc.section.3.3.2.p.6">HTTP's use of Content-Length is significantly different from how it is used in MIME, where it is an optional field used only 1449 within the "message/external-body" media-type. 1450 </p> 1451 <p id="rfc.section.3.3.2.p.7">Any Content-Length field value greater than or equal to zero is valid. Since there is no predefined limit to the length of 1452 an HTTP payload, recipients <em class="bcp14">SHOULD</em> anticipate potentially large decimal numerals and prevent parsing errors due to integer conversion overflows (<a href="#attack.protocol.element.size.overflows" title="Protocol Element Size Overflows">Section 8.6</a>). 1453 </p> 1454 <p id="rfc.section.3.3.2.p.8">If a message is received that has multiple Content-Length header fields (<a href="#header.content-length" id="rfc.xref.header.content-length.1" title="Content-Length">Section 3.3.2</a>) with field-values consisting of the same decimal value, or a single Content-Length header field with a field value containing 1455 a list of identical decimal values (e.g., "Content-Length: 42, 42"), indicating that duplicate Content-Length header fields 1456 have been generated or combined by an upstream message processor, then the recipient <em class="bcp14">MUST</em> either reject the message as invalid or replace the duplicated field-values with a single valid Content-Length field containing 1457 that decimal value prior to determining the message body length. 1458 </p> 1459 <h3 id="rfc.section.3.3.3"><a href="#rfc.section.3.3.3">3.3.3</a> <a id="message.body.length" href="#message.body.length">Message Body Length</a></h3> 1460 <p id="rfc.section.3.3.3.p.1">The length of a message body is determined by one of the following (in order of precedence):</p> 1461 <p id="rfc.section.3.3.3.p.2"> </p> 1462 <ol> 1463 <li> 1464 <p>Any response to a HEAD request and any response with a status code of 100-199, 204, or 304 is always terminated by the first 1465 empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message 1466 body. 1467 </p> 1468 </li> 1469 <li> 1470 <p>Any successful (2xx) response to a CONNECT request implies that the connection will become a tunnel immediately after the 1471 empty line that concludes the header fields. A client <em class="bcp14">MUST</em> ignore any Content-Length or Transfer-Encoding header fields received in such a message. 1472 </p> 1473 </li> 1474 <li> 1475 <p>If a Transfer-Encoding header field is present and the "chunked" transfer-coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a>) is the final encoding, the message body length is determined by reading and decoding the chunked data until the transfer-coding 1476 indicates the data is complete. 1477 </p> 1478 <p>If a Transfer-Encoding header field is present in a response and the "chunked" transfer-coding is not the final encoding, 1479 the message body length is determined by reading the connection until it is closed by the server. If a Transfer-Encoding header 1480 field is present in a request and the "chunked" transfer-coding is not the final encoding, the message body length cannot 1481 be determined reliably; the server <em class="bcp14">MUST</em> respond with the 400 (Bad Request) status code and then close the connection. 1482 </p> 1483 <p>If a message is received with both a Transfer-Encoding header field and a Content-Length header field, the Transfer-Encoding 1484 overrides the Content-Length. Such a message might indicate an attempt to perform request or response smuggling (bypass of 1485 security-related checks on message routing or content) and thus ought to be handled as an error. The provided Content-Length <em class="bcp14">MUST</em> be removed, prior to forwarding the message downstream, or replaced with the real message body length after the transfer-coding 1486 is decoded. 1487 </p> 1488 </li> 1489 <li> 1490 <p>If a message is received without Transfer-Encoding and with either multiple Content-Length header fields having differing 1491 field-values or a single Content-Length header field having an invalid value, then the message framing is invalid and <em class="bcp14">MUST</em> be treated as an error to prevent request or response smuggling. If this is a request message, the server <em class="bcp14">MUST</em> respond with a 400 (Bad Request) status code and then close the connection. If this is a response message received by a proxy, 1492 the proxy <em class="bcp14">MUST</em> discard the received response, send a 502 (Bad Gateway) status code as its downstream response, and then close the connection. 1493 If this is a response message received by a user-agent, it <em class="bcp14">MUST</em> be treated as an error by discarding the message and closing the connection. 1494 </p> 1495 </li> 1496 <li> 1497 <p>If a valid Content-Length header field is present without Transfer-Encoding, its decimal value defines the message body length 1498 in octets. If the actual number of octets sent in the message is less than the indicated Content-Length, the recipient <em class="bcp14">MUST</em> consider the message to be incomplete and treat the connection as no longer usable. If the actual number of octets sent in 1499 the message is more than the indicated Content-Length, the recipient <em class="bcp14">MUST</em> only process the message body up to the field value's number of octets; the remainder of the message <em class="bcp14">MUST</em> either be discarded or treated as the next message in a pipeline. For the sake of robustness, a user-agent <em class="bcp14">MAY</em> attempt to detect and correct such an error in message framing if it is parsing the response to the last request on a connection 1500 and the connection has been closed by the server. 1501 </p> 1502 </li> 1503 <li> 1504 <p>If this is a request message and none of the above are true, then the message body length is zero (no message body is present).</p> 1505 </li> 1506 <li> 1507 <p>Otherwise, this is a response message without a declared message body length, so the message body length is determined by 1508 the number of octets received prior to the server closing the connection. 1509 </p> 1510 </li> 1511 </ol> 1512 <p id="rfc.section.3.3.3.p.3">Since there is no way to distinguish a successfully completed, close-delimited message from a partially-received message interrupted 1513 by network failure, implementations <em class="bcp14">SHOULD</em> use encoding or length-delimited messages whenever possible. The close-delimiting feature exists primarily for backwards compatibility 1514 with HTTP/1.0. 1515 </p> 1516 <p id="rfc.section.3.3.3.p.4">A server <em class="bcp14">MAY</em> reject a request that contains a message body but not a Content-Length by responding with 411 (Length Required). 1517 </p> 1518 <p id="rfc.section.3.3.3.p.5">Unless a transfer-coding other than "chunked" has been applied, a client that sends a request containing a message body <em class="bcp14">SHOULD</em> use a valid Content-Length header field if the message body length is known in advance, rather than the "chunked" encoding, 1519 since some existing services respond to "chunked" with a 411 (Length Required) status code even though they understand the 1520 chunked encoding. This is typically because such services are implemented via a gateway that requires a content-length in 1521 advance of being called and the server is unable or unwilling to buffer the entire request before processing. 1522 </p> 1523 <p id="rfc.section.3.3.3.p.6">A client that sends a request containing a message body <em class="bcp14">MUST</em> include a valid Content-Length header field if it does not know the server will handle HTTP/1.1 (or later) requests; such 1524 knowledge can be in the form of specific user configuration or by remembering the version of a prior received response. 1525 </p> 1526 <h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4</a> <a id="incomplete.messages" href="#incomplete.messages">Handling Incomplete Messages</a></h2> 1527 <p id="rfc.section.3.4.p.1">Request messages that are prematurely terminated, possibly due to a cancelled connection or a server-imposed time-out exception, <em class="bcp14">MUST</em> result in closure of the connection; sending an HTTP/1.1 error response prior to closing the connection is <em class="bcp14">OPTIONAL</em>. 1528 </p> 1529 <p id="rfc.section.3.4.p.2">Response messages that are prematurely terminated, usually by closure of the connection prior to receiving the expected number 1530 of octets or by failure to decode a transfer-encoded message body, <em class="bcp14">MUST</em> be recorded as incomplete. A response that terminates in the middle of the header block (before the empty line is received) 1531 cannot be assumed to convey the full semantics of the response and <em class="bcp14">MUST</em> be treated as an error. 1532 </p> 1533 <p id="rfc.section.3.4.p.3">A message body that uses the chunked transfer encoding is incomplete if the zero-sized chunk that terminates the encoding 1534 has not been received. A message that uses a valid Content-Length is incomplete if the size of the message body received (in 1535 octets) is less than the value given by Content-Length. A response that has neither chunked transfer encoding nor Content-Length 1536 is terminated by closure of the connection, and thus is considered complete regardless of the number of message body octets 1537 received, provided that the header block was received intact. 1538 </p> 1539 <p id="rfc.section.3.4.p.4">A user agent <em class="bcp14">MUST NOT</em> render an incomplete response message body as if it were complete (i.e., some indication must be given to the user that an 1540 error occurred). Cache requirements for incomplete responses are defined in <a href="p6-cache.html#response.cacheability" title="Response Cacheability">Section 2.1</a> of <a href="#Part6" id="rfc.xref.Part6.4"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>. 1541 </p> 1542 <p id="rfc.section.3.4.p.5">A server <em class="bcp14">MUST</em> read the entire request message body or close the connection after sending its response, since otherwise the remaining data 1543 on a persistent connection would be misinterpreted as the next request. Likewise, a client <em class="bcp14">MUST</em> read the entire response message body if it intends to reuse the same connection for a subsequent request. Pipelining multiple 1544 requests on a connection is described in <a href="#pipelining" title="Pipelining">Section 6.3.2.2</a>. 1545 </p> 1546 <h2 id="rfc.section.3.5"><a href="#rfc.section.3.5">3.5</a> <a id="message.robustness" href="#message.robustness">Message Parsing Robustness</a></h2> 1547 <p id="rfc.section.3.5.p.1">Older HTTP/1.0 client implementations might send an extra CRLF after a POST request as a lame workaround for some early server 1548 applications that failed to read message body content that was not terminated by a line-ending. An HTTP/1.1 client <em class="bcp14">MUST NOT</em> preface or follow a request with an extra CRLF. If terminating the request message body with a line-ending is desired, then 1549 the client <em class="bcp14">MUST</em> include the terminating CRLF octets as part of the message body length. 1550 </p> 1551 <p id="rfc.section.3.5.p.2">In the interest of robustness, servers <em class="bcp14">SHOULD</em> ignore at least one empty line received where a request-line is expected. In other words, if the server is reading the protocol 1552 stream at the beginning of a message and receives a CRLF first, it <em class="bcp14">SHOULD</em> ignore the CRLF. Likewise, although the line terminator for the start-line and header fields is the sequence CRLF, we recommend 1553 that recipients recognize a single LF as a line terminator and ignore any CR. 1554 </p> 1555 <p id="rfc.section.3.5.p.3">When a server listening only for HTTP request messages, or processing what appears from the start-line to be an HTTP request 1556 message, receives a sequence of octets that does not match the HTTP-message grammar aside from the robustness exceptions listed 1557 above, the server <em class="bcp14">MUST</em> respond with an HTTP/1.1 400 (Bad Request) response. 1558 </p> 1559 <h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a> <a id="transfer.codings" href="#transfer.codings">Transfer Codings</a></h1> 1560 <p id="rfc.section.4.p.1">Transfer-coding values are used to indicate an encoding transformation that has been, can be, or might need to be applied 1561 to a payload body in order to ensure "safe transport" through the network. This differs from a content coding in that the 1562 transfer-coding is a property of the message rather than a property of the representation that is being transferred. 1563 </p> 1564 <div id="rfc.figure.u.37"></div><pre class="inline"><span id="rfc.iref.g.54"></span><span id="rfc.iref.g.55"></span> <a href="#transfer.codings" class="smpl">transfer-coding</a> = "chunked" ; <a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a> 1498 transfer-coding) that would have been sent had the request been a GET. In the case of a 304 (Not Modified) response to a GET 1499 request, Content-Length indicates the size of the payload body (without any potential transfer-coding) that would have been 1500 sent in a 200 (OK) response. 1501 </p> 1502 <p id="rfc.section.3.3.2.p.6">HTTP's use of Content-Length is significantly different from how it is used in MIME, where it is an optional field used only 1503 within the "message/external-body" media-type. 1504 </p> 1505 <p id="rfc.section.3.3.2.p.7">Any Content-Length field value greater than or equal to zero is valid. Since there is no predefined limit to the length of 1506 an HTTP payload, recipients <em class="bcp14">SHOULD</em> anticipate potentially large decimal numerals and prevent parsing errors due to integer conversion overflows (<a href="#attack.protocol.element.size.overflows" title="Protocol Element Size Overflows">Section 8.6</a>). 1507 </p> 1508 <p id="rfc.section.3.3.2.p.8">If a message is received that has multiple Content-Length header fields (<a href="#header.content-length" id="rfc.xref.header.content-length.1" title="Content-Length">Section 3.3.2</a>) with field-values consisting of the same decimal value, or a single Content-Length header field with a field value containing 1509 a list of identical decimal values (e.g., "Content-Length: 42, 42"), indicating that duplicate Content-Length header fields 1510 have been generated or combined by an upstream message processor, then the recipient <em class="bcp14">MUST</em> either reject the message as invalid or replace the duplicated field-values with a single valid Content-Length field containing 1511 that decimal value prior to determining the message body length. 1512 </p> 1513 </div> 1514 <div id="message.body.length"> 1515 <h3 id="rfc.section.3.3.3"><a href="#rfc.section.3.3.3">3.3.3</a> <a href="#message.body.length">Message Body Length</a></h3> 1516 <p id="rfc.section.3.3.3.p.1">The length of a message body is determined by one of the following (in order of precedence):</p> 1517 <p id="rfc.section.3.3.3.p.2"></p> 1518 <ol> 1519 <li> 1520 <p>Any response to a HEAD request and any response with a status code of 100-199, 204, or 304 is always terminated by the first 1521 empty line after the header fields, regardless of the header fields present in the message, and thus cannot contain a message 1522 body. 1523 </p> 1524 </li> 1525 <li> 1526 <p>Any successful (2xx) response to a CONNECT request implies that the connection will become a tunnel immediately after the 1527 empty line that concludes the header fields. A client <em class="bcp14">MUST</em> ignore any Content-Length or Transfer-Encoding header fields received in such a message. 1528 </p> 1529 </li> 1530 <li> 1531 <p>If a Transfer-Encoding header field is present and the "chunked" transfer-coding (<a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a>) is the final encoding, the message body length is determined by reading and decoding the chunked data until the transfer-coding 1532 indicates the data is complete. 1533 </p> 1534 <p>If a Transfer-Encoding header field is present in a response and the "chunked" transfer-coding is not the final encoding, 1535 the message body length is determined by reading the connection until it is closed by the server. If a Transfer-Encoding header 1536 field is present in a request and the "chunked" transfer-coding is not the final encoding, the message body length cannot 1537 be determined reliably; the server <em class="bcp14">MUST</em> respond with the 400 (Bad Request) status code and then close the connection. 1538 </p> 1539 <p>If a message is received with both a Transfer-Encoding header field and a Content-Length header field, the Transfer-Encoding 1540 overrides the Content-Length. Such a message might indicate an attempt to perform request or response smuggling (bypass of 1541 security-related checks on message routing or content) and thus ought to be handled as an error. The provided Content-Length <em class="bcp14">MUST</em> be removed, prior to forwarding the message downstream, or replaced with the real message body length after the transfer-coding 1542 is decoded. 1543 </p> 1544 </li> 1545 <li> 1546 <p>If a message is received without Transfer-Encoding and with either multiple Content-Length header fields having differing 1547 field-values or a single Content-Length header field having an invalid value, then the message framing is invalid and <em class="bcp14">MUST</em> be treated as an error to prevent request or response smuggling. If this is a request message, the server <em class="bcp14">MUST</em> respond with a 400 (Bad Request) status code and then close the connection. If this is a response message received by a proxy, 1548 the proxy <em class="bcp14">MUST</em> discard the received response, send a 502 (Bad Gateway) status code as its downstream response, and then close the connection. 1549 If this is a response message received by a user-agent, it <em class="bcp14">MUST</em> be treated as an error by discarding the message and closing the connection. 1550 </p> 1551 </li> 1552 <li> 1553 <p>If a valid Content-Length header field is present without Transfer-Encoding, its decimal value defines the message body length 1554 in octets. If the actual number of octets sent in the message is less than the indicated Content-Length, the recipient <em class="bcp14">MUST</em> consider the message to be incomplete and treat the connection as no longer usable. If the actual number of octets sent in 1555 the message is more than the indicated Content-Length, the recipient <em class="bcp14">MUST</em> only process the message body up to the field value's number of octets; the remainder of the message <em class="bcp14">MUST</em> either be discarded or treated as the next message in a pipeline. For the sake of robustness, a user-agent <em class="bcp14">MAY</em> attempt to detect and correct such an error in message framing if it is parsing the response to the last request on a connection 1556 and the connection has been closed by the server. 1557 </p> 1558 </li> 1559 <li> 1560 <p>If this is a request message and none of the above are true, then the message body length is zero (no message body is present).</p> 1561 </li> 1562 <li> 1563 <p>Otherwise, this is a response message without a declared message body length, so the message body length is determined by 1564 the number of octets received prior to the server closing the connection. 1565 </p> 1566 </li> 1567 </ol> 1568 <p id="rfc.section.3.3.3.p.3">Since there is no way to distinguish a successfully completed, close-delimited message from a partially-received message interrupted 1569 by network failure, implementations <em class="bcp14">SHOULD</em> use encoding or length-delimited messages whenever possible. The close-delimiting feature exists primarily for backwards compatibility 1570 with HTTP/1.0. 1571 </p> 1572 <p id="rfc.section.3.3.3.p.4">A server <em class="bcp14">MAY</em> reject a request that contains a message body but not a Content-Length by responding with 411 (Length Required). 1573 </p> 1574 <p id="rfc.section.3.3.3.p.5">Unless a transfer-coding other than "chunked" has been applied, a client that sends a request containing a message body <em class="bcp14">SHOULD</em> use a valid Content-Length header field if the message body length is known in advance, rather than the "chunked" encoding, 1575 since some existing services respond to "chunked" with a 411 (Length Required) status code even though they understand the 1576 chunked encoding. This is typically because such services are implemented via a gateway that requires a content-length in 1577 advance of being called and the server is unable or unwilling to buffer the entire request before processing. 1578 </p> 1579 <p id="rfc.section.3.3.3.p.6">A client that sends a request containing a message body <em class="bcp14">MUST</em> include a valid Content-Length header field if it does not know the server will handle HTTP/1.1 (or later) requests; such 1580 knowledge can be in the form of specific user configuration or by remembering the version of a prior received response. 1581 </p> 1582 </div> 1583 </div> 1584 <div id="incomplete.messages"> 1585 <h2 id="rfc.section.3.4"><a href="#rfc.section.3.4">3.4</a> <a href="#incomplete.messages">Handling Incomplete Messages</a></h2> 1586 <p id="rfc.section.3.4.p.1">Request messages that are prematurely terminated, possibly due to a cancelled connection or a server-imposed time-out exception, <em class="bcp14">MUST</em> result in closure of the connection; sending an HTTP/1.1 error response prior to closing the connection is <em class="bcp14">OPTIONAL</em>. 1587 </p> 1588 <p id="rfc.section.3.4.p.2">Response messages that are prematurely terminated, usually by closure of the connection prior to receiving the expected number 1589 of octets or by failure to decode a transfer-encoded message body, <em class="bcp14">MUST</em> be recorded as incomplete. A response that terminates in the middle of the header block (before the empty line is received) 1590 cannot be assumed to convey the full semantics of the response and <em class="bcp14">MUST</em> be treated as an error. 1591 </p> 1592 <p id="rfc.section.3.4.p.3">A message body that uses the chunked transfer encoding is incomplete if the zero-sized chunk that terminates the encoding 1593 has not been received. A message that uses a valid Content-Length is incomplete if the size of the message body received (in 1594 octets) is less than the value given by Content-Length. A response that has neither chunked transfer encoding nor Content-Length 1595 is terminated by closure of the connection, and thus is considered complete regardless of the number of message body octets 1596 received, provided that the header block was received intact. 1597 </p> 1598 <p id="rfc.section.3.4.p.4">A user agent <em class="bcp14">MUST NOT</em> render an incomplete response message body as if it were complete (i.e., some indication must be given to the user that an 1599 error occurred). Cache requirements for incomplete responses are defined in <a href="p6-cache.html#response.cacheability" title="Response Cacheability">Section 2.1</a> of <a href="#Part6" id="rfc.xref.Part6.4"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>. 1600 </p> 1601 <p id="rfc.section.3.4.p.5">A server <em class="bcp14">MUST</em> read the entire request message body or close the connection after sending its response, since otherwise the remaining data 1602 on a persistent connection would be misinterpreted as the next request. Likewise, a client <em class="bcp14">MUST</em> read the entire response message body if it intends to reuse the same connection for a subsequent request. Pipelining multiple 1603 requests on a connection is described in <a href="#pipelining" title="Pipelining">Section 6.3.2.2</a>. 1604 </p> 1605 </div> 1606 <div id="message.robustness"> 1607 <h2 id="rfc.section.3.5"><a href="#rfc.section.3.5">3.5</a> <a href="#message.robustness">Message Parsing Robustness</a></h2> 1608 <p id="rfc.section.3.5.p.1">Older HTTP/1.0 client implementations might send an extra CRLF after a POST request as a lame workaround for some early server 1609 applications that failed to read message body content that was not terminated by a line-ending. An HTTP/1.1 client <em class="bcp14">MUST NOT</em> preface or follow a request with an extra CRLF. If terminating the request message body with a line-ending is desired, then 1610 the client <em class="bcp14">MUST</em> include the terminating CRLF octets as part of the message body length. 1611 </p> 1612 <p id="rfc.section.3.5.p.2">In the interest of robustness, servers <em class="bcp14">SHOULD</em> ignore at least one empty line received where a request-line is expected. In other words, if the server is reading the protocol 1613 stream at the beginning of a message and receives a CRLF first, it <em class="bcp14">SHOULD</em> ignore the CRLF. Likewise, although the line terminator for the start-line and header fields is the sequence CRLF, we recommend 1614 that recipients recognize a single LF as a line terminator and ignore any CR. 1615 </p> 1616 <p id="rfc.section.3.5.p.3">When a server listening only for HTTP request messages, or processing what appears from the start-line to be an HTTP request 1617 message, receives a sequence of octets that does not match the HTTP-message grammar aside from the robustness exceptions listed 1618 above, the server <em class="bcp14">MUST</em> respond with an HTTP/1.1 400 (Bad Request) response. 1619 </p> 1620 </div> 1621 </div> 1622 <div id="transfer.codings"> 1623 <h1 id="rfc.section.4"><a href="#rfc.section.4">4.</a> <a href="#transfer.codings">Transfer Codings</a></h1> 1624 <p id="rfc.section.4.p.1">Transfer-coding values are used to indicate an encoding transformation that has been, can be, or might need to be applied 1625 to a payload body in order to ensure "safe transport" through the network. This differs from a content coding in that the 1626 transfer-coding is a property of the message rather than a property of the representation that is being transferred. 1627 </p> 1628 <div id="rfc.figure.u.37"></div><pre class="inline"><span id="rfc.iref.g.54"></span><span id="rfc.iref.g.55"></span> <a href="#transfer.codings" class="smpl">transfer-coding</a> = "chunked" ; <a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a> 1565 1629 / "compress" ; <a href="#compress.coding" title="Compress Coding">Section 4.2.1</a> 1566 1630 / "deflate" ; <a href="#deflate.coding" title="Deflate Coding">Section 4.2.2</a> … … 1569 1633 <a href="#transfer.codings" class="smpl">transfer-extension</a> = <a href="#rule.token.separators" class="smpl">token</a> *( <a href="#rule.whitespace" class="smpl">OWS</a> ";" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#rule.parameter" class="smpl">transfer-parameter</a> ) 1570 1634 </pre><div id="rule.parameter"> 1571 <p id="rfc.section.4.p.3">Parameters are in the form of attribute/value pairs.</p>1572 </div>1573 <div id="rfc.figure.u.38"></div><pre class="inline"><span id="rfc.iref.g.56"></span><span id="rfc.iref.g.57"></span><span id="rfc.iref.g.58"></span><span id="rfc.iref.g.59"></span><span id="rfc.iref.g.60"></span> <a href="#rule.parameter" class="smpl">transfer-parameter</a> = <a href="#rule.parameter" class="smpl">attribute</a> <a href="#rule.whitespace" class="smpl">BWS</a> "=" <a href="#rule.whitespace" class="smpl">BWS</a> <a href="#rule.parameter" class="smpl">value</a>1635 <p id="rfc.section.4.p.3"> Parameters are in the form of attribute/value pairs.</p> 1636 </div> 1637 <div id="rfc.figure.u.38"></div><pre class="inline"><span id="rfc.iref.g.56"></span><span id="rfc.iref.g.57"></span><span id="rfc.iref.g.58"></span><span id="rfc.iref.g.59"></span><span id="rfc.iref.g.60"></span> <a href="#rule.parameter" class="smpl">transfer-parameter</a> = <a href="#rule.parameter" class="smpl">attribute</a> <a href="#rule.whitespace" class="smpl">BWS</a> "=" <a href="#rule.whitespace" class="smpl">BWS</a> <a href="#rule.parameter" class="smpl">value</a> 1574 1638 <a href="#rule.parameter" class="smpl">attribute</a> = <a href="#rule.token.separators" class="smpl">token</a> 1575 1639 <a href="#rule.parameter" class="smpl">value</a> = <a href="#rule.token.separators" class="smpl">word</a> 1576 1640 </pre><p id="rfc.section.4.p.5">All transfer-coding values are case-insensitive. The HTTP Transfer Coding registry is defined in <a href="#transfer.coding.registry" title="Transfer Coding Registry">Section 7.4</a>. HTTP/1.1 uses transfer-coding values in the TE header field (<a href="#header.te" id="rfc.xref.header.te.1" title="TE">Section 4.3</a>) and in the Transfer-Encoding header field (<a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.2" title="Transfer-Encoding">Section 3.3.1</a>). 1577 </p> 1578 <div id="rfc.iref.c.7"></div> 1579 <div id="rfc.iref.c.8"></div> 1580 <h2 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1</a> <a id="chunked.encoding" href="#chunked.encoding">Chunked Transfer Coding</a></h2> 1581 <p id="rfc.section.4.1.p.1">The chunked encoding modifies the body of a message in order to transfer it as a series of chunks, each with its own size 1582 indicator, followed by an <em class="bcp14">OPTIONAL</em> trailer containing header fields. This allows dynamically produced content to be transferred along with the information necessary 1583 for the recipient to verify that it has received the full message. 1584 </p> 1585 <div id="rfc.figure.u.39"></div><pre class="inline"><span id="rfc.iref.g.61"></span><span id="rfc.iref.g.62"></span><span id="rfc.iref.g.63"></span><span id="rfc.iref.g.64"></span><span id="rfc.iref.g.65"></span><span id="rfc.iref.g.66"></span><span id="rfc.iref.g.67"></span><span id="rfc.iref.g.68"></span><span id="rfc.iref.g.69"></span><span id="rfc.iref.g.70"></span><span id="rfc.iref.g.71"></span> <a href="#chunked.encoding" class="smpl">chunked-body</a> = *<a href="#chunked.encoding" class="smpl">chunk</a> 1641 </p> 1642 <div id="chunked.encoding"> 1643 <div id="rfc.iref.c.7"></div> 1644 <div id="rfc.iref.c.8"></div> 1645 <h2 id="rfc.section.4.1"><a href="#rfc.section.4.1">4.1</a> <a href="#chunked.encoding">Chunked Transfer Coding</a></h2> 1646 <p id="rfc.section.4.1.p.1">The chunked encoding modifies the body of a message in order to transfer it as a series of chunks, each with its own size 1647 indicator, followed by an <em class="bcp14">OPTIONAL</em> trailer containing header fields. This allows dynamically produced content to be transferred along with the information necessary 1648 for the recipient to verify that it has received the full message. 1649 </p> 1650 <div id="rfc.figure.u.39"></div><pre class="inline"><span id="rfc.iref.g.61"></span><span id="rfc.iref.g.62"></span><span id="rfc.iref.g.63"></span><span id="rfc.iref.g.64"></span><span id="rfc.iref.g.65"></span><span id="rfc.iref.g.66"></span><span id="rfc.iref.g.67"></span><span id="rfc.iref.g.68"></span><span id="rfc.iref.g.69"></span><span id="rfc.iref.g.70"></span><span id="rfc.iref.g.71"></span> <a href="#chunked.encoding" class="smpl">chunked-body</a> = *<a href="#chunked.encoding" class="smpl">chunk</a> 1586 1651 <a href="#chunked.encoding" class="smpl">last-chunk</a> 1587 1652 <a href="#chunked.encoding" class="smpl">trailer-part</a> … … 1603 1668 <a href="#chunked.encoding" class="smpl">qdtext-nf</a> = <a href="#core.rules" class="smpl">HTAB</a> / <a href="#core.rules" class="smpl">SP</a> / %x21 / %x23-5B / %x5D-7E / <a href="#rule.quoted-string" class="smpl">obs-text</a> 1604 1669 </pre><p id="rfc.section.4.1.p.3">The chunk-size field is a string of hex digits indicating the size of the chunk-data in octets. The chunked encoding is ended 1605 by any chunk whose size is zero, followed by the trailer, which is terminated by an empty line.1606 </p>1607 <p id="rfc.section.4.1.p.4">The trailer allows the sender to include additional HTTP header fields at the end of the message. The Trailer header field1608 can be used to indicate which header fields are included in a trailer (see <a href="#header.trailer" id="rfc.xref.header.trailer.1" title="Trailer">Section 4.4</a>).1609 </p>1610 <p id="rfc.section.4.1.p.5">A server using chunked transfer-coding in a response <em class="bcp14">MUST NOT</em> use the trailer for any header fields unless at least one of the following is true:1611 </p>1612 <ol>1613 <li>the request included a TE header field that indicates "trailers" is acceptable in the transfer-coding of the response, as1614 described in <a href="#header.te" id="rfc.xref.header.te.2" title="TE">Section 4.3</a>; or,1615 </li>1616 <li>the trailer fields consist entirely of optional metadata, and the recipient could use the message (in a manner acceptable1617 to the server where the field originated) without receiving it. In other words, the server that generated the header (often1618 but not always the origin server) is willing to accept the possibility that the trailer fields might be silently discarded1619 along the path to the client.1620 </li>1621 </ol>1622 <p id="rfc.section.4.1.p.6">This requirement prevents an interoperability failure when the message is being received by an HTTP/1.1 (or later) proxy and1623 forwarded to an HTTP/1.0 recipient. It avoids a situation where conformance with the protocol would have necessitated a possibly1624 infinite buffer on the proxy.1625 </p>1626 <p id="rfc.section.4.1.p.7">A process for decoding the "chunked" transfer-coding can be represented in pseudo-code as:</p>1627 <div id="rfc.figure.u.40"></div><pre class="text"> length := 01670 by any chunk whose size is zero, followed by the trailer, which is terminated by an empty line. 1671 </p> 1672 <p id="rfc.section.4.1.p.4">The trailer allows the sender to include additional HTTP header fields at the end of the message. The Trailer header field 1673 can be used to indicate which header fields are included in a trailer (see <a href="#header.trailer" id="rfc.xref.header.trailer.1" title="Trailer">Section 4.4</a>). 1674 </p> 1675 <p id="rfc.section.4.1.p.5">A server using chunked transfer-coding in a response <em class="bcp14">MUST NOT</em> use the trailer for any header fields unless at least one of the following is true: 1676 </p> 1677 <ol> 1678 <li>the request included a TE header field that indicates "trailers" is acceptable in the transfer-coding of the response, as 1679 described in <a href="#header.te" id="rfc.xref.header.te.2" title="TE">Section 4.3</a>; or, 1680 </li> 1681 <li>the trailer fields consist entirely of optional metadata, and the recipient could use the message (in a manner acceptable 1682 to the server where the field originated) without receiving it. In other words, the server that generated the header (often 1683 but not always the origin server) is willing to accept the possibility that the trailer fields might be silently discarded 1684 along the path to the client. 1685 </li> 1686 </ol> 1687 <p id="rfc.section.4.1.p.6">This requirement prevents an interoperability failure when the message is being received by an HTTP/1.1 (or later) proxy and 1688 forwarded to an HTTP/1.0 recipient. It avoids a situation where conformance with the protocol would have necessitated a possibly 1689 infinite buffer on the proxy. 1690 </p> 1691 <p id="rfc.section.4.1.p.7">A process for decoding the "chunked" transfer-coding can be represented in pseudo-code as:</p> 1692 <div id="rfc.figure.u.40"></div><pre class="text"> length := 0 1628 1693 read chunk-size, chunk-ext (if any) and CRLF 1629 1694 while (chunk-size > 0) { … … 1641 1706 Remove "chunked" from Transfer-Encoding 1642 1707 </pre><p id="rfc.section.4.1.p.9">All HTTP/1.1 applications <em class="bcp14">MUST</em> be able to receive and decode the "chunked" transfer-coding and <em class="bcp14">MUST</em> ignore chunk-ext extensions they do not understand. 1643 </p> 1644 <p id="rfc.section.4.1.p.10">Use of chunk-ext extensions by senders is deprecated; they <em class="bcp14">SHOULD NOT</em> be sent and definition of new chunk-extensions is discouraged. 1645 </p> 1646 <h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a> <a id="compression.codings" href="#compression.codings">Compression Codings</a></h2> 1647 <p id="rfc.section.4.2.p.1">The codings defined below can be used to compress the payload of a message.</p> 1648 <div class="note" id="rfc.section.4.2.p.2"> 1649 <p> <b>Note:</b> Use of program names for the identification of encoding formats is not desirable and is discouraged for future encodings. 1650 Their use here is representative of historical practice, not good design. 1651 </p> 1652 </div> 1653 <div class="note" id="rfc.section.4.2.p.3"> 1654 <p> <b>Note:</b> For compatibility with previous implementations of HTTP, applications <em class="bcp14">SHOULD</em> consider "x-gzip" and "x-compress" to be equivalent to "gzip" and "compress" respectively. 1655 </p> 1656 </div> 1657 <div id="rfc.iref.c.9"></div> 1658 <div id="rfc.iref.c.10"></div> 1659 <h3 id="rfc.section.4.2.1"><a href="#rfc.section.4.2.1">4.2.1</a> <a id="compress.coding" href="#compress.coding">Compress Coding</a></h3> 1660 <p id="rfc.section.4.2.1.p.1">The "compress" format is produced by the common UNIX file compression program "compress". This format is an adaptive Lempel-Ziv-Welch 1661 coding (LZW). 1662 </p> 1663 <div id="rfc.iref.d.2"></div> 1664 <div id="rfc.iref.c.11"></div> 1665 <h3 id="rfc.section.4.2.2"><a href="#rfc.section.4.2.2">4.2.2</a> <a id="deflate.coding" href="#deflate.coding">Deflate Coding</a></h3> 1666 <p id="rfc.section.4.2.2.p.1">The "deflate" format is defined as the "deflate" compression mechanism (described in <a href="#RFC1951" id="rfc.xref.RFC1951.1"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a>) used inside the "zlib" data format (<a href="#RFC1950" id="rfc.xref.RFC1950.1"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a>). 1667 </p> 1668 <div class="note" id="rfc.section.4.2.2.p.2"> 1669 <p> <b>Note:</b> Some incorrect implementations send the "deflate" compressed data without the zlib wrapper. 1670 </p> 1671 </div> 1672 <div id="rfc.iref.g.72"></div> 1673 <div id="rfc.iref.c.12"></div> 1674 <h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a> <a id="gzip.coding" href="#gzip.coding">Gzip Coding</a></h3> 1675 <p id="rfc.section.4.2.3.p.1">The "gzip" format is produced by the file compression program "gzip" (GNU zip), as described in <a href="#RFC1952" id="rfc.xref.RFC1952.1"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a>. This format is a Lempel-Ziv coding (LZ77) with a 32 bit CRC. 1676 </p> 1677 <div id="rfc.iref.t.5"></div> 1678 <div id="rfc.iref.h.8"></div> 1679 <h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a> <a id="header.te" href="#header.te">TE</a></h2> 1680 <p id="rfc.section.4.3.p.1">The "TE" header field indicates what extension transfer-codings the client is willing to accept in the response, and whether 1681 or not it is willing to accept trailer fields in a chunked transfer-coding. 1682 </p> 1683 <p id="rfc.section.4.3.p.2">Its value consists of the keyword "trailers" and/or a comma-separated list of extension transfer-coding names with optional 1684 accept parameters (as described in <a href="#transfer.codings" title="Transfer Codings">Section 4</a>). 1685 </p> 1686 <div id="rfc.figure.u.41"></div><pre class="inline"><span id="rfc.iref.g.73"></span><span id="rfc.iref.g.74"></span><span id="rfc.iref.g.75"></span><span id="rfc.iref.g.76"></span> <a href="#header.te" class="smpl">TE</a> = #<a href="#header.te" class="smpl">t-codings</a> 1708 </p> 1709 <p id="rfc.section.4.1.p.10">Use of chunk-ext extensions by senders is deprecated; they <em class="bcp14">SHOULD NOT</em> be sent and definition of new chunk-extensions is discouraged. 1710 </p> 1711 </div> 1712 <div id="compression.codings"> 1713 <h2 id="rfc.section.4.2"><a href="#rfc.section.4.2">4.2</a> <a href="#compression.codings">Compression Codings</a></h2> 1714 <p id="rfc.section.4.2.p.1">The codings defined below can be used to compress the payload of a message.</p> 1715 <div class="note" id="rfc.section.4.2.p.2"> 1716 <p><b>Note:</b> Use of program names for the identification of encoding formats is not desirable and is discouraged for future encodings. 1717 Their use here is representative of historical practice, not good design. 1718 </p> 1719 </div> 1720 <div class="note" id="rfc.section.4.2.p.3"> 1721 <p><b>Note:</b> For compatibility with previous implementations of HTTP, applications <em class="bcp14">SHOULD</em> consider "x-gzip" and "x-compress" to be equivalent to "gzip" and "compress" respectively. 1722 </p> 1723 </div> 1724 <div id="compress.coding"> 1725 <div id="rfc.iref.c.9"></div> 1726 <div id="rfc.iref.c.10"></div> 1727 <h3 id="rfc.section.4.2.1"><a href="#rfc.section.4.2.1">4.2.1</a> <a href="#compress.coding">Compress Coding</a></h3> 1728 <p id="rfc.section.4.2.1.p.1">The "compress" format is produced by the common UNIX file compression program "compress". This format is an adaptive Lempel-Ziv-Welch 1729 coding (LZW). 1730 </p> 1731 </div> 1732 <div id="deflate.coding"> 1733 <div id="rfc.iref.d.2"></div> 1734 <div id="rfc.iref.c.11"></div> 1735 <h3 id="rfc.section.4.2.2"><a href="#rfc.section.4.2.2">4.2.2</a> <a href="#deflate.coding">Deflate Coding</a></h3> 1736 <p id="rfc.section.4.2.2.p.1">The "deflate" format is defined as the "deflate" compression mechanism (described in <a href="#RFC1951" id="rfc.xref.RFC1951.1"><cite title="DEFLATE Compressed Data Format Specification version 1.3">[RFC1951]</cite></a>) used inside the "zlib" data format (<a href="#RFC1950" id="rfc.xref.RFC1950.1"><cite title="ZLIB Compressed Data Format Specification version 3.3">[RFC1950]</cite></a>). 1737 </p> 1738 <div class="note" id="rfc.section.4.2.2.p.2"> 1739 <p><b>Note:</b> Some incorrect implementations send the "deflate" compressed data without the zlib wrapper. 1740 </p> 1741 </div> 1742 </div> 1743 <div id="gzip.coding"> 1744 <div id="rfc.iref.g.72"></div> 1745 <div id="rfc.iref.c.12"></div> 1746 <h3 id="rfc.section.4.2.3"><a href="#rfc.section.4.2.3">4.2.3</a> <a href="#gzip.coding">Gzip Coding</a></h3> 1747 <p id="rfc.section.4.2.3.p.1">The "gzip" format is produced by the file compression program "gzip" (GNU zip), as described in <a href="#RFC1952" id="rfc.xref.RFC1952.1"><cite title="GZIP file format specification version 4.3">[RFC1952]</cite></a>. This format is a Lempel-Ziv coding (LZ77) with a 32 bit CRC. 1748 </p> 1749 </div> 1750 </div> 1751 <div id="header.te"> 1752 <div id="rfc.iref.t.5"></div> 1753 <div id="rfc.iref.h.8"></div> 1754 <h2 id="rfc.section.4.3"><a href="#rfc.section.4.3">4.3</a> <a href="#header.te">TE</a></h2> 1755 <p id="rfc.section.4.3.p.1">The "TE" header field indicates what extension transfer-codings the client is willing to accept in the response, and whether 1756 or not it is willing to accept trailer fields in a chunked transfer-coding. 1757 </p> 1758 <p id="rfc.section.4.3.p.2">Its value consists of the keyword "trailers" and/or a comma-separated list of extension transfer-coding names with optional 1759 accept parameters (as described in <a href="#transfer.codings" title="Transfer Codings">Section 4</a>). 1760 </p> 1761 <div id="rfc.figure.u.41"></div><pre class="inline"><span id="rfc.iref.g.73"></span><span id="rfc.iref.g.74"></span><span id="rfc.iref.g.75"></span><span id="rfc.iref.g.76"></span> <a href="#header.te" class="smpl">TE</a> = #<a href="#header.te" class="smpl">t-codings</a> 1687 1762 <a href="#header.te" class="smpl">t-codings</a> = "trailers" / ( <a href="#transfer.codings" class="smpl">transfer-extension</a> [ <a href="#header.te" class="smpl">te-params</a> ] ) 1688 1763 <a href="#header.te" class="smpl">te-params</a> = <a href="#rule.whitespace" class="smpl">OWS</a> ";" <a href="#rule.whitespace" class="smpl">OWS</a> "q=" <a href="#quality.values" class="smpl">qvalue</a> *( <a href="#header.te" class="smpl">te-ext</a> ) 1689 1764 <a href="#header.te" class="smpl">te-ext</a> = <a href="#rule.whitespace" class="smpl">OWS</a> ";" <a href="#rule.whitespace" class="smpl">OWS</a> <a href="#rule.token.separators" class="smpl">token</a> [ "=" <a href="#rule.token.separators" class="smpl">word</a> ] 1690 1765 </pre><p id="rfc.section.4.3.p.4">The presence of the keyword "trailers" indicates that the client is willing to accept trailer fields in a chunked transfer-coding, 1691 as defined in <a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a>. This keyword is reserved for use with transfer-coding values even though it does not itself represent a transfer-coding.1692 </p>1693 <p id="rfc.section.4.3.p.5">Examples of its use are:</p>1694 <div id="rfc.figure.u.42"></div><pre class="text"> TE: deflate1766 as defined in <a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a>. This keyword is reserved for use with transfer-coding values even though it does not itself represent a transfer-coding. 1767 </p> 1768 <p id="rfc.section.4.3.p.5">Examples of its use are:</p> 1769 <div id="rfc.figure.u.42"></div><pre class="text"> TE: deflate 1695 1770 TE: 1696 1771 TE: trailers, deflate;q=0.5 1697 1772 </pre><p id="rfc.section.4.3.p.7">The TE header field only applies to the immediate connection. Therefore, the keyword <em class="bcp14">MUST</em> be supplied within a Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.4" title="Connection">Section 6.1</a>) whenever TE is present in an HTTP/1.1 message. 1698 </p> 1699 <p id="rfc.section.4.3.p.8">A server tests whether a transfer-coding is acceptable, according to a TE field, using these rules: </p> 1700 <ol> 1701 <li> 1702 <p>The "chunked" transfer-coding is always acceptable. If the keyword "trailers" is listed, the client indicates that it is willing 1703 to accept trailer fields in the chunked response on behalf of itself and any downstream clients. The implication is that, 1704 if given, the client is stating that either all downstream clients are willing to accept trailer fields in the forwarded response, 1705 or that it will attempt to buffer the response on behalf of downstream recipients. 1706 </p> 1707 <p> <b>Note:</b> HTTP/1.1 does not define any means to limit the size of a chunked response such that a client can be assured of buffering 1708 the entire response. 1709 </p> 1710 </li> 1711 <li> 1712 <p>If the transfer-coding being tested is one of the transfer-codings listed in the TE field, then it is acceptable unless it 1713 is accompanied by a qvalue of 0. (As defined in <a href="#quality.values" title="Quality Values">Section 4.3.1</a>, a qvalue of 0 means "not acceptable".) 1714 </p> 1715 </li> 1716 <li> 1717 <p>If multiple transfer-codings are acceptable, then the acceptable transfer-coding with the highest non-zero qvalue is preferred. 1718 The "chunked" transfer-coding always has a qvalue of 1. 1719 </p> 1720 </li> 1721 </ol> 1722 <p id="rfc.section.4.3.p.9">If the TE field-value is empty or if no TE field is present, the only acceptable transfer-coding is "chunked". A message with 1723 no transfer-coding is always acceptable. 1724 </p> 1725 <h3 id="rfc.section.4.3.1"><a href="#rfc.section.4.3.1">4.3.1</a> <a id="quality.values" href="#quality.values">Quality Values</a></h3> 1726 <p id="rfc.section.4.3.1.p.1">Both transfer codings (TE request header field, <a href="#header.te" id="rfc.xref.header.te.3" title="TE">Section 4.3</a>) and content negotiation (<a href="p3-payload.html#content.negotiation" title="Content Negotiation">Section 5</a> of <a href="#Part3" id="rfc.xref.Part3.3"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a>) use short "floating point" numbers to indicate the relative importance ("weight") of various negotiable parameters. A weight 1727 is normalized to a real number in the range 0 through 1, where 0 is the minimum and 1 the maximum value. If a parameter has 1728 a quality value of 0, then content with this parameter is "not acceptable" for the client. HTTP/1.1 applications <em class="bcp14">MUST NOT</em> generate more than three digits after the decimal point. User configuration of these values <em class="bcp14">SHOULD</em> also be limited in this fashion. 1729 </p> 1730 <div id="rfc.figure.u.43"></div><pre class="inline"><span id="rfc.iref.g.77"></span> <a href="#quality.values" class="smpl">qvalue</a> = ( "0" [ "." 0*3<a href="#core.rules" class="smpl">DIGIT</a> ] ) 1773 </p> 1774 <p id="rfc.section.4.3.p.8">A server tests whether a transfer-coding is acceptable, according to a TE field, using these rules: </p> 1775 <ol> 1776 <li> 1777 <p>The "chunked" transfer-coding is always acceptable. If the keyword "trailers" is listed, the client indicates that it is willing 1778 to accept trailer fields in the chunked response on behalf of itself and any downstream clients. The implication is that, 1779 if given, the client is stating that either all downstream clients are willing to accept trailer fields in the forwarded response, 1780 or that it will attempt to buffer the response on behalf of downstream recipients. 1781 </p> 1782 <p><b>Note:</b> HTTP/1.1 does not define any means to limit the size of a chunked response such that a client can be assured of buffering 1783 the entire response. 1784 </p> 1785 </li> 1786 <li> 1787 <p>If the transfer-coding being tested is one of the transfer-codings listed in the TE field, then it is acceptable unless it 1788 is accompanied by a qvalue of 0. (As defined in <a href="#quality.values" title="Quality Values">Section 4.3.1</a>, a qvalue of 0 means "not acceptable".) 1789 </p> 1790 </li> 1791 <li> 1792 <p>If multiple transfer-codings are acceptable, then the acceptable transfer-coding with the highest non-zero qvalue is preferred. 1793 The "chunked" transfer-coding always has a qvalue of 1. 1794 </p> 1795 </li> 1796 </ol> 1797 <p id="rfc.section.4.3.p.9">If the TE field-value is empty or if no TE field is present, the only acceptable transfer-coding is "chunked". A message with 1798 no transfer-coding is always acceptable. 1799 </p> 1800 <div id="quality.values"> 1801 <h3 id="rfc.section.4.3.1"><a href="#rfc.section.4.3.1">4.3.1</a> <a href="#quality.values">Quality Values</a></h3> 1802 <p id="rfc.section.4.3.1.p.1">Both transfer codings (TE request header field, <a href="#header.te" id="rfc.xref.header.te.3" title="TE">Section 4.3</a>) and content negotiation (<a href="p3-payload.html#content.negotiation" title="Content Negotiation">Section 5</a> of <a href="#Part3" id="rfc.xref.Part3.3"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a>) use short "floating point" numbers to indicate the relative importance ("weight") of various negotiable parameters. A weight 1803 is normalized to a real number in the range 0 through 1, where 0 is the minimum and 1 the maximum value. If a parameter has 1804 a quality value of 0, then content with this parameter is "not acceptable" for the client. HTTP/1.1 applications <em class="bcp14">MUST NOT</em> generate more than three digits after the decimal point. User configuration of these values <em class="bcp14">SHOULD</em> also be limited in this fashion. 1805 </p> 1806 <div id="rfc.figure.u.43"></div><pre class="inline"><span id="rfc.iref.g.77"></span> <a href="#quality.values" class="smpl">qvalue</a> = ( "0" [ "." 0*3<a href="#core.rules" class="smpl">DIGIT</a> ] ) 1731 1807 / ( "1" [ "." 0*3("0") ] ) 1732 </pre><div class="note" id="rfc.section.4.3.1.p.3"> 1733 <p> <b>Note:</b> "Quality values" is a misnomer, since these values merely represent relative degradation in desired quality. 1734 </p> 1808 </pre><div class="note" id="rfc.section.4.3.1.p.3"> 1809 <p><b>Note:</b> "Quality values" is a misnomer, since these values merely represent relative degradation in desired quality. 1810 </p> 1811 </div> 1812 </div> 1813 </div> 1814 <div id="header.trailer"> 1815 <div id="rfc.iref.t.6"></div> 1816 <div id="rfc.iref.h.9"></div> 1817 <h2 id="rfc.section.4.4"><a href="#rfc.section.4.4">4.4</a> <a href="#header.trailer">Trailer</a></h2> 1818 <p id="rfc.section.4.4.p.1">The "Trailer" header field indicates that the given set of header fields is present in the trailer of a message encoded with 1819 chunked transfer-coding. 1820 </p> 1821 <div id="rfc.figure.u.44"></div><pre class="inline"><span id="rfc.iref.g.78"></span> <a href="#header.trailer" class="smpl">Trailer</a> = 1#<a href="#header.fields" class="smpl">field-name</a> 1822 </pre><p id="rfc.section.4.4.p.3">An HTTP/1.1 message <em class="bcp14">SHOULD</em> include a Trailer header field in a message using chunked transfer-coding with a non-empty trailer. Doing so allows the recipient 1823 to know which header fields to expect in the trailer. 1824 </p> 1825 <p id="rfc.section.4.4.p.4">If no Trailer header field is present, the trailer <em class="bcp14">SHOULD NOT</em> include any header fields. See <a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a> for restrictions on the use of trailer fields in a "chunked" transfer-coding. 1826 </p> 1827 <p id="rfc.section.4.4.p.5">Message header fields listed in the Trailer header field <em class="bcp14">MUST NOT</em> include the following header fields: 1828 </p> 1829 <ul> 1830 <li>Transfer-Encoding</li> 1831 <li>Content-Length</li> 1832 <li>Trailer</li> 1833 </ul> 1834 </div> 1735 1835 </div> 1736 <div id="rfc.iref.t.6"></div> 1737 <div id="rfc.iref.h.9"></div> 1738 <h2 id="rfc.section.4.4"><a href="#rfc.section.4.4">4.4</a> <a id="header.trailer" href="#header.trailer">Trailer</a></h2> 1739 <p id="rfc.section.4.4.p.1">The "Trailer" header field indicates that the given set of header fields is present in the trailer of a message encoded with 1740 chunked transfer-coding. 1741 </p> 1742 <div id="rfc.figure.u.44"></div><pre class="inline"><span id="rfc.iref.g.78"></span> <a href="#header.trailer" class="smpl">Trailer</a> = 1#<a href="#header.fields" class="smpl">field-name</a> 1743 </pre><p id="rfc.section.4.4.p.3">An HTTP/1.1 message <em class="bcp14">SHOULD</em> include a Trailer header field in a message using chunked transfer-coding with a non-empty trailer. Doing so allows the recipient 1744 to know which header fields to expect in the trailer. 1745 </p> 1746 <p id="rfc.section.4.4.p.4">If no Trailer header field is present, the trailer <em class="bcp14">SHOULD NOT</em> include any header fields. See <a href="#chunked.encoding" title="Chunked Transfer Coding">Section 4.1</a> for restrictions on the use of trailer fields in a "chunked" transfer-coding. 1747 </p> 1748 <p id="rfc.section.4.4.p.5">Message header fields listed in the Trailer header field <em class="bcp14">MUST NOT</em> include the following header fields: 1749 </p> 1750 <ul> 1751 <li>Transfer-Encoding</li> 1752 <li>Content-Length</li> 1753 <li>Trailer</li> 1754 </ul> 1755 <h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a> <a id="message.routing" href="#message.routing">Message Routing</a></h1> 1756 <p id="rfc.section.5.p.1">HTTP request message routing is determined by each client based on the target resource, the client's proxy configuration, 1757 and establishment or reuse of an inbound connection. The corresponding response routing follows the same connection chain 1758 back to the client. 1759 </p> 1760 <div id="rfc.iref.t.7"></div> 1761 <div id="rfc.iref.t.8"></div> 1762 <h2 id="rfc.section.5.1"><a href="#rfc.section.5.1">5.1</a> <a id="target-resource" href="#target-resource">Identifying a Target Resource</a></h2> 1763 <p id="rfc.section.5.1.p.1">HTTP is used in a wide variety of applications, ranging from general-purpose computers to home appliances. In some cases, 1764 communication options are hard-coded in a client's configuration. However, most HTTP clients rely on the same resource identification 1765 mechanism and configuration techniques as general-purpose Web browsers. 1766 </p> 1767 <p id="rfc.section.5.1.p.2">HTTP communication is initiated by a user agent for some purpose. The purpose is a combination of request semantics, which 1768 are defined in <a href="#Part2" id="rfc.xref.Part2.8"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>, and a target resource upon which to apply those semantics. A URI reference (<a href="#uri" title="Uniform Resource Identifiers">Section 2.7</a>) is typically used as an identifier for the "target resource", which a user agent would resolve to its absolute form in order 1769 to obtain the "target URI". The target URI excludes the reference's fragment identifier component, if any, since fragment 1770 identifiers are reserved for client-side processing (<a href="#RFC3986" id="rfc.xref.RFC3986.18"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="http://tools.ietf.org/html/rfc3986#section-3.5">Section 3.5</a>). 1771 </p> 1772 <p id="rfc.section.5.1.p.3">HTTP intermediaries obtain the request semantics and target URI from the request-line of an incoming request message.</p> 1773 <h2 id="rfc.section.5.2"><a href="#rfc.section.5.2">5.2</a> <a id="connecting.inbound" href="#connecting.inbound">Connecting Inbound</a></h2> 1774 <p id="rfc.section.5.2.p.1">Once the target URI is determined, a client needs to decide whether a network request is necessary to accomplish the desired 1775 semantics and, if so, where that request is to be directed. 1776 </p> 1777 <p id="rfc.section.5.2.p.2">If the client has a response cache and the request semantics can be satisfied by a cache (<a href="#Part6" id="rfc.xref.Part6.5"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>), then the request is usually directed to the cache first. 1778 </p> 1779 <p id="rfc.section.5.2.p.3">If the request is not satisfied by a cache, then a typical client will check its configuration to determine whether a proxy 1780 is to be used to satisfy the request. Proxy configuration is implementation-dependent, but is often based on URI prefix matching, 1781 selective authority matching, or both, and the proxy itself is usually identified by an "http" or "https" URI. If a proxy 1782 is applicable, the client connects inbound by establishing (or reusing) a connection to that proxy. 1783 </p> 1784 <p id="rfc.section.5.2.p.4">If no proxy is applicable, a typical client will invoke a handler routine, usually specific to the target URI's scheme, to 1785 connect directly to an authority for the target resource. How that is accomplished is dependent on the target URI scheme and 1786 defined by its associated specification, similar to how this specification defines origin server access for resolution of 1787 the "http" (<a href="#http.uri" title="http URI scheme">Section 2.7.1</a>) and "https" (<a href="#https.uri" title="https URI scheme">Section 2.7.2</a>) schemes. 1788 </p> 1789 <h2 id="rfc.section.5.3"><a href="#rfc.section.5.3">5.3</a> <a id="request-target" href="#request-target">Request Target</a></h2> 1790 <p id="rfc.section.5.3.p.1">Once an inbound connection is obtained (<a href="#connection.management" title="Connection Management">Section 6</a>), the client sends an HTTP request message (<a href="#http.message" title="Message Format">Section 3</a>) with a request-target derived from the target URI. There are four distinct formats for the request-target, depending on 1791 both the method being requested and whether the request is to a proxy. 1792 </p> 1793 <div id="rfc.figure.u.45"></div><pre class="inline"><span id="rfc.iref.g.79"></span><span id="rfc.iref.g.80"></span><span id="rfc.iref.g.81"></span><span id="rfc.iref.g.82"></span><span id="rfc.iref.g.83"></span> <a href="#request-target" class="smpl">request-target</a> = <a href="#origin-form" class="smpl">origin-form</a> 1836 <div id="message.routing"> 1837 <h1 id="rfc.section.5"><a href="#rfc.section.5">5.</a> <a href="#message.routing">Message Routing</a></h1> 1838 <p id="rfc.section.5.p.1">HTTP request message routing is determined by each client based on the target resource, the client's proxy configuration, 1839 and establishment or reuse of an inbound connection. The corresponding response routing follows the same connection chain 1840 back to the client. 1841 </p> 1842 <div id="target-resource"> 1843 <div id="rfc.iref.t.7"></div> 1844 <div id="rfc.iref.t.8"></div> 1845 <h2 id="rfc.section.5.1"><a href="#rfc.section.5.1">5.1</a> <a href="#target-resource">Identifying a Target Resource</a></h2> 1846 <p id="rfc.section.5.1.p.1">HTTP is used in a wide variety of applications, ranging from general-purpose computers to home appliances. In some cases, 1847 communication options are hard-coded in a client's configuration. However, most HTTP clients rely on the same resource identification 1848 mechanism and configuration techniques as general-purpose Web browsers. 1849 </p> 1850 <p id="rfc.section.5.1.p.2">HTTP communication is initiated by a user agent for some purpose. The purpose is a combination of request semantics, which 1851 are defined in <a href="#Part2" id="rfc.xref.Part2.8"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>, and a target resource upon which to apply those semantics. A URI reference (<a href="#uri" title="Uniform Resource Identifiers">Section 2.7</a>) is typically used as an identifier for the "target resource", which a user agent would resolve to its absolute form in order 1852 to obtain the "target URI". The target URI excludes the reference's fragment identifier component, if any, since fragment 1853 identifiers are reserved for client-side processing (<a href="#RFC3986" id="rfc.xref.RFC3986.18"><cite title="Uniform Resource Identifier (URI): Generic Syntax">[RFC3986]</cite></a>, <a href="https://tools.ietf.org/html/rfc3986#section-3.5">Section 3.5</a>). 1854 </p> 1855 <p id="rfc.section.5.1.p.3">HTTP intermediaries obtain the request semantics and target URI from the request-line of an incoming request message.</p> 1856 </div> 1857 <div id="connecting.inbound"> 1858 <h2 id="rfc.section.5.2"><a href="#rfc.section.5.2">5.2</a> <a href="#connecting.inbound">Connecting Inbound</a></h2> 1859 <p id="rfc.section.5.2.p.1">Once the target URI is determined, a client needs to decide whether a network request is necessary to accomplish the desired 1860 semantics and, if so, where that request is to be directed. 1861 </p> 1862 <p id="rfc.section.5.2.p.2">If the client has a response cache and the request semantics can be satisfied by a cache (<a href="#Part6" id="rfc.xref.Part6.5"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>), then the request is usually directed to the cache first. 1863 </p> 1864 <p id="rfc.section.5.2.p.3">If the request is not satisfied by a cache, then a typical client will check its configuration to determine whether a proxy 1865 is to be used to satisfy the request. Proxy configuration is implementation-dependent, but is often based on URI prefix matching, 1866 selective authority matching, or both, and the proxy itself is usually identified by an "http" or "https" URI. If a proxy 1867 is applicable, the client connects inbound by establishing (or reusing) a connection to that proxy. 1868 </p> 1869 <p id="rfc.section.5.2.p.4">If no proxy is applicable, a typical client will invoke a handler routine, usually specific to the target URI's scheme, to 1870 connect directly to an authority for the target resource. How that is accomplished is dependent on the target URI scheme and 1871 defined by its associated specification, similar to how this specification defines origin server access for resolution of 1872 the "http" (<a href="#http.uri" title="http URI scheme">Section 2.7.1</a>) and "https" (<a href="#https.uri" title="https URI scheme">Section 2.7.2</a>) schemes. 1873 </p> 1874 </div> 1875 <div id="request-target"> 1876 <h2 id="rfc.section.5.3"><a href="#rfc.section.5.3">5.3</a> <a href="#request-target">Request Target</a></h2> 1877 <p id="rfc.section.5.3.p.1">Once an inbound connection is obtained (<a href="#connection.management" title="Connection Management">Section 6</a>), the client sends an HTTP request message (<a href="#http.message" title="Message Format">Section 3</a>) with a request-target derived from the target URI. There are four distinct formats for the request-target, depending on 1878 both the method being requested and whether the request is to a proxy. 1879 </p> 1880 <div id="rfc.figure.u.45"></div><pre class="inline"><span id="rfc.iref.g.79"></span><span id="rfc.iref.g.80"></span><span id="rfc.iref.g.81"></span><span id="rfc.iref.g.82"></span><span id="rfc.iref.g.83"></span> <a href="#request-target" class="smpl">request-target</a> = <a href="#origin-form" class="smpl">origin-form</a> 1794 1881 / <a href="#absolute-form" class="smpl">absolute-form</a> 1795 1882 / <a href="#authority-form" class="smpl">authority-form</a> … … 1801 1888 <a href="#asterisk-form" class="smpl">asterisk-form</a> = "*" 1802 1889 </pre><div id="origin-form"> 1803 <p id="rfc.section.5.3.p.3"><span id="rfc.iref.o.3"></span> The most common form of request-target is the origin-form. When making a request directly to an origin server, other than1804 a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send only the absolute path and query components of the target URI as the request-target. If the target URI's path component1805 is empty, then the client <em class="bcp14">MUST</em> send "/" as the path within the origin-form of request-target. A Host header field is also sent, as defined in <a href="#header.host" id="rfc.xref.header.host.1" title="Host">Section 5.4</a>, containing the target URI's authority component (excluding any userinfo).1806 </p>1807 </div>1808 <p id="rfc.section.5.3.p.4">For example, a client wishing to retrieve a representation of the resource identified as</p>1809 <div id="rfc.figure.u.46"></div><pre>http://www.example.org/where?q=now1890 <p id="rfc.section.5.3.p.3"><span id="rfc.iref.o.3"></span> The most common form of request-target is the origin-form. When making a request directly to an origin server, other than 1891 a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send only the absolute path and query components of the target URI as the request-target. If the target URI's path component 1892 is empty, then the client <em class="bcp14">MUST</em> send "/" as the path within the origin-form of request-target. A Host header field is also sent, as defined in <a href="#header.host" id="rfc.xref.header.host.1" title="Host">Section 5.4</a>, containing the target URI's authority component (excluding any userinfo). 1893 </p> 1894 </div> 1895 <p id="rfc.section.5.3.p.4">For example, a client wishing to retrieve a representation of the resource identified as</p> 1896 <div id="rfc.figure.u.46"></div><pre>http://www.example.org/where?q=now 1810 1897 </pre><p id="rfc.section.5.3.p.6">directly from the origin server would open (or reuse) a TCP connection to port 80 of the host "www.example.org" and send the 1811 lines:1812 </p>1813 <div id="rfc.figure.u.47"></div><pre class="text2">GET /where?q=now HTTP/1.11898 lines: 1899 </p> 1900 <div id="rfc.figure.u.47"></div><pre class="text2">GET /where?q=now HTTP/1.1 1814 1901 Host: www.example.org 1815 1902 </pre><p id="rfc.section.5.3.p.8">followed by the remainder of the request message.</p> 1816 <div id="absolute-form">1817 <p id="rfc.section.5.3.p.9"><span id="rfc.iref.a.2"></span> When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send the target URI in absolute-form as the request-target. The proxy is requested to either service that request from a valid1818 cache, if possible, or make the same request on the client's behalf to either the next inbound proxy server or directly to1819 the origin server indicated by the request-target. Requirements on such "forwarding" of messages are defined in <a href="#intermediary.forwarding" title="Intermediary Forwarding">Section 5.6</a>.1820 </p>1821 </div>1822 <p id="rfc.section.5.3.p.10">An example absolute-form of request-line would be:</p>1823 <div id="rfc.figure.u.48"></div><pre class="text2">GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.11903 <div id="absolute-form"> 1904 <p id="rfc.section.5.3.p.9"><span id="rfc.iref.a.2"></span> When making a request to a proxy, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client <em class="bcp14">MUST</em> send the target URI in absolute-form as the request-target. The proxy is requested to either service that request from a valid 1905 cache, if possible, or make the same request on the client's behalf to either the next inbound proxy server or directly to 1906 the origin server indicated by the request-target. Requirements on such "forwarding" of messages are defined in <a href="#intermediary.forwarding" title="Intermediary Forwarding">Section 5.6</a>. 1907 </p> 1908 </div> 1909 <p id="rfc.section.5.3.p.10">An example absolute-form of request-line would be:</p> 1910 <div id="rfc.figure.u.48"></div><pre class="text2">GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1 1824 1911 </pre><p id="rfc.section.5.3.p.12">To allow for transition to the absolute-form for all requests in some future version of HTTP, HTTP/1.1 servers <em class="bcp14">MUST</em> accept the absolute-form in requests, even though HTTP/1.1 clients will only send them in requests to proxies. 1825 </p>1826 <div id="authority-form">1827 <p id="rfc.section.5.3.p.13"><span id="rfc.iref.a.3"></span> The authority-form of request-target is only used for CONNECT requests (<a href="p2-semantics.html#CONNECT" title="CONNECT">Section 6.9</a> of <a href="#Part2" id="rfc.xref.Part2.9"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). When making a CONNECT request to establish a tunnel through one or more proxies, a client <em class="bcp14">MUST</em> send only the target URI's authority component (excluding any userinfo) as the request-target. For example,1828 </p>1829 </div>1830 <div id="rfc.figure.u.49"></div><pre class="text2">CONNECT www.example.com:80 HTTP/1.11912 </p> 1913 <div id="authority-form"> 1914 <p id="rfc.section.5.3.p.13"><span id="rfc.iref.a.3"></span> The authority-form of request-target is only used for CONNECT requests (<a href="p2-semantics.html#CONNECT" title="CONNECT">Section 6.9</a> of <a href="#Part2" id="rfc.xref.Part2.9"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). When making a CONNECT request to establish a tunnel through one or more proxies, a client <em class="bcp14">MUST</em> send only the target URI's authority component (excluding any userinfo) as the request-target. For example, 1915 </p> 1916 </div> 1917 <div id="rfc.figure.u.49"></div><pre class="text2">CONNECT www.example.com:80 HTTP/1.1 1831 1918 </pre><div id="asterisk-form"> 1832 <p id="rfc.section.5.3.p.15"><span id="rfc.iref.a.4"></span> The asterisk-form of request-target is only used for a server-wide OPTIONS request (<a href="p2-semantics.html#OPTIONS" title="OPTIONS">Section 6.2</a> of <a href="#Part2" id="rfc.xref.Part2.10"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). When a client wishes to request OPTIONS for the server as a whole, as opposed to a specific named resource of that server,1833 the client <em class="bcp14">MUST</em> send only "*" (%x2A) as the request-target. For example,1834 </p>1835 </div>1836 <div id="rfc.figure.u.50"></div><pre class="text2">OPTIONS * HTTP/1.11919 <p id="rfc.section.5.3.p.15"><span id="rfc.iref.a.4"></span> The asterisk-form of request-target is only used for a server-wide OPTIONS request (<a href="p2-semantics.html#OPTIONS" title="OPTIONS">Section 6.2</a> of <a href="#Part2" id="rfc.xref.Part2.10"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). When a client wishes to request OPTIONS for the server as a whole, as opposed to a specific named resource of that server, 1920 the client <em class="bcp14">MUST</em> send only "*" (%x2A) as the request-target. For example, 1921 </p> 1922 </div> 1923 <div id="rfc.figure.u.50"></div><pre class="text2">OPTIONS * HTTP/1.1 1837 1924 </pre><p id="rfc.section.5.3.p.17">If a proxy receives an OPTIONS request with an absolute-form of request-target in which the URI has an empty path and no query 1838 component, then the last proxy on the request chain <em class="bcp14">MUST</em> send a request-target of "*" when it forwards the request to the indicated origin server.1839 </p>1840 <div id="rfc.figure.u.51"></div>1841 <p>For example, the request</p><pre class="text2">OPTIONS http://www.example.org:8001 HTTP/1.11925 component, then the last proxy on the request chain <em class="bcp14">MUST</em> send a request-target of "*" when it forwards the request to the indicated origin server. 1926 </p> 1927 <div id="rfc.figure.u.51"></div> 1928 <p>For example, the request</p><pre class="text2">OPTIONS http://www.example.org:8001 HTTP/1.1 1842 1929 </pre><div id="rfc.figure.u.52"></div> 1843 <p>would be forwarded by the final proxy as</p><pre class="text2">OPTIONS * HTTP/1.11930 <p>would be forwarded by the final proxy as</p><pre class="text2">OPTIONS * HTTP/1.1 1844 1931 Host: www.example.org:8001 1845 </pre> <p>after connecting to port 8001 of host "www.example.org".</p> 1846 <div id="rfc.iref.h.10"></div> 1847 <div id="rfc.iref.h.11"></div> 1848 <h2 id="rfc.section.5.4"><a href="#rfc.section.5.4">5.4</a> <a id="header.host" href="#header.host">Host</a></h2> 1849 <p id="rfc.section.5.4.p.1">The "Host" header field in a request provides the host and port information from the target URI, enabling the origin server 1850 to distinguish among resources while servicing requests for multiple host names on a single IP address. Since the Host field-value 1851 is critical information for handling a request, it <em class="bcp14">SHOULD</em> be sent as the first header field following the request-line. 1852 </p> 1853 <div id="rfc.figure.u.53"></div><pre class="inline"><span id="rfc.iref.g.84"></span> <a href="#header.host" class="smpl">Host</a> = <a href="#uri" class="smpl">uri-host</a> [ ":" <a href="#uri" class="smpl">port</a> ] ; <a href="#http.uri" title="http URI scheme">Section 2.7.1</a> 1932 </pre><p>after connecting to port 8001 of host "www.example.org".</p> 1933 </div> 1934 <div id="header.host"> 1935 <div id="rfc.iref.h.10"></div> 1936 <div id="rfc.iref.h.11"></div> 1937 <h2 id="rfc.section.5.4"><a href="#rfc.section.5.4">5.4</a> <a href="#header.host">Host</a></h2> 1938 <p id="rfc.section.5.4.p.1">The "Host" header field in a request provides the host and port information from the target URI, enabling the origin server 1939 to distinguish among resources while servicing requests for multiple host names on a single IP address. Since the Host field-value 1940 is critical information for handling a request, it <em class="bcp14">SHOULD</em> be sent as the first header field following the request-line. 1941 </p> 1942 <div id="rfc.figure.u.53"></div><pre class="inline"><span id="rfc.iref.g.84"></span> <a href="#header.host" class="smpl">Host</a> = <a href="#uri" class="smpl">uri-host</a> [ ":" <a href="#uri" class="smpl">port</a> ] ; <a href="#http.uri" title="http URI scheme">Section 2.7.1</a> 1854 1943 </pre><p id="rfc.section.5.4.p.3">A client <em class="bcp14">MUST</em> send a Host header field in all HTTP/1.1 request messages. If the target URI includes an authority component, then the Host 1855 field-value <em class="bcp14">MUST</em> be identical to that authority component after excluding any userinfo (<a href="#http.uri" title="http URI scheme">Section 2.7.1</a>). If the authority component is missing or undefined for the target URI, then the Host header field <em class="bcp14">MUST</em> be sent with an empty field-value.1856 </p>1857 <p id="rfc.section.5.4.p.4">For example, a GET request to the origin server for <http://www.example.org/pub/WWW/> would begin with:</p>1858 <div id="rfc.figure.u.54"></div><pre class="text2">GET /pub/WWW/ HTTP/1.11944 field-value <em class="bcp14">MUST</em> be identical to that authority component after excluding any userinfo (<a href="#http.uri" title="http URI scheme">Section 2.7.1</a>). If the authority component is missing or undefined for the target URI, then the Host header field <em class="bcp14">MUST</em> be sent with an empty field-value. 1945 </p> 1946 <p id="rfc.section.5.4.p.4">For example, a GET request to the origin server for <http://www.example.org/pub/WWW/> would begin with:</p> 1947 <div id="rfc.figure.u.54"></div><pre class="text2">GET /pub/WWW/ HTTP/1.1 1859 1948 Host: www.example.org 1860 1949 </pre><p id="rfc.section.5.4.p.6">The Host header field <em class="bcp14">MUST</em> be sent in an HTTP/1.1 request even if the request-target is in the absolute-form, since this allows the Host information 1861 to be forwarded through ancient HTTP/1.0 proxies that might not have implemented Host. 1862 </p> 1863 <p id="rfc.section.5.4.p.7">When an HTTP/1.1 proxy receives a request with an absolute-form of request-target, the proxy <em class="bcp14">MUST</em> ignore the received Host header field (if any) and instead replace it with the host information of the request-target. If 1864 the proxy forwards the request, it <em class="bcp14">MUST</em> generate a new Host field-value based on the received request-target rather than forward the received Host field-value. 1865 </p> 1866 <p id="rfc.section.5.4.p.8">Since the Host header field acts as an application-level routing mechanism, it is a frequent target for malware seeking to 1867 poison a shared cache or redirect a request to an unintended server. An interception proxy is particularly vulnerable if it 1868 relies on the Host field-value for redirecting requests to internal servers, or for use as a cache key in a shared cache, 1869 without first verifying that the intercepted connection is targeting a valid IP address for that host. 1870 </p> 1871 <p id="rfc.section.5.4.p.9">A server <em class="bcp14">MUST</em> respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header field and to any request 1872 message that contains more than one Host header field or a Host header field with an invalid field-value. 1873 </p> 1874 <div id="rfc.iref.e.1"></div> 1875 <h2 id="rfc.section.5.5"><a href="#rfc.section.5.5">5.5</a> <a id="effective.request.uri" href="#effective.request.uri">Effective Request URI</a></h2> 1876 <p id="rfc.section.5.5.p.1">A server that receives an HTTP request message <em class="bcp14">MUST</em> reconstruct the user agent's original target URI, based on the pieces of information learned from the request-target, Host, 1877 and connection context, in order to identify the intended target resource and properly service the request. The URI derived 1878 from this reconstruction process is referred to as the "effective request URI". 1879 </p> 1880 <p id="rfc.section.5.5.p.2">For a user agent, the effective request URI is the target URI.</p> 1881 <p id="rfc.section.5.5.p.3">If the request-target is in absolute-form, then the effective request URI is the same as the request-target. Otherwise, the 1882 effective request URI is constructed as follows. 1883 </p> 1884 <p id="rfc.section.5.5.p.4">If the request is received over an SSL/TLS-secured TCP connection, then the effective request URI's scheme is "https"; otherwise, 1885 the scheme is "http". 1886 </p> 1887 <p id="rfc.section.5.5.p.5">If the request-target is in authority-form, then the effective request URI's authority component is the same as the request-target. 1888 Otherwise, if a Host header field is supplied with a non-empty field-value, then the authority component is the same as the 1889 Host field-value. Otherwise, the authority component is the concatenation of the default hostname configured for the server, 1890 a colon (":"), and the connection's incoming TCP port number in decimal form. 1891 </p> 1892 <p id="rfc.section.5.5.p.6">If the request-target is in authority-form or asterisk-form, then the effective request URI's combined path and query component 1893 is empty. Otherwise, the combined path and query component is the same as the request-target. 1894 </p> 1895 <p id="rfc.section.5.5.p.7">The components of the effective request URI, once determined as above, can be combined into absolute-URI form by concatenating 1896 the scheme, "://", authority, and combined path and query component. 1897 </p> 1898 <div id="rfc.figure.u.55"></div> 1899 <p>Example 1: the following message received over an insecure TCP connection</p> <pre class="text">GET /pub/WWW/TheProject.html HTTP/1.1 1950 to be forwarded through ancient HTTP/1.0 proxies that might not have implemented Host. 1951 </p> 1952 <p id="rfc.section.5.4.p.7">When an HTTP/1.1 proxy receives a request with an absolute-form of request-target, the proxy <em class="bcp14">MUST</em> ignore the received Host header field (if any) and instead replace it with the host information of the request-target. If 1953 the proxy forwards the request, it <em class="bcp14">MUST</em> generate a new Host field-value based on the received request-target rather than forward the received Host field-value. 1954 </p> 1955 <p id="rfc.section.5.4.p.8">Since the Host header field acts as an application-level routing mechanism, it is a frequent target for malware seeking to 1956 poison a shared cache or redirect a request to an unintended server. An interception proxy is particularly vulnerable if it 1957 relies on the Host field-value for redirecting requests to internal servers, or for use as a cache key in a shared cache, 1958 without first verifying that the intercepted connection is targeting a valid IP address for that host. 1959 </p> 1960 <p id="rfc.section.5.4.p.9">A server <em class="bcp14">MUST</em> respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header field and to any request 1961 message that contains more than one Host header field or a Host header field with an invalid field-value. 1962 </p> 1963 </div> 1964 <div id="effective.request.uri"> 1965 <div id="rfc.iref.e.1"></div> 1966 <h2 id="rfc.section.5.5"><a href="#rfc.section.5.5">5.5</a> <a href="#effective.request.uri">Effective Request URI</a></h2> 1967 <p id="rfc.section.5.5.p.1">A server that receives an HTTP request message <em class="bcp14">MUST</em> reconstruct the user agent's original target URI, based on the pieces of information learned from the request-target, Host, 1968 and connection context, in order to identify the intended target resource and properly service the request. The URI derived 1969 from this reconstruction process is referred to as the "effective request URI". 1970 </p> 1971 <p id="rfc.section.5.5.p.2">For a user agent, the effective request URI is the target URI.</p> 1972 <p id="rfc.section.5.5.p.3">If the request-target is in absolute-form, then the effective request URI is the same as the request-target. Otherwise, the 1973 effective request URI is constructed as follows. 1974 </p> 1975 <p id="rfc.section.5.5.p.4">If the request is received over an SSL/TLS-secured TCP connection, then the effective request URI's scheme is "https"; otherwise, 1976 the scheme is "http". 1977 </p> 1978 <p id="rfc.section.5.5.p.5">If the request-target is in authority-form, then the effective request URI's authority component is the same as the request-target. 1979 Otherwise, if a Host header field is supplied with a non-empty field-value, then the authority component is the same as the 1980 Host field-value. Otherwise, the authority component is the concatenation of the default hostname configured for the server, 1981 a colon (":"), and the connection's incoming TCP port number in decimal form. 1982 </p> 1983 <p id="rfc.section.5.5.p.6">If the request-target is in authority-form or asterisk-form, then the effective request URI's combined path and query component 1984 is empty. Otherwise, the combined path and query component is the same as the request-target. 1985 </p> 1986 <p id="rfc.section.5.5.p.7">The components of the effective request URI, once determined as above, can be combined into absolute-URI form by concatenating 1987 the scheme, "://", authority, and combined path and query component. 1988 </p> 1989 <div id="rfc.figure.u.55"></div> 1990 <p>Example 1: the following message received over an insecure TCP connection</p><pre class="text">GET /pub/WWW/TheProject.html HTTP/1.1 1900 1991 Host: www.example.org:8080 1901 </pre> <div id="rfc.figure.u.56"></div>1902 <p>has an effective request URI of</p><pre class="text">http://www.example.org:8080/pub/WWW/TheProject.html1903 </pre> <div id="rfc.figure.u.57"></div>1904 <p>Example 2: the following message received over an SSL/TLS-secured TCP connection</p><pre class="text">OPTIONS * HTTP/1.11992 </pre><div id="rfc.figure.u.56"></div> 1993 <p>has an effective request URI of</p><pre class="text">http://www.example.org:8080/pub/WWW/TheProject.html 1994 </pre><div id="rfc.figure.u.57"></div> 1995 <p>Example 2: the following message received over an SSL/TLS-secured TCP connection</p><pre class="text">OPTIONS * HTTP/1.1 1905 1996 Host: www.example.org 1906 </pre> <div id="rfc.figure.u.58"></div> 1907 <p>has an effective request URI of</p> <pre class="text">https://www.example.org 1908 </pre> <p id="rfc.section.5.5.p.12">An origin server that does not allow resources to differ by requested host <em class="bcp14">MAY</em> ignore the Host field-value and instead replace it with a configured server name when constructing the effective request URI. 1909 </p> 1910 <p id="rfc.section.5.5.p.13">Recipients of an HTTP/1.0 request that lacks a Host header field <em class="bcp14">MAY</em> attempt to use heuristics (e.g., examination of the URI path for something unique to a particular host) in order to guess 1911 the effective request URI's authority component. 1912 </p> 1913 <h2 id="rfc.section.5.6"><a href="#rfc.section.5.6">5.6</a> <a id="intermediary.forwarding" href="#intermediary.forwarding">Intermediary Forwarding</a></h2> 1914 <p id="rfc.section.5.6.p.1">As described in <a href="#intermediaries" title="Intermediaries">Section 2.3</a>, intermediaries can serve a variety of roles in the processing of HTTP requests and responses. Some intermediaries are used 1915 to improve performance or availability. Others are used for access control or to filter content. Since an HTTP stream has 1916 characteristics similar to a pipe-and-filter architecture, there are no inherent limits to the extent an intermediary can 1917 enhance (or interfere) with either direction of the stream. 1918 </p> 1919 <p id="rfc.section.5.6.p.2">In order to avoid request loops, a proxy that forwards requests to other proxies <em class="bcp14">MUST</em> be able to recognize and exclude all of its own server names, including any aliases, local variations, or literal IP addresses. 1920 </p> 1921 <p id="rfc.section.5.6.p.3">If a proxy receives a request-target with a host name that is not a fully qualified domain name, it <em class="bcp14">MAY</em> add its domain to the host name it received when forwarding the request. A proxy <em class="bcp14">MUST NOT</em> change the host name if it is a fully qualified domain name. 1922 </p> 1923 <p id="rfc.section.5.6.p.4">A non-transforming proxy <em class="bcp14">MUST NOT</em> rewrite the "path-absolute" and "query" parts of the received request-target when forwarding it to the next inbound server, 1924 except as noted above to replace an empty path with "/" or "*". 1925 </p> 1926 <p id="rfc.section.5.6.p.5">Intermediaries that forward a message <em class="bcp14">MUST</em> implement the Connection header field as specified in <a href="#header.connection" id="rfc.xref.header.connection.5" title="Connection">Section 6.1</a>. 1927 </p> 1928 <h3 id="rfc.section.5.6.1"><a href="#rfc.section.5.6.1">5.6.1</a> <a id="end-to-end.and.hop-by-hop.header-fields" href="#end-to-end.and.hop-by-hop.header-fields">End-to-end and Hop-by-hop Header Fields</a></h3> 1929 <p id="rfc.section.5.6.1.p.1">For the purpose of defining the behavior of caches and non-caching proxies, we divide HTTP header fields into two categories: </p> 1930 <ul> 1931 <li>End-to-end header fields, which are transmitted to the ultimate recipient of a request or response. End-to-end header fields 1932 in responses <em class="bcp14">MUST</em> be stored as part of a cache entry and <em class="bcp14">MUST</em> be transmitted in any response formed from a cache entry. 1933 </li> 1934 <li>Hop-by-hop header fields, which are meaningful only for a single transport-level connection, and are not stored by caches 1935 or forwarded by proxies. 1936 </li> 1937 </ul> 1938 <p id="rfc.section.5.6.1.p.2">The following HTTP/1.1 header fields are hop-by-hop header fields: </p> 1939 <ul> 1940 <li>Connection</li> 1941 <li>Keep-Alive</li> 1942 <li>Proxy-Authenticate</li> 1943 <li>Proxy-Authorization</li> 1944 <li>TE</li> 1945 <li>Trailer</li> 1946 <li>Transfer-Encoding</li> 1947 <li>Upgrade</li> 1948 </ul> 1949 <p id="rfc.section.5.6.1.p.3">All other header fields defined by HTTP/1.1 are end-to-end header fields.</p> 1950 <p id="rfc.section.5.6.1.p.4">Other hop-by-hop header fields <em class="bcp14">MUST</em> be listed in a Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.6" title="Connection">Section 6.1</a>). 1951 </p> 1952 <h3 id="rfc.section.5.6.2"><a href="#rfc.section.5.6.2">5.6.2</a> <a id="non-modifiable.header-fields" href="#non-modifiable.header-fields">Non-modifiable Header Fields</a></h3> 1953 <p id="rfc.section.5.6.2.p.1">Some features of HTTP/1.1, such as Digest Authentication, depend on the value of certain end-to-end header fields. A non-transforming 1954 proxy <em class="bcp14">SHOULD NOT</em> modify an end-to-end header field unless the definition of that header field requires or specifically allows that. 1955 </p> 1956 <p id="rfc.section.5.6.2.p.2">A non-transforming proxy <em class="bcp14">MUST NOT</em> modify any of the following fields in a request or response, and it <em class="bcp14">MUST NOT</em> add any of these fields if not already present: 1957 </p> 1958 <ul> 1959 <li>Allow</li> 1960 <li>Content-Location</li> 1961 <li>Content-MD5</li> 1962 <li>ETag</li> 1963 <li>Last-Modified</li> 1964 <li>Server</li> 1965 </ul> 1966 <p id="rfc.section.5.6.2.p.3">A non-transforming proxy <em class="bcp14">MUST NOT</em> modify any of the following fields in a response: 1967 </p> 1968 <ul> 1969 <li>Expires</li> 1970 </ul> 1971 <p id="rfc.section.5.6.2.p.4">but it <em class="bcp14">MAY</em> add any of these fields if not already present. If an Expires header field is added, it <em class="bcp14">MUST</em> be given a field-value identical to that of the Date header field in that response. 1972 </p> 1973 <p id="rfc.section.5.6.2.p.5">A proxy <em class="bcp14">MUST NOT</em> modify or add any of the following fields in a message that contains the no-transform cache-control directive, or in any request: 1974 </p> 1975 <ul> 1976 <li>Content-Encoding</li> 1977 <li>Content-Range</li> 1978 <li>Content-Type</li> 1979 </ul> 1980 <p id="rfc.section.5.6.2.p.6">A transforming proxy <em class="bcp14">MAY</em> modify or add these fields to a message that does not include no-transform, but if it does so, it <em class="bcp14">MUST</em> add a Warning 214 (Transformation applied) if one does not already appear in the message (see <a href="p6-cache.html#header.warning" title="Warning">Section 3.6</a> of <a href="#Part6" id="rfc.xref.Part6.6"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>). 1981 </p> 1982 <div class="note" id="rfc.section.5.6.2.p.7"> 1983 <p> <b>Warning:</b> Unnecessary modification of end-to-end header fields might cause authentication failures if stronger authentication mechanisms 1984 are introduced in later versions of HTTP. Such authentication mechanisms <em class="bcp14">MAY</em> rely on the values of header fields not listed here. 1985 </p> 1997 </pre><div id="rfc.figure.u.58"></div> 1998 <p>has an effective request URI of</p><pre class="text">https://www.example.org 1999 </pre><p id="rfc.section.5.5.p.12">An origin server that does not allow resources to differ by requested host <em class="bcp14">MAY</em> ignore the Host field-value and instead replace it with a configured server name when constructing the effective request URI. 2000 </p> 2001 <p id="rfc.section.5.5.p.13">Recipients of an HTTP/1.0 request that lacks a Host header field <em class="bcp14">MAY</em> attempt to use heuristics (e.g., examination of the URI path for something unique to a particular host) in order to guess 2002 the effective request URI's authority component. 2003 </p> 2004 </div> 2005 <div id="intermediary.forwarding"> 2006 <h2 id="rfc.section.5.6"><a href="#rfc.section.5.6">5.6</a> <a href="#intermediary.forwarding">Intermediary Forwarding</a></h2> 2007 <p id="rfc.section.5.6.p.1">As described in <a href="#intermediaries" title="Intermediaries">Section 2.3</a>, intermediaries can serve a variety of roles in the processing of HTTP requests and responses. Some intermediaries are used 2008 to improve performance or availability. Others are used for access control or to filter content. Since an HTTP stream has 2009 characteristics similar to a pipe-and-filter architecture, there are no inherent limits to the extent an intermediary can 2010 enhance (or interfere) with either direction of the stream. 2011 </p> 2012 <p id="rfc.section.5.6.p.2">In order to avoid request loops, a proxy that forwards requests to other proxies <em class="bcp14">MUST</em> be able to recognize and exclude all of its own server names, including any aliases, local variations, or literal IP addresses. 2013 </p> 2014 <p id="rfc.section.5.6.p.3">If a proxy receives a request-target with a host name that is not a fully qualified domain name, it <em class="bcp14">MAY</em> add its domain to the host name it received when forwarding the request. A proxy <em class="bcp14">MUST NOT</em> change the host name if it is a fully qualified domain name. 2015 </p> 2016 <p id="rfc.section.5.6.p.4">A non-transforming proxy <em class="bcp14">MUST NOT</em> rewrite the "path-absolute" and "query" parts of the received request-target when forwarding it to the next inbound server, 2017 except as noted above to replace an empty path with "/" or "*". 2018 </p> 2019 <p id="rfc.section.5.6.p.5">Intermediaries that forward a message <em class="bcp14">MUST</em> implement the Connection header field as specified in <a href="#header.connection" id="rfc.xref.header.connection.5" title="Connection">Section 6.1</a>. 2020 </p> 2021 <div id="end-to-end.and.hop-by-hop.header-fields"> 2022 <h3 id="rfc.section.5.6.1"><a href="#rfc.section.5.6.1">5.6.1</a> <a href="#end-to-end.and.hop-by-hop.header-fields">End-to-end and Hop-by-hop Header Fields</a></h3> 2023 <p id="rfc.section.5.6.1.p.1">For the purpose of defining the behavior of caches and non-caching proxies, we divide HTTP header fields into two categories: </p> 2024 <ul> 2025 <li>End-to-end header fields, which are transmitted to the ultimate recipient of a request or response. End-to-end header fields 2026 in responses <em class="bcp14">MUST</em> be stored as part of a cache entry and <em class="bcp14">MUST</em> be transmitted in any response formed from a cache entry. 2027 </li> 2028 <li>Hop-by-hop header fields, which are meaningful only for a single transport-level connection, and are not stored by caches 2029 or forwarded by proxies. 2030 </li> 2031 </ul> 2032 <p id="rfc.section.5.6.1.p.2">The following HTTP/1.1 header fields are hop-by-hop header fields: </p> 2033 <ul> 2034 <li>Connection</li> 2035 <li>Keep-Alive</li> 2036 <li>Proxy-Authenticate</li> 2037 <li>Proxy-Authorization</li> 2038 <li>TE</li> 2039 <li>Trailer</li> 2040 <li>Transfer-Encoding</li> 2041 <li>Upgrade</li> 2042 </ul> 2043 <p id="rfc.section.5.6.1.p.3">All other header fields defined by HTTP/1.1 are end-to-end header fields.</p> 2044 <p id="rfc.section.5.6.1.p.4">Other hop-by-hop header fields <em class="bcp14">MUST</em> be listed in a Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.6" title="Connection">Section 6.1</a>). 2045 </p> 2046 </div> 2047 <div id="non-modifiable.header-fields"> 2048 <h3 id="rfc.section.5.6.2"><a href="#rfc.section.5.6.2">5.6.2</a> <a href="#non-modifiable.header-fields">Non-modifiable Header Fields</a></h3> 2049 <p id="rfc.section.5.6.2.p.1">Some features of HTTP/1.1, such as Digest Authentication, depend on the value of certain end-to-end header fields. A non-transforming 2050 proxy <em class="bcp14">SHOULD NOT</em> modify an end-to-end header field unless the definition of that header field requires or specifically allows that. 2051 </p> 2052 <p id="rfc.section.5.6.2.p.2">A non-transforming proxy <em class="bcp14">MUST NOT</em> modify any of the following fields in a request or response, and it <em class="bcp14">MUST NOT</em> add any of these fields if not already present: 2053 </p> 2054 <ul> 2055 <li>Allow</li> 2056 <li>Content-Location</li> 2057 <li>Content-MD5</li> 2058 <li>ETag</li> 2059 <li>Last-Modified</li> 2060 <li>Server</li> 2061 </ul> 2062 <p id="rfc.section.5.6.2.p.3">A non-transforming proxy <em class="bcp14">MUST NOT</em> modify any of the following fields in a response: 2063 </p> 2064 <ul> 2065 <li>Expires</li> 2066 </ul> 2067 <p id="rfc.section.5.6.2.p.4">but it <em class="bcp14">MAY</em> add any of these fields if not already present. If an Expires header field is added, it <em class="bcp14">MUST</em> be given a field-value identical to that of the Date header field in that response. 2068 </p> 2069 <p id="rfc.section.5.6.2.p.5">A proxy <em class="bcp14">MUST NOT</em> modify or add any of the following fields in a message that contains the no-transform cache-control directive, or in any request: 2070 </p> 2071 <ul> 2072 <li>Content-Encoding</li> 2073 <li>Content-Range</li> 2074 <li>Content-Type</li> 2075 </ul> 2076 <p id="rfc.section.5.6.2.p.6">A transforming proxy <em class="bcp14">MAY</em> modify or add these fields to a message that does not include no-transform, but if it does so, it <em class="bcp14">MUST</em> add a Warning 214 (Transformation applied) if one does not already appear in the message (see <a href="p6-cache.html#header.warning" title="Warning">Section 3.6</a> of <a href="#Part6" id="rfc.xref.Part6.6"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>). 2077 </p> 2078 <div class="note" id="rfc.section.5.6.2.p.7"> 2079 <p><b>Warning:</b> Unnecessary modification of end-to-end header fields might cause authentication failures if stronger authentication mechanisms 2080 are introduced in later versions of HTTP. Such authentication mechanisms <em class="bcp14">MAY</em> rely on the values of header fields not listed here. 2081 </p> 2082 </div> 2083 <p id="rfc.section.5.6.2.p.8">A non-transforming proxy <em class="bcp14">MUST</em> preserve the message payload (<a href="#Part3" id="rfc.xref.Part3.4"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a>), though it <em class="bcp14">MAY</em> change the message body through application or removal of a transfer-coding (<a href="#transfer.codings" title="Transfer Codings">Section 4</a>). 2084 </p> 2085 </div> 2086 </div> 2087 <div id="associating.response.to.request"> 2088 <h2 id="rfc.section.5.7"><a href="#rfc.section.5.7">5.7</a> <a href="#associating.response.to.request">Associating a Response to a Request</a></h2> 2089 <p id="rfc.section.5.7.p.1">HTTP does not include a request identifier for associating a given request message with its corresponding one or more response 2090 messages. Hence, it relies on the order of response arrival to correspond exactly to the order in which requests are made 2091 on the same connection. More than one response message per request only occurs when one or more informational responses (1xx, 2092 see <a href="p2-semantics.html#status.1xx" title="Informational 1xx">Section 7.1</a> of <a href="#Part2" id="rfc.xref.Part2.11"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) precede a final response to the same request. 2093 </p> 2094 <p id="rfc.section.5.7.p.2">A client that uses persistent connections and sends more than one request per connection <em class="bcp14">MUST</em> maintain a list of outstanding requests in the order sent on that connection and <em class="bcp14">MUST</em> associate each received response message to the highest ordered request that has not yet received a final (non-1xx) response. 2095 </p> 2096 </div> 1986 2097 </div> 1987 <p id="rfc.section.5.6.2.p.8">A non-transforming proxy <em class="bcp14">MUST</em> preserve the message payload (<a href="#Part3" id="rfc.xref.Part3.4"><cite title="HTTP/1.1, part 3: Message Payload and Content Negotiation">[Part3]</cite></a>), though it <em class="bcp14">MAY</em> change the message body through application or removal of a transfer-coding (<a href="#transfer.codings" title="Transfer Codings">Section 4</a>). 1988 </p> 1989 <h2 id="rfc.section.5.7"><a href="#rfc.section.5.7">5.7</a> <a id="associating.response.to.request" href="#associating.response.to.request">Associating a Response to a Request</a></h2> 1990 <p id="rfc.section.5.7.p.1">HTTP does not include a request identifier for associating a given request message with its corresponding one or more response 1991 messages. Hence, it relies on the order of response arrival to correspond exactly to the order in which requests are made 1992 on the same connection. More than one response message per request only occurs when one or more informational responses (1xx, 1993 see <a href="p2-semantics.html#status.1xx" title="Informational 1xx">Section 7.1</a> of <a href="#Part2" id="rfc.xref.Part2.11"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) precede a final response to the same request. 1994 </p> 1995 <p id="rfc.section.5.7.p.2">A client that uses persistent connections and sends more than one request per connection <em class="bcp14">MUST</em> maintain a list of outstanding requests in the order sent on that connection and <em class="bcp14">MUST</em> associate each received response message to the highest ordered request that has not yet received a final (non-1xx) response. 1996 </p> 1997 <h1 id="rfc.section.6"><a href="#rfc.section.6">6.</a> <a id="connection.management" href="#connection.management">Connection Management</a></h1> 1998 <div id="rfc.iref.c.13"></div> 1999 <div id="rfc.iref.h.12"></div> 2000 <h2 id="rfc.section.6.1"><a href="#rfc.section.6.1">6.1</a> <a id="header.connection" href="#header.connection">Connection</a></h2> 2001 <p id="rfc.section.6.1.p.1">The "Connection" header field allows the sender to specify options that are desired only for that particular connection. Such 2002 connection options <em class="bcp14">MUST</em> be removed or replaced before the message can be forwarded downstream by a proxy or gateway. This mechanism also allows the 2003 sender to indicate which HTTP header fields used in the message are only intended for the immediate recipient ("hop-by-hop"), 2004 as opposed to all recipients on the chain ("end-to-end"), enabling the message to be self-descriptive and allowing future 2005 connection-specific extensions to be deployed in HTTP without fear that they will be blindly forwarded by previously deployed 2006 intermediaries. 2007 </p> 2008 <p id="rfc.section.6.1.p.2">The Connection header field's value has the following grammar:</p> 2009 <div id="rfc.figure.u.59"></div><pre class="inline"><span id="rfc.iref.g.85"></span><span id="rfc.iref.g.86"></span> <a href="#header.connection" class="smpl">Connection</a> = 1#<a href="#header.connection" class="smpl">connection-token</a> 2098 <div id="connection.management"> 2099 <h1 id="rfc.section.6"><a href="#rfc.section.6">6.</a> <a href="#connection.management">Connection Management</a></h1> 2100 <div id="header.connection"> 2101 <div id="rfc.iref.c.13"></div> 2102 <div id="rfc.iref.h.12"></div> 2103 <h2 id="rfc.section.6.1"><a href="#rfc.section.6.1">6.1</a> <a href="#header.connection">Connection</a></h2> 2104 <p id="rfc.section.6.1.p.1">The "Connection" header field allows the sender to specify options that are desired only for that particular connection. Such 2105 connection options <em class="bcp14">MUST</em> be removed or replaced before the message can be forwarded downstream by a proxy or gateway. This mechanism also allows the 2106 sender to indicate which HTTP header fields used in the message are only intended for the immediate recipient ("hop-by-hop"), 2107 as opposed to all recipients on the chain ("end-to-end"), enabling the message to be self-descriptive and allowing future 2108 connection-specific extensions to be deployed in HTTP without fear that they will be blindly forwarded by previously deployed 2109 intermediaries. 2110 </p> 2111 <p id="rfc.section.6.1.p.2">The Connection header field's value has the following grammar:</p> 2112 <div id="rfc.figure.u.59"></div><pre class="inline"><span id="rfc.iref.g.85"></span><span id="rfc.iref.g.86"></span> <a href="#header.connection" class="smpl">Connection</a> = 1#<a href="#header.connection" class="smpl">connection-token</a> 2010 2113 <a href="#header.connection" class="smpl">connection-token</a> = <a href="#rule.token.separators" class="smpl">token</a> 2011 2114 </pre><p id="rfc.section.6.1.p.4">A proxy or gateway <em class="bcp14">MUST</em> parse a received Connection header field before a message is forwarded and, for each connection-token in this field, remove 2012 any header field(s) from the message with the same name as the connection-token, and then remove the Connection header field2013 itself or replace it with the sender's own connection options for the forwarded message.2014 </p>2015 <p id="rfc.section.6.1.p.5">A sender <em class="bcp14">MUST NOT</em> include field-names in the Connection header field-value for fields that are defined as expressing constraints for all recipients2016 in the request or response chain, such as the Cache-Control header field (<a href="p6-cache.html#header.cache-control" title="Cache-Control">Section 3.2</a> of <a href="#Part6" id="rfc.xref.Part6.7"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>).2017 </p>2018 <p id="rfc.section.6.1.p.6">The connection options do not have to correspond to a header field present in the message, since a connection-specific header2019 field might not be needed if there are no parameters associated with that connection option. Recipients that trigger certain2020 connection behavior based on the presence of connection options <em class="bcp14">MUST</em> do so based on the presence of the connection-token rather than only the presence of the optional header field. In other words,2021 if the connection option is received as a header field but not indicated within the Connection field-value, then the recipient <em class="bcp14">MUST</em> ignore the connection-specific header field because it has likely been forwarded by an intermediary that is only partially2022 conformant.2023 </p>2024 <p id="rfc.section.6.1.p.7">When defining new connection options, specifications ought to carefully consider existing deployed header fields and ensure2025 that the new connection-token does not share the same name as an unrelated header field that might already be deployed. Defining2026 a new connection-token essentially reserves that potential field-name for carrying additional information related to the connection2027 option, since it would be unwise for senders to use that field-name for anything else.2028 </p>2029 <p id="rfc.section.6.1.p.8">HTTP/1.1 defines the "close" connection option for the sender to signal that the connection will be closed after completion2030 of the response. For example,2031 </p>2032 <div id="rfc.figure.u.60"></div><pre class="text"> Connection: close2115 any header field(s) from the message with the same name as the connection-token, and then remove the Connection header field 2116 itself or replace it with the sender's own connection options for the forwarded message. 2117 </p> 2118 <p id="rfc.section.6.1.p.5">A sender <em class="bcp14">MUST NOT</em> include field-names in the Connection header field-value for fields that are defined as expressing constraints for all recipients 2119 in the request or response chain, such as the Cache-Control header field (<a href="p6-cache.html#header.cache-control" title="Cache-Control">Section 3.2</a> of <a href="#Part6" id="rfc.xref.Part6.7"><cite title="HTTP/1.1, part 6: Caching">[Part6]</cite></a>). 2120 </p> 2121 <p id="rfc.section.6.1.p.6">The connection options do not have to correspond to a header field present in the message, since a connection-specific header 2122 field might not be needed if there are no parameters associated with that connection option. Recipients that trigger certain 2123 connection behavior based on the presence of connection options <em class="bcp14">MUST</em> do so based on the presence of the connection-token rather than only the presence of the optional header field. In other words, 2124 if the connection option is received as a header field but not indicated within the Connection field-value, then the recipient <em class="bcp14">MUST</em> ignore the connection-specific header field because it has likely been forwarded by an intermediary that is only partially 2125 conformant. 2126 </p> 2127 <p id="rfc.section.6.1.p.7">When defining new connection options, specifications ought to carefully consider existing deployed header fields and ensure 2128 that the new connection-token does not share the same name as an unrelated header field that might already be deployed. Defining 2129 a new connection-token essentially reserves that potential field-name for carrying additional information related to the connection 2130 option, since it would be unwise for senders to use that field-name for anything else. 2131 </p> 2132 <p id="rfc.section.6.1.p.8">HTTP/1.1 defines the "close" connection option for the sender to signal that the connection will be closed after completion 2133 of the response. For example, 2134 </p> 2135 <div id="rfc.figure.u.60"></div><pre class="text"> Connection: close 2033 2136 </pre><p id="rfc.section.6.1.p.10">in either the request or the response header fields indicates that the connection <em class="bcp14">SHOULD NOT</em> be considered "persistent" (<a href="#persistent.connections" title="Persistent Connections">Section 6.3</a>) after the current request/response is complete. 2034 </p> 2035 <p id="rfc.section.6.1.p.11">An HTTP/1.1 client that does not support persistent connections <em class="bcp14">MUST</em> include the "close" connection option in every request message. 2036 </p> 2037 <p id="rfc.section.6.1.p.12">An HTTP/1.1 server that does not support persistent connections <em class="bcp14">MUST</em> include the "close" connection option in every response message that does not have a 1xx (Informational) status code. 2038 </p> 2039 <div id="rfc.iref.v.1"></div> 2040 <div id="rfc.iref.h.13"></div> 2041 <h2 id="rfc.section.6.2"><a href="#rfc.section.6.2">6.2</a> <a id="header.via" href="#header.via">Via</a></h2> 2042 <p id="rfc.section.6.2.p.1">The "Via" header field <em class="bcp14">MUST</em> be sent by a proxy or gateway to indicate the intermediate protocols and recipients between the user agent and the server 2043 on requests, and between the origin server and the client on responses. It is analogous to the "Received" field used by email 2044 systems (<a href="http://tools.ietf.org/html/rfc5322#section-3.6.7">Section 3.6.7</a> of <a href="#RFC5322" id="rfc.xref.RFC5322.3"><cite title="Internet Message Format">[RFC5322]</cite></a>) and is intended to be used for tracking message forwards, avoiding request loops, and identifying the protocol capabilities 2045 of all senders along the request/response chain. 2046 </p> 2047 <div id="rfc.figure.u.61"></div><pre class="inline"><span id="rfc.iref.g.87"></span><span id="rfc.iref.g.88"></span><span id="rfc.iref.g.89"></span><span id="rfc.iref.g.90"></span><span id="rfc.iref.g.91"></span><span id="rfc.iref.g.92"></span> <a href="#header.via" class="smpl">Via</a> = 1#( <a href="#header.via" class="smpl">received-protocol</a> <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#header.via" class="smpl">received-by</a> 2137 </p> 2138 <p id="rfc.section.6.1.p.11">An HTTP/1.1 client that does not support persistent connections <em class="bcp14">MUST</em> include the "close" connection option in every request message. 2139 </p> 2140 <p id="rfc.section.6.1.p.12">An HTTP/1.1 server that does not support persistent connections <em class="bcp14">MUST</em> include the "close" connection option in every response message that does not have a 1xx (Informational) status code. 2141 </p> 2142 </div> 2143 <div id="header.via"> 2144 <div id="rfc.iref.v.1"></div> 2145 <div id="rfc.iref.h.13"></div> 2146 <h2 id="rfc.section.6.2"><a href="#rfc.section.6.2">6.2</a> <a href="#header.via">Via</a></h2> 2147 <p id="rfc.section.6.2.p.1">The "Via" header field <em class="bcp14">MUST</em> be sent by a proxy or gateway to indicate the intermediate protocols and recipients between the user agent and the server 2148 on requests, and between the origin server and the client on responses. It is analogous to the "Received" field used by email 2149 systems (<a href="https://tools.ietf.org/html/rfc5322#section-3.6.7">Section 3.6.7</a> of <a href="#RFC5322" id="rfc.xref.RFC5322.3"><cite title="Internet Message Format">[RFC5322]</cite></a>) and is intended to be used for tracking message forwards, avoiding request loops, and identifying the protocol capabilities 2150 of all senders along the request/response chain. 2151 </p> 2152 <div id="rfc.figure.u.61"></div><pre class="inline"><span id="rfc.iref.g.87"></span><span id="rfc.iref.g.88"></span><span id="rfc.iref.g.89"></span><span id="rfc.iref.g.90"></span><span id="rfc.iref.g.91"></span><span id="rfc.iref.g.92"></span> <a href="#header.via" class="smpl">Via</a> = 1#( <a href="#header.via" class="smpl">received-protocol</a> <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#header.via" class="smpl">received-by</a> 2048 2153 [ <a href="#rule.whitespace" class="smpl">RWS</a> <a href="#rule.comment" class="smpl">comment</a> ] ) 2049 2154 <a href="#header.via" class="smpl">received-protocol</a> = [ <a href="#header.upgrade" class="smpl">protocol-name</a> "/" ] <a href="#header.upgrade" class="smpl">protocol-version</a> … … 2051 2156 <a href="#header.via" class="smpl">pseudonym</a> = <a href="#rule.token.separators" class="smpl">token</a> 2052 2157 </pre><p id="rfc.section.6.2.p.3">The received-protocol indicates the protocol version of the message received by the server or client along each segment of 2053 the request/response chain. The received-protocol version is appended to the Via field value when the message is forwarded2054 so that information about the protocol capabilities of upstream applications remains visible to all recipients.2055 </p>2056 <p id="rfc.section.6.2.p.4">The protocol-name is excluded if and only if it would be "HTTP". The received-by field is normally the host and optional port2057 number of a recipient server or client that subsequently forwarded the message. However, if the real host is considered to2058 be sensitive information, it <em class="bcp14">MAY</em> be replaced by a pseudonym. If the port is not given, it <em class="bcp14">MAY</em> be assumed to be the default port of the received-protocol.2059 </p>2060 <p id="rfc.section.6.2.p.5">Multiple Via field values represent each proxy or gateway that has forwarded the message. Each recipient <em class="bcp14">MUST</em> append its information such that the end result is ordered according to the sequence of forwarding applications.2061 </p>2062 <p id="rfc.section.6.2.p.6">Comments <em class="bcp14">MAY</em> be used in the Via header field to identify the software of each recipient, analogous to the User-Agent and Server header2063 fields. However, all comments in the Via field are optional and <em class="bcp14">MAY</em> be removed by any recipient prior to forwarding the message.2064 </p>2065 <p id="rfc.section.6.2.p.7">For example, a request message could be sent from an HTTP/1.0 user agent to an internal proxy code-named "fred", which uses2066 HTTP/1.1 to forward the request to a public proxy at p.example.net, which completes the request by forwarding it to the origin2067 server at www.example.com. The request received by www.example.com would then have the following Via header field:2068 </p>2069 <div id="rfc.figure.u.62"></div><pre class="text"> Via: 1.0 fred, 1.1 p.example.net (Apache/1.1)2158 the request/response chain. The received-protocol version is appended to the Via field value when the message is forwarded 2159 so that information about the protocol capabilities of upstream applications remains visible to all recipients. 2160 </p> 2161 <p id="rfc.section.6.2.p.4">The protocol-name is excluded if and only if it would be "HTTP". The received-by field is normally the host and optional port 2162 number of a recipient server or client that subsequently forwarded the message. However, if the real host is considered to 2163 be sensitive information, it <em class="bcp14">MAY</em> be replaced by a pseudonym. If the port is not given, it <em class="bcp14">MAY</em> be assumed to be the default port of the received-protocol. 2164 </p> 2165 <p id="rfc.section.6.2.p.5">Multiple Via field values represent each proxy or gateway that has forwarded the message. Each recipient <em class="bcp14">MUST</em> append its information such that the end result is ordered according to the sequence of forwarding applications. 2166 </p> 2167 <p id="rfc.section.6.2.p.6">Comments <em class="bcp14">MAY</em> be used in the Via header field to identify the software of each recipient, analogous to the User-Agent and Server header 2168 fields. However, all comments in the Via field are optional and <em class="bcp14">MAY</em> be removed by any recipient prior to forwarding the message. 2169 </p> 2170 <p id="rfc.section.6.2.p.7">For example, a request message could be sent from an HTTP/1.0 user agent to an internal proxy code-named "fred", which uses 2171 HTTP/1.1 to forward the request to a public proxy at p.example.net, which completes the request by forwarding it to the origin 2172 server at www.example.com. The request received by www.example.com would then have the following Via header field: 2173 </p> 2174 <div id="rfc.figure.u.62"></div><pre class="text"> Via: 1.0 fred, 1.1 p.example.net (Apache/1.1) 2070 2175 </pre><p id="rfc.section.6.2.p.9">A proxy or gateway used as a portal through a network firewall <em class="bcp14">SHOULD NOT</em> forward the names and ports of hosts within the firewall region unless it is explicitly enabled to do so. If not enabled, 2071 the received-by host of any host behind the firewall <em class="bcp14">SHOULD</em> be replaced by an appropriate pseudonym for that host.2072 </p>2073 <p id="rfc.section.6.2.p.10">For organizations that have strong privacy requirements for hiding internal structures, a proxy or gateway <em class="bcp14">MAY</em> combine an ordered subsequence of Via header field entries with identical received-protocol values into a single such entry.2074 For example,2075 </p>2076 <div id="rfc.figure.u.63"></div><pre class="text"> Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy2176 the received-by host of any host behind the firewall <em class="bcp14">SHOULD</em> be replaced by an appropriate pseudonym for that host. 2177 </p> 2178 <p id="rfc.section.6.2.p.10">For organizations that have strong privacy requirements for hiding internal structures, a proxy or gateway <em class="bcp14">MAY</em> combine an ordered subsequence of Via header field entries with identical received-protocol values into a single such entry. 2179 For example, 2180 </p> 2181 <div id="rfc.figure.u.63"></div><pre class="text"> Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy 2077 2182 </pre><p id="rfc.section.6.2.p.12">could be collapsed to</p> 2078 <div id="rfc.figure.u.64"></div><pre class="text"> Via: 1.0 ricky, 1.1 mertz, 1.0 lucy2183 <div id="rfc.figure.u.64"></div><pre class="text"> Via: 1.0 ricky, 1.1 mertz, 1.0 lucy 2079 2184 </pre><p id="rfc.section.6.2.p.14">Senders <em class="bcp14">SHOULD NOT</em> combine multiple entries unless they are all under the same organizational control and the hosts have already been replaced 2080 by pseudonyms. Senders <em class="bcp14">MUST NOT</em> combine entries which have different received-protocol values. 2081 </p> 2082 <h2 id="rfc.section.6.3"><a href="#rfc.section.6.3">6.3</a> <a id="persistent.connections" href="#persistent.connections">Persistent Connections</a></h2> 2083 <h3 id="rfc.section.6.3.1"><a href="#rfc.section.6.3.1">6.3.1</a> <a id="persistent.purpose" href="#persistent.purpose">Purpose</a></h3> 2084 <p id="rfc.section.6.3.1.p.1">Prior to persistent connections, a separate TCP connection was established for each request, increasing the load on HTTP servers 2085 and causing congestion on the Internet. The use of inline images and other associated data often requires a client to make 2086 multiple requests of the same server in a short amount of time. Analysis of these performance problems and results from a 2087 prototype implementation are available <a href="#Pad1995" id="rfc.xref.Pad1995.1"><cite title="Improving HTTP Latency">[Pad1995]</cite></a> <a href="#Spe" id="rfc.xref.Spe.1"><cite title="Analysis of HTTP Performance Problems">[Spe]</cite></a>. Implementation experience and measurements of actual HTTP/1.1 implementations show good results <a href="#Nie1997" id="rfc.xref.Nie1997.1"><cite title="Network Performance Effects of HTTP/1.1, CSS1, and PNG">[Nie1997]</cite></a>. Alternatives have also been explored, for example, T/TCP <a href="#Tou1998" id="rfc.xref.Tou1998.1"><cite title="Analysis of HTTP Performance">[Tou1998]</cite></a>. 2088 </p> 2089 <p id="rfc.section.6.3.1.p.2">Persistent HTTP connections have a number of advantages: </p> 2090 <ul> 2091 <li>By opening and closing fewer TCP connections, CPU time is saved in routers and hosts (clients, servers, proxies, gateways, 2092 tunnels, or caches), and memory used for TCP protocol control blocks can be saved in hosts. 2093 </li> 2094 <li>HTTP requests and responses can be pipelined on a connection. Pipelining allows a client to make multiple requests without 2095 waiting for each response, allowing a single TCP connection to be used much more efficiently, with much lower elapsed time. 2096 </li> 2097 <li>Network congestion is reduced by reducing the number of packets caused by TCP opens, and by allowing TCP sufficient time to 2098 determine the congestion state of the network. 2099 </li> 2100 <li>Latency on subsequent requests is reduced since there is no time spent in TCP's connection opening handshake.</li> 2101 <li>HTTP can evolve more gracefully, since errors can be reported without the penalty of closing the TCP connection. Clients using 2102 future versions of HTTP might optimistically try a new feature, but if communicating with an older server, retry with old 2103 semantics after an error is reported. 2104 </li> 2105 </ul> 2106 <p id="rfc.section.6.3.1.p.3">HTTP implementations <em class="bcp14">SHOULD</em> implement persistent connections. 2107 </p> 2108 <h3 id="rfc.section.6.3.2"><a href="#rfc.section.6.3.2">6.3.2</a> <a id="persistent.overall" href="#persistent.overall">Overall Operation</a></h3> 2109 <p id="rfc.section.6.3.2.p.1">A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior 2110 of any HTTP connection. That is, unless otherwise indicated, the client <em class="bcp14">SHOULD</em> assume that the server will maintain a persistent connection, even after error responses from the server. 2111 </p> 2112 <p id="rfc.section.6.3.2.p.2">Persistent connections provide a mechanism by which a client and a server can signal the close of a TCP connection. This signaling 2113 takes place using the Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.7" title="Connection">Section 6.1</a>). Once a close has been signaled, the client <em class="bcp14">MUST NOT</em> send any more requests on that connection. 2114 </p> 2115 <h4 id="rfc.section.6.3.2.1"><a href="#rfc.section.6.3.2.1">6.3.2.1</a> <a id="persistent.negotiation" href="#persistent.negotiation">Negotiation</a></h4> 2116 <p id="rfc.section.6.3.2.1.p.1">An HTTP/1.1 server <em class="bcp14">MAY</em> assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header field including the connection-token 2117 "close" was sent in the request. If the server chooses to close the connection immediately after sending the response, it <em class="bcp14">SHOULD</em> send a Connection header field including the connection-token "close". 2118 </p> 2119 <p id="rfc.section.6.3.2.1.p.2">An HTTP/1.1 client <em class="bcp14">MAY</em> expect a connection to remain open, but would decide to keep it open based on whether the response from a server contains 2120 a Connection header field with the connection-token close. In case the client does not want to maintain a connection for more 2121 than that request, it <em class="bcp14">SHOULD</em> send a Connection header field including the connection-token close. 2122 </p> 2123 <p id="rfc.section.6.3.2.1.p.3">If either the client or the server sends the close token in the Connection header field, that request becomes the last one 2124 for the connection. 2125 </p> 2126 <p id="rfc.section.6.3.2.1.p.4">Clients and servers <em class="bcp14">SHOULD NOT</em> assume that a persistent connection is maintained for HTTP versions less than 1.1 unless it is explicitly signaled. See <a href="#compatibility.with.http.1.0.persistent.connections" title="Keep-Alive Connections">Appendix A.1.2</a> for more information on backward compatibility with HTTP/1.0 clients. 2127 </p> 2128 <p id="rfc.section.6.3.2.1.p.5">Each persistent connection applies to only one transport link.</p> 2129 <p id="rfc.section.6.3.2.1.p.6">A proxy server <em class="bcp14">MUST NOT</em> establish a HTTP/1.1 persistent connection with an HTTP/1.0 client (but see <a href="http://tools.ietf.org/html/rfc2068#section-19.7.1">Section 19.7.1</a> of <a href="#RFC2068" id="rfc.xref.RFC2068.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> for information and discussion of the problems with the Keep-Alive header field implemented by many HTTP/1.0 clients). 2130 </p> 2131 <p id="rfc.section.6.3.2.1.p.7">In order to remain persistent, all messages on the connection <em class="bcp14">MUST</em> have a self-defined message length (i.e., one not defined by closure of the connection), as described in <a href="#message.body" title="Message Body">Section 3.3</a>. 2132 </p> 2133 <h4 id="rfc.section.6.3.2.2"><a href="#rfc.section.6.3.2.2">6.3.2.2</a> <a id="pipelining" href="#pipelining">Pipelining</a></h4> 2134 <p id="rfc.section.6.3.2.2.p.1">A client that supports persistent connections <em class="bcp14">MAY</em> "pipeline" its requests (i.e., send multiple requests without waiting for each response). A server <em class="bcp14">MUST</em> send its responses to those requests in the same order that the requests were received. 2135 </p> 2136 <p id="rfc.section.6.3.2.2.p.2">Clients which assume persistent connections and pipeline immediately after connection establishment <em class="bcp14">SHOULD</em> be prepared to retry their connection if the first pipelined attempt fails. If a client does such a retry, it <em class="bcp14">MUST NOT</em> pipeline before it knows the connection is persistent. Clients <em class="bcp14">MUST</em> also be prepared to resend their requests if the server closes the connection before sending all of the corresponding responses. 2137 </p> 2138 <p id="rfc.section.6.3.2.2.p.3">Clients <em class="bcp14">SHOULD NOT</em> pipeline requests using non-idempotent request methods or non-idempotent sequences of request methods (see <a href="p2-semantics.html#idempotent.methods" title="Idempotent Methods">Section 6.1.2</a> of <a href="#Part2" id="rfc.xref.Part2.12"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). Otherwise, a premature termination of the transport connection could lead to indeterminate results. A client wishing to 2139 send a non-idempotent request <em class="bcp14">SHOULD</em> wait to send that request until it has received the response status line for the previous request. 2140 </p> 2141 <h3 id="rfc.section.6.3.3"><a href="#rfc.section.6.3.3">6.3.3</a> <a id="persistent.practical" href="#persistent.practical">Practical Considerations</a></h3> 2142 <p id="rfc.section.6.3.3.p.1">Servers will usually have some time-out value beyond which they will no longer maintain an inactive connection. Proxy servers 2143 might make this a higher value since it is likely that the client will be making more connections through the same server. 2144 The use of persistent connections places no requirements on the length (or existence) of this time-out for either the client 2145 or the server. 2146 </p> 2147 <p id="rfc.section.6.3.3.p.2">When a client or server wishes to time-out it <em class="bcp14">SHOULD</em> issue a graceful close on the transport connection. Clients and servers <em class="bcp14">SHOULD</em> both constantly watch for the other side of the transport close, and respond to it as appropriate. If a client or server does 2148 not detect the other side's close promptly it could cause unnecessary resource drain on the network. 2149 </p> 2150 <p id="rfc.section.6.3.3.p.3">A client, server, or proxy <em class="bcp14">MAY</em> close the transport connection at any time. For example, a client might have started to send a new request at the same time 2151 that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed 2152 while it was idle, but from the client's point of view, a request is in progress. 2153 </p> 2154 <p id="rfc.section.6.3.3.p.4">Clients (including proxies) <em class="bcp14">SHOULD</em> limit the number of simultaneous connections that they maintain to a given server (including proxies). 2155 </p> 2156 <p id="rfc.section.6.3.3.p.5">Previous revisions of HTTP gave a specific number of connections as a ceiling, but this was found to be impractical for many 2157 applications. As a result, this specification does not mandate a particular maximum number of connections, but instead encourages 2158 clients to be conservative when opening multiple connections. 2159 </p> 2160 <p id="rfc.section.6.3.3.p.6">In particular, while using multiple connections avoids the "head-of-line blocking" problem (whereby a request that takes significant 2161 server-side processing and/or has a large payload can block subsequent requests on the same connection), each connection used 2162 consumes server resources (sometimes significantly), and furthermore using multiple connections can cause undesirable side 2163 effects in congested networks. 2164 </p> 2165 <p id="rfc.section.6.3.3.p.7">Note that servers might reject traffic that they deem abusive, including an excessive number of connections from a client.</p> 2166 <h3 id="rfc.section.6.3.4"><a href="#rfc.section.6.3.4">6.3.4</a> <a id="persistent.retrying.requests" href="#persistent.retrying.requests">Retrying Requests</a></h3> 2167 <p id="rfc.section.6.3.4.p.1">Senders can close the transport connection at any time. Therefore, clients, servers, and proxies <em class="bcp14">MUST</em> be able to recover from asynchronous close events. Client software <em class="bcp14">MAY</em> reopen the transport connection and retransmit the aborted sequence of requests without user interaction so long as the request 2168 sequence is idempotent (see <a href="p2-semantics.html#idempotent.methods" title="Idempotent Methods">Section 6.1.2</a> of <a href="#Part2" id="rfc.xref.Part2.13"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). Non-idempotent request methods or sequences <em class="bcp14">MUST NOT</em> be automatically retried, although user agents <em class="bcp14">MAY</em> offer a human operator the choice of retrying the request(s). Confirmation by user-agent software with semantic understanding 2169 of the application <em class="bcp14">MAY</em> substitute for user confirmation. The automatic retry <em class="bcp14">SHOULD NOT</em> be repeated if the second sequence of requests fails. 2170 </p> 2171 <h2 id="rfc.section.6.4"><a href="#rfc.section.6.4">6.4</a> <a id="message.transmission.requirements" href="#message.transmission.requirements">Message Transmission Requirements</a></h2> 2172 <h3 id="rfc.section.6.4.1"><a href="#rfc.section.6.4.1">6.4.1</a> <a id="persistent.flow" href="#persistent.flow">Persistent Connections and Flow Control</a></h3> 2173 <p id="rfc.section.6.4.1.p.1">HTTP/1.1 servers <em class="bcp14">SHOULD</em> maintain persistent connections and use TCP's flow control mechanisms to resolve temporary overloads, rather than terminating 2174 connections with the expectation that clients will retry. The latter technique can exacerbate network congestion. 2175 </p> 2176 <h3 id="rfc.section.6.4.2"><a href="#rfc.section.6.4.2">6.4.2</a> <a id="persistent.monitor" href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></h3> 2177 <p id="rfc.section.6.4.2.p.1">An HTTP/1.1 (or later) client sending a message body <em class="bcp14">SHOULD</em> monitor the network connection for an error status code while it is transmitting the request. If the client sees an error 2178 status code, it <em class="bcp14">SHOULD</em> immediately cease transmitting the body. If the body is being sent using a "chunked" encoding (<a href="#transfer.codings" title="Transfer Codings">Section 4</a>), a zero length chunk and empty trailer <em class="bcp14">MAY</em> be used to prematurely mark the end of the message. If the body was preceded by a Content-Length header field, the client <em class="bcp14">MUST</em> close the connection. 2179 </p> 2180 <h3 id="rfc.section.6.4.3"><a href="#rfc.section.6.4.3">6.4.3</a> <a id="use.of.the.100.status" href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></h3> 2181 <p id="rfc.section.6.4.3.p.1">The purpose of the 100 (Continue) status code (see <a href="p2-semantics.html#status.100" title="100 Continue">Section 7.1.1</a> of <a href="#Part2" id="rfc.xref.Part2.14"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) is to allow a client that is sending a request message with a request body to determine if the origin server is willing 2182 to accept the request (based on the request header fields) before the client sends the request body. In some cases, it might 2183 either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without 2184 looking at the body. 2185 </p> 2186 <p id="rfc.section.6.4.3.p.2">Requirements for HTTP/1.1 clients: </p> 2187 <ul> 2188 <li>If a client will wait for a 100 (Continue) response before sending the request body, it <em class="bcp14">MUST</em> send an Expect header field (<a href="p2-semantics.html#header.expect" title="Expect">Section 10.3</a> of <a href="#Part2" id="rfc.xref.Part2.15"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) with the "100-continue" expectation. 2189 </li> 2190 <li>A client <em class="bcp14">MUST NOT</em> send an Expect header field (<a href="p2-semantics.html#header.expect" title="Expect">Section 10.3</a> of <a href="#Part2" id="rfc.xref.Part2.16"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) with the "100-continue" expectation if it does not intend to send a request body. 2191 </li> 2192 </ul> 2193 <p id="rfc.section.6.4.3.p.3">Because of the presence of older implementations, the protocol allows ambiguous situations in which a client might send "Expect: 2194 100-continue" without receiving either a 417 (Expectation Failed) or a 100 (Continue) status code. Therefore, when a client 2195 sends this header field to an origin server (possibly via a proxy) from which it has never seen a 100 (Continue) status code, 2196 the client <em class="bcp14">SHOULD NOT</em> wait for an indefinite period before sending the request body. 2197 </p> 2198 <p id="rfc.section.6.4.3.p.4">Requirements for HTTP/1.1 origin servers: </p> 2199 <ul> 2200 <li>Upon receiving a request which includes an Expect header field with the "100-continue" expectation, an origin server <em class="bcp14">MUST</em> either respond with 100 (Continue) status code and continue to read from the input stream, or respond with a final status 2201 code. The origin server <em class="bcp14">MUST NOT</em> wait for the request body before sending the 100 (Continue) response. If it responds with a final status code, it <em class="bcp14">MAY</em> close the transport connection or it <em class="bcp14">MAY</em> continue to read and discard the rest of the request. It <em class="bcp14">MUST NOT</em> perform the request method if it returns a final status code. 2202 </li> 2203 <li>An origin server <em class="bcp14">SHOULD NOT</em> send a 100 (Continue) response if the request message does not include an Expect header field with the "100-continue" expectation, 2204 and <em class="bcp14">MUST NOT</em> send a 100 (Continue) response if such a request comes from an HTTP/1.0 (or earlier) client. There is an exception to this 2205 rule: for compatibility with <a href="#RFC2068" id="rfc.xref.RFC2068.4"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a>, a server <em class="bcp14">MAY</em> send a 100 (Continue) status code in response to an HTTP/1.1 PUT or POST request that does not include an Expect header field 2206 with the "100-continue" expectation. This exception, the purpose of which is to minimize any client processing delays associated 2207 with an undeclared wait for 100 (Continue) status code, applies only to HTTP/1.1 requests, and not to requests with any other 2208 HTTP-version value. 2209 </li> 2210 <li>An origin server <em class="bcp14">MAY</em> omit a 100 (Continue) response if it has already received some or all of the request body for the corresponding request. 2211 </li> 2212 <li>An origin server that sends a 100 (Continue) response <em class="bcp14">MUST</em> ultimately send a final status code, once the request body is received and processed, unless it terminates the transport connection 2213 prematurely. 2214 </li> 2215 <li>If an origin server receives a request that does not include an Expect header field with the "100-continue" expectation, the 2216 request includes a request body, and the server responds with a final status code before reading the entire request body from 2217 the transport connection, then the server <em class="bcp14">SHOULD NOT</em> close the transport connection until it has read the entire request, or until the client closes the connection. Otherwise, 2218 the client might not reliably receive the response message. However, this requirement ought not be construed as preventing 2219 a server from defending itself against denial-of-service attacks, or from badly broken client implementations. 2220 </li> 2221 </ul> 2222 <p id="rfc.section.6.4.3.p.5">Requirements for HTTP/1.1 proxies: </p> 2223 <ul> 2224 <li>If a proxy receives a request that includes an Expect header field with the "100-continue" expectation, and the proxy either 2225 knows that the next-hop server complies with HTTP/1.1 or higher, or does not know the HTTP version of the next-hop server, 2226 it <em class="bcp14">MUST</em> forward the request, including the Expect header field. 2227 </li> 2228 <li>If the proxy knows that the version of the next-hop server is HTTP/1.0 or lower, it <em class="bcp14">MUST NOT</em> forward the request, and it <em class="bcp14">MUST</em> respond with a 417 (Expectation Failed) status code. 2229 </li> 2230 <li>Proxies <em class="bcp14">SHOULD</em> maintain a record of the HTTP version numbers received from recently-referenced next-hop servers. 2231 </li> 2232 <li>A proxy <em class="bcp14">MUST NOT</em> forward a 100 (Continue) response if the request message was received from an HTTP/1.0 (or earlier) client and did not include 2233 an Expect header field with the "100-continue" expectation. This requirement overrides the general rule for forwarding of 2234 1xx responses (see <a href="p2-semantics.html#status.1xx" title="Informational 1xx">Section 7.1</a> of <a href="#Part2" id="rfc.xref.Part2.17"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). 2235 </li> 2236 </ul> 2237 <h3 id="rfc.section.6.4.4"><a href="#rfc.section.6.4.4">6.4.4</a> <a id="closing.connections.on.error" href="#closing.connections.on.error">Closing Connections on Error</a></h3> 2238 <p id="rfc.section.6.4.4.p.1">If the client is sending data, a server implementation using TCP <em class="bcp14">SHOULD</em> be careful to ensure that the client acknowledges receipt of the packet(s) containing the response, before the server closes 2239 the input connection. If the client continues sending data to the server after the close, the server's TCP stack will send 2240 a reset packet to the client, which might erase the client's unacknowledged input buffers before they can be read and interpreted 2241 by the HTTP application. 2242 </p> 2243 <div id="rfc.iref.u.5"></div> 2244 <div id="rfc.iref.h.14"></div> 2245 <h2 id="rfc.section.6.5"><a href="#rfc.section.6.5">6.5</a> <a id="header.upgrade" href="#header.upgrade">Upgrade</a></h2> 2246 <p id="rfc.section.6.5.p.1">The "Upgrade" header field allows the client to specify what additional communication protocols it would like to use, if the 2247 server chooses to switch protocols. Servers can use it to indicate what protocols they are willing to switch to. 2248 </p> 2249 <div id="rfc.figure.u.65"></div><pre class="inline"><span id="rfc.iref.g.93"></span> <a href="#header.upgrade" class="smpl">Upgrade</a> = 1#<a href="#header.upgrade" class="smpl">protocol</a> 2185 by pseudonyms. Senders <em class="bcp14">MUST NOT</em> combine entries which have different received-protocol values. 2186 </p> 2187 </div> 2188 <div id="persistent.connections"> 2189 <h2 id="rfc.section.6.3"><a href="#rfc.section.6.3">6.3</a> <a href="#persistent.connections">Persistent Connections</a></h2> 2190 <div id="persistent.purpose"> 2191 <h3 id="rfc.section.6.3.1"><a href="#rfc.section.6.3.1">6.3.1</a> <a href="#persistent.purpose">Purpose</a></h3> 2192 <p id="rfc.section.6.3.1.p.1">Prior to persistent connections, a separate TCP connection was established for each request, increasing the load on HTTP servers 2193 and causing congestion on the Internet. The use of inline images and other associated data often requires a client to make 2194 multiple requests of the same server in a short amount of time. Analysis of these performance problems and results from a 2195 prototype implementation are available <a href="#Pad1995" id="rfc.xref.Pad1995.1"><cite title="Improving HTTP Latency">[Pad1995]</cite></a> <a href="#Spe" id="rfc.xref.Spe.1"><cite title="Analysis of HTTP Performance Problems">[Spe]</cite></a>. Implementation experience and measurements of actual HTTP/1.1 implementations show good results <a href="#Nie1997" id="rfc.xref.Nie1997.1"><cite title="Network Performance Effects of HTTP/1.1, CSS1, and PNG">[Nie1997]</cite></a>. Alternatives have also been explored, for example, T/TCP <a href="#Tou1998" id="rfc.xref.Tou1998.1"><cite title="Analysis of HTTP Performance">[Tou1998]</cite></a>. 2196 </p> 2197 <p id="rfc.section.6.3.1.p.2">Persistent HTTP connections have a number of advantages: </p> 2198 <ul> 2199 <li>By opening and closing fewer TCP connections, CPU time is saved in routers and hosts (clients, servers, proxies, gateways, 2200 tunnels, or caches), and memory used for TCP protocol control blocks can be saved in hosts. 2201 </li> 2202 <li>HTTP requests and responses can be pipelined on a connection. Pipelining allows a client to make multiple requests without 2203 waiting for each response, allowing a single TCP connection to be used much more efficiently, with much lower elapsed time. 2204 </li> 2205 <li>Network congestion is reduced by reducing the number of packets caused by TCP opens, and by allowing TCP sufficient time to 2206 determine the congestion state of the network. 2207 </li> 2208 <li>Latency on subsequent requests is reduced since there is no time spent in TCP's connection opening handshake.</li> 2209 <li>HTTP can evolve more gracefully, since errors can be reported without the penalty of closing the TCP connection. Clients using 2210 future versions of HTTP might optimistically try a new feature, but if communicating with an older server, retry with old 2211 semantics after an error is reported. 2212 </li> 2213 </ul> 2214 <p id="rfc.section.6.3.1.p.3">HTTP implementations <em class="bcp14">SHOULD</em> implement persistent connections. 2215 </p> 2216 </div> 2217 <div id="persistent.overall"> 2218 <h3 id="rfc.section.6.3.2"><a href="#rfc.section.6.3.2">6.3.2</a> <a href="#persistent.overall">Overall Operation</a></h3> 2219 <p id="rfc.section.6.3.2.p.1">A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior 2220 of any HTTP connection. That is, unless otherwise indicated, the client <em class="bcp14">SHOULD</em> assume that the server will maintain a persistent connection, even after error responses from the server. 2221 </p> 2222 <p id="rfc.section.6.3.2.p.2">Persistent connections provide a mechanism by which a client and a server can signal the close of a TCP connection. This signaling 2223 takes place using the Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.7" title="Connection">Section 6.1</a>). Once a close has been signaled, the client <em class="bcp14">MUST NOT</em> send any more requests on that connection. 2224 </p> 2225 <div id="persistent.negotiation"> 2226 <h4 id="rfc.section.6.3.2.1"><a href="#rfc.section.6.3.2.1">6.3.2.1</a> <a href="#persistent.negotiation">Negotiation</a></h4> 2227 <p id="rfc.section.6.3.2.1.p.1">An HTTP/1.1 server <em class="bcp14">MAY</em> assume that a HTTP/1.1 client intends to maintain a persistent connection unless a Connection header field including the connection-token 2228 "close" was sent in the request. If the server chooses to close the connection immediately after sending the response, it <em class="bcp14">SHOULD</em> send a Connection header field including the connection-token "close". 2229 </p> 2230 <p id="rfc.section.6.3.2.1.p.2">An HTTP/1.1 client <em class="bcp14">MAY</em> expect a connection to remain open, but would decide to keep it open based on whether the response from a server contains 2231 a Connection header field with the connection-token close. In case the client does not want to maintain a connection for more 2232 than that request, it <em class="bcp14">SHOULD</em> send a Connection header field including the connection-token close. 2233 </p> 2234 <p id="rfc.section.6.3.2.1.p.3">If either the client or the server sends the close token in the Connection header field, that request becomes the last one 2235 for the connection. 2236 </p> 2237 <p id="rfc.section.6.3.2.1.p.4">Clients and servers <em class="bcp14">SHOULD NOT</em> assume that a persistent connection is maintained for HTTP versions less than 1.1 unless it is explicitly signaled. See <a href="#compatibility.with.http.1.0.persistent.connections" title="Keep-Alive Connections">Appendix A.1.2</a> for more information on backward compatibility with HTTP/1.0 clients. 2238 </p> 2239 <p id="rfc.section.6.3.2.1.p.5">Each persistent connection applies to only one transport link.</p> 2240 <p id="rfc.section.6.3.2.1.p.6">A proxy server <em class="bcp14">MUST NOT</em> establish a HTTP/1.1 persistent connection with an HTTP/1.0 client (but see <a href="https://tools.ietf.org/html/rfc2068#section-19.7.1">Section 19.7.1</a> of <a href="#RFC2068" id="rfc.xref.RFC2068.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a> for information and discussion of the problems with the Keep-Alive header field implemented by many HTTP/1.0 clients). 2241 </p> 2242 <p id="rfc.section.6.3.2.1.p.7">In order to remain persistent, all messages on the connection <em class="bcp14">MUST</em> have a self-defined message length (i.e., one not defined by closure of the connection), as described in <a href="#message.body" title="Message Body">Section 3.3</a>. 2243 </p> 2244 </div> 2245 <div id="pipelining"> 2246 <h4 id="rfc.section.6.3.2.2"><a href="#rfc.section.6.3.2.2">6.3.2.2</a> <a href="#pipelining">Pipelining</a></h4> 2247 <p id="rfc.section.6.3.2.2.p.1">A client that supports persistent connections <em class="bcp14">MAY</em> "pipeline" its requests (i.e., send multiple requests without waiting for each response). A server <em class="bcp14">MUST</em> send its responses to those requests in the same order that the requests were received. 2248 </p> 2249 <p id="rfc.section.6.3.2.2.p.2">Clients which assume persistent connections and pipeline immediately after connection establishment <em class="bcp14">SHOULD</em> be prepared to retry their connection if the first pipelined attempt fails. If a client does such a retry, it <em class="bcp14">MUST NOT</em> pipeline before it knows the connection is persistent. Clients <em class="bcp14">MUST</em> also be prepared to resend their requests if the server closes the connection before sending all of the corresponding responses. 2250 </p> 2251 <p id="rfc.section.6.3.2.2.p.3">Clients <em class="bcp14">SHOULD NOT</em> pipeline requests using non-idempotent request methods or non-idempotent sequences of request methods (see <a href="p2-semantics.html#idempotent.methods" title="Idempotent Methods">Section 6.1.2</a> of <a href="#Part2" id="rfc.xref.Part2.12"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). Otherwise, a premature termination of the transport connection could lead to indeterminate results. A client wishing to 2252 send a non-idempotent request <em class="bcp14">SHOULD</em> wait to send that request until it has received the response status line for the previous request. 2253 </p> 2254 </div> 2255 </div> 2256 <div id="persistent.practical"> 2257 <h3 id="rfc.section.6.3.3"><a href="#rfc.section.6.3.3">6.3.3</a> <a href="#persistent.practical">Practical Considerations</a></h3> 2258 <p id="rfc.section.6.3.3.p.1">Servers will usually have some time-out value beyond which they will no longer maintain an inactive connection. Proxy servers 2259 might make this a higher value since it is likely that the client will be making more connections through the same server. 2260 The use of persistent connections places no requirements on the length (or existence) of this time-out for either the client 2261 or the server. 2262 </p> 2263 <p id="rfc.section.6.3.3.p.2">When a client or server wishes to time-out it <em class="bcp14">SHOULD</em> issue a graceful close on the transport connection. Clients and servers <em class="bcp14">SHOULD</em> both constantly watch for the other side of the transport close, and respond to it as appropriate. If a client or server does 2264 not detect the other side's close promptly it could cause unnecessary resource drain on the network. 2265 </p> 2266 <p id="rfc.section.6.3.3.p.3">A client, server, or proxy <em class="bcp14">MAY</em> close the transport connection at any time. For example, a client might have started to send a new request at the same time 2267 that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed 2268 while it was idle, but from the client's point of view, a request is in progress. 2269 </p> 2270 <p id="rfc.section.6.3.3.p.4">Clients (including proxies) <em class="bcp14">SHOULD</em> limit the number of simultaneous connections that they maintain to a given server (including proxies). 2271 </p> 2272 <p id="rfc.section.6.3.3.p.5">Previous revisions of HTTP gave a specific number of connections as a ceiling, but this was found to be impractical for many 2273 applications. As a result, this specification does not mandate a particular maximum number of connections, but instead encourages 2274 clients to be conservative when opening multiple connections. 2275 </p> 2276 <p id="rfc.section.6.3.3.p.6">In particular, while using multiple connections avoids the "head-of-line blocking" problem (whereby a request that takes significant 2277 server-side processing and/or has a large payload can block subsequent requests on the same connection), each connection used 2278 consumes server resources (sometimes significantly), and furthermore using multiple connections can cause undesirable side 2279 effects in congested networks. 2280 </p> 2281 <p id="rfc.section.6.3.3.p.7">Note that servers might reject traffic that they deem abusive, including an excessive number of connections from a client.</p> 2282 </div> 2283 <div id="persistent.retrying.requests"> 2284 <h3 id="rfc.section.6.3.4"><a href="#rfc.section.6.3.4">6.3.4</a> <a href="#persistent.retrying.requests">Retrying Requests</a></h3> 2285 <p id="rfc.section.6.3.4.p.1">Senders can close the transport connection at any time. Therefore, clients, servers, and proxies <em class="bcp14">MUST</em> be able to recover from asynchronous close events. Client software <em class="bcp14">MAY</em> reopen the transport connection and retransmit the aborted sequence of requests without user interaction so long as the request 2286 sequence is idempotent (see <a href="p2-semantics.html#idempotent.methods" title="Idempotent Methods">Section 6.1.2</a> of <a href="#Part2" id="rfc.xref.Part2.13"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). Non-idempotent request methods or sequences <em class="bcp14">MUST NOT</em> be automatically retried, although user agents <em class="bcp14">MAY</em> offer a human operator the choice of retrying the request(s). Confirmation by user-agent software with semantic understanding 2287 of the application <em class="bcp14">MAY</em> substitute for user confirmation. The automatic retry <em class="bcp14">SHOULD NOT</em> be repeated if the second sequence of requests fails. 2288 </p> 2289 </div> 2290 </div> 2291 <div id="message.transmission.requirements"> 2292 <h2 id="rfc.section.6.4"><a href="#rfc.section.6.4">6.4</a> <a href="#message.transmission.requirements">Message Transmission Requirements</a></h2> 2293 <div id="persistent.flow"> 2294 <h3 id="rfc.section.6.4.1"><a href="#rfc.section.6.4.1">6.4.1</a> <a href="#persistent.flow">Persistent Connections and Flow Control</a></h3> 2295 <p id="rfc.section.6.4.1.p.1">HTTP/1.1 servers <em class="bcp14">SHOULD</em> maintain persistent connections and use TCP's flow control mechanisms to resolve temporary overloads, rather than terminating 2296 connections with the expectation that clients will retry. The latter technique can exacerbate network congestion. 2297 </p> 2298 </div> 2299 <div id="persistent.monitor"> 2300 <h3 id="rfc.section.6.4.2"><a href="#rfc.section.6.4.2">6.4.2</a> <a href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></h3> 2301 <p id="rfc.section.6.4.2.p.1">An HTTP/1.1 (or later) client sending a message body <em class="bcp14">SHOULD</em> monitor the network connection for an error status code while it is transmitting the request. If the client sees an error 2302 status code, it <em class="bcp14">SHOULD</em> immediately cease transmitting the body. If the body is being sent using a "chunked" encoding (<a href="#transfer.codings" title="Transfer Codings">Section 4</a>), a zero length chunk and empty trailer <em class="bcp14">MAY</em> be used to prematurely mark the end of the message. If the body was preceded by a Content-Length header field, the client <em class="bcp14">MUST</em> close the connection. 2303 </p> 2304 </div> 2305 <div id="use.of.the.100.status"> 2306 <h3 id="rfc.section.6.4.3"><a href="#rfc.section.6.4.3">6.4.3</a> <a href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></h3> 2307 <p id="rfc.section.6.4.3.p.1">The purpose of the 100 (Continue) status code (see <a href="p2-semantics.html#status.100" title="100 Continue">Section 7.1.1</a> of <a href="#Part2" id="rfc.xref.Part2.14"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) is to allow a client that is sending a request message with a request body to determine if the origin server is willing 2308 to accept the request (based on the request header fields) before the client sends the request body. In some cases, it might 2309 either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without 2310 looking at the body. 2311 </p> 2312 <p id="rfc.section.6.4.3.p.2">Requirements for HTTP/1.1 clients: </p> 2313 <ul> 2314 <li>If a client will wait for a 100 (Continue) response before sending the request body, it <em class="bcp14">MUST</em> send an Expect header field (<a href="p2-semantics.html#header.expect" title="Expect">Section 10.3</a> of <a href="#Part2" id="rfc.xref.Part2.15"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) with the "100-continue" expectation. 2315 </li> 2316 <li>A client <em class="bcp14">MUST NOT</em> send an Expect header field (<a href="p2-semantics.html#header.expect" title="Expect">Section 10.3</a> of <a href="#Part2" id="rfc.xref.Part2.16"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>) with the "100-continue" expectation if it does not intend to send a request body. 2317 </li> 2318 </ul> 2319 <p id="rfc.section.6.4.3.p.3">Because of the presence of older implementations, the protocol allows ambiguous situations in which a client might send "Expect: 2320 100-continue" without receiving either a 417 (Expectation Failed) or a 100 (Continue) status code. Therefore, when a client 2321 sends this header field to an origin server (possibly via a proxy) from which it has never seen a 100 (Continue) status code, 2322 the client <em class="bcp14">SHOULD NOT</em> wait for an indefinite period before sending the request body. 2323 </p> 2324 <p id="rfc.section.6.4.3.p.4">Requirements for HTTP/1.1 origin servers: </p> 2325 <ul> 2326 <li>Upon receiving a request which includes an Expect header field with the "100-continue" expectation, an origin server <em class="bcp14">MUST</em> either respond with 100 (Continue) status code and continue to read from the input stream, or respond with a final status 2327 code. The origin server <em class="bcp14">MUST NOT</em> wait for the request body before sending the 100 (Continue) response. If it responds with a final status code, it <em class="bcp14">MAY</em> close the transport connection or it <em class="bcp14">MAY</em> continue to read and discard the rest of the request. It <em class="bcp14">MUST NOT</em> perform the request method if it returns a final status code. 2328 </li> 2329 <li>An origin server <em class="bcp14">SHOULD NOT</em> send a 100 (Continue) response if the request message does not include an Expect header field with the "100-continue" expectation, 2330 and <em class="bcp14">MUST NOT</em> send a 100 (Continue) response if such a request comes from an HTTP/1.0 (or earlier) client. There is an exception to this 2331 rule: for compatibility with <a href="#RFC2068" id="rfc.xref.RFC2068.4"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[RFC2068]</cite></a>, a server <em class="bcp14">MAY</em> send a 100 (Continue) status code in response to an HTTP/1.1 PUT or POST request that does not include an Expect header field 2332 with the "100-continue" expectation. This exception, the purpose of which is to minimize any client processing delays associated 2333 with an undeclared wait for 100 (Continue) status code, applies only to HTTP/1.1 requests, and not to requests with any other 2334 HTTP-version value. 2335 </li> 2336 <li>An origin server <em class="bcp14">MAY</em> omit a 100 (Continue) response if it has already received some or all of the request body for the corresponding request. 2337 </li> 2338 <li>An origin server that sends a 100 (Continue) response <em class="bcp14">MUST</em> ultimately send a final status code, once the request body is received and processed, unless it terminates the transport connection 2339 prematurely. 2340 </li> 2341 <li>If an origin server receives a request that does not include an Expect header field with the "100-continue" expectation, the 2342 request includes a request body, and the server responds with a final status code before reading the entire request body from 2343 the transport connection, then the server <em class="bcp14">SHOULD NOT</em> close the transport connection until it has read the entire request, or until the client closes the connection. Otherwise, 2344 the client might not reliably receive the response message. However, this requirement ought not be construed as preventing 2345 a server from defending itself against denial-of-service attacks, or from badly broken client implementations. 2346 </li> 2347 </ul> 2348 <p id="rfc.section.6.4.3.p.5">Requirements for HTTP/1.1 proxies: </p> 2349 <ul> 2350 <li>If a proxy receives a request that includes an Expect header field with the "100-continue" expectation, and the proxy either 2351 knows that the next-hop server complies with HTTP/1.1 or higher, or does not know the HTTP version of the next-hop server, 2352 it <em class="bcp14">MUST</em> forward the request, including the Expect header field. 2353 </li> 2354 <li>If the proxy knows that the version of the next-hop server is HTTP/1.0 or lower, it <em class="bcp14">MUST NOT</em> forward the request, and it <em class="bcp14">MUST</em> respond with a 417 (Expectation Failed) status code. 2355 </li> 2356 <li>Proxies <em class="bcp14">SHOULD</em> maintain a record of the HTTP version numbers received from recently-referenced next-hop servers. 2357 </li> 2358 <li>A proxy <em class="bcp14">MUST NOT</em> forward a 100 (Continue) response if the request message was received from an HTTP/1.0 (or earlier) client and did not include 2359 an Expect header field with the "100-continue" expectation. This requirement overrides the general rule for forwarding of 2360 1xx responses (see <a href="p2-semantics.html#status.1xx" title="Informational 1xx">Section 7.1</a> of <a href="#Part2" id="rfc.xref.Part2.17"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). 2361 </li> 2362 </ul> 2363 </div> 2364 <div id="closing.connections.on.error"> 2365 <h3 id="rfc.section.6.4.4"><a href="#rfc.section.6.4.4">6.4.4</a> <a href="#closing.connections.on.error">Closing Connections on Error</a></h3> 2366 <p id="rfc.section.6.4.4.p.1">If the client is sending data, a server implementation using TCP <em class="bcp14">SHOULD</em> be careful to ensure that the client acknowledges receipt of the packet(s) containing the response, before the server closes 2367 the input connection. If the client continues sending data to the server after the close, the server's TCP stack will send 2368 a reset packet to the client, which might erase the client's unacknowledged input buffers before they can be read and interpreted 2369 by the HTTP application. 2370 </p> 2371 </div> 2372 </div> 2373 <div id="header.upgrade"> 2374 <div id="rfc.iref.u.5"></div> 2375 <div id="rfc.iref.h.14"></div> 2376 <h2 id="rfc.section.6.5"><a href="#rfc.section.6.5">6.5</a> <a href="#header.upgrade">Upgrade</a></h2> 2377 <p id="rfc.section.6.5.p.1">The "Upgrade" header field allows the client to specify what additional communication protocols it would like to use, if the 2378 server chooses to switch protocols. Servers can use it to indicate what protocols they are willing to switch to. 2379 </p> 2380 <div id="rfc.figure.u.65"></div><pre class="inline"><span id="rfc.iref.g.93"></span> <a href="#header.upgrade" class="smpl">Upgrade</a> = 1#<a href="#header.upgrade" class="smpl">protocol</a> 2250 2381 2251 2382 <a href="#header.upgrade" class="smpl">protocol</a> = <a href="#header.upgrade" class="smpl">protocol-name</a> ["/" <a href="#header.upgrade" class="smpl">protocol-version</a>] … … 2253 2384 <a href="#header.upgrade" class="smpl">protocol-version</a> = <a href="#rule.token.separators" class="smpl">token</a> 2254 2385 </pre><p id="rfc.section.6.5.p.3">For example,</p> 2255 <div id="rfc.figure.u.66"></div><pre class="text"> Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x112386 <div id="rfc.figure.u.66"></div><pre class="text"> Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11 2256 2387 </pre><p id="rfc.section.6.5.p.5">The Upgrade header field is intended to provide a simple mechanism for transitioning from HTTP/1.1 to some other, incompatible 2257 protocol. It does so by allowing the client to advertise its desire to use another protocol, such as a later version of HTTP 2258 with a higher major version number, even though the current request has been made using HTTP/1.1. This eases the difficult 2259 transition between incompatible protocols by allowing the client to initiate a request in the more commonly supported protocol 2260 while indicating to the server that it would like to use a "better" protocol if available (where "better" is determined by 2261 the server, possibly according to the nature of the request method or target resource). 2262 </p> 2263 <p id="rfc.section.6.5.p.6">The Upgrade header field only applies to switching application-layer protocols upon the existing transport-layer connection. 2264 Upgrade cannot be used to insist on a protocol change; its acceptance and use by the server is optional. The capabilities 2265 and nature of the application-layer communication after the protocol change is entirely dependent upon the new protocol chosen, 2266 although the first action after changing the protocol <em class="bcp14">MUST</em> be a response to the initial HTTP request containing the Upgrade header field. 2267 </p> 2268 <p id="rfc.section.6.5.p.7">The Upgrade header field only applies to the immediate connection. Therefore, the upgrade keyword <em class="bcp14">MUST</em> be supplied within a Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.8" title="Connection">Section 6.1</a>) whenever Upgrade is present in an HTTP/1.1 message. 2269 </p> 2270 <p id="rfc.section.6.5.p.8">The Upgrade header field cannot be used to indicate a switch to a protocol on a different connection. For that purpose, it 2271 is more appropriate to use a 3xx redirection response (<a href="p2-semantics.html#status.3xx" title="Redirection 3xx">Section 7.3</a> of <a href="#Part2" id="rfc.xref.Part2.18"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). 2272 </p> 2273 <p id="rfc.section.6.5.p.9">Servers <em class="bcp14">MUST</em> include the "Upgrade" header field in 101 (Switching Protocols) responses to indicate which protocol(s) are being switched 2274 to, and <em class="bcp14">MUST</em> include it in 426 (Upgrade Required) responses to indicate acceptable protocols to upgrade to. Servers <em class="bcp14">MAY</em> include it in any other response to indicate that they are willing to upgrade to one of the specified protocols. 2275 </p> 2276 <p id="rfc.section.6.5.p.10">This specification only defines the protocol name "HTTP" for use by the family of Hypertext Transfer Protocols, as defined 2277 by the HTTP version rules of <a href="#http.version" title="Protocol Versioning">Section 2.6</a> and future updates to this specification. Additional tokens can be registered with IANA using the registration procedure defined 2278 in <a href="#upgrade.token.registry" title="Upgrade Token Registry">Section 7.6</a>. 2279 </p> 2280 <h1 id="rfc.section.7"><a href="#rfc.section.7">7.</a> <a id="IANA.considerations" href="#IANA.considerations">IANA Considerations</a></h1> 2281 <h2 id="rfc.section.7.1"><a href="#rfc.section.7.1">7.1</a> <a id="header.field.registration" href="#header.field.registration">Header Field Registration</a></h2> 2282 <p id="rfc.section.7.1.p.1">HTTP header fields are registered within the Message Header Field Registry <a href="#RFC3864" id="rfc.xref.RFC3864.1"><cite title="Registration Procedures for Message Header Fields">[RFC3864]</cite></a> maintained by IANA at <<a href="http://www.iana.org/assignments/message-headers/message-header-index.html">http://www.iana.org/assignments/message-headers/message-header-index.html</a>>. 2283 </p> 2284 <p id="rfc.section.7.1.p.2">This document defines the following HTTP header fields, so their associated registry entries shall be updated according to 2285 the permanent registrations below: 2286 </p> 2287 <div id="rfc.table.1"> 2288 <div id="iana.header.registration.table"></div> 2289 <table class="tt full left" cellpadding="3" cellspacing="0"> 2290 <thead> 2291 <tr> 2292 <th>Header Field Name</th> 2293 <th>Protocol</th> 2294 <th>Status</th> 2295 <th>Reference</th> 2296 </tr> 2297 </thead> 2298 <tbody> 2299 <tr> 2300 <td class="left">Connection</td> 2301 <td class="left">http</td> 2302 <td class="left">standard</td> 2303 <td class="left"> <a href="#header.connection" id="rfc.xref.header.connection.9" title="Connection">Section 6.1</a> 2304 </td> 2305 </tr> 2306 <tr> 2307 <td class="left">Content-Length</td> 2308 <td class="left">http</td> 2309 <td class="left">standard</td> 2310 <td class="left"> <a href="#header.content-length" id="rfc.xref.header.content-length.2" title="Content-Length">Section 3.3.2</a> 2311 </td> 2312 </tr> 2313 <tr> 2314 <td class="left">Host</td> 2315 <td class="left">http</td> 2316 <td class="left">standard</td> 2317 <td class="left"> <a href="#header.host" id="rfc.xref.header.host.2" title="Host">Section 5.4</a> 2318 </td> 2319 </tr> 2320 <tr> 2321 <td class="left">TE</td> 2322 <td class="left">http</td> 2323 <td class="left">standard</td> 2324 <td class="left"> <a href="#header.te" id="rfc.xref.header.te.4" title="TE">Section 4.3</a> 2325 </td> 2326 </tr> 2327 <tr> 2328 <td class="left">Trailer</td> 2329 <td class="left">http</td> 2330 <td class="left">standard</td> 2331 <td class="left"> <a href="#header.trailer" id="rfc.xref.header.trailer.2" title="Trailer">Section 4.4</a> 2332 </td> 2333 </tr> 2334 <tr> 2335 <td class="left">Transfer-Encoding</td> 2336 <td class="left">http</td> 2337 <td class="left">standard</td> 2338 <td class="left"> <a href="#header.transfer-encoding" id="rfc.xref.header.transfer-encoding.3" title="Transfer-Encoding">Section 3.3.1</a> 2339 </td> 2340 </tr> 2341 <tr> 2342 <td class="left">Upgrade</td> 2343 <td class="left">http</td> 2344 <td class="left">standard</td> 2345 <td class="left"> <a href="#header.upgrade" id="rfc.xref.header.upgrade.1" title="Upgrade">Section 6.5</a> 2346 </td> 2347 </tr> 2348 <tr> 2349 <td class="left">Via</td> 2350 <td class="left">http</td> 2351 <td class="left">standard</td> 2352 <td class="left"> <a href="#header.via" id="rfc.xref.header.via.2" title="Via">Section 6.2</a> 2353 </td> 2354 </tr> 2355 </tbody> 2356 </table> 2388 protocol. It does so by allowing the client to advertise its desire to use another protocol, such as a later version of HTTP 2389 with a higher major version number, even though the current request has been made using HTTP/1.1. This eases the difficult 2390 transition between incompatible protocols by allowing the client to initiate a request in the more commonly supported protocol 2391 while indicating to the server that it would like to use a "better" protocol if available (where "better" is determined by 2392 the server, possibly according to the nature of the request method or target resource). 2393 </p> 2394 <p id="rfc.section.6.5.p.6">The Upgrade header field only applies to switching application-layer protocols upon the existing transport-layer connection. 2395 Upgrade cannot be used to insist on a protocol change; its acceptance and use by the server is optional. The capabilities 2396 and nature of the application-layer communication after the protocol change is entirely dependent upon the new protocol chosen, 2397 although the first action after changing the protocol <em class="bcp14">MUST</em> be a response to the initial HTTP request containing the Upgrade header field. 2398 </p> 2399 <p id="rfc.section.6.5.p.7">The Upgrade header field only applies to the immediate connection. Therefore, the upgrade keyword <em class="bcp14">MUST</em> be supplied within a Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.8" title="Connection">Section 6.1</a>) whenever Upgrade is present in an HTTP/1.1 message. 2400 </p> 2401 <p id="rfc.section.6.5.p.8">The Upgrade header field cannot be used to indicate a switch to a protocol on a different connection. For that purpose, it 2402 is more appropriate to use a 3xx redirection response (<a href="p2-semantics.html#status.3xx" title="Redirection 3xx">Section 7.3</a> of <a href="#Part2" id="rfc.xref.Part2.18"><cite title="HTTP/1.1, part 2: Message Semantics">[Part2]</cite></a>). 2403 </p> 2404 <p id="rfc.section.6.5.p.9">Servers <em class="bcp14">MUST</em> include the "Upgrade" header field in 101 (Switching Protocols) responses to indicate which protocol(s) are being switched 2405 to, and <em class="bcp14">MUST</em> include it in 426 (Upgrade Required) responses to indicate acceptable protocols to upgrade to. Servers <em class="bcp14">MAY</em> include it in any other response to indicate that they are willing to upgrade to one of the specified protocols. 2406 </p> 2407 <p id="rfc.section.6.5.p.10">This specification only defines the protocol name "HTTP" for use by the family of Hypertext Transfer Protocols, as defined 2408 by the HTTP version rules of <a href="#http.version" title="Protocol Versioning">Section 2.6</a> and future updates to this specification. Additional tokens can be registered with IANA using the registration procedure defined 2409 in <a href="#upgrade.token.registry" title="Upgrade Token Registry">Section 7.6</a>. 2410 </p> 2411 </div> 2357 2412 </div> 2358 <p id="rfc.section.7.1.p.3">Furthermore, the header field-name "Close" shall be registered as "reserved", since using that name as an HTTP header field 2359 might conflict with the "close" connection option of the "Connection" header field (<a href="#header.connection" id="rfc.xref.header.connection.10" title="Connection">Section 6.1</a>). 2360 </p> 2361 <div id="rfc.table.u.1"> 2362 <table class="tt full left" cellpadding="3" cellspacing="0"> 2363 <thead> 2364 <tr> 2365 <th>Header Field Name</th> 2366 <th>Protocol</th> 2367 <th>Status</th> 2368 <th>Reference</th> 2369 </tr> 2370 </thead> 2371 <tbody> 2372 <tr> 2373 <td class="left">Close</td> 2374 <td class="left">http</td> 2375 <td class="left">reserved</td> 2376 <td class="left"> <a href="#header.field.registration" title="Header Field Registration">Section 7.1</a> 2377 </td> 2378 </tr> 2379 </tbody> 2380 </table> 2413 <div id="IANA.considerations"> 2414 <h1 id="rfc.section.7"><a href="#rfc.section.7">7.</a> <a href="#IANA.considerations">IANA Considerations</a></h1> 2415 <div id="header.field.registration"> 2416 <h2 id="rfc.section.7.1"><a href="#rfc.section.7.1">7.1</a> <a href="#header.field.registration">Header Field Registration</a></h2> 2417 <p id="rfc.section.7.1.p.1">HTTP header fields are registered within the Message Header Field Registry <a href="#RFC3864" id="rfc.xref.RFC3864.1"><cite title="Registration Procedures for Message Header Fields">[RFC3864]</cite></a> maintained by IANA at <<a href="http://www.iana.org/assignments/message-headers/message-header-index.html">http://www.iana.org/assignments/message-headers/message-header-index.html</a>>. 2418 </p> 2419 <p id="rfc.section.7.1.p.2">This document defines the following HTTP header fields, so their associated registry entries shall be updated according to 2420 the permanent registrations below: 2421 </p> 2422 <div id="rfc.table.1"> 2423 <div id="iana.header.registration.table"></div> 2424 <table class="tt full left" cellpadding="3" cellspacing="0"> 2425 <thead> 2426 <tr> 2427