333 | | </style><link rel="Contents" href="#rfc.toc"> |
334 | | <link rel="Author" href="#rfc.authors"> |
335 | | <link rel="Copyright" href="#rfc.copyright"> |
336 | | <link rel="Index" href="#rfc.index"> |
337 | | <link rel="Chapter" title="1 Introduction" href="#rfc.section.1"> |
338 | | <link rel="Chapter" title="2 Notational Conventions and Generic Grammar" href="#rfc.section.2"> |
339 | | <link rel="Chapter" title="3 Protocol Parameters" href="#rfc.section.3"> |
340 | | <link rel="Chapter" title="4 HTTP Message" href="#rfc.section.4"> |
341 | | <link rel="Chapter" title="5 Request" href="#rfc.section.5"> |
342 | | <link rel="Chapter" title="6 Response" href="#rfc.section.6"> |
343 | | <link rel="Chapter" title="7 Entity" href="#rfc.section.7"> |
344 | | <link rel="Chapter" title="8 Connections" href="#rfc.section.8"> |
345 | | <link rel="Chapter" title="9 Method Definitions" href="#rfc.section.9"> |
346 | | <link rel="Chapter" title="10 Status Code Definitions" href="#rfc.section.10"> |
347 | | <link rel="Chapter" title="11 Access Authentication" href="#rfc.section.11"> |
348 | | <link rel="Chapter" title="12 Content Negotiation" href="#rfc.section.12"> |
349 | | <link rel="Chapter" title="13 Caching in HTTP" href="#rfc.section.13"> |
350 | | <link rel="Chapter" title="14 Header Field Definitions" href="#rfc.section.14"> |
351 | | <link rel="Chapter" title="15 Security Considerations" href="#rfc.section.15"> |
352 | | <link rel="Chapter" title="16 Acknowledgments" href="#rfc.section.16"> |
353 | | <link rel="Chapter" href="#rfc.section.17" title="17 References"> |
354 | | <link rel="Appendix" title="19 Appendices" href="#rfc.section.19"> |
355 | | <link rel="Appendix" title="20 Index" href="#rfc.section.20"> |
356 | | <link rel="Alternate" title="Authorative ASCII version" href="http://www.ietf.org/rfc/rfc2616.txt"> |
357 | | <meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.362, 2008-02-29 17:10:19, XSLT vendor: SAXON 8.9 from Saxonica http://www.saxonica.com/"> |
358 | | <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"> |
359 | | <meta name="DC.Creator" content="Fielding, R."> |
360 | | <meta name="DC.Creator" content="Gettys, J."> |
361 | | <meta name="DC.Creator" content="Mogul, J."> |
362 | | <meta name="DC.Creator" content="Frystyk, H."> |
363 | | <meta name="DC.Creator" content="Masinter, L."> |
364 | | <meta name="DC.Creator" content="Leach, P."> |
365 | | <meta name="DC.Creator" content="Berners-Lee, T."> |
366 | | <meta name="DC.Identifier" content="urn:ietf:rfc:2616"> |
367 | | <meta name="DC.Date.Issued" scheme="ISO8601" content="1999-06"> |
368 | | <meta name="DC.Relation.Replaces" content="urn:ietf:rfc:2068"> |
369 | | <meta name="DC.Description.Abstract" content="The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers . A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068 ."> |
370 | | </head> |
371 | | <body> |
372 | | <table summary="header information" class="header" border="0" cellpadding="1" cellspacing="1"> |
373 | | <tr> |
374 | | <td class="header left">Network Working Group</td> |
375 | | <td class="header right">R. Fielding</td> |
376 | | </tr> |
377 | | <tr> |
378 | | <td class="header left">Request for Comments: 2616</td> |
379 | | <td class="header right">UC Irvine</td> |
380 | | </tr> |
381 | | <tr> |
382 | | <td class="header left">Obsoletes: <a href="http://tools.ietf.org/html/rfc2068">2068</a></td> |
383 | | <td class="header right">J. Gettys</td> |
384 | | </tr> |
385 | | <tr> |
386 | | <td class="header left">Category: Standards Track</td> |
387 | | <td class="header right">Compaq/W3C</td> |
388 | | </tr> |
389 | | <tr> |
390 | | <td class="header left"></td> |
391 | | <td class="header right">J. Mogul</td> |
392 | | </tr> |
393 | | <tr> |
394 | | <td class="header left"></td> |
395 | | <td class="header right">Compaq</td> |
396 | | </tr> |
397 | | <tr> |
398 | | <td class="header left"></td> |
399 | | <td class="header right">H. Frystyk</td> |
400 | | </tr> |
401 | | <tr> |
402 | | <td class="header left"></td> |
403 | | <td class="header right">W3C/MIT</td> |
404 | | </tr> |
405 | | <tr> |
406 | | <td class="header left"></td> |
407 | | <td class="header right">L. Masinter</td> |
408 | | </tr> |
409 | | <tr> |
410 | | <td class="header left"></td> |
411 | | <td class="header right">Xerox</td> |
412 | | </tr> |
413 | | <tr> |
414 | | <td class="header left"></td> |
415 | | <td class="header right">P. Leach</td> |
416 | | </tr> |
417 | | <tr> |
418 | | <td class="header left"></td> |
419 | | <td class="header right">Microsoft</td> |
420 | | </tr> |
421 | | <tr> |
422 | | <td class="header left"></td> |
423 | | <td class="header right">T. Berners-Lee</td> |
424 | | </tr> |
425 | | <tr> |
426 | | <td class="header left"></td> |
427 | | <td class="header right">W3C/MIT</td> |
428 | | </tr> |
429 | | <tr> |
430 | | <td class="header left"></td> |
431 | | <td class="header right">June 1999</td> |
432 | | </tr> |
433 | | </table> |
434 | | <p class="title">Hypertext Transfer Protocol -- HTTP/1.1</p> |
435 | | <h1><a id="rfc.status" href="#rfc.status">Status of this Memo</a></h1> |
436 | | <p>This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions |
437 | | for improvements. Please refer to the current edition of the “Internet Official Protocol Standards” (STD 1) for the standardization |
438 | | state and status of this protocol. Distribution of this memo is unlimited. |
439 | | </p> |
440 | | <h1><a id="rfc.copyrightnotice" href="#rfc.copyrightnotice">Copyright Notice</a></h1> |
441 | | <p>Copyright © The Internet Society (1999). All Rights Reserved.</p> |
442 | | <h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1> |
443 | | <p>The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information |
444 | | systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name |
445 | | servers and distributed object management systems, through extension of its request methods, error codes and headers <a href="#RFC2324" id="rfc.xref.RFC2324.1"><cite title="Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)">[47]</cite></a>. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the |
446 | | data being transferred. |
447 | | </p> |
448 | | <p>HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol |
449 | | referred to as "HTTP/1.1", and is an update to RFC 2068 <a href="#RFC2068" id="rfc.xref.RFC2068.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[33]</cite></a>. |
450 | | </p> |
451 | | <hr class="noprint"> |
452 | | <h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1> |
453 | | <ul class="toc"> |
454 | | <li class="tocline0">1. <a href="#introduction">Introduction</a><ul class="toc"> |
455 | | <li class="tocline1">1.1 <a href="#intro.purpose">Purpose</a></li> |
456 | | <li class="tocline1">1.2 <a href="#intro.requirements">Requirements</a></li> |
457 | | <li class="tocline1">1.3 <a href="#intro.terminology">Terminology</a></li> |
458 | | <li class="tocline1">1.4 <a href="#intro.overall.operation">Overall Operation</a></li> |
459 | | </ul> |
460 | | </li> |
461 | | <li class="tocline0">2. <a href="#notation">Notational Conventions and Generic Grammar</a><ul class="toc"> |
462 | | <li class="tocline1">2.1 <a href="#notation.abnf">Augmented BNF</a></li> |
463 | | <li class="tocline1">2.2 <a href="#basic.rules">Basic Rules</a></li> |
464 | | </ul> |
465 | | </li> |
466 | | <li class="tocline0">3. <a href="#protocol.parameters">Protocol Parameters</a><ul class="toc"> |
467 | | <li class="tocline1">3.1 <a href="#http.version">HTTP Version</a></li> |
468 | | <li class="tocline1">3.2 <a href="#uri">Uniform Resource Identifiers</a><ul class="toc"> |
469 | | <li class="tocline1">3.2.1 <a href="#general.syntax">General Syntax</a></li> |
470 | | <li class="tocline1">3.2.2 <a href="#http.url">http URL</a></li> |
471 | | <li class="tocline1">3.2.3 <a href="#uri.comparison">URI Comparison</a></li> |
472 | | </ul> |
473 | | </li> |
474 | | <li class="tocline1">3.3 <a href="#date.time.formats">Date/Time Formats</a><ul class="toc"> |
475 | | <li class="tocline1">3.3.1 <a href="#full.date">Full Date</a></li> |
476 | | <li class="tocline1">3.3.2 <a href="#delta.seconds">Delta Seconds</a></li> |
477 | | </ul> |
478 | | </li> |
479 | | <li class="tocline1">3.4 <a href="#character.sets">Character Sets</a><ul class="toc"> |
480 | | <li class="tocline1">3.4.1 <a href="#missing.charset">Missing Charset</a></li> |
481 | | </ul> |
482 | | </li> |
483 | | <li class="tocline1">3.5 <a href="#content.codings">Content Codings</a></li> |
484 | | <li class="tocline1">3.6 <a href="#transfer.codings">Transfer Codings</a><ul class="toc"> |
485 | | <li class="tocline1">3.6.1 <a href="#chunked.transfer.encoding">Chunked Transfer Coding</a></li> |
486 | | </ul> |
487 | | </li> |
488 | | <li class="tocline1">3.7 <a href="#media.types">Media Types</a><ul class="toc"> |
489 | | <li class="tocline1">3.7.1 <a href="#canonicalization.and.text.defaults">Canonicalization and Text Defaults</a></li> |
490 | | <li class="tocline1">3.7.2 <a href="#multipart.types">Multipart Types</a></li> |
491 | | </ul> |
492 | | </li> |
493 | | <li class="tocline1">3.8 <a href="#product.tokens">Product Tokens</a></li> |
494 | | <li class="tocline1">3.9 <a href="#quality.values">Quality Values</a></li> |
495 | | <li class="tocline1">3.10 <a href="#language.tags">Language Tags</a></li> |
496 | | <li class="tocline1">3.11 <a href="#entity.tags">Entity Tags</a></li> |
497 | | <li class="tocline1">3.12 <a href="#range.units">Range Units</a></li> |
498 | | </ul> |
499 | | </li> |
500 | | <li class="tocline0">4. <a href="#http.message">HTTP Message</a><ul class="toc"> |
501 | | <li class="tocline1">4.1 <a href="#message.types">Message Types</a></li> |
502 | | <li class="tocline1">4.2 <a href="#message.headers">Message Headers</a></li> |
503 | | <li class="tocline1">4.3 <a href="#message.body">Message Body</a></li> |
504 | | <li class="tocline1">4.4 <a href="#message.length">Message Length</a></li> |
505 | | <li class="tocline1">4.5 <a href="#general.header.fields">General Header Fields</a></li> |
506 | | </ul> |
507 | | </li> |
508 | | <li class="tocline0">5. <a href="#request">Request</a><ul class="toc"> |
509 | | <li class="tocline1">5.1 <a href="#request-line">Request-Line</a><ul class="toc"> |
510 | | <li class="tocline1">5.1.1 <a href="#method">Method</a></li> |
511 | | <li class="tocline1">5.1.2 <a href="#request-uri">Request-URI</a></li> |
512 | | </ul> |
513 | | </li> |
514 | | <li class="tocline1">5.2 <a href="#the.resource.identified.by.a.request">The Resource Identified by a Request</a></li> |
515 | | <li class="tocline1">5.3 <a href="#request.header.fields">Request Header Fields</a></li> |
516 | | </ul> |
517 | | </li> |
518 | | <li class="tocline0">6. <a href="#response">Response</a><ul class="toc"> |
519 | | <li class="tocline1">6.1 <a href="#status-line">Status-Line</a><ul class="toc"> |
520 | | <li class="tocline1">6.1.1 <a href="#status.code.and.reason.phrase">Status Code and Reason Phrase</a></li> |
521 | | </ul> |
522 | | </li> |
523 | | <li class="tocline1">6.2 <a href="#response.header.fields">Response Header Fields</a></li> |
524 | | </ul> |
525 | | </li> |
526 | | <li class="tocline0">7. <a href="#entity">Entity</a><ul class="toc"> |
527 | | <li class="tocline1">7.1 <a href="#entity.header.fields">Entity Header Fields</a></li> |
528 | | <li class="tocline1">7.2 <a href="#entity.body">Entity Body</a><ul class="toc"> |
529 | | <li class="tocline1">7.2.1 <a href="#type">Type</a></li> |
530 | | <li class="tocline1">7.2.2 <a href="#entity.length">Entity Length</a></li> |
531 | | </ul> |
532 | | </li> |
533 | | </ul> |
534 | | </li> |
535 | | <li class="tocline0">8. <a href="#connections">Connections</a><ul class="toc"> |
536 | | <li class="tocline1">8.1 <a href="#persistent.connections">Persistent Connections</a><ul class="toc"> |
537 | | <li class="tocline1">8.1.1 <a href="#persistent.purpose">Purpose</a></li> |
538 | | <li class="tocline1">8.1.2 <a href="#persistent.overall">Overall Operation</a><ul class="toc"> |
539 | | <li class="tocline1">8.1.2.1 <a href="#persistent.negotiation">Negotiation</a></li> |
540 | | <li class="tocline1">8.1.2.2 <a href="#pipelining">Pipelining</a></li> |
541 | | </ul> |
542 | | </li> |
543 | | <li class="tocline1">8.1.3 <a href="#persistent.proxy">Proxy Servers</a></li> |
544 | | <li class="tocline1">8.1.4 <a href="#persistent.practical">Practical Considerations</a></li> |
545 | | </ul> |
546 | | </li> |
547 | | <li class="tocline1">8.2 <a href="#message.transmission.requirements">Message Transmission Requirements</a><ul class="toc"> |
548 | | <li class="tocline1">8.2.1 <a href="#persistent.flow">Persistent Connections and Flow Control</a></li> |
549 | | <li class="tocline1">8.2.2 <a href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></li> |
550 | | <li class="tocline1">8.2.3 <a href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></li> |
551 | | <li class="tocline1">8.2.4 <a href="#connection.premature">Client Behavior if Server Prematurely Closes Connection</a></li> |
552 | | </ul> |
553 | | </li> |
554 | | </ul> |
555 | | </li> |
556 | | <li class="tocline0">9. <a href="#method.definitions">Method Definitions</a><ul class="toc"> |
557 | | <li class="tocline1">9.1 <a href="#safe.and.idempotent">Safe and Idempotent Methods</a><ul class="toc"> |
558 | | <li class="tocline1">9.1.1 <a href="#safe.methods">Safe Methods</a></li> |
559 | | <li class="tocline1">9.1.2 <a href="#idempotent.methods">Idempotent Methods</a></li> |
560 | | </ul> |
561 | | </li> |
562 | | <li class="tocline1">9.2 <a href="#OPTIONS">OPTIONS</a></li> |
563 | | <li class="tocline1">9.3 <a href="#GET">GET</a></li> |
564 | | <li class="tocline1">9.4 <a href="#HEAD">HEAD</a></li> |
565 | | <li class="tocline1">9.5 <a href="#POST">POST</a></li> |
566 | | <li class="tocline1">9.6 <a href="#PUT">PUT</a></li> |
567 | | <li class="tocline1">9.7 <a href="#DELETE">DELETE</a></li> |
568 | | <li class="tocline1">9.8 <a href="#TRACE">TRACE</a></li> |
569 | | <li class="tocline1">9.9 <a href="#CONNECT">CONNECT</a></li> |
570 | | </ul> |
571 | | </li> |
572 | | <li class="tocline0">10. <a href="#status.codes">Status Code Definitions</a><ul class="toc"> |
573 | | <li class="tocline1">10.1 <a href="#status.1xx">Informational 1xx</a><ul class="toc"> |
574 | | <li class="tocline1">10.1.1 <a href="#status.100">100 Continue</a></li> |
575 | | <li class="tocline1">10.1.2 <a href="#status.101">101 Switching Protocols</a></li> |
576 | | </ul> |
577 | | </li> |
578 | | <li class="tocline1">10.2 <a href="#status.2xx">Successful 2xx</a><ul class="toc"> |
579 | | <li class="tocline1">10.2.1 <a href="#status.200">200 OK</a></li> |
580 | | <li class="tocline1">10.2.2 <a href="#status.201">201 Created</a></li> |
581 | | <li class="tocline1">10.2.3 <a href="#status.202">202 Accepted</a></li> |
582 | | <li class="tocline1">10.2.4 <a href="#status.203">203 Non-Authoritative Information</a></li> |
583 | | <li class="tocline1">10.2.5 <a href="#status.204">204 No Content</a></li> |
584 | | <li class="tocline1">10.2.6 <a href="#status.205">205 Reset Content</a></li> |
585 | | <li class="tocline1">10.2.7 <a href="#status.206">206 Partial Content</a></li> |
586 | | </ul> |
587 | | </li> |
588 | | <li class="tocline1">10.3 <a href="#status.3xx">Redirection 3xx</a><ul class="toc"> |
589 | | <li class="tocline1">10.3.1 <a href="#status.300">300 Multiple Choices</a></li> |
590 | | <li class="tocline1">10.3.2 <a href="#status.301">301 Moved Permanently</a></li> |
591 | | <li class="tocline1">10.3.3 <a href="#status.302">302 Found</a></li> |
592 | | <li class="tocline1">10.3.4 <a href="#status.303">303 See Other</a></li> |
593 | | <li class="tocline1">10.3.5 <a href="#status.304">304 Not Modified</a></li> |
594 | | <li class="tocline1">10.3.6 <a href="#status.305">305 Use Proxy</a></li> |
595 | | <li class="tocline1">10.3.7 <a href="#status.306">306 (Unused)</a></li> |
596 | | <li class="tocline1">10.3.8 <a href="#status.307">307 Temporary Redirect</a></li> |
597 | | </ul> |
598 | | </li> |
599 | | <li class="tocline1">10.4 <a href="#status.4xx">Client Error 4xx</a><ul class="toc"> |
600 | | <li class="tocline1">10.4.1 <a href="#status.400">400 Bad Request</a></li> |
601 | | <li class="tocline1">10.4.2 <a href="#status.401">401 Unauthorized</a></li> |
602 | | <li class="tocline1">10.4.3 <a href="#status.402">402 Payment Required</a></li> |
603 | | <li class="tocline1">10.4.4 <a href="#status.403">403 Forbidden</a></li> |
604 | | <li class="tocline1">10.4.5 <a href="#status.404">404 Not Found</a></li> |
605 | | <li class="tocline1">10.4.6 <a href="#status.405">405 Method Not Allowed</a></li> |
606 | | <li class="tocline1">10.4.7 <a href="#status.406">406 Not Acceptable</a></li> |
607 | | <li class="tocline1">10.4.8 <a href="#status.407">407 Proxy Authentication Required</a></li> |
608 | | <li class="tocline1">10.4.9 <a href="#status.408">408 Request Timeout</a></li> |
609 | | <li class="tocline1">10.4.10 <a href="#status.409">409 Conflict</a></li> |
610 | | <li class="tocline1">10.4.11 <a href="#status.410">410 Gone</a></li> |
611 | | <li class="tocline1">10.4.12 <a href="#status.411">411 Length Required</a></li> |
612 | | <li class="tocline1">10.4.13 <a href="#status.412">412 Precondition Failed</a></li> |
613 | | <li class="tocline1">10.4.14 <a href="#status.413">413 Request Entity Too Large</a></li> |
614 | | <li class="tocline1">10.4.15 <a href="#status.414">414 Request-URI Too Long</a></li> |
615 | | <li class="tocline1">10.4.16 <a href="#status.415">415 Unsupported Media Type</a></li> |
616 | | <li class="tocline1">10.4.17 <a href="#status.416">416 Requested Range Not Satisfiable</a></li> |
617 | | <li class="tocline1">10.4.18 <a href="#status.417">417 Expectation Failed</a></li> |
618 | | </ul> |
619 | | </li> |
620 | | <li class="tocline1">10.5 <a href="#status.5xx">Server Error 5xx</a><ul class="toc"> |
621 | | <li class="tocline1">10.5.1 <a href="#status.500">500 Internal Server Error</a></li> |
622 | | <li class="tocline1">10.5.2 <a href="#status.501">501 Not Implemented</a></li> |
623 | | <li class="tocline1">10.5.3 <a href="#status.502">502 Bad Gateway</a></li> |
624 | | <li class="tocline1">10.5.4 <a href="#status.503">503 Service Unavailable</a></li> |
625 | | <li class="tocline1">10.5.5 <a href="#status.504">504 Gateway Timeout</a></li> |
626 | | <li class="tocline1">10.5.6 <a href="#status.505">505 HTTP Version Not Supported</a></li> |
627 | | </ul> |
628 | | </li> |
629 | | </ul> |
630 | | </li> |
631 | | <li class="tocline0">11. <a href="#access.authentication">Access Authentication</a></li> |
632 | | <li class="tocline0">12. <a href="#content.negotiation">Content Negotiation</a><ul class="toc"> |
633 | | <li class="tocline1">12.1 <a href="#server-driven.negotiation">Server-driven Negotiation</a></li> |
634 | | <li class="tocline1">12.2 <a href="#agent-driven.negotiation">Agent-driven Negotiation</a></li> |
635 | | <li class="tocline1">12.3 <a href="#transparent.negotiation">Transparent Negotiation</a></li> |
636 | | </ul> |
637 | | </li> |
638 | | <li class="tocline0">13. <a href="#caching">Caching in HTTP</a><ul class="toc"> |
639 | | <li class="tocline1">13.1 <a href="#rfc.section.13.1"></a><ul class="toc"> |
640 | | <li class="tocline1">13.1.1 <a href="#cache.correctness">Cache Correctness</a></li> |
641 | | <li class="tocline1">13.1.2 <a href="#warnings">Warnings</a></li> |
642 | | <li class="tocline1">13.1.3 <a href="#cache-control.mechanisms">Cache-control Mechanisms</a></li> |
643 | | <li class="tocline1">13.1.4 <a href="#explicit.ua.warnings">Explicit User Agent Warnings</a></li> |
644 | | <li class="tocline1">13.1.5 <a href="#exceptions.to.the.rules.and.warnings">Exceptions to the Rules and Warnings</a></li> |
645 | | <li class="tocline1">13.1.6 <a href="#client-controlled.behavior">Client-controlled Behavior</a></li> |
646 | | </ul> |
647 | | </li> |
648 | | <li class="tocline1">13.2 <a href="#expiration.model">Expiration Model</a><ul class="toc"> |
649 | | <li class="tocline1">13.2.1 <a href="#server-specified.expiration">Server-Specified Expiration</a></li> |
650 | | <li class="tocline1">13.2.2 <a href="#heuristic.expiration">Heuristic Expiration</a></li> |
651 | | <li class="tocline1">13.2.3 <a href="#age.calculations">Age Calculations</a></li> |
652 | | <li class="tocline1">13.2.4 <a href="#expiration.calculations">Expiration Calculations</a></li> |
653 | | <li class="tocline1">13.2.5 <a href="#disambiguating.expiration.values">Disambiguating Expiration Values</a></li> |
654 | | <li class="tocline1">13.2.6 <a href="#disambiguating.multiple.responses">Disambiguating Multiple Responses</a></li> |
655 | | </ul> |
656 | | </li> |
657 | | <li class="tocline1">13.3 <a href="#validation.model">Validation Model</a><ul class="toc"> |
658 | | <li class="tocline1">13.3.1 <a href="#last-modified.dates">Last-Modified Dates</a></li> |
659 | | <li class="tocline1">13.3.2 <a href="#entity.tag.cache.validators">Entity Tag Cache Validators</a></li> |
660 | | <li class="tocline1">13.3.3 <a href="#weak.and.strong.validators">Weak and Strong Validators</a></li> |
661 | | <li class="tocline1">13.3.4 <a href="#rules.for.when.to.use.entity.tags.and.last-modified.dates">Rules for When to Use Entity Tags and Last-Modified Dates</a></li> |
662 | | <li class="tocline1">13.3.5 <a href="#non-validating.conditionals">Non-validating Conditionals</a></li> |
663 | | </ul> |
664 | | </li> |
665 | | <li class="tocline1">13.4 <a href="#response.cacheability">Response Cacheability</a></li> |
666 | | <li class="tocline1">13.5 <a href="#constructing.responses.from.caches">Constructing Responses From Caches</a><ul class="toc"> |
667 | | <li class="tocline1">13.5.1 <a href="#end-to-end.and.hop-by-hop.headers">End-to-end and Hop-by-hop Headers</a></li> |
668 | | <li class="tocline1">13.5.2 <a href="#non-modifiable.headers">Non-modifiable Headers</a></li> |
669 | | <li class="tocline1">13.5.3 <a href="#combining.headers">Combining Headers</a></li> |
670 | | <li class="tocline1">13.5.4 <a href="#combining.byte.ranges">Combining Byte Ranges</a></li> |
671 | | </ul> |
672 | | </li> |
673 | | <li class="tocline1">13.6 <a href="#caching.negotiated.responses">Caching Negotiated Responses</a></li> |
674 | | <li class="tocline1">13.7 <a href="#shared.and.non-shared.caches">Shared and Non-Shared Caches</a></li> |
675 | | <li class="tocline1">13.8 <a href="#errors.or.incomplete.response.cache.behavior">Errors or Incomplete Response Cache Behavior</a></li> |
676 | | <li class="tocline1">13.9 <a href="#side.effects.of.get.and.head">Side Effects of GET and HEAD</a></li> |
677 | | <li class="tocline1">13.10 <a href="#invalidation.after.updates.or.deletions">Invalidation After Updates or Deletions</a></li> |
678 | | <li class="tocline1">13.11 <a href="#write-through.mandatory">Write-Through Mandatory</a></li> |
679 | | <li class="tocline1">13.12 <a href="#cache.replacement">Cache Replacement</a></li> |
680 | | <li class="tocline1">13.13 <a href="#history.lists">History Lists</a></li> |
681 | | </ul> |
682 | | </li> |
683 | | <li class="tocline0">14. <a href="#header.fields">Header Field Definitions</a><ul class="toc"> |
684 | | <li class="tocline1">14.1 <a href="#header.accept">Accept</a></li> |
685 | | <li class="tocline1">14.2 <a href="#header.accept-charset">Accept-Charset</a></li> |
686 | | <li class="tocline1">14.3 <a href="#header.accept-encoding">Accept-Encoding</a></li> |
687 | | <li class="tocline1">14.4 <a href="#header.accept-language">Accept-Language</a></li> |
688 | | <li class="tocline1">14.5 <a href="#header.accept-ranges">Accept-Ranges</a></li> |
689 | | <li class="tocline1">14.6 <a href="#header.age">Age</a></li> |
690 | | <li class="tocline1">14.7 <a href="#header.allow">Allow</a></li> |
691 | | <li class="tocline1">14.8 <a href="#header.authorization">Authorization</a></li> |
692 | | <li class="tocline1">14.9 <a href="#header.cache-control">Cache-Control</a><ul class="toc"> |
693 | | <li class="tocline1">14.9.1 <a href="#what.is.cacheable">What is Cacheable</a></li> |
694 | | <li class="tocline1">14.9.2 <a href="#what.may.be.stored.by.caches">What May be Stored by Caches</a></li> |
695 | | <li class="tocline1">14.9.3 <a href="#modifications.of.the.basic.expiration.mechanism">Modifications of the Basic Expiration Mechanism</a></li> |
696 | | <li class="tocline1">14.9.4 <a href="#cache.revalidation.and.reload.controls">Cache Revalidation and Reload Controls</a></li> |
697 | | <li class="tocline1">14.9.5 <a href="#no-transform.directive">No-Transform Directive</a></li> |
698 | | <li class="tocline1">14.9.6 <a href="#cache.control.extensions">Cache Control Extensions</a></li> |
699 | | </ul> |
700 | | </li> |
701 | | <li class="tocline1">14.10 <a href="#header.connection">Connection</a></li> |
702 | | <li class="tocline1">14.11 <a href="#header.content-encoding">Content-Encoding</a></li> |
703 | | <li class="tocline1">14.12 <a href="#header.content-language">Content-Language</a></li> |
704 | | <li class="tocline1">14.13 <a href="#header.content-length">Content-Length</a></li> |
705 | | <li class="tocline1">14.14 <a href="#header.content-location">Content-Location</a></li> |
706 | | <li class="tocline1">14.15 <a href="#header.content-md5">Content-MD5</a></li> |
707 | | <li class="tocline1">14.16 <a href="#header.content-range">Content-Range</a></li> |
708 | | <li class="tocline1">14.17 <a href="#header.content-type">Content-Type</a></li> |
709 | | <li class="tocline1">14.18 <a href="#header.date">Date</a><ul class="toc"> |
710 | | <li class="tocline1">14.18.1 <a href="#clockless.origin.server.operation">Clockless Origin Server Operation</a></li> |
711 | | </ul> |
712 | | </li> |
713 | | <li class="tocline1">14.19 <a href="#header.etag">ETag</a></li> |
714 | | <li class="tocline1">14.20 <a href="#header.expect">Expect</a></li> |
715 | | <li class="tocline1">14.21 <a href="#header.expires">Expires</a></li> |
716 | | <li class="tocline1">14.22 <a href="#header.from">From</a></li> |
717 | | <li class="tocline1">14.23 <a href="#header.host">Host</a></li> |
718 | | <li class="tocline1">14.24 <a href="#header.if-match">If-Match</a></li> |
719 | | <li class="tocline1">14.25 <a href="#header.if-modified-since">If-Modified-Since</a></li> |
720 | | <li class="tocline1">14.26 <a href="#header.if-none-match">If-None-Match</a></li> |
721 | | <li class="tocline1">14.27 <a href="#header.if-range">If-Range</a></li> |
722 | | <li class="tocline1">14.28 <a href="#header.if-unmodified-since">If-Unmodified-Since</a></li> |
723 | | <li class="tocline1">14.29 <a href="#header.last-modified">Last-Modified</a></li> |
724 | | <li class="tocline1">14.30 <a href="#header.location">Location</a></li> |
725 | | <li class="tocline1">14.31 <a href="#header.max-forwards">Max-Forwards</a></li> |
726 | | <li class="tocline1">14.32 <a href="#header.pragma">Pragma</a></li> |
727 | | <li class="tocline1">14.33 <a href="#header.proxy-authenticate">Proxy-Authenticate</a></li> |
728 | | <li class="tocline1">14.34 <a href="#header.proxy-authorization">Proxy-Authorization</a></li> |
729 | | <li class="tocline1">14.35 <a href="#header.range">Range</a><ul class="toc"> |
730 | | <li class="tocline1">14.35.1 <a href="#byte.ranges">Byte Ranges</a></li> |
731 | | <li class="tocline1">14.35.2 <a href="#range.retrieval.requests">Range Retrieval Requests</a></li> |
732 | | </ul> |
733 | | </li> |
734 | | <li class="tocline1">14.36 <a href="#header.referer">Referer</a></li> |
735 | | <li class="tocline1">14.37 <a href="#header.retry-after">Retry-After</a></li> |
736 | | <li class="tocline1">14.38 <a href="#header.server">Server</a></li> |
737 | | <li class="tocline1">14.39 <a href="#header.te">TE</a></li> |
738 | | <li class="tocline1">14.40 <a href="#header.trailer">Trailer</a></li> |
739 | | <li class="tocline1">14.41 <a href="#header.transfer-encoding">Transfer-Encoding</a></li> |
740 | | <li class="tocline1">14.42 <a href="#header.upgrade">Upgrade</a></li> |
741 | | <li class="tocline1">14.43 <a href="#header.user-agent">User-Agent</a></li> |
742 | | <li class="tocline1">14.44 <a href="#header.vary">Vary</a></li> |
743 | | <li class="tocline1">14.45 <a href="#header.via">Via</a></li> |
744 | | <li class="tocline1">14.46 <a href="#header.warning">Warning</a></li> |
745 | | <li class="tocline1">14.47 <a href="#header.www-authenticate">WWW-Authenticate</a></li> |
746 | | </ul> |
747 | | </li> |
748 | | <li class="tocline0">15. <a href="#security.considerations">Security Considerations</a><ul class="toc"> |
749 | | <li class="tocline1">15.1 <a href="#personal.information">Personal Information</a><ul class="toc"> |
750 | | <li class="tocline1">15.1.1 <a href="#abuse.of.server.log.information">Abuse of Server Log Information</a></li> |
751 | | <li class="tocline1">15.1.2 <a href="#security.sensitive">Transfer of Sensitive Information</a></li> |
752 | | <li class="tocline1">15.1.3 <a href="#encoding.sensitive.information.in.uris">Encoding Sensitive Information in URI's</a></li> |
753 | | <li class="tocline1">15.1.4 <a href="#privacy.issues.connected.to.accept.headers">Privacy Issues Connected to Accept Headers</a></li> |
754 | | </ul> |
755 | | </li> |
756 | | <li class="tocline1">15.2 <a href="#attack.pathname">Attacks Based On File and Path Names</a></li> |
757 | | <li class="tocline1">15.3 <a href="#dns.spoofing">DNS Spoofing</a></li> |
758 | | <li class="tocline1">15.4 <a href="#location.spoofing">Location Headers and Spoofing</a></li> |
759 | | <li class="tocline1">15.5 <a href="#content-disposition.issues">Content-Disposition Issues</a></li> |
760 | | <li class="tocline1">15.6 <a href="#auth.credentials.and.idle.clients">Authentication Credentials and Idle Clients</a></li> |
761 | | <li class="tocline1">15.7 <a href="#attack.proxies">Proxies and Caching</a><ul class="toc"> |
762 | | <li class="tocline1">15.7.1 <a href="#attack.DoS">Denial of Service Attacks on Proxies</a></li> |
763 | | </ul> |
764 | | </li> |
765 | | </ul> |
766 | | </li> |
767 | | <li class="tocline0">16. <a href="#ack">Acknowledgments</a></li> |
768 | | <li class="tocline0">17. <a href="#rfc.references">References</a></li> |
769 | | <li class="tocline0">18. <a href="#rfc.authors">Authors' Addresses</a></li> |
770 | | <li class="tocline0">19. <a href="#rfc.section.19">Appendices</a><ul class="toc"> |
771 | | <li class="tocline1">19.1 <a href="#internet.media.type.http">Internet Media Type message/http and application/http</a></li> |
772 | | <li class="tocline1">19.2 <a href="#internet.media.type.multipart.byteranges">Internet Media Type multipart/byteranges</a></li> |
773 | | <li class="tocline1">19.3 <a href="#tolerant.applications">Tolerant Applications</a></li> |
774 | | <li class="tocline1">19.4 <a href="#differences.between.http.entities.and.rfc.2045.entities">Differences Between HTTP Entities and RFC 2045 Entities</a><ul class="toc"> |
775 | | <li class="tocline1">19.4.1 <a href="#mime-version">MIME-Version</a></li> |
776 | | <li class="tocline1">19.4.2 <a href="#conversion.to.canonical.form">Conversion to Canonical Form</a></li> |
777 | | <li class="tocline1">19.4.3 <a href="#conversion.of.date.formats">Conversion of Date Formats</a></li> |
778 | | <li class="tocline1">19.4.4 <a href="#introduction.of.content-encoding">Introduction of Content-Encoding</a></li> |
779 | | <li class="tocline1">19.4.5 <a href="#no.content-transfer-encoding">No Content-Transfer-Encoding</a></li> |
780 | | <li class="tocline1">19.4.6 <a href="#introduction.of.transfer-encoding">Introduction of Transfer-Encoding</a></li> |
781 | | <li class="tocline1">19.4.7 <a href="#mhtml.line.length">MHTML and Line Length Limitations</a></li> |
782 | | </ul> |
783 | | </li> |
784 | | <li class="tocline1">19.5 <a href="#additional.features">Additional Features</a><ul class="toc"> |
785 | | <li class="tocline1">19.5.1 <a href="#content-disposition">Content-Disposition</a></li> |
786 | | </ul> |
787 | | </li> |
788 | | <li class="tocline1">19.6 <a href="#compatibility">Compatibility with Previous Versions</a><ul class="toc"> |
789 | | <li class="tocline1">19.6.1 <a href="#changes.from.1.0">Changes from HTTP/1.0</a><ul class="toc"> |
790 | | <li class="tocline1">19.6.1.1 <a href="#changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses">Changes to Simplify Multi-homed Web Servers and Conserve IP Addresses</a></li> |
791 | | </ul> |
792 | | </li> |
793 | | <li class="tocline1">19.6.2 <a href="#compatibility.with.http.1.0.persistent.connections">Compatibility with HTTP/1.0 Persistent Connections</a></li> |
794 | | <li class="tocline1">19.6.3 <a href="#changes.from.rfc.2068">Changes from RFC 2068</a></li> |
795 | | </ul> |
796 | | </li> |
797 | | </ul> |
798 | | </li> |
799 | | <li class="tocline0">20. <a href="#rfc.section.20">Index</a></li> |
800 | | <li class="tocline0"><a href="#rfc.ipr">Intellectual Property and Copyright Statements</a></li> |
801 | | <li class="tocline0"><a href="#rfc.index">Index</a></li> |
802 | | </ul> |
803 | | <h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a> <a id="introduction" href="#introduction">Introduction</a></h1> |
804 | | <h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a> <a id="intro.purpose" href="#intro.purpose">Purpose</a></h2> |
805 | | <p id="rfc.section.1.1.p.1">The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information |
806 | | systems. HTTP has been in use by the World-Wide Web global information initiative since 1990. The first version of HTTP, referred |
807 | | to as HTTP/0.9, was a simple protocol for raw data transfer across the Internet. HTTP/1.0, as defined by RFC 1945 <a href="#RFC1945" id="rfc.xref.RFC1945.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[6]</cite></a>, improved the protocol by allowing messages to be in the format of MIME-like messages, containing metainformation about the |
808 | | data transferred and modifiers on the request/response semantics. However, HTTP/1.0 does not sufficiently take into consideration |
809 | | the effects of hierarchical proxies, caching, the need for persistent connections, or virtual hosts. In addition, the proliferation |
810 | | of incompletely-implemented applications calling themselves "HTTP/1.0" has necessitated a protocol version change in order |
811 | | for two communicating applications to determine each other's true capabilities. |
812 | | </p> |
813 | | <p id="rfc.section.1.1.p.2">This specification defines the protocol referred to as "HTTP/1.1". This protocol includes more stringent requirements than |
814 | | HTTP/1.0 in order to ensure reliable implementation of its features. |
815 | | </p> |
816 | | <p id="rfc.section.1.1.p.3">Practical information systems require more functionality than simple retrieval, including search, front-end update, and annotation. |
817 | | HTTP allows an open-ended set of methods and headers that indicate the purpose of a request <a href="#RFC2324" id="rfc.xref.RFC2324.2"><cite title="Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)">[47]</cite></a>. It builds on the discipline of reference provided by the Uniform Resource Identifier (URI) <a href="#RFC1630" id="rfc.xref.RFC1630.1"><cite title="Universal Resource Identifiers in WWW: A Unifying Syntax for the Expression of Names and Addresses of Objects on the Network as used in the World-Wide Web">[3]</cite></a>, as a location (URL) <a href="#RFC1738" id="rfc.xref.RFC1738.1"><cite title="Uniform Resource Locators (URL)">[4]</cite></a> or name (URN) <a href="#RFC1737" id="rfc.xref.RFC1737.1"><cite title="Functional Requirements for Uniform Resource Names">[20]</cite></a>, for indicating the resource to which a method is to be applied. Messages are passed in a format similar to that used by |
818 | | Internet mail <a href="#RFC822" id="rfc.xref.RFC822.1"><cite title="Standard for the format of ARPA Internet text messages">[9]</cite></a> as defined by 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">[7]</cite></a>. |
819 | | </p> |
820 | | <p id="rfc.section.1.1.p.4">HTTP is also used as a generic protocol for communication between user agents and proxies/gateways to other Internet systems, |
821 | | including those supported by the SMTP <a href="#RFC821" id="rfc.xref.RFC821.1"><cite title="Simple Mail Transfer Protocol">[16]</cite></a>, NNTP <a href="#RFC977" id="rfc.xref.RFC977.1"><cite title="Network News Transfer Protocol">[13]</cite></a>, FTP <a href="#RFC959" id="rfc.xref.RFC959.1"><cite title="File Transfer Protocol">[18]</cite></a>, Gopher <a href="#RFC1436" id="rfc.xref.RFC1436.1"><cite title="The Internet Gopher Protocol (a distributed document search and retrieval protocol)">[2]</cite></a>, and WAIS <a href="#WAIS" id="rfc.xref.WAIS.1"><cite title="WAIS Interface Protocol Prototype Functional Specification (v1.5)">[10]</cite></a> protocols. In this way, HTTP allows basic hypermedia access to resources available from diverse applications. |
822 | | </p> |
823 | | <h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a> <a id="intro.requirements" href="#intro.requirements">Requirements</a></h2> |
824 | | <p id="rfc.section.1.2.p.1">The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" |
825 | | in this document are to be interpreted as described in RFC 2119 <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[34]</cite></a>. |
826 | | </p> |
827 | | <p id="rfc.section.1.2.p.2">An implementation is not compliant if it fails to satisfy one or more of the <em class="bcp14">MUST</em> or <em class="bcp14">REQUIRED</em> level requirements for the protocols it implements. An implementation that satisfies all the <em class="bcp14">MUST</em> or <em class="bcp14">REQUIRED</em> level and all the <em class="bcp14">SHOULD</em> level requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the <em class="bcp14">MUST</em> level requirements but not all the <em class="bcp14">SHOULD</em> level requirements for its protocols is said to be "conditionally compliant." |
828 | | </p> |
829 | | <h2 id="rfc.section.1.3"><a href="#rfc.section.1.3">1.3</a> <a id="intro.terminology" href="#intro.terminology">Terminology</a></h2> |
830 | | <p id="rfc.section.1.3.p.1">This specification uses a number of terms to refer to the roles played by participants in, and objects of, the HTTP communication.</p> |
831 | | <p id="rfc.section.1.3.p.2"> <span id="rfc.iref.c.1"></span> <dfn>connection</dfn> |
832 | | </p> |
833 | | <dl class="empty"> |
834 | | <dd>A transport layer virtual circuit established between two programs for the purpose of communication.</dd> |
835 | | </dl> |
836 | | <p id="rfc.section.1.3.p.3"> <span id="rfc.iref.m.1"></span> <dfn>message</dfn> |
837 | | </p> |
838 | | <dl class="empty"> |
839 | | <dd>The basic unit of HTTP communication, consisting of a structured sequence of octets matching the syntax defined in <a href="#http.message" title="HTTP Message">Section 4</a> and transmitted via the connection. |
840 | | </dd> |
841 | | </dl> |
842 | | <p id="rfc.section.1.3.p.4"> <span id="rfc.iref.r.1"></span> <dfn>request</dfn> |
843 | | </p> |
844 | | <dl class="empty"> |
845 | | <dd>An HTTP request message, as defined in <a href="#request" title="Request">Section 5</a>. |
846 | | </dd> |
847 | | </dl> |
848 | | <p id="rfc.section.1.3.p.5"> <span id="rfc.iref.r.2"></span> <dfn>response</dfn> |
849 | | </p> |
850 | | <dl class="empty"> |
851 | | <dd>An HTTP response message, as defined in <a href="#response" title="Response">Section 6</a>. |
852 | | </dd> |
853 | | </dl> |
854 | | <p id="rfc.section.1.3.p.6"> <span id="rfc.iref.r.3"></span> <dfn>resource</dfn> |
855 | | </p> |
856 | | <dl class="empty"> |
857 | | <dd>A network data object or service that can be identified by a URI, as defined in <a href="#uri" title="Uniform Resource Identifiers">Section 3.2</a>. Resources may be available in multiple representations (e.g. multiple languages, data formats, size, and resolutions) or |
858 | | vary in other ways. |
859 | | </dd> |
860 | | </dl> |
861 | | <p id="rfc.section.1.3.p.7"> <span id="rfc.iref.e.1"></span> <dfn>entity</dfn> |
862 | | </p> |
863 | | <dl class="empty"> |
864 | | <dd>The information transferred as the payload of a request or response. An entity consists of metainformation in the form of |
865 | | entity-header fields and content in the form of an entity-body, as described in <a href="#entity" title="Entity">Section 7</a>. |
866 | | </dd> |
867 | | </dl> |
868 | | <p id="rfc.section.1.3.p.8"> <span id="rfc.iref.r.4"></span> <dfn>representation</dfn> |
869 | | </p> |
870 | | <dl class="empty"> |
871 | | <dd>An entity included with a response that is subject to content negotiation, as described in <a href="#content.negotiation" title="Content Negotiation">Section 12</a>. There may exist multiple representations associated with a particular response status. |
872 | | </dd> |
873 | | </dl> |
874 | | <p id="rfc.section.1.3.p.9"> <span id="rfc.iref.c.2"></span> <dfn>content negotiation</dfn> |
875 | | </p> |
876 | | <dl class="empty"> |
877 | | <dd>The mechanism for selecting the appropriate representation when servicing a request, as described in <a href="#content.negotiation" title="Content Negotiation">Section 12</a>. The representation of entities in any response can be negotiated (including error responses). |
878 | | </dd> |
879 | | </dl> |
880 | | <p id="rfc.section.1.3.p.10"> <span id="rfc.iref.v.1"></span> <dfn>variant</dfn> |
881 | | </p> |
882 | | <dl class="empty"> |
883 | | <dd>A resource may have one, or more than one, representation(s) associated with it at any given instant. Each of these representations |
884 | | is termed a `varriant'. Use of the term `variant' does not necessarily imply that the resource is subject to content negotiation. |
885 | | </dd> |
886 | | </dl> |
887 | | <p id="rfc.section.1.3.p.11"> <span id="rfc.iref.c.3"></span> <dfn>client</dfn> |
888 | | </p> |
889 | | <dl class="empty"> |
890 | | <dd>A program that establishes connections for the purpose of sending requests.</dd> |
891 | | </dl> |
892 | | <p id="rfc.section.1.3.p.12"> <span id="rfc.iref.u.1"></span> <dfn>user agent</dfn> |
893 | | </p> |
894 | | <dl class="empty"> |
895 | | <dd>The client which initiates a request. These are often browsers, editors, spiders (web-traversing robots), or other end user |
896 | | tools. |
897 | | </dd> |
898 | | </dl> |
899 | | <p id="rfc.section.1.3.p.13"> <span id="rfc.iref.s.1"></span> <dfn>server</dfn> |
900 | | </p> |
901 | | <dl class="empty"> |
902 | | <dd>An application program that accepts connections in order to service requests by sending back responses. Any given program |
903 | | may be capable of being both a client and a server; our use of these terms refers only to the role being performed by the |
904 | | program for a particular connection, rather than to the program's capabilities in general. Likewise, any server may act as |
905 | | an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request. |
906 | | </dd> |
907 | | </dl> |
908 | | <p id="rfc.section.1.3.p.14"> <span id="rfc.iref.o.1"></span> <dfn>origin server</dfn> |
909 | | </p> |
910 | | <dl class="empty"> |
911 | | <dd>The server on which a given resource resides or is to be created.</dd> |
912 | | </dl> |
913 | | <p id="rfc.section.1.3.p.15"> <span id="rfc.iref.p.1"></span> <dfn>proxy</dfn> |
914 | | </p> |
915 | | <dl class="empty"> |
916 | | <dd>An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients. |
917 | | Requests are serviced internally or by passing them on, with possible translation, to other servers. A proxy <em class="bcp14">MUST</em> implement both the client and server requirements of this specification. A "transparent proxy" is a proxy that does not modify |
918 | | the request or response beyond what is required for proxy authentication and identification. A "non-transparent proxy" is |
919 | | a proxy that modifies the request or response in order to provide some added service to the user agent, such as group annotation |
920 | | services, media type transformation, protocol reduction, or anonymity filtering. Except where either transparent or non-transparent |
921 | | behavior is explicitly stated, the HTTP proxy requirements apply to both types of proxies. |
922 | | </dd> |
923 | | </dl> |
924 | | <p id="rfc.section.1.3.p.16"> <span id="rfc.iref.g.1"></span> <dfn>gateway</dfn> |
925 | | </p> |
926 | | <dl class="empty"> |
927 | | <dd>A server which acts as an intermediary for some other server. Unlike a proxy, a gateway receives requests as if it were the |
928 | | origin server for the requested resource; the requesting client may not be aware that it is communicating with a gateway. |
929 | | </dd> |
930 | | </dl> |
931 | | <p id="rfc.section.1.3.p.17"> <span id="rfc.iref.t.1"></span> <dfn>tunnel</dfn> |
932 | | </p> |
933 | | <dl class="empty"> |
934 | | <dd>An intermediary program which is acting as a blind relay between two connections. Once active, a tunnel is not considered |
935 | | a party to the HTTP communication, though the tunnel may have been initiated by an HTTP request. The tunnel ceases to exist |
936 | | when both ends of the relayed connections are closed. |
937 | | </dd> |
938 | | </dl> |
939 | | <p id="rfc.section.1.3.p.18"> <span id="rfc.iref.c.4"></span> <dfn>cache</dfn> |
940 | | </p> |
941 | | <dl class="empty"> |
942 | | <dd>A program's local store of 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 may include a cache, though a cache cannot be used by a server that is acting as a tunnel. |
945 | | </dd> |
946 | | </dl> |
947 | | <p id="rfc.section.1.3.p.19"> <span id="rfc.iref.c.5"></span> <dfn>cacheable</dfn> |
948 | | </p> |
949 | | <dl class="empty"> |
950 | | <dd>A response is cacheable if a cache is allowed to store a copy of the response message for use in answering subsequent requests. |
951 | | The rules for determining the cacheability of HTTP responses are defined in <a href="#caching" title="Caching in HTTP">Section 13</a>. Even if a resource is cacheable, there may be additional constraints on whether a cache can use the cached copy for a particular |
952 | | request. |
953 | | </dd> |
954 | | </dl> |
955 | | <p id="rfc.section.1.3.p.20"> <span id="rfc.iref.f.1"></span> <dfn>first-hand</dfn> |
956 | | </p> |
957 | | <dl class="empty"> |
958 | | <dd>A response is first-hand if it comes directly and without unnecessary delay from the origin server, perhaps via one or more |
959 | | proxies. A response is also first-hand if its validity has just been checked directly with the origin server. |
960 | | </dd> |
961 | | </dl> |
962 | | <p id="rfc.section.1.3.p.21"> <span id="rfc.iref.e.2"></span> <dfn>explicit expiration time</dfn> |
963 | | </p> |
964 | | <dl class="empty"> |
965 | | <dd>The time at which the origin server intends that an entity should no longer be returned by a cache without further validation.</dd> |
966 | | </dl> |
967 | | <p id="rfc.section.1.3.p.22"> <span id="rfc.iref.h.1"></span> <dfn>heuristic expiration time</dfn> |
968 | | </p> |
969 | | <dl class="empty"> |
970 | | <dd>An expiration time assigned by a cache when no explicit expiration time is available.</dd> |
971 | | </dl> |
972 | | <p id="rfc.section.1.3.p.23"> <span id="rfc.iref.a.1"></span> <dfn>age</dfn> |
973 | | </p> |
974 | | <dl class="empty"> |
975 | | <dd>The age of a response is the time since it was sent by, or successfully validated with, the origin server.</dd> |
976 | | </dl> |
977 | | <p id="rfc.section.1.3.p.24"> <span id="rfc.iref.f.2"></span> <dfn>freshness lifetime</dfn> |
978 | | </p> |
979 | | <dl class="empty"> |
980 | | <dd>The length of time between the generation of a response and its expiration time.</dd> |
981 | | </dl> |
982 | | <p id="rfc.section.1.3.p.25"> <span id="rfc.iref.f.3"></span> <dfn>fresh</dfn> |
983 | | </p> |
984 | | <dl class="empty"> |
985 | | <dd>A response is fresh if its age has not yet exceeded its freshness lifetime.</dd> |
986 | | </dl> |
987 | | <p id="rfc.section.1.3.p.26"> <span id="rfc.iref.s.2"></span> <dfn>stale</dfn> |
988 | | </p> |
989 | | <dl class="empty"> |
990 | | <dd>A response is stale if its age has passed its freshness lifetime.</dd> |
991 | | </dl> |
992 | | <p id="rfc.section.1.3.p.27"> <span id="rfc.iref.s.3"></span> <dfn>semantically transparent</dfn> |
993 | | </p> |
994 | | <dl class="empty"> |
995 | | <dd>A cache behaves in a "semantically transparent" manner, with respect to a particular response, when its use affects neither |
996 | | the requesting client nor the origin server, except to improve performance. When a cache is semantically transparent, the |
997 | | client receives exactly the same response (except for hop-by-hop headers) that it would have received had its request been |
998 | | handled directly by the origin server. |
999 | | </dd> |
1000 | | </dl> |
1001 | | <p id="rfc.section.1.3.p.28"> <span id="rfc.iref.v.2"></span> <dfn>validator</dfn> |
1002 | | </p> |
1003 | | <dl class="empty"> |
1004 | | <dd>A protocol element (e.g., an entity tag or a Last-Modified time) that is used to find out whether a cache entry is an equivalent |
1005 | | copy of an entity. |
1006 | | </dd> |
1007 | | </dl> |
1008 | | <p id="rfc.section.1.3.p.29"> <span id="rfc.iref.u.2"></span> <span id="rfc.iref.d.1"></span> <dfn>upstream</dfn>/<dfn>downstream</dfn> |
1009 | | </p> |
1010 | | <dl class="empty"> |
1011 | | <dd>Upstream and downstream describe the flow of a message: all messages flow from upstream to downstream.</dd> |
1012 | | </dl> |
1013 | | <p id="rfc.section.1.3.p.30"> <span id="rfc.iref.i.1"></span> <span id="rfc.iref.o.2"></span> <dfn>inbound</dfn>/<dfn>outbound</dfn> |
1014 | | </p> |
1015 | | <dl class="empty"> |
1016 | | <dd>Inbound and outbound refer to the request and response paths for messages: "inbound" means "traveling toward the origin server", |
1017 | | and "outbound" means "traveling toward the user agent" |
1018 | | </dd> |
1019 | | </dl> |
1020 | | <h2 id="rfc.section.1.4"><a href="#rfc.section.1.4">1.4</a> <a id="intro.overall.operation" href="#intro.overall.operation">Overall Operation</a></h2> |
1021 | | <p id="rfc.section.1.4.p.1">The HTTP protocol is a request/response protocol. A client sends a request to the server in the form of a request method, |
1022 | | URI, and protocol version, followed by a MIME-like message containing request modifiers, client information, and possible |
1023 | | body content over a connection with a server. The server responds with a status line, including the message's protocol version |
1024 | | and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible |
1025 | | entity-body content. The relationship between HTTP and MIME is described in <a href="#differences.between.http.entities.and.rfc.2045.entities" title="Differences Between HTTP Entities and RFC 2045 Entities">Appendix 19.4</a>. |
1026 | | </p> |
1027 | | <p id="rfc.section.1.4.p.2">Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some origin |
1028 | | server. In the simplest case, this may be accomplished via a single connection (v) between the user agent (UA) and the origin |
1029 | | server (O). |
1030 | | </p> |
1031 | | <div id="rfc.figure.u.1"></div><pre class="drawing"> request chain ------------------------> |
| 333 | </style><link rel="Contents" href="#rfc.toc"><link rel="Author" href="#rfc.authors"><link rel="Copyright" href="#rfc.copyright"><link rel="Index" href="#rfc.index"><link rel="Chapter" title="1 Introduction" href="#rfc.section.1"><link rel="Chapter" title="2 Notational Conventions and Generic Grammar" href="#rfc.section.2"><link rel="Chapter" title="3 Protocol Parameters" href="#rfc.section.3"><link rel="Chapter" title="4 HTTP Message" href="#rfc.section.4"><link rel="Chapter" title="5 Request" href="#rfc.section.5"><link rel="Chapter" title="6 Response" href="#rfc.section.6"><link rel="Chapter" title="7 Entity" href="#rfc.section.7"><link rel="Chapter" title="8 Connections" href="#rfc.section.8"><link rel="Chapter" title="9 Method Definitions" href="#rfc.section.9"><link rel="Chapter" title="10 Status Code Definitions" href="#rfc.section.10"><link rel="Chapter" title="11 Access Authentication" href="#rfc.section.11"><link rel="Chapter" title="12 Content Negotiation" href="#rfc.section.12"><link rel="Chapter" title="13 Caching in HTTP" href="#rfc.section.13"><link rel="Chapter" title="14 Header Field Definitions" href="#rfc.section.14"><link rel="Chapter" title="15 Security Considerations" href="#rfc.section.15"><link rel="Chapter" title="16 Acknowledgments" href="#rfc.section.16"><link rel="Chapter" href="#rfc.section.17" title="17 References"><link rel="Appendix" title="19 Appendices" href="#rfc.section.19"><link rel="Appendix" title="20 Index" href="#rfc.section.20"><link rel="Alternate" title="Authorative ASCII version" href="http://www.ietf.org/rfc/rfc2616.txt"><meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.389, 2008-08-20 14:21:35, XSLT vendor: SAXON 6.5.5 from Michael Kay http://saxon.sf.net/"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.Creator" content="Fielding, R."><meta name="DC.Creator" content="Gettys, J."><meta name="DC.Creator" content="Mogul, J."><meta name="DC.Creator" content="Frystyk, H."><meta name="DC.Creator" content="Masinter, L."><meta name="DC.Creator" content="Leach, P."><meta name="DC.Creator" content="Berners-Lee, T."><meta name="DC.Identifier" content="urn:ietf:rfc:2616"><meta name="DC.Date.Issued" scheme="ISO8601" content="1999-06"><meta name="DC.Relation.Replaces" content="urn:ietf:rfc:2068"><meta name="DC.Description.Abstract" content="The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers . A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068 ."></head><body><table summary="header information" class="header" border="0" cellpadding="1" cellspacing="1"><tr><td class="header left">Network Working Group</td><td class="header right">R. Fielding</td></tr><tr><td class="header left">Request for Comments: 2616</td><td class="header right">UC Irvine</td></tr><tr><td class="header left">Obsoletes: <a href="http://tools.ietf.org/html/rfc2068">2068</a></td><td class="header right">J. Gettys</td></tr><tr><td class="header left">Category: Standards Track</td><td class="header right">Compaq/W3C</td></tr><tr><td class="header left"></td><td class="header right">J. Mogul</td></tr><tr><td class="header left"></td><td class="header right">Compaq</td></tr><tr><td class="header left"></td><td class="header right">H. Frystyk</td></tr><tr><td class="header left"></td><td class="header right">W3C/MIT</td></tr><tr><td class="header left"></td><td class="header right">L. Masinter</td></tr><tr><td class="header left"></td><td class="header right">Xerox</td></tr><tr><td class="header left"></td><td class="header right">P. Leach</td></tr><tr><td class="header left"></td><td class="header right">Microsoft</td></tr><tr><td class="header left"></td><td class="header right">T. Berners-Lee</td></tr><tr><td class="header left"></td><td class="header right">W3C/MIT</td></tr><tr><td class="header left"></td><td class="header right">June 1999</td></tr></table><p class="title">Hypertext Transfer Protocol -- HTTP/1.1</p><h1><a id="rfc.status" href="#rfc.status">Status of this Memo</a></h1><p>This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the “Internet Official Protocol Standards” (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.</p><h1><a id="rfc.copyrightnotice" href="#rfc.copyrightnotice">Copyright Notice</a></h1><p>Copyright © The Internet Society (1999). All Rights Reserved.</p><h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1> <p>The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers <a href="#RFC2324" id="rfc.xref.RFC2324.1"><cite title="Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)">[47]</cite></a>. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.</p> <p>HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068 <a href="#RFC2068" id="rfc.xref.RFC2068.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[33]</cite></a>.</p> <hr class="noprint"><h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1><ul class="toc"><li class="tocline0">1. <a href="#introduction">Introduction</a><ul class="toc"><li class="tocline1">1.1 <a href="#intro.purpose">Purpose</a></li><li class="tocline1">1.2 <a href="#intro.requirements">Requirements</a></li><li class="tocline1">1.3 <a href="#intro.terminology">Terminology</a></li><li class="tocline1">1.4 <a href="#intro.overall.operation">Overall Operation</a></li></ul></li><li class="tocline0">2. <a href="#notation">Notational Conventions and Generic Grammar</a><ul class="toc"><li class="tocline1">2.1 <a href="#notation.abnf">Augmented BNF</a></li><li class="tocline1">2.2 <a href="#basic.rules">Basic Rules</a></li></ul></li><li class="tocline0">3. <a href="#protocol.parameters">Protocol Parameters</a><ul class="toc"><li class="tocline1">3.1 <a href="#http.version">HTTP Version</a></li><li class="tocline1">3.2 <a href="#uri">Uniform Resource Identifiers</a><ul class="toc"><li class="tocline1">3.2.1 <a href="#general.syntax">General Syntax</a></li><li class="tocline1">3.2.2 <a href="#http.url">http URL</a></li><li class="tocline1">3.2.3 <a href="#uri.comparison">URI Comparison</a></li></ul></li><li class="tocline1">3.3 <a href="#date.time.formats">Date/Time Formats</a><ul class="toc"><li class="tocline1">3.3.1 <a href="#full.date">Full Date</a></li><li class="tocline1">3.3.2 <a href="#delta.seconds">Delta Seconds</a></li></ul></li><li class="tocline1">3.4 <a href="#character.sets">Character Sets</a><ul class="toc"><li class="tocline1">3.4.1 <a href="#missing.charset">Missing Charset</a></li></ul></li><li class="tocline1">3.5 <a href="#content.codings">Content Codings</a></li><li class="tocline1">3.6 <a href="#transfer.codings">Transfer Codings</a><ul class="toc"><li class="tocline1">3.6.1 <a href="#chunked.transfer.encoding">Chunked Transfer Coding</a></li></ul></li><li class="tocline1">3.7 <a href="#media.types">Media Types</a><ul class="toc"><li class="tocline1">3.7.1 <a href="#canonicalization.and.text.defaults">Canonicalization and Text Defaults</a></li><li class="tocline1">3.7.2 <a href="#multipart.types">Multipart Types</a></li></ul></li><li class="tocline1">3.8 <a href="#product.tokens">Product Tokens</a></li><li class="tocline1">3.9 <a href="#quality.values">Quality Values</a></li><li class="tocline1">3.10 <a href="#language.tags">Language Tags</a></li><li class="tocline1">3.11 <a href="#entity.tags">Entity Tags</a></li><li class="tocline1">3.12 <a href="#range.units">Range Units</a></li></ul></li><li class="tocline0">4. <a href="#http.message">HTTP Message</a><ul class="toc"><li class="tocline1">4.1 <a href="#message.types">Message Types</a></li><li class="tocline1">4.2 <a href="#message.headers">Message Headers</a></li><li class="tocline1">4.3 <a href="#message.body">Message Body</a></li><li class="tocline1">4.4 <a href="#message.length">Message Length</a></li><li class="tocline1">4.5 <a href="#general.header.fields">General Header Fields</a></li></ul></li><li class="tocline0">5. <a href="#request">Request</a><ul class="toc"><li class="tocline1">5.1 <a href="#request-line">Request-Line</a><ul class="toc"><li class="tocline1">5.1.1 <a href="#method">Method</a></li><li class="tocline1">5.1.2 <a href="#request-uri">Request-URI</a></li></ul></li><li class="tocline1">5.2 <a href="#the.resource.identified.by.a.request">The Resource Identified by a Request</a></li><li class="tocline1">5.3 <a href="#request.header.fields">Request Header Fields</a></li></ul></li><li class="tocline0">6. <a href="#response">Response</a><ul class="toc"><li class="tocline1">6.1 <a href="#status-line">Status-Line</a><ul class="toc"><li class="tocline1">6.1.1 <a href="#status.code.and.reason.phrase">Status Code and Reason Phrase</a></li></ul></li><li class="tocline1">6.2 <a href="#response.header.fields">Response Header Fields</a></li></ul></li><li class="tocline0">7. <a href="#entity">Entity</a><ul class="toc"><li class="tocline1">7.1 <a href="#entity.header.fields">Entity Header Fields</a></li><li class="tocline1">7.2 <a href="#entity.body">Entity Body</a><ul class="toc"><li class="tocline1">7.2.1 <a href="#type">Type</a></li><li class="tocline1">7.2.2 <a href="#entity.length">Entity Length</a></li></ul></li></ul></li><li class="tocline0">8. <a href="#connections">Connections</a><ul class="toc"><li class="tocline1">8.1 <a href="#persistent.connections">Persistent Connections</a><ul class="toc"><li class="tocline1">8.1.1 <a href="#persistent.purpose">Purpose</a></li><li class="tocline1">8.1.2 <a href="#persistent.overall">Overall Operation</a><ul class="toc"><li class="tocline1">8.1.2.1 <a href="#persistent.negotiation">Negotiation</a></li><li class="tocline1">8.1.2.2 <a href="#pipelining">Pipelining</a></li></ul></li><li class="tocline1">8.1.3 <a href="#persistent.proxy">Proxy Servers</a></li><li class="tocline1">8.1.4 <a href="#persistent.practical">Practical Considerations</a></li></ul></li><li class="tocline1">8.2 <a href="#message.transmission.requirements">Message Transmission Requirements</a><ul class="toc"><li class="tocline1">8.2.1 <a href="#persistent.flow">Persistent Connections and Flow Control</a></li><li class="tocline1">8.2.2 <a href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></li><li class="tocline1">8.2.3 <a href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></li><li class="tocline1">8.2.4 <a href="#connection.premature">Client Behavior if Server Prematurely Closes Connection</a></li></ul></li></ul></li><li class="tocline0">9. <a href="#method.definitions">Method Definitions</a><ul class="toc"><li class="tocline1">9.1 <a href="#safe.and.idempotent">Safe and Idempotent Methods</a><ul class="toc"><li class="tocline1">9.1.1 <a href="#safe.methods">Safe Methods</a></li><li class="tocline1">9.1.2 <a href="#idempotent.methods">Idempotent Methods</a></li></ul></li><li class="tocline1">9.2 <a href="#OPTIONS">OPTIONS</a></li><li class="tocline1">9.3 <a href="#GET">GET</a></li><li class="tocline1">9.4 <a href="#HEAD">HEAD</a></li><li class="tocline1">9.5 <a href="#POST">POST</a></li><li class="tocline1">9.6 <a href="#PUT">PUT</a></li><li class="tocline1">9.7 <a href="#DELETE">DELETE</a></li><li class="tocline1">9.8 <a href="#TRACE">TRACE</a></li><li class="tocline1">9.9 <a href="#CONNECT">CONNECT</a></li></ul></li><li class="tocline0">10. <a href="#status.codes">Status Code Definitions</a><ul class="toc"><li class="tocline1">10.1 <a href="#status.1xx">Informational 1xx</a><ul class="toc"><li class="tocline1">10.1.1 <a href="#status.100">100 Continue</a></li><li class="tocline1">10.1.2 <a href="#status.101">101 Switching Protocols</a></li></ul></li><li class="tocline1">10.2 <a href="#status.2xx">Successful 2xx</a><ul class="toc"><li class="tocline1">10.2.1 <a href="#status.200">200 OK</a></li><li class="tocline1">10.2.2 <a href="#status.201">201 Created</a></li><li class="tocline1">10.2.3 <a href="#status.202">202 Accepted</a></li><li class="tocline1">10.2.4 <a href="#status.203">203 Non-Authoritative Information</a></li><li class="tocline1">10.2.5 <a href="#status.204">204 No Content</a></li><li class="tocline1">10.2.6 <a href="#status.205">205 Reset Content</a></li><li class="tocline1">10.2.7 <a href="#status.206">206 Partial Content</a></li></ul></li><li class="tocline1">10.3 <a href="#status.3xx">Redirection 3xx</a><ul class="toc"><li class="tocline1">10.3.1 <a href="#status.300">300 Multiple Choices</a></li><li class="tocline1">10.3.2 <a href="#status.301">301 Moved Permanently</a></li><li class="tocline1">10.3.3 <a href="#status.302">302 Found</a></li><li class="tocline1">10.3.4 <a href="#status.303">303 See Other</a></li><li class="tocline1">10.3.5 <a href="#status.304">304 Not Modified</a></li><li class="tocline1">10.3.6 <a href="#status.305">305 Use Proxy</a></li><li class="tocline1">10.3.7 <a href="#status.306">306 (Unused)</a></li><li class="tocline1">10.3.8 <a href="#status.307">307 Temporary Redirect</a></li></ul></li><li class="tocline1">10.4 <a href="#status.4xx">Client Error 4xx</a><ul class="toc"><li class="tocline1">10.4.1 <a href="#status.400">400 Bad Request</a></li><li class="tocline1">10.4.2 <a href="#status.401">401 Unauthorized</a></li><li class="tocline1">10.4.3 <a href="#status.402">402 Payment Required</a></li><li class="tocline1">10.4.4 <a href="#status.403">403 Forbidden</a></li><li class="tocline1">10.4.5 <a href="#status.404">404 Not Found</a></li><li class="tocline1">10.4.6 <a href="#status.405">405 Method Not Allowed</a></li><li class="tocline1">10.4.7 <a href="#status.406">406 Not Acceptable</a></li><li class="tocline1">10.4.8 <a href="#status.407">407 Proxy Authentication Required</a></li><li class="tocline1">10.4.9 <a href="#status.408">408 Request Timeout</a></li><li class="tocline1">10.4.10 <a href="#status.409">409 Conflict</a></li><li class="tocline1">10.4.11 <a href="#status.410">410 Gone</a></li><li class="tocline1">10.4.12 <a href="#status.411">411 Length Required</a></li><li class="tocline1">10.4.13 <a href="#status.412">412 Precondition Failed</a></li><li class="tocline1">10.4.14 <a href="#status.413">413 Request Entity Too Large</a></li><li class="tocline1">10.4.15 <a href="#status.414">414 Request-URI Too Long</a></li><li class="tocline1">10.4.16 <a href="#status.415">415 Unsupported Media Type</a></li><li class="tocline1">10.4.17 <a href="#status.416">416 Requested Range Not Satisfiable</a></li><li class="tocline1">10.4.18 <a href="#status.417">417 Expectation Failed</a></li></ul></li><li class="tocline1">10.5 <a href="#status.5xx">Server Error 5xx</a><ul class="toc"><li class="tocline1">10.5.1 <a href="#status.500">500 Internal Server Error</a></li><li class="tocline1">10.5.2 <a href="#status.501">501 Not Implemented</a></li><li class="tocline1">10.5.3 <a href="#status.502">502 Bad Gateway</a></li><li class="tocline1">10.5.4 <a href="#status.503">503 Service Unavailable</a></li><li class="tocline1">10.5.5 <a href="#status.504">504 Gateway Timeout</a></li><li class="tocline1">10.5.6 <a href="#status.505">505 HTTP Version Not Supported</a></li></ul></li></ul></li><li class="tocline0">11. <a href="#access.authentication">Access Authentication</a></li><li class="tocline0">12. <a href="#content.negotiation">Content Negotiation</a><ul class="toc"><li class="tocline1">12.1 <a href="#server-driven.negotiation">Server-driven Negotiation</a></li><li class="tocline1">12.2 <a href="#agent-driven.negotiation">Agent-driven Negotiation</a></li><li class="tocline1">12.3 <a href="#transparent.negotiation">Transparent Negotiation</a></li></ul></li><li class="tocline0">13. <a href="#caching">Caching in HTTP</a><ul class="toc"><li class="tocline1">13.1 <a href="#rfc.section.13.1"></a><ul class="toc"><li class="tocline1">13.1.1 <a href="#cache.correctness">Cache Correctness</a></li><li class="tocline1">13.1.2 <a href="#warnings">Warnings</a></li><li class="tocline1">13.1.3 <a href="#cache-control.mechanisms">Cache-control Mechanisms</a></li><li class="tocline1">13.1.4 <a href="#explicit.ua.warnings">Explicit User Agent Warnings</a></li><li class="tocline1">13.1.5 <a href="#exceptions.to.the.rules.and.warnings">Exceptions to the Rules and Warnings</a></li><li class="tocline1">13.1.6 <a href="#client-controlled.behavior">Client-controlled Behavior</a></li></ul></li><li class="tocline1">13.2 <a href="#expiration.model">Expiration Model</a><ul class="toc"><li class="tocline1">13.2.1 <a href="#server-specified.expiration">Server-Specified Expiration</a></li><li class="tocline1">13.2.2 <a href="#heuristic.expiration">Heuristic Expiration</a></li><li class="tocline1">13.2.3 <a href="#age.calculations">Age Calculations</a></li><li class="tocline1">13.2.4 <a href="#expiration.calculations">Expiration Calculations</a></li><li class="tocline1">13.2.5 <a href="#disambiguating.expiration.values">Disambiguating Expiration Values</a></li><li class="tocline1">13.2.6 <a href="#disambiguating.multiple.responses">Disambiguating Multiple Responses</a></li></ul></li><li class="tocline1">13.3 <a href="#validation.model">Validation Model</a><ul class="toc"><li class="tocline1">13.3.1 <a href="#last-modified.dates">Last-Modified Dates</a></li><li class="tocline1">13.3.2 <a href="#entity.tag.cache.validators">Entity Tag Cache Validators</a></li><li class="tocline1">13.3.3 <a href="#weak.and.strong.validators">Weak and Strong Validators</a></li><li class="tocline1">13.3.4 <a href="#rules.for.when.to.use.entity.tags.and.last-modified.dates">Rules for When to Use Entity Tags and Last-Modified Dates</a></li><li class="tocline1">13.3.5 <a href="#non-validating.conditionals">Non-validating Conditionals</a></li></ul></li><li class="tocline1">13.4 <a href="#response.cacheability">Response Cacheability</a></li><li class="tocline1">13.5 <a href="#constructing.responses.from.caches">Constructing Responses From Caches</a><ul class="toc"><li class="tocline1">13.5.1 <a href="#end-to-end.and.hop-by-hop.headers">End-to-end and Hop-by-hop Headers</a></li><li class="tocline1">13.5.2 <a href="#non-modifiable.headers">Non-modifiable Headers</a></li><li class="tocline1">13.5.3 <a href="#combining.headers">Combining Headers</a></li><li class="tocline1">13.5.4 <a href="#combining.byte.ranges">Combining Byte Ranges</a></li></ul></li><li class="tocline1">13.6 <a href="#caching.negotiated.responses">Caching Negotiated Responses</a></li><li class="tocline1">13.7 <a href="#shared.and.non-shared.caches">Shared and Non-Shared Caches</a></li><li class="tocline1">13.8 <a href="#errors.or.incomplete.response.cache.behavior">Errors or Incomplete Response Cache Behavior</a></li><li class="tocline1">13.9 <a href="#side.effects.of.get.and.head">Side Effects of GET and HEAD</a></li><li class="tocline1">13.10 <a href="#invalidation.after.updates.or.deletions">Invalidation After Updates or Deletions</a></li><li class="tocline1">13.11 <a href="#write-through.mandatory">Write-Through Mandatory</a></li><li class="tocline1">13.12 <a href="#cache.replacement">Cache Replacement</a></li><li class="tocline1">13.13 <a href="#history.lists">History Lists</a></li></ul></li><li class="tocline0">14. <a href="#header.fields">Header Field Definitions</a><ul class="toc"><li class="tocline1">14.1 <a href="#header.accept">Accept</a></li><li class="tocline1">14.2 <a href="#header.accept-charset">Accept-Charset</a></li><li class="tocline1">14.3 <a href="#header.accept-encoding">Accept-Encoding</a></li><li class="tocline1">14.4 <a href="#header.accept-language">Accept-Language</a></li><li class="tocline1">14.5 <a href="#header.accept-ranges">Accept-Ranges</a></li><li class="tocline1">14.6 <a href="#header.age">Age</a></li><li class="tocline1">14.7 <a href="#header.allow">Allow</a></li><li class="tocline1">14.8 <a href="#header.authorization">Authorization</a></li><li class="tocline1">14.9 <a href="#header.cache-control">Cache-Control</a><ul class="toc"><li class="tocline1">14.9.1 <a href="#what.is.cacheable">What is Cacheable</a></li><li class="tocline1">14.9.2 <a href="#what.may.be.stored.by.caches">What May be Stored by Caches</a></li><li class="tocline1">14.9.3 <a href="#modifications.of.the.basic.expiration.mechanism">Modifications of the Basic Expiration Mechanism</a></li><li class="tocline1">14.9.4 <a href="#cache.revalidation.and.reload.controls">Cache Revalidation and Reload Controls</a></li><li class="tocline1">14.9.5 <a href="#no-transform.directive">No-Transform Directive</a></li><li class="tocline1">14.9.6 <a href="#cache.control.extensions">Cache Control Extensions</a></li></ul></li><li class="tocline1">14.10 <a href="#header.connection">Connection</a></li><li class="tocline1">14.11 <a href="#header.content-encoding">Content-Encoding</a></li><li class="tocline1">14.12 <a href="#header.content-language">Content-Language</a></li><li class="tocline1">14.13 <a href="#header.content-length">Content-Length</a></li><li class="tocline1">14.14 <a href="#header.content-location">Content-Location</a></li><li class="tocline1">14.15 <a href="#header.content-md5">Content-MD5</a></li><li class="tocline1">14.16 <a href="#header.content-range">Content-Range</a></li><li class="tocline1">14.17 <a href="#header.content-type">Content-Type</a></li><li class="tocline1">14.18 <a href="#header.date">Date</a><ul class="toc"><li class="tocline1">14.18.1 <a href="#clockless.origin.server.operation">Clockless Origin Server Operation</a></li></ul></li><li class="tocline1">14.19 <a href="#header.etag">ETag</a></li><li class="tocline1">14.20 <a href="#header.expect">Expect</a></li><li class="tocline1">14.21 <a href="#header.expires">Expires</a></li><li class="tocline1">14.22 <a href="#header.from">From</a></li><li class="tocline1">14.23 <a href="#header.host">Host</a></li><li class="tocline1">14.24 <a href="#header.if-match">If-Match</a></li><li class="tocline1">14.25 <a href="#header.if-modified-since">If-Modified-Since</a></li><li class="tocline1">14.26 <a href="#header.if-none-match">If-None-Match</a></li><li class="tocline1">14.27 <a href="#header.if-range">If-Range</a></li><li class="tocline1">14.28 <a href="#header.if-unmodified-since">If-Unmodified-Since</a></li><li class="tocline1">14.29 <a href="#header.last-modified">Last-Modified</a></li><li class="tocline1">14.30 <a href="#header.location">Location</a></li><li class="tocline1">14.31 <a href="#header.max-forwards">Max-Forwards</a></li><li class="tocline1">14.32 <a href="#header.pragma">Pragma</a></li><li class="tocline1">14.33 <a href="#header.proxy-authenticate">Proxy-Authenticate</a></li><li class="tocline1">14.34 <a href="#header.proxy-authorization">Proxy-Authorization</a></li><li class="tocline1">14.35 <a href="#header.range">Range</a><ul class="toc"><li class="tocline1">14.35.1 <a href="#byte.ranges">Byte Ranges</a></li><li class="tocline1">14.35.2 <a href="#range.retrieval.requests">Range Retrieval Requests</a></li></ul></li><li class="tocline1">14.36 <a href="#header.referer">Referer</a></li><li class="tocline1">14.37 <a href="#header.retry-after">Retry-After</a></li><li class="tocline1">14.38 <a href="#header.server">Server</a></li><li class="tocline1">14.39 <a href="#header.te">TE</a></li><li class="tocline1">14.40 <a href="#header.trailer">Trailer</a></li><li class="tocline1">14.41 <a href="#header.transfer-encoding">Transfer-Encoding</a></li><li class="tocline1">14.42 <a href="#header.upgrade">Upgrade</a></li><li class="tocline1">14.43 <a href="#header.user-agent">User-Agent</a></li><li class="tocline1">14.44 <a href="#header.vary">Vary</a></li><li class="tocline1">14.45 <a href="#header.via">Via</a></li><li class="tocline1">14.46 <a href="#header.warning">Warning</a></li><li class="tocline1">14.47 <a href="#header.www-authenticate">WWW-Authenticate</a></li></ul></li><li class="tocline0">15. <a href="#security.considerations">Security Considerations</a><ul class="toc"><li class="tocline1">15.1 <a href="#personal.information">Personal Information</a><ul class="toc"><li class="tocline1">15.1.1 <a href="#abuse.of.server.log.information">Abuse of Server Log Information</a></li><li class="tocline1">15.1.2 <a href="#security.sensitive">Transfer of Sensitive Information</a></li><li class="tocline1">15.1.3 <a href="#encoding.sensitive.information.in.uris">Encoding Sensitive Information in URI's</a></li><li class="tocline1">15.1.4 <a href="#privacy.issues.connected.to.accept.headers">Privacy Issues Connected to Accept Headers</a></li></ul></li><li class="tocline1">15.2 <a href="#attack.pathname">Attacks Based On File and Path Names</a></li><li class="tocline1">15.3 <a href="#dns.spoofing">DNS Spoofing</a></li><li class="tocline1">15.4 <a href="#location.spoofing">Location Headers and Spoofing</a></li><li class="tocline1">15.5 <a href="#content-disposition.issues">Content-Disposition Issues</a></li><li class="tocline1">15.6 <a href="#auth.credentials.and.idle.clients">Authentication Credentials and Idle Clients</a></li><li class="tocline1">15.7 <a href="#attack.proxies">Proxies and Caching</a><ul class="toc"><li class="tocline1">15.7.1 <a href="#attack.DoS">Denial of Service Attacks on Proxies</a></li></ul></li></ul></li><li class="tocline0">16. <a href="#acknowledgments">Acknowledgments</a></li><li class="tocline0">17. <a href="#rfc.references">References</a></li><li class="tocline0">18. <a href="#rfc.authors">Authors' Addresses</a></li><li class="tocline0">19. <a href="#rfc.section.19">Appendices</a><ul class="toc"><li class="tocline1">19.1 <a href="#internet.media.type.http">Internet Media Type message/http and application/http</a></li><li class="tocline1">19.2 <a href="#internet.media.type.multipart.byteranges">Internet Media Type multipart/byteranges</a></li><li class="tocline1">19.3 <a href="#tolerant.applications">Tolerant Applications</a></li><li class="tocline1">19.4 <a href="#differences.between.http.entities.and.rfc.2045.entities">Differences Between HTTP Entities and RFC 2045 Entities</a><ul class="toc"><li class="tocline1">19.4.1 <a href="#mime-version">MIME-Version</a></li><li class="tocline1">19.4.2 <a href="#conversion.to.canonical.form">Conversion to Canonical Form</a></li><li class="tocline1">19.4.3 <a href="#conversion.of.date.formats">Conversion of Date Formats</a></li><li class="tocline1">19.4.4 <a href="#introduction.of.content-encoding">Introduction of Content-Encoding</a></li><li class="tocline1">19.4.5 <a href="#no.content-transfer-encoding">No Content-Transfer-Encoding</a></li><li class="tocline1">19.4.6 <a href="#introduction.of.transfer-encoding">Introduction of Transfer-Encoding</a></li><li class="tocline1">19.4.7 <a href="#mhtml.line.length">MHTML and Line Length Limitations</a></li></ul></li><li class="tocline1">19.5 <a href="#additional.features">Additional Features</a><ul class="toc"><li class="tocline1">19.5.1 <a href="#content-disposition">Content-Disposition</a></li></ul></li><li class="tocline1">19.6 <a href="#compatibility">Compatibility with Previous Versions</a><ul class="toc"><li class="tocline1">19.6.1 <a href="#changes.from.1.0">Changes from HTTP/1.0</a><ul class="toc"><li class="tocline1">19.6.1.1 <a href="#changes.to.simplify.multi-homed.web.servers.and.conserve.ip.addresses">Changes to Simplify Multi-homed Web Servers and Conserve IP Addresses</a></li></ul></li><li class="tocline1">19.6.2 <a href="#compatibility.with.http.1.0.persistent.connections">Compatibility with HTTP/1.0 Persistent Connections</a></li><li class="tocline1">19.6.3 <a href="#changes.from.rfc.2068">Changes from RFC 2068</a></li></ul></li></ul></li><li class="tocline0">20. <a href="#rfc.section.20">Index</a></li><li class="tocline0"><a href="#rfc.ipr">Intellectual Property and Copyright Statements</a></li><li class="tocline0"><a href="#rfc.index">Index</a></li></ul><hr class="noprint"><h1 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a> <a id="introduction" href="#introduction">Introduction</a></h1><h2 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1</a> <a id="intro.purpose" href="#intro.purpose">Purpose</a></h2><p id="rfc.section.1.1.p.1">The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. HTTP has been in use by the World-Wide Web global information initiative since 1990. The first version of HTTP, referred to as HTTP/0.9, was a simple protocol for raw data transfer across the Internet. HTTP/1.0, as defined by RFC 1945 <a href="#RFC1945" id="rfc.xref.RFC1945.1"><cite title="Hypertext Transfer Protocol -- HTTP/1.0">[6]</cite></a>, improved the protocol by allowing messages to be in the format of MIME-like messages, containing metainformation about the data transferred and modifiers on the request/response semantics. However, HTTP/1.0 does not sufficiently take into consideration the effects of hierarchical proxies, caching, the need for persistent connections, or virtual hosts. In addition, the proliferation of incompletely-implemented applications calling themselves "HTTP/1.0" has necessitated a protocol version change in order for two communicating applications to determine each other's true capabilities.</p><p id="rfc.section.1.1.p.2">This specification defines the protocol referred to as "HTTP/1.1". This protocol includes more stringent requirements than HTTP/1.0 in order to ensure reliable implementation of its features.</p><p id="rfc.section.1.1.p.3">Practical information systems require more functionality than simple retrieval, including search, front-end update, and annotation. HTTP allows an open-ended set of methods and headers that indicate the purpose of a request <a href="#RFC2324" id="rfc.xref.RFC2324.2"><cite title="Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)">[47]</cite></a>. It builds on the discipline of reference provided by the Uniform Resource Identifier (URI) <a href="#RFC1630" id="rfc.xref.RFC1630.1"><cite title="Universal Resource Identifiers in WWW: A Unifying Syntax for the Expression of Names and Addresses of Objects on the Network as used in the World-Wide Web">[3]</cite></a>, as a location (URL) <a href="#RFC1738" id="rfc.xref.RFC1738.1"><cite title="Uniform Resource Locators (URL)">[4]</cite></a> or name (URN) <a href="#RFC1737" id="rfc.xref.RFC1737.1"><cite title="Functional Requirements for Uniform Resource Names">[20]</cite></a>, for indicating the resource to which a method is to be applied. Messages are passed in a format similar to that used by Internet mail <a href="#RFC822" id="rfc.xref.RFC822.1"><cite title="Standard for the format of ARPA Internet text messages">[9]</cite></a> as defined by 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">[7]</cite></a>.</p><p id="rfc.section.1.1.p.4">HTTP is also used as a generic protocol for communication between user agents and proxies/gateways to other Internet systems, including those supported by the SMTP <a href="#RFC821" id="rfc.xref.RFC821.1"><cite title="Simple Mail Transfer Protocol">[16]</cite></a>, NNTP <a href="#RFC977" id="rfc.xref.RFC977.1"><cite title="Network News Transfer Protocol">[13]</cite></a>, FTP <a href="#RFC959" id="rfc.xref.RFC959.1"><cite title="File Transfer Protocol">[18]</cite></a>, Gopher <a href="#RFC1436" id="rfc.xref.RFC1436.1"><cite title="The Internet Gopher Protocol (a distributed document search and retrieval protocol)">[2]</cite></a>, and WAIS <a href="#WAIS" id="rfc.xref.WAIS.1"><cite title="WAIS Interface Protocol Prototype Functional Specification (v1.5)">[10]</cite></a> protocols. In this way, HTTP allows basic hypermedia access to resources available from diverse applications.</p><h2 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2</a> <a id="intro.requirements" href="#intro.requirements">Requirements</a></h2><p id="rfc.section.1.2.p.1">The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[34]</cite></a>.</p><p id="rfc.section.1.2.p.2">An implementation is not compliant if it fails to satisfy one or more of the <em class="bcp14">MUST</em> or <em class="bcp14">REQUIRED</em> level requirements for the protocols it implements. An implementation that satisfies all the <em class="bcp14">MUST</em> or <em class="bcp14">REQUIRED</em> level and all the <em class="bcp14">SHOULD</em> level requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the <em class="bcp14">MUST</em> level requirements but not all the <em class="bcp14">SHOULD</em> level requirements for its protocols is said to be "conditionally compliant."</p><h2 id="rfc.section.1.3"><a href="#rfc.section.1.3">1.3</a> <a id="intro.terminology" href="#intro.terminology">Terminology</a></h2><p id="rfc.section.1.3.p.1">This specification uses a number of terms to refer to the roles played by participants in, and objects of, the HTTP communication.</p><p id="rfc.section.1.3.p.2"> <span id="rfc.iref.c.1"></span> <dfn>connection</dfn> </p><dl class="empty"><dd>A transport layer virtual circuit established between two programs for the purpose of communication.</dd></dl><p id="rfc.section.1.3.p.3"> <span id="rfc.iref.m.1"></span> <dfn>message</dfn> </p><dl class="empty"><dd>The basic unit of HTTP communication, consisting of a structured sequence of octets matching the syntax defined in <a href="#http.message" title="HTTP Message">Section 4</a> and transmitted via the connection.</dd></dl><p id="rfc.section.1.3.p.4"> <span id="rfc.iref.r.1"></span> <dfn>request</dfn> </p><dl class="empty"><dd>An HTTP request message, as defined in <a href="#request" title="Request">Section 5</a>.</dd></dl><p id="rfc.section.1.3.p.5"> <span id="rfc.iref.r.2"></span> <dfn>response</dfn> </p><dl class="empty"><dd>An HTTP response message, as defined in <a href="#response" title="Response">Section 6</a>.</dd></dl><p id="rfc.section.1.3.p.6"> <span id="rfc.iref.r.3"></span> <dfn>resource</dfn> </p><dl class="empty"><dd>A network data object or service that can be identified by a URI, as defined in <a href="#uri" title="Uniform Resource Identifiers">Section 3.2</a>. Resources may be available in multiple representations (e.g. multiple languages, data formats, size, and resolutions) or vary in other ways.</dd></dl><p id="rfc.section.1.3.p.7"> <span id="rfc.iref.e.1"></span> <dfn>entity</dfn> </p><dl class="empty"><dd>The information transferred as the payload of a request or response. An entity consists of metainformation in the form of entity-header fields and content in the form of an entity-body, as described in <a href="#entity" title="Entity">Section 7</a>.</dd></dl><p id="rfc.section.1.3.p.8"> <span id="rfc.iref.r.4"></span> <dfn>representation</dfn> </p><dl class="empty"><dd>An entity included with a response that is subject to content negotiation, as described in <a href="#content.negotiation" title="Content Negotiation">Section 12</a>. There may exist multiple representations associated with a particular response status.</dd></dl><p id="rfc.section.1.3.p.9"> <span id="rfc.iref.c.2"></span> <dfn>content negotiation</dfn> </p><dl class="empty"><dd>The mechanism for selecting the appropriate representation when servicing a request, as described in <a href="#content.negotiation" title="Content Negotiation">Section 12</a>. The representation of entities in any response can be negotiated (including error responses).</dd></dl><p id="rfc.section.1.3.p.10"> <span id="rfc.iref.v.1"></span> <dfn>variant</dfn> </p><dl class="empty"><dd>A resource may have one, or more than one, representation(s) associated with it at any given instant. Each of these representations is termed a `varriant'. Use of the term `variant' does not necessarily imply that the resource is subject to content negotiation.</dd></dl><p id="rfc.section.1.3.p.11"> <span id="rfc.iref.c.3"></span> <dfn>client</dfn> </p><dl class="empty"><dd>A program that establishes connections for the purpose of sending requests.</dd></dl><p id="rfc.section.1.3.p.12"> <span id="rfc.iref.u.1"></span> <dfn>user agent</dfn> </p><dl class="empty"><dd>The client which initiates a request. These are often browsers, editors, spiders (web-traversing robots), or other end user tools.</dd></dl><p id="rfc.section.1.3.p.13"> <span id="rfc.iref.s.1"></span> <dfn>server</dfn> </p><dl class="empty"><dd>An application program that accepts connections in order to service requests by sending back responses. Any given program may be capable of being both a client and a server; our use of these terms refers only to the role being performed by the program for a particular connection, rather than to the program's capabilities in general. Likewise, any server may act as an origin server, proxy, gateway, or tunnel, switching behavior based on the nature of each request.</dd></dl><p id="rfc.section.1.3.p.14"> <span id="rfc.iref.o.1"></span> <dfn>origin server</dfn> </p><dl class="empty"><dd>The server on which a given resource resides or is to be created.</dd></dl><p id="rfc.section.1.3.p.15"> <span id="rfc.iref.p.1"></span> <dfn>proxy</dfn> </p><dl class="empty"><dd>An intermediary program which acts as both a server and a client for the purpose of making requests on behalf of other clients. Requests are serviced internally or by passing them on, with possible translation, to other servers. A proxy <em class="bcp14">MUST</em> implement both the client and server requirements of this specification. A "transparent proxy" is a proxy that does not modify the request or response beyond what is required for proxy authentication and identification. A "non-transparent proxy" is a proxy that modifies the request or response in order to provide some added service to the user agent, such as group annotation services, media type transformation, protocol reduction, or anonymity filtering. Except where either transparent or non-transparent behavior is explicitly stated, the HTTP proxy requirements apply to both types of proxies.</dd></dl><p id="rfc.section.1.3.p.16"> <span id="rfc.iref.g.1"></span> <dfn>gateway</dfn> </p><dl class="empty"><dd>A server which acts as an intermediary for some other server. Unlike a proxy, a gateway receives requests as if it were the origin server for the requested resource; the requesting client may not be aware that it is communicating with a gateway.</dd></dl><p id="rfc.section.1.3.p.17"> <span id="rfc.iref.t.1"></span> <dfn>tunnel</dfn> </p><dl class="empty"><dd>An intermediary program which is acting as a blind relay between two connections. Once active, a tunnel is not considered a party to the HTTP communication, though the tunnel may have been initiated by an HTTP request. The tunnel ceases to exist when both ends of the relayed connections are closed.</dd></dl><p id="rfc.section.1.3.p.18"> <span id="rfc.iref.c.4"></span> <dfn>cache</dfn> </p><dl class="empty"><dd>A program's local store of response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server may include a cache, though a cache cannot be used by a server that is acting as a tunnel.</dd></dl><p id="rfc.section.1.3.p.19"> <span id="rfc.iref.c.5"></span> <dfn>cacheable</dfn> </p><dl class="empty"><dd>A response is cacheable if a cache is allowed to store a copy of the response message for use in answering subsequent requests. The rules for determining the cacheability of HTTP responses are defined in <a href="#caching" title="Caching in HTTP">Section 13</a>. Even if a resource is cacheable, there may be additional constraints on whether a cache can use the cached copy for a particular request.</dd></dl><p id="rfc.section.1.3.p.20"> <span id="rfc.iref.f.1"></span> <dfn>first-hand</dfn> </p><dl class="empty"><dd>A response is first-hand if it comes directly and without unnecessary delay from the origin server, perhaps via one or more proxies. A response is also first-hand if its validity has just been checked directly with the origin server.</dd></dl><p id="rfc.section.1.3.p.21"> <span id="rfc.iref.e.2"></span> <dfn>explicit expiration time</dfn> </p><dl class="empty"><dd>The time at which the origin server intends that an entity should no longer be returned by a cache without further validation.</dd></dl><p id="rfc.section.1.3.p.22"> <span id="rfc.iref.h.1"></span> <dfn>heuristic expiration time</dfn> </p><dl class="empty"><dd>An expiration time assigned by a cache when no explicit expiration time is available.</dd></dl><p id="rfc.section.1.3.p.23"> <span id="rfc.iref.a.1"></span> <dfn>age</dfn> </p><dl class="empty"><dd>The age of a response is the time since it was sent by, or successfully validated with, the origin server.</dd></dl><p id="rfc.section.1.3.p.24"> <span id="rfc.iref.f.2"></span> <dfn>freshness lifetime</dfn> </p><dl class="empty"><dd>The length of time between the generation of a response and its expiration time.</dd></dl><p id="rfc.section.1.3.p.25"> <span id="rfc.iref.f.3"></span> <dfn>fresh</dfn> </p><dl class="empty"><dd>A response is fresh if its age has not yet exceeded its freshness lifetime.</dd></dl><p id="rfc.section.1.3.p.26"> <span id="rfc.iref.s.2"></span> <dfn>stale</dfn> </p><dl class="empty"><dd>A response is stale if its age has passed its freshness lifetime.</dd></dl><p id="rfc.section.1.3.p.27"> <span id="rfc.iref.s.3"></span> <dfn>semantically transparent</dfn> </p><dl class="empty"><dd>A cache behaves in a "semantically transparent" manner, with respect to a particular response, when its use affects neither the requesting client nor the origin server, except to improve performance. When a cache is semantically transparent, the client receives exactly the same response (except for hop-by-hop headers) that it would have received had its request been handled directly by the origin server.</dd></dl><p id="rfc.section.1.3.p.28"> <span id="rfc.iref.v.2"></span> <dfn>validator</dfn> </p><dl class="empty"><dd>A protocol element (e.g., an entity tag or a Last-Modified time) that is used to find out whether a cache entry is an equivalent copy of an entity.</dd></dl><p id="rfc.section.1.3.p.29"> <span id="rfc.iref.u.2"></span> <span id="rfc.iref.d.1"></span> <dfn>upstream</dfn>/<dfn>downstream</dfn> </p><dl class="empty"><dd>Upstream and downstream describe the flow of a message: all messages flow from upstream to downstream.</dd></dl><p id="rfc.section.1.3.p.30"> <span id="rfc.iref.i.1"></span> <span id="rfc.iref.o.2"></span> <dfn>inbound</dfn>/<dfn>outbound</dfn> </p><dl class="empty"><dd>Inbound and outbound refer to the request and response paths for messages: "inbound" means "traveling toward the origin server", and "outbound" means "traveling toward the user agent"</dd></dl><h2 id="rfc.section.1.4"><a href="#rfc.section.1.4">1.4</a> <a id="intro.overall.operation" href="#intro.overall.operation">Overall Operation</a></h2><p id="rfc.section.1.4.p.1">The HTTP protocol is a request/response protocol. A client sends a request to the server in the form of a request method, URI, and protocol version, followed by a MIME-like message containing request modifiers, client information, and possible body content over a connection with a server. The server responds with a status line, including the message's protocol version and a success or error code, followed by a MIME-like message containing server information, entity metainformation, and possible entity-body content. The relationship between HTTP and MIME is described in <a href="#differences.between.http.entities.and.rfc.2045.entities" title="Differences Between HTTP Entities and RFC 2045 Entities">Appendix 19.4</a>.</p><p id="rfc.section.1.4.p.2">Most HTTP communication is initiated by a user agent and consists of a request to be applied to a resource on some origin server. In the simplest case, this may be accomplished via a single connection (v) between the user agent (UA) and the origin server (O).</p><div id="rfc.figure.u.1"></div><pre class="drawing"> request chain ------------------------> |
1967 | | extension-header = message-header |
1968 | | </pre><p id="rfc.section.7.1.p.3">The extension-header mechanism allows additional entity-header fields to be defined without changing the protocol, but these |
1969 | | fields cannot be assumed to be recognizable by the recipient. Unrecognized header fields <em class="bcp14">SHOULD</em> be ignored by the recipient and <em class="bcp14">MUST</em> be forwarded by transparent proxies. |
1970 | | </p> |
1971 | | <h2 id="rfc.section.7.2"><a href="#rfc.section.7.2">7.2</a> <a id="entity.body" href="#entity.body">Entity Body</a></h2> |
1972 | | <p id="rfc.section.7.2.p.1">The entity-body (if any) sent with an HTTP request or response is in a format and encoding defined by the entity-header fields.</p> |
1973 | | <div id="rfc.figure.u.50"></div><pre class="inline"><span id="rfc.iref.g.93"></span> entity-body = *OCTET |
1974 | | </pre><p id="rfc.section.7.2.p.3">An entity-body is only present in a message when a message-body is present, as described in <a href="#message.body" title="Message Body">Section 4.3</a>. The entity-body is obtained from the message-body by decoding any Transfer-Encoding that might have been applied to ensure |
1975 | | safe and proper transfer of the message. |
1976 | | </p> |
1977 | | <h3 id="rfc.section.7.2.1"><a href="#rfc.section.7.2.1">7.2.1</a> <a id="type" href="#type">Type</a></h3> |
1978 | | <p id="rfc.section.7.2.1.p.1">When an entity-body is included with a message, the data type of that body is determined via the header fields Content-Type |
1979 | | and Content-Encoding. These define a two-layer, ordered encoding model: |
1980 | | </p> |
1981 | | <div id="rfc.figure.u.51"></div><pre class="text"> entity-body := Content-Encoding( Content-Type( data ) ) |
1982 | | </pre><p id="rfc.section.7.2.1.p.3">Content-Type specifies the media type of the underlying data. Content-Encoding may be used to indicate any additional content |
1983 | | codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. There |
1984 | | is no default encoding. |
1985 | | </p> |
1986 | | <p id="rfc.section.7.2.1.p.4">Any HTTP/1.1 message containing an entity-body <em class="bcp14">SHOULD</em> include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a |
1987 | | Content-Type field, the recipient <em class="bcp14">MAY</em> attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the |
1988 | | resource. If the media type remains unknown, the recipient <em class="bcp14">SHOULD</em> treat it as type "application/octet-stream". |
1989 | | </p> |
1990 | | <h3 id="rfc.section.7.2.2"><a href="#rfc.section.7.2.2">7.2.2</a> <a id="entity.length" href="#entity.length">Entity Length</a></h3> |
1991 | | <p id="rfc.section.7.2.2.p.1">The entity-length of a message is the length of the message-body before any transfer-codings have been applied. <a href="#message.length" title="Message Length">Section 4.4</a> defines how the transfer-length of a message-body is determined. |
1992 | | </p> |
1993 | | <h1 id="rfc.section.8"><a href="#rfc.section.8">8.</a> <a id="connections" href="#connections">Connections</a></h1> |
1994 | | <h2 id="rfc.section.8.1"><a href="#rfc.section.8.1">8.1</a> <a id="persistent.connections" href="#persistent.connections">Persistent Connections</a></h2> |
1995 | | <h3 id="rfc.section.8.1.1"><a href="#rfc.section.8.1.1">8.1.1</a> <a id="persistent.purpose" href="#persistent.purpose">Purpose</a></h3> |
1996 | | <p id="rfc.section.8.1.1.p.1">Prior to persistent connections, a separate TCP connection was established to fetch each URL, increasing the load on HTTP |
1997 | | servers and causing congestion on the Internet. The use of inline images and other associated data often require a client |
1998 | | to make multiple requests of the same server in a short amount of time. Analysis of these performance problems and results |
1999 | | from a prototype implementation are available <a href="#Pad1995" id="rfc.xref.Pad1995.1"><cite title="Improving HTTP Latency">[26]</cite></a> <a href="#Spe" id="rfc.xref.Spe.1"><cite title="Analysis of HTTP Performance Problems">[30]</cite></a>. Implementation experience and measurements of actual HTTP/1.1 (RFC 2068) implementations show good results <a href="#Nie1997" id="rfc.xref.Nie1997.1"><cite title="Network Performance Effects of HTTP/1.1, CSS1, and PNG">[39]</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">[27]</cite></a>. |
2000 | | </p> |
2001 | | <p id="rfc.section.8.1.1.p.2">Persistent HTTP connections have a number of advantages: </p> |
2002 | | <ul> |
2003 | | <li>By opening and closing fewer TCP connections, CPU time is saved in routers and hosts (clients, servers, proxies, gateways, |
2004 | | tunnels, or caches), and memory used for TCP protocol control blocks can be saved in hosts. |
2005 | | </li> |
2006 | | <li>HTTP requests and responses can be pipelined on a connection. Pipelining allows a client to make multiple requests without |
2007 | | waiting for each response, allowing a single TCP connection to be used much more efficiently, with much lower elapsed time. |
2008 | | </li> |
2009 | | <li>Network congestion is reduced by reducing the number of packets caused by TCP opens, and by allowing TCP sufficient time to |
2010 | | determine the congestion state of the network. |
2011 | | </li> |
2012 | | <li>Latency on subsequent requests is reduced since there is no time spent in TCP's connection opening handshake.</li> |
2013 | | <li>HTTP can evolve more gracefully, since errors can be reported without the penalty of closing the TCP connection. Clients using |
2014 | | future versions of HTTP might optimistically try a new feature, but if communicating with an older server, retry with old |
2015 | | semantics after an error is reported. |
2016 | | </li> |
2017 | | </ul> |
2018 | | <p id="rfc.section.8.1.1.p.3">HTTP implementations <em class="bcp14">SHOULD</em> implement persistent connections. |
2019 | | </p> |
2020 | | <h3 id="rfc.section.8.1.2"><a href="#rfc.section.8.1.2">8.1.2</a> <a id="persistent.overall" href="#persistent.overall">Overall Operation</a></h3> |
2021 | | <p id="rfc.section.8.1.2.p.1">A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior |
2022 | | 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. |
2023 | | </p> |
2024 | | <p id="rfc.section.8.1.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 |
2025 | | takes place using the Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.2" title="Connection">Section 14.10</a>). Once a close has been signaled, the client <em class="bcp14">MUST NOT</em> send any more requests on that connection. |
2026 | | </p> |
2027 | | <h4 id="rfc.section.8.1.2.1"><a href="#rfc.section.8.1.2.1">8.1.2.1</a> <a id="persistent.negotiation" href="#persistent.negotiation">Negotiation</a></h4> |
2028 | | <p id="rfc.section.8.1.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 including the connection-token |
2029 | | "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 including the connection-token close. |
2030 | | </p> |
2031 | | <p id="rfc.section.8.1.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 |
2032 | | a Connection header with the connection-token close. In case the client does not want to maintain a connection for more than |
2033 | | that request, it <em class="bcp14">SHOULD</em> send a Connection header including the connection-token close. |
2034 | | </p> |
2035 | | <p id="rfc.section.8.1.2.1.p.3">If either the client or the server sends the close token in the Connection header, that request becomes the last one for the |
2036 | | connection. |
2037 | | </p> |
2038 | | <p id="rfc.section.8.1.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="Compatibility with HTTP/1.0 Persistent Connections">Appendix 19.6.2</a> for more information on backward compatibility with HTTP/1.0 clients. |
2039 | | </p> |
2040 | | <p id="rfc.section.8.1.2.1.p.5">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.length" title="Message Length">Section 4.4</a>. |
2041 | | </p> |
2042 | | <h4 id="rfc.section.8.1.2.2"><a href="#rfc.section.8.1.2.2">8.1.2.2</a> <a id="pipelining" href="#pipelining">Pipelining</a></h4> |
2043 | | <p id="rfc.section.8.1.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. |
2044 | | </p> |
2045 | | <p id="rfc.section.8.1.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. |
2046 | | </p> |
2047 | | <p id="rfc.section.8.1.2.2.p.3">Clients <em class="bcp14">SHOULD NOT</em> pipeline requests using non-idempotent methods or non-idempotent sequences of methods (see <a href="#idempotent.methods" title="Idempotent Methods">Section 9.1.2</a>). Otherwise, a premature termination of the transport connection could lead to indeterminate results. A client wishing to |
2048 | | send a non-idempotent request <em class="bcp14">SHOULD</em> wait to send that request until it has received the response status for the previous request. |
2049 | | </p> |
2050 | | <h3 id="rfc.section.8.1.3"><a href="#rfc.section.8.1.3">8.1.3</a> <a id="persistent.proxy" href="#persistent.proxy">Proxy Servers</a></h3> |
2051 | | <p id="rfc.section.8.1.3.p.1">It is especially important that proxies correctly implement the properties of the Connection header field as specified in <a href="#header.connection" id="rfc.xref.header.connection.3" title="Connection">Section 14.10</a>. |
2052 | | </p> |
2053 | | <p id="rfc.section.8.1.3.p.2">The proxy server <em class="bcp14">MUST</em> signal persistent connections separately with its clients and the origin servers (or other proxy servers) that it connects |
2054 | | to. Each persistent connection applies to only one transport link. |
2055 | | </p> |
2056 | | <p id="rfc.section.8.1.3.p.3">A proxy server <em class="bcp14">MUST NOT</em> establish a HTTP/1.1 persistent connection with an HTTP/1.0 client (but see RFC 2068 <a href="#RFC2068" id="rfc.xref.RFC2068.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[33]</cite></a> for information and discussion of the problems with the Keep-Alive header implemented by many HTTP/1.0 clients). |
2057 | | </p> |
2058 | | <h3 id="rfc.section.8.1.4"><a href="#rfc.section.8.1.4">8.1.4</a> <a id="persistent.practical" href="#persistent.practical">Practical Considerations</a></h3> |
2059 | | <p id="rfc.section.8.1.4.p.1">Servers will usually have some time-out value beyond which they will no longer maintain an inactive connection. Proxy servers |
2060 | | might make this a higher value since it is likely that the client will be making more connections through the same server. |
2061 | | The use of persistent connections places no requirements on the length (or existence) of this time-out for either the client |
2062 | | or the server. |
2063 | | </p> |
2064 | | <p id="rfc.section.8.1.4.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 |
2065 | | not detect the other side's close promptly it could cause unnecessary resource drain on the network. |
2066 | | </p> |
2067 | | <p id="rfc.section.8.1.4.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 |
2068 | | that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed |
2069 | | while it was idle, but from the client's point of view, a request is in progress. |
2070 | | </p> |
2071 | | <p id="rfc.section.8.1.4.p.4">This means that clients, servers, and proxies <em class="bcp14">MUST</em> be able to recover from asynchronous close events. Client software <em class="bcp14">SHOULD</em> reopen the transport connection and retransmit the aborted sequence of requests without user interaction so long as the request |
2072 | | sequence is idempotent (see <a href="#idempotent.methods" title="Idempotent Methods">Section 9.1.2</a>). Non-idempotent 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 |
2073 | | 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. |
2074 | | </p> |
2075 | | <p id="rfc.section.8.1.4.p.5">Servers <em class="bcp14">SHOULD</em> always respond to at least one request per connection, if at all possible. Servers <em class="bcp14">SHOULD NOT</em> close a connection in the middle of transmitting a response, unless a network or client failure is suspected. |
2076 | | </p> |
2077 | | <p id="rfc.section.8.1.4.p.6">Clients that use persistent connections <em class="bcp14">SHOULD</em> limit the number of simultaneous connections that they maintain to a given server. A single-user client <em class="bcp14">SHOULD NOT</em> maintain more than 2 connections with any server or proxy. A proxy <em class="bcp14">SHOULD</em> use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines |
2078 | | are intended to improve HTTP response times and avoid congestion. |
2079 | | </p> |
2080 | | <h2 id="rfc.section.8.2"><a href="#rfc.section.8.2">8.2</a> <a id="message.transmission.requirements" href="#message.transmission.requirements">Message Transmission Requirements</a></h2> |
2081 | | <h3 id="rfc.section.8.2.1"><a href="#rfc.section.8.2.1">8.2.1</a> <a id="persistent.flow" href="#persistent.flow">Persistent Connections and Flow Control</a></h3> |
2082 | | <p id="rfc.section.8.2.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 |
2083 | | connections with the expectation that clients will retry. The latter technique can exacerbate network congestion. |
2084 | | </p> |
2085 | | <h3 id="rfc.section.8.2.2"><a href="#rfc.section.8.2.2">8.2.2</a> <a id="persistent.monitor" href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></h3> |
2086 | | <p id="rfc.section.8.2.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 while it is transmitting the request. If the client sees an error status, |
2087 | | 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 3.6</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, the client <em class="bcp14">MUST</em> close the connection. |
2088 | | </p> |
2089 | | <h3 id="rfc.section.8.2.3"><a href="#rfc.section.8.2.3">8.2.3</a> <a id="use.of.the.100.status" href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></h3> |
2090 | | <p id="rfc.section.8.2.3.p.1">The purpose of the 100 (Continue) status (see <a href="#status.100" id="rfc.xref.status.100.2" title="100 Continue">Section 10.1.1</a>) is to allow a client that is sending a request message with a request body to determine if the origin server is willing |
2091 | | to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either |
2092 | | be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking |
2093 | | at the body. |
2094 | | </p> |
2095 | | <p id="rfc.section.8.2.3.p.2">Requirements for HTTP/1.1 clients: </p> |
2096 | | <ul> |
2097 | | <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 request-header field (<a href="#header.expect" id="rfc.xref.header.expect.2" title="Expect">Section 14.20</a>) with the "100-continue" expectation. |
2098 | | </li> |
2099 | | <li>A client <em class="bcp14">MUST NOT</em> send an Expect request-header field (<a href="#header.expect" id="rfc.xref.header.expect.3" title="Expect">Section 14.20</a>) with the "100-continue" expectation if it does not intend to send a request body. |
2100 | | </li> |
2101 | | </ul> |
2102 | | <p id="rfc.section.8.2.3.p.3">Because of the presence of older implementations, the protocol allows ambiguous situations in which a client may send "Expect: |
2103 | | 100-continue" without receiving either a 417 (Expectation Failed) status or a 100 (Continue) status. Therefore, when a client |
2104 | | sends this header field to an origin server (possibly via a proxy) from which it has never seen a 100 (Continue) status, the |
2105 | | client <em class="bcp14">SHOULD NOT</em> wait for an indefinite period before sending the request body. |
2106 | | </p> |
2107 | | <p id="rfc.section.8.2.3.p.4">Requirements for HTTP/1.1 origin servers: </p> |
2108 | | <ul> |
2109 | | <li>Upon receiving a request which includes an Expect request-header field with the "100-continue" expectation, an origin server <em class="bcp14">MUST</em> either respond with 100 (Continue) status and continue to read from the input stream, or respond with a final status code. |
2110 | | 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 requested method if it returns a final status code. |
2111 | | </li> |
2112 | | <li>An origin server <em class="bcp14">SHOULD NOT</em> send a 100 (Continue) response if the request message does not include an Expect request-header field with the "100-continue" |
2113 | | expectation, 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 |
2114 | | rule: for compatibility with RFC 2068, a server <em class="bcp14">MAY</em> send a 100 (Continue) status in response to an HTTP/1.1 PUT or POST request that does not include an Expect request-header |
2115 | | field with the "100-continue" expectation. This exception, the purpose of which is to minimize any client processing delays |
2116 | | associated with an undeclared wait for 100 (Continue) status, applies only to HTTP/1.1 requests, and not to requests with |
2117 | | any other HTTP-version value. |
2118 | | </li> |
2119 | | <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. |
2120 | | </li> |
2121 | | <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 |
2122 | | prematurely. |
2123 | | </li> |
2124 | | <li>If an origin server receives a request that does not include an Expect request-header field with the "100-continue" expectation, |
2125 | | the request includes a request body, and the server responds with a final status code before reading the entire request body |
2126 | | from 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, |
2127 | | the client might not reliably receive the response message. However, this requirement is not be construed as preventing a |
2128 | | server from defending itself against denial-of-service attacks, or from badly broken client implementations. |
2129 | | </li> |
2130 | | </ul> |
2131 | | <p id="rfc.section.8.2.3.p.5">Requirements for HTTP/1.1 proxies: </p> |
2132 | | <ul> |
2133 | | <li>If a proxy receives a request that includes an Expect request-header field with the "100-continue" expectation, and the proxy |
2134 | | either knows that the next-hop server complies with HTTP/1.1 or higher, or does not know the HTTP version of the next-hop |
2135 | | server, it <em class="bcp14">MUST</em> forward the request, including the Expect header field. |
2136 | | </li> |
2137 | | <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. |
2138 | | </li> |
2139 | | <li>Proxies <em class="bcp14">SHOULD</em> maintain a cache recording the HTTP version numbers received from recently-referenced next-hop servers. |
2140 | | </li> |
2141 | | <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 |
2142 | | an Expect request-header field with the "100-continue" expectation. This requirement overrides the general rule for forwarding |
2143 | | of 1xx responses (see <a href="#status.1xx" title="Informational 1xx">Section 10.1</a>). |
2144 | | </li> |
2145 | | </ul> |
2146 | | <h3 id="rfc.section.8.2.4"><a href="#rfc.section.8.2.4">8.2.4</a> <a id="connection.premature" href="#connection.premature">Client Behavior if Server Prematurely Closes Connection</a></h3> |
2147 | | <p id="rfc.section.8.2.4.p.1">If an HTTP/1.1 client sends a request which includes a request body, but which does not include an Expect request-header field |
2148 | | with the "100-continue" expectation, and if the client is not directly connected to an HTTP/1.1 origin server, and if the |
2149 | | client sees the connection close before receiving any status from the server, the client <em class="bcp14">SHOULD</em> retry the request. If the client does retry this request, it <em class="bcp14">MAY</em> use the following "binary exponential backoff" algorithm to be assured of obtaining a reliable response: |
2150 | | </p> |
2151 | | <ol> |
2152 | | <li>Initiate a new connection to the server</li> |
2153 | | <li>Transmit the request-headers</li> |
2154 | | <li>Initialize a variable R to the estimated round-trip time to the server (e.g., based on the time it took to establish the connection), |
2155 | | or to a constant value of 5 seconds if the round-trip time is not available. |
2156 | | </li> |
2157 | | <li>Compute T = R * (2**N), where N is the number of previous retries of this request.</li> |
2158 | | <li>Wait either for an error response from the server, or for T seconds (whichever comes first)</li> |
2159 | | <li>If no error response is received, after T seconds transmit the body of the request.</li> |
2160 | | <li>If client sees that the connection is closed prematurely, repeat from step 1 until the request is accepted, an error response |
2161 | | is received, or the user becomes impatient and terminates the retry process. |
2162 | | </li> |
2163 | | </ol> |
2164 | | <p id="rfc.section.8.2.4.p.2">If at any point an error status is received, the client </p> |
2165 | | <ul> |
2166 | | <li><em class="bcp14">SHOULD NOT</em> continue and |
2167 | | </li> |
2168 | | <li><em class="bcp14">SHOULD</em> close the connection if it has not completed sending the request message. |
2169 | | </li> |
2170 | | </ul> |
2171 | | <h1 id="rfc.section.9"><a href="#rfc.section.9">9.</a> <a id="method.definitions" href="#method.definitions">Method Definitions</a></h1> |
2172 | | <p id="rfc.section.9.p.1">The set of common methods for HTTP/1.1 is defined below. Although this set can be expanded, additional methods cannot be assumed |
2173 | | to share the same semantics for separately extended clients and servers. The Host request-header field (<a href="#header.host" id="rfc.xref.header.host.2" title="Host">Section 14.23</a>) <em class="bcp14">MUST</em> accompany all HTTP/1.1 requests. |
2174 | | </p> |
2175 | | <h2 id="rfc.section.9.1"><a href="#rfc.section.9.1">9.1</a> <a id="safe.and.idempotent" href="#safe.and.idempotent">Safe and Idempotent Methods</a></h2> |
2176 | | <h3 id="rfc.section.9.1.1"><a href="#rfc.section.9.1.1">9.1.1</a> <a id="safe.methods" href="#safe.methods">Safe Methods</a></h3> |
2177 | | <p id="rfc.section.9.1.1.p.1">Implementors should be aware that the software represents the user in their interactions over the Internet, and should be |
2178 | | careful to allow the user to be aware of any actions they might take which may have an unexpected significance to themselves |
2179 | | or others. |
2180 | | </p> |
2181 | | <p id="rfc.section.9.1.1.p.2">In particular, the convention has been established that the GET and HEAD methods <em class="bcp14">SHOULD NOT</em> have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user |
2182 | | agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact |
2183 | | that a possibly unsafe action is being requested. |
2184 | | </p> |
2185 | | <p id="rfc.section.9.1.1.p.3">Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; |
2186 | | in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the |
2187 | | side-effects, so therefore cannot be held accountable for them. |
2188 | | </p> |
2189 | | <h3 id="rfc.section.9.1.2"><a href="#rfc.section.9.1.2">9.1.2</a> <a id="idempotent.methods" href="#idempotent.methods">Idempotent Methods</a></h3> |
2190 | | <p id="rfc.section.9.1.2.p.1">Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N |
2191 | | > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property. Also, |
2192 | | the methods OPTIONS and TRACE <em class="bcp14">SHOULD NOT</em> have side effects, and so are inherently idempotent. |
2193 | | </p> |
2194 | | <p id="rfc.section.9.1.2.p.2">However, it is possible that a sequence of several requests is non-idempotent, even if all of the methods executed in that |
2195 | | sequence are idempotent. (A sequence is idempotent if a single execution of the entire sequence always yields a result that |
2196 | | is not changed by a reexecution of all, or part, of that sequence.) For example, a sequence is non-idempotent if its result |
2197 | | depends on a value that is later modified in the same sequence. |
2198 | | </p> |
2199 | | <p id="rfc.section.9.1.2.p.3">A sequence that never has side effects is idempotent, by definition (provided that no concurrent operations are being executed |
2200 | | on the same set of resources). |
2201 | | </p> |
2202 | | <div id="rfc.iref.o.3"></div> |
2203 | | <div id="rfc.iref.m.2"></div> |
2204 | | <h2 id="rfc.section.9.2"><a href="#rfc.section.9.2">9.2</a> <a id="OPTIONS" href="#OPTIONS">OPTIONS</a></h2> |
2205 | | <p id="rfc.section.9.2.p.1">The OPTIONS method represents a request for information about the communication options available on the request/response |
2206 | | chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated |
2207 | | with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. |
2208 | | </p> |
2209 | | <p id="rfc.section.9.2.p.2">Responses to this method are not cacheable.</p> |
2210 | | <p id="rfc.section.9.2.p.3">If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding), then |
2211 | | the media type <em class="bcp14">MUST</em> be indicated by a Content-Type field. Although this specification does not define any use for such a body, future extensions |
2212 | | to HTTP might use the OPTIONS body to make more detailed queries on the server. A server that does not support such an extension <em class="bcp14">MAY</em> discard the request body. |
2213 | | </p> |
2214 | | <p id="rfc.section.9.2.p.4">If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather than to |
2215 | | a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful |
2216 | | as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. |
2217 | | For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof). |
2218 | | </p> |
2219 | | <p id="rfc.section.9.2.p.5">If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating |
2220 | | with that resource. |
2221 | | </p> |
2222 | | <p id="rfc.section.9.2.p.6">A 200 response <em class="bcp14">SHOULD</em> include any header fields that indicate optional features implemented by the server and applicable to that resource (e.g., |
2223 | | Allow), possibly including extensions not defined by this specification. The response body, if any, <em class="bcp14">SHOULD</em> also include information about the communication options. The format for such a body is not defined by this specification, |
2224 | | but might be defined by future extensions to HTTP. Content negotiation <em class="bcp14">MAY</em> be used to select the appropriate response format. If no response body is included, the response <em class="bcp14">MUST</em> include a Content-Length field with a field-value of "0". |
2225 | | </p> |
2226 | | <p id="rfc.section.9.2.p.7">The Max-Forwards request-header field <em class="bcp14">MAY</em> be used to target a specific proxy in the request chain. When a proxy receives an OPTIONS request on an absoluteURI for which |
2227 | | request forwarding is permitted, the proxy <em class="bcp14">MUST</em> check for a Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy <em class="bcp14">MUST NOT</em> forward the message; instead, the proxy <em class="bcp14">SHOULD</em> respond with its own communication options. If the Max-Forwards field-value is an integer greater than zero, the proxy <em class="bcp14">MUST</em> decrement the field-value when it forwards the request. If no Max-Forwards field is present in the request, then the forwarded |
2228 | | request <em class="bcp14">MUST NOT</em> include a Max-Forwards field. |
2229 | | </p> |
2230 | | <div id="rfc.iref.g.94"></div> |
2231 | | <div id="rfc.iref.m.3"></div> |
2232 | | <h2 id="rfc.section.9.3"><a href="#rfc.section.9.3">9.3</a> <a id="GET" href="#GET">GET</a></h2> |
2233 | | <p id="rfc.section.9.3.p.1">The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI |
2234 | | refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not |
2235 | | the source text of the process, unless that text happens to be the output of the process. |
2236 | | </p> |
2237 | | <p id="rfc.section.9.3.p.2">The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, |
2238 | | If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under |
2239 | | the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary |
2240 | | network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already |
2241 | | held by the client. |
2242 | | </p> |
2243 | | <p id="rfc.section.9.3.p.3">The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial |
2244 | | GET requests that only part of the entity be transferred, as described in <a href="#header.range" id="rfc.xref.header.range.3" title="Range">Section 14.35</a>. The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed |
2245 | | without transferring data already held by the client. |
2246 | | </p> |
2247 | | <p id="rfc.section.9.3.p.4">The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching described in <a href="#caching" title="Caching in HTTP">Section 13</a>. |
2248 | | </p> |
2249 | | <p id="rfc.section.9.3.p.5">See <a href="#encoding.sensitive.information.in.uris" title="Encoding Sensitive Information in URI's">Section 15.1.3</a> for security considerations when used for forms. |
2250 | | </p> |
2251 | | <div id="rfc.iref.h.2"></div> |
2252 | | <div id="rfc.iref.m.4"></div> |
2253 | | <h2 id="rfc.section.9.4"><a href="#rfc.section.9.4">9.4</a> <a id="HEAD" href="#HEAD">HEAD</a></h2> |
2254 | | <p id="rfc.section.9.4.p.1">The HEAD method is identical to GET except that the server <em class="bcp14">MUST NOT</em> return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request <em class="bcp14">SHOULD</em> be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about |
2255 | | the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext |
2256 | | links for validity, accessibility, and recent modification. |
2257 | | </p> |
2258 | | <p id="rfc.section.9.4.p.2">The response to a HEAD request <em class="bcp14">MAY</em> be cacheable in the sense that the information contained in the response <em class="bcp14">MAY</em> be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs |
2259 | | from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the |
2260 | | cache <em class="bcp14">MUST</em> treat the cache entry as stale. |
2261 | | </p> |
2262 | | <div id="rfc.iref.p.2"></div> |
2263 | | <div id="rfc.iref.m.5"></div> |
2264 | | <h2 id="rfc.section.9.5"><a href="#rfc.section.9.5">9.5</a> <a id="POST" href="#POST">POST</a></h2> |
2265 | | <p id="rfc.section.9.5.p.1">The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of |
2266 | | the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following |
2267 | | functions: |
2268 | | </p> |
2269 | | <ul> |
2270 | | <li>Annotation of existing resources;</li> |
2271 | | <li>Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;</li> |
2272 | | <li>Providing a block of data, such as the result of submitting a form, to a data-handling process;</li> |
2273 | | <li>Extending a database through an append operation.</li> |
2274 | | </ul> |
2275 | | <p id="rfc.section.9.5.p.2">The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. |
2276 | | The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news |
2277 | | article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database. |
2278 | | </p> |
2279 | | <p id="rfc.section.9.5.p.3">The action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either |
2280 | | 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the response includes an entity |
2281 | | that describes the result. |
2282 | | </p> |
2283 | | <p id="rfc.section.9.5.p.4">If a resource has been created on the origin server, the response <em class="bcp14">SHOULD</em> be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location |
2284 | | header (see <a href="#header.location" id="rfc.xref.header.location.2" title="Location">Section 14.30</a>). |
2285 | | </p> |
2286 | | <p id="rfc.section.9.5.p.5">Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. |
2287 | | However, the 303 (See Other) response can be used to direct the user agent to retrieve a cacheable resource. |
2288 | | </p> |
2289 | | <p id="rfc.section.9.5.p.6">POST requests <em class="bcp14">MUST</em> obey the message transmission requirements set out in <a href="#message.transmission.requirements" title="Message Transmission Requirements">Section 8.2</a>. |
2290 | | </p> |
2291 | | <p id="rfc.section.9.5.p.7">See <a href="#encoding.sensitive.information.in.uris" title="Encoding Sensitive Information in URI's">Section 15.1.3</a> for security considerations. |
2292 | | </p> |
2293 | | <div id="rfc.iref.p.3"></div> |
2294 | | <div id="rfc.iref.m.6"></div> |
2295 | | <h2 id="rfc.section.9.6"><a href="#rfc.section.9.6">9.6</a> <a id="PUT" href="#PUT">PUT</a></h2> |
2296 | | <p id="rfc.section.9.6.p.1">The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an |
2297 | | already existing resource, the enclosed entity <em class="bcp14">SHOULD</em> be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing |
2298 | | resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create |
2299 | | the resource with that URI. If a new resource is created, the origin server <em class="bcp14">MUST</em> inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No |
2300 | | Content) response codes <em class="bcp14">SHOULD</em> be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, |
2301 | | an appropriate error response <em class="bcp14">SHOULD</em> be given that reflects the nature of the problem. The recipient of the entity <em class="bcp14">MUST NOT</em> ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and <em class="bcp14">MUST</em> return a 501 (Not Implemented) response in such cases. |
2302 | | </p> |
2303 | | <p id="rfc.section.9.6.p.2">If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries <em class="bcp14">SHOULD</em> be treated as stale. Responses to this method are not cacheable. |
2304 | | </p> |
2305 | | <p id="rfc.section.9.6.p.3">The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The |
2306 | | URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting |
2307 | | process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request |
2308 | | identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server <em class="bcp14">MUST NOT</em> attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, |
2309 | | it <em class="bcp14">MUST</em> send a 301 (Moved Permanently) response; the user agent <em class="bcp14">MAY</em> then make its own decision regarding whether or not to redirect the request. |
2310 | | </p> |
2311 | | <p id="rfc.section.9.6.p.4">A single resource <em class="bcp14">MAY</em> be identified by many different URIs. For example, an article might have a URI for identifying "the current version" which |
2312 | | is separate from the URI identifying each particular version. In this case, a PUT request on a general URI might result in |
2313 | | several other URIs being defined by the origin server. |
2314 | | </p> |
2315 | | <p id="rfc.section.9.6.p.5">HTTP/1.1 does not define how a PUT method affects the state of an origin server.</p> |
2316 | | <p id="rfc.section.9.6.p.6">PUT requests <em class="bcp14">MUST</em> obey the message transmission requirements set out in <a href="#message.transmission.requirements" title="Message Transmission Requirements">Section 8.2</a>. |
2317 | | </p> |
2318 | | <p id="rfc.section.9.6.p.7">Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request <em class="bcp14">SHOULD</em> be applied to the resource created or modified by the PUT. |
2319 | | </p> |
2320 | | <div id="rfc.iref.d.3"></div> |
2321 | | <div id="rfc.iref.m.7"></div> |
2322 | | <h2 id="rfc.section.9.7"><a href="#rfc.section.9.7">9.7</a> <a id="DELETE" href="#DELETE">DELETE</a></h2> |
2323 | | <p id="rfc.section.9.7.p.1">The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method <em class="bcp14">MAY</em> be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation |
2324 | | has been carried out, even if the status code returned from the origin server indicates that the action has been completed |
2325 | | successfully. However, the server <em class="bcp14">SHOULD NOT</em> indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible |
2326 | | location. |
2327 | | </p> |
2328 | | <p id="rfc.section.9.7.p.2">A successful response <em class="bcp14">SHOULD</em> be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, |
2329 | | or 204 (No Content) if the action has been enacted but the response does not include an entity. |
2330 | | </p> |
2331 | | <p id="rfc.section.9.7.p.3">If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries <em class="bcp14">SHOULD</em> be treated as stale. Responses to this method are not cacheable. |
2332 | | </p> |
2333 | | <div id="rfc.iref.t.2"></div> |
2334 | | <div id="rfc.iref.m.8"></div> |
2335 | | <h2 id="rfc.section.9.8"><a href="#rfc.section.9.8">9.8</a> <a id="TRACE" href="#TRACE">TRACE</a></h2> |
2336 | | <p id="rfc.section.9.8.p.1">The TRACE method is used to invoke a remote, application-layer loop-back of the request message. The final recipient of the |
2337 | | request <em class="bcp14">SHOULD</em> reflect the message received back to the client as the entity-body of a 200 (OK) response. The final recipient is either the |
2338 | | origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see <a href="#header.max-forwards" id="rfc.xref.header.max-forwards.2" title="Max-Forwards">Section 14.31</a>). A TRACE request <em class="bcp14">MUST NOT</em> include an entity. |
2339 | | </p> |
2340 | | <p id="rfc.section.9.8.p.2">TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing |
2341 | | or diagnostic information. The value of the Via header field (<a href="#header.via" id="rfc.xref.header.via.2" title="Via">Section 14.45</a>) is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the |
2342 | | client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an |
2343 | | infinite loop. |
2344 | | </p> |
2345 | | <p id="rfc.section.9.8.p.3">If the request is valid, the response <em class="bcp14">SHOULD</em> contain the entire request message in the entity-body, with a Content-Type of "message/http". Responses to this method <em class="bcp14">MUST NOT</em> be cached. |
2346 | | </p> |
2347 | | <div id="rfc.iref.c.7"></div> |
2348 | | <div id="rfc.iref.m.9"></div> |
2349 | | <h2 id="rfc.section.9.9"><a href="#rfc.section.9.9">9.9</a> <a id="CONNECT" href="#CONNECT">CONNECT</a></h2> |
2350 | | <p id="rfc.section.9.9.p.1">This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel (e.g. |
2351 | | SSL tunneling <a href="#Luo1998" id="rfc.xref.Luo1998.1"><cite title="Tunneling TCP based protocols through Web proxy servers">[44]</cite></a>). |
2352 | | </p> |
2353 | | <h1 id="rfc.section.10"><a href="#rfc.section.10">10.</a> <a id="status.codes" href="#status.codes">Status Code Definitions</a></h1> |
2354 | | <p id="rfc.section.10.p.1">Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required |
2355 | | in the response. |
2356 | | </p> |
2357 | | <h2 id="rfc.section.10.1"><a href="#rfc.section.10.1">10.1</a> <a id="status.1xx" href="#status.1xx">Informational 1xx</a></h2> |
2358 | | <p id="rfc.section.10.1.p.1">This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is |
2359 | | terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did not define any |
2360 | | 1xx status codes, servers <em class="bcp14">MUST NOT</em> send a 1xx response to an HTTP/1.0 client except under experimental conditions. |
2361 | | </p> |
2362 | | <p id="rfc.section.10.1.p.2">A client <em class="bcp14">MUST</em> be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 |
2363 | | (Continue) status message. Unexpected 1xx status responses <em class="bcp14">MAY</em> be ignored by a user agent. |
2364 | | </p> |
2365 | | <p id="rfc.section.10.1.p.3">Proxies <em class="bcp14">MUST</em> forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself |
2366 | | requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards |
2367 | | a request, then it need not forward the corresponding 100 (Continue) response(s).) |
2368 | | </p> |
2369 | | <div id="rfc.iref.142"></div> |
2370 | | <div id="rfc.iref.s.4"></div> |
2371 | | <h3 id="rfc.section.10.1.1"><a href="#rfc.section.10.1.1">10.1.1</a> <a id="status.100" href="#status.100">100 Continue</a></h3> |
2372 | | <p id="rfc.section.10.1.1.p.1">The client <em class="bcp14">SHOULD</em> continue with its request. This interim response is used to inform the client that the initial part of the request has been |
2373 | | received and has not yet been rejected by the server. The client <em class="bcp14">SHOULD</em> continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The |
2374 | | server <em class="bcp14">MUST</em> send a final response after the request has been completed. See <a href="#use.of.the.100.status" title="Use of the 100 (Continue) Status">Section 8.2.3</a> for detailed discussion of the use and handling of this status code. |
2375 | | </p> |
2376 | | <div id="rfc.iref.143"></div> |
2377 | | <div id="rfc.iref.s.5"></div> |
2378 | | <h3 id="rfc.section.10.1.2"><a href="#rfc.section.10.1.2">10.1.2</a> <a id="status.101" href="#status.101">101 Switching Protocols</a></h3> |
2379 | | <p id="rfc.section.10.1.2.p.1">The server understands and is willing to comply with the client's request, via the Upgrade message header field (<a href="#header.upgrade" id="rfc.xref.header.upgrade.2" title="Upgrade">Section 14.42</a>), for a change in the application protocol being used on this connection. The server will switch protocols to those defined |
2380 | | by the response's Upgrade header field immediately after the empty line which terminates the 101 response. |
2381 | | </p> |
2382 | | <p id="rfc.section.10.1.2.p.2">The protocol <em class="bcp14">SHOULD</em> be switched only when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over |
2383 | | older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use |
2384 | | such features. |
2385 | | </p> |
2386 | | <h2 id="rfc.section.10.2"><a href="#rfc.section.10.2">10.2</a> <a id="status.2xx" href="#status.2xx">Successful 2xx</a></h2> |
2387 | | <p id="rfc.section.10.2.p.1">This class of status code indicates that the client's request was successfully received, understood, and accepted.</p> |
2388 | | <div id="rfc.iref.144"></div> |
2389 | | <div id="rfc.iref.s.6"></div> |
2390 | | <h3 id="rfc.section.10.2.1"><a href="#rfc.section.10.2.1">10.2.1</a> <a id="status.200" href="#status.200">200 OK</a></h3> |
2391 | | <p id="rfc.section.10.2.1.p.1">The request has succeeded. The information returned with the response is dependent on the method used in the request, for |
2392 | | example: |
2393 | | </p> |
2394 | | <dl> |
2395 | | <dt>GET</dt> |
2396 | | <dd>an entity corresponding to the requested resource is sent in the response;</dd> |
2397 | | <dt>HEAD</dt> |
2398 | | <dd>the entity-header fields corresponding to the requested resource are sent in the response without any message-body;</dd> |
2399 | | <dt>POST</dt> |
2400 | | <dd>an entity describing or containing the result of the action;</dd> |
2401 | | <dt>TRACE</dt> |
2402 | | <dd>an entity containing the request message as received by the end server.</dd> |
2403 | | </dl> |
2404 | | <div id="rfc.iref.145"></div> |
2405 | | <div id="rfc.iref.s.7"></div> |
2406 | | <h3 id="rfc.section.10.2.2"><a href="#rfc.section.10.2.2">10.2.2</a> <a id="status.201" href="#status.201">201 Created</a></h3> |
2407 | | <p id="rfc.section.10.2.2.p.1">The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced |
2408 | | by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header |
2409 | | field. The response <em class="bcp14">SHOULD</em> include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose |
2410 | | the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. The origin |
2411 | | server <em class="bcp14">MUST</em> create the resource before returning the 201 status code. If the action cannot be carried out immediately, the server <em class="bcp14">SHOULD</em> respond with 202 (Accepted) response instead. |
2412 | | </p> |
2413 | | <p id="rfc.section.10.2.2.p.2">A 201 response <em class="bcp14">MAY</em> contain an ETag response header field indicating the current value of the entity tag for the requested variant just created, |
2414 | | see <a href="#header.etag" id="rfc.xref.header.etag.3" title="ETag">Section 14.19</a>. |
2415 | | </p> |
2416 | | <div id="rfc.iref.146"></div> |
2417 | | <div id="rfc.iref.s.8"></div> |
2418 | | <h3 id="rfc.section.10.2.3"><a href="#rfc.section.10.2.3">10.2.3</a> <a id="status.202" href="#status.202">202 Accepted</a></h3> |
2419 | | <p id="rfc.section.10.2.3.p.1">The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually |
2420 | | be acted upon, as it might be disallowed when processing actually takes place. There is no facility for re-sending a status |
2421 | | code from an asynchronous operation such as this. |
2422 | | </p> |
2423 | | <p id="rfc.section.10.2.3.p.2">The 202 response is intentionally non-committal. Its purpose is to allow a server to accept a request for some other process |
2424 | | (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the |
2425 | | server persist until the process is completed. The entity returned with this response <em class="bcp14">SHOULD</em> include an indication of the request's current status and either a pointer to a status monitor or some estimate of when the |
2426 | | user can expect the request to be fulfilled. |
2427 | | </p> |
2428 | | <div id="rfc.iref.147"></div> |
2429 | | <div id="rfc.iref.s.9"></div> |
2430 | | <h3 id="rfc.section.10.2.4"><a href="#rfc.section.10.2.4">10.2.4</a> <a id="status.203" href="#status.203">203 Non-Authoritative Information</a></h3> |
2431 | | <p id="rfc.section.10.2.4.p.1">The returned metainformation in the entity-header is not the definitive set as available from the origin server, but is gathered |
2432 | | from a local or a third-party copy. The set presented <em class="bcp14">MAY</em> be a subset or superset of the original version. For example, including local annotation information about the resource might |
2433 | | result in a superset of the metainformation known by the origin server. Use of this response code is not required and is only |
2434 | | appropriate when the response would otherwise be 200 (OK). |
2435 | | </p> |
2436 | | <div id="rfc.iref.148"></div> |
2437 | | <div id="rfc.iref.s.10"></div> |
2438 | | <h3 id="rfc.section.10.2.5"><a href="#rfc.section.10.2.5">10.2.5</a> <a id="status.204" href="#status.204">204 No Content</a></h3> |
2439 | | <p id="rfc.section.10.2.5.p.1">The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. |
2440 | | The response <em class="bcp14">MAY</em> include new or updated metainformation in the form of entity-headers, which if present <em class="bcp14">SHOULD</em> be associated with the requested variant. |
2441 | | </p> |
2442 | | <p id="rfc.section.10.2.5.p.2">If the client is a user agent, it <em class="bcp14">SHOULD NOT</em> change its document view from that which caused the request to be sent. This response is primarily intended to allow input |
2443 | | for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation <em class="bcp14">SHOULD</em> be applied to the document currently in the user agent's active view. |
2444 | | </p> |
2445 | | <p id="rfc.section.10.2.5.p.3">The 204 response <em class="bcp14">MUST NOT</em> include a message-body, and thus is always terminated by the first empty line after the header fields. |
2446 | | </p> |
2447 | | <div id="rfc.iref.149"></div> |
2448 | | <div id="rfc.iref.s.11"></div> |
2449 | | <h3 id="rfc.section.10.2.6"><a href="#rfc.section.10.2.6">10.2.6</a> <a id="status.205" href="#status.205">205 Reset Content</a></h3> |
2450 | | <p id="rfc.section.10.2.6.p.1">The server has fulfilled the request and the user agent <em class="bcp14">SHOULD</em> reset the document view which caused the request to be sent. This response is primarily intended to allow input for actions |
2451 | | to take place via user input, followed by a clearing of the form in which the input is given so that the user can easily initiate |
2452 | | another input action. The response <em class="bcp14">MUST NOT</em> include an entity. |
2453 | | </p> |
2454 | | <div id="rfc.iref.150"></div> |
2455 | | <div id="rfc.iref.s.12"></div> |
2456 | | <h3 id="rfc.section.10.2.7"><a href="#rfc.section.10.2.7">10.2.7</a> <a id="status.206" href="#status.206">206 Partial Content</a></h3> |
2457 | | <p id="rfc.section.10.2.7.p.1">The server has fulfilled the partial GET request for the resource. The request <em class="bcp14">MUST</em> have included a Range header field (<a href="#header.range" id="rfc.xref.header.range.4" title="Range">Section 14.35</a>) indicating the desired range, and <em class="bcp14">MAY</em> have included an If-Range header field (<a href="#header.if-range" id="rfc.xref.header.if-range.3" title="If-Range">Section 14.27</a>) to make the request conditional. |
2458 | | </p> |
2459 | | <p id="rfc.section.10.2.7.p.2">The response <em class="bcp14">MUST</em> include the following header fields: |
2460 | | </p> |
2461 | | <ul> |
2462 | | <li>Either a Content-Range header field (<a href="#header.content-range" id="rfc.xref.header.content-range.4" title="Content-Range">Section 14.16</a>) indicating the range included with this response, or a multipart/byteranges Content-Type including Content-Range fields |
2463 | | for each part. If a Content-Length header field is present in the response, its value <em class="bcp14">MUST</em> match the actual number of OCTETs transmitted in the message-body. |
2464 | | </li> |
2465 | | <li>Date</li> |
2466 | | <li>ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request</li> |
2467 | | <li>Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same |
2468 | | variant |
2469 | | </li> |
2470 | | </ul> |
2471 | | <p id="rfc.section.10.2.7.p.3">If the 206 response is the result of an If-Range request that used a strong cache validator (see <a href="#weak.and.strong.validators" title="Weak and Strong Validators">Section 13.3.3</a>), the response <em class="bcp14">SHOULD NOT</em> include other entity-headers. If the response is the result of an If-Range request that used a weak validator, the response <em class="bcp14">MUST NOT</em> include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. Otherwise, the |
2472 | | response <em class="bcp14">MUST</em> include all of the entity-headers that would have been returned with a 200 (OK) response to the same request. |
2473 | | </p> |
2474 | | <p id="rfc.section.10.2.7.p.4">A cache <em class="bcp14">MUST NOT</em> combine a 206 response with other previously cached content if the ETag or Last-Modified headers do not match exactly, see <a href="#combining.byte.ranges" title="Combining Byte Ranges">13.5.4</a>. |
2475 | | </p> |
2476 | | <p id="rfc.section.10.2.7.p.5">A cache that does not support the Range and Content-Range headers <em class="bcp14">MUST NOT</em> cache 206 (Partial) responses. |
2477 | | </p> |
2478 | | <h2 id="rfc.section.10.3"><a href="#rfc.section.10.3">10.3</a> <a id="status.3xx" href="#status.3xx">Redirection 3xx</a></h2> |
2479 | | <p id="rfc.section.10.3.p.1">This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. |
2480 | | The action required <em class="bcp14">MAY</em> be carried out by the user agent without interaction with the user if and only if the method used in the second request is |
2481 | | GET or HEAD. A client <em class="bcp14">SHOULD</em> detect infinite redirection loops, since such loops generate network traffic for each redirection. |
2482 | | </p> |
2483 | | <dl class="empty"> |
2484 | | <dd> <b>Note:</b> previous versions of this specification recommended a maximum of five redirections. Content developers should be aware that |
2485 | | there might be clients that implement such a fixed limitation. |
2486 | | </dd> |
2487 | | </dl> |
2488 | | <div id="rfc.iref.151"></div> |
2489 | | <div id="rfc.iref.s.13"></div> |
2490 | | <h3 id="rfc.section.10.3.1"><a href="#rfc.section.10.3.1">10.3.1</a> <a id="status.300" href="#status.300">300 Multiple Choices</a></h3> |
2491 | | <p id="rfc.section.10.3.1.p.1">The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent-driven |
2492 | | negotiation information (<a href="#content.negotiation" title="Content Negotiation">Section 12</a>) is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that |
2493 | | location. |
2494 | | </p> |
2495 | | <p id="rfc.section.10.3.1.p.2">Unless it was a HEAD request, the response <em class="bcp14">SHOULD</em> include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose |
2496 | | the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending |
2497 | | upon the format and the capabilities of the user agent, selection of the most appropriate choice <em class="bcp14">MAY</em> be performed automatically. However, this specification does not define any standard for such automatic selection. |
2498 | | </p> |
2499 | | <p id="rfc.section.10.3.1.p.3">If the server has a preferred choice of representation, it <em class="bcp14">SHOULD</em> include the specific URI for that representation in the Location field; user agents <em class="bcp14">MAY</em> use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise. |
2500 | | </p> |
2501 | | <div id="rfc.iref.152"></div> |
2502 | | <div id="rfc.iref.s.14"></div> |
2503 | | <h3 id="rfc.section.10.3.2"><a href="#rfc.section.10.3.2">10.3.2</a> <a id="status.301" href="#status.301">301 Moved Permanently</a></h3> |
2504 | | <p id="rfc.section.10.3.2.p.1">The requested resource has been assigned a new permanent URI and any future references to this resource <em class="bcp14">SHOULD</em> use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI |
2505 | | to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise. |
2506 | | </p> |
2507 | | <p id="rfc.section.10.3.2.p.2">The new permanent URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s). |
2508 | | </p> |
2509 | | <p id="rfc.section.10.3.2.p.3">If the 301 status code is received in response to a request other than GET or HEAD, the user agent <em class="bcp14">MUST NOT</em> automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which |
2510 | | the request was issued. |
2511 | | </p> |
2512 | | <dl class="empty"> |
2513 | | <dd> <b>Note:</b> When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously |
2514 | | change it into a GET request. |
2515 | | </dd> |
2516 | | </dl> |
2517 | | <div id="rfc.iref.153"></div> |
2518 | | <div id="rfc.iref.s.15"></div> |
2519 | | <h3 id="rfc.section.10.3.3"><a href="#rfc.section.10.3.3">10.3.3</a> <a id="status.302" href="#status.302">302 Found</a></h3> |
2520 | | <p id="rfc.section.10.3.3.p.1">The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the |
2521 | | client <em class="bcp14">SHOULD</em> continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires |
2522 | | header field. |
2523 | | </p> |
2524 | | <p id="rfc.section.10.3.3.p.2">The temporary URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s). |
2525 | | </p> |
2526 | | <p id="rfc.section.10.3.3.p.3">If the 302 status code is received in response to a request other than GET or HEAD, the user agent <em class="bcp14">MUST NOT</em> automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which |
2527 | | the request was issued. |
2528 | | </p> |
2529 | | <dl class="empty"> |
2530 | | <dd> <b>Note:</b> RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most |
2531 | | existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless |
2532 | | of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear |
2533 | | which kind of reaction is expected of the client. |
2534 | | </dd> |
2535 | | </dl> |
2536 | | <div id="rfc.iref.154"></div> |
2537 | | <div id="rfc.iref.s.16"></div> |
2538 | | <h3 id="rfc.section.10.3.4"><a href="#rfc.section.10.3.4">10.3.4</a> <a id="status.303" href="#status.303">303 See Other</a></h3> |
2539 | | <p id="rfc.section.10.3.4.p.1">The response to the request can be found under a different URI and <em class="bcp14">SHOULD</em> be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script |
2540 | | to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested |
2541 | | resource. The 303 response <em class="bcp14">MUST NOT</em> be cached, but the response to the second (redirected) request might be cacheable. |
2542 | | </p> |
2543 | | <p id="rfc.section.10.3.4.p.2">The different URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s). |
2544 | | </p> |
2545 | | <dl class="empty"> |
2546 | | <dd> <b>Note:</b> Many pre-HTTP/1.1 user agents do not understand the 303 status. When interoperability with such clients is a concern, the |
2547 | | 302 status code may be used instead, since most user agents react to a 302 response as described here for 303. |
2548 | | </dd> |
2549 | | </dl> |
2550 | | <div id="rfc.iref.155"></div> |
2551 | | <div id="rfc.iref.s.17"></div> |
2552 | | <h3 id="rfc.section.10.3.5"><a href="#rfc.section.10.3.5">10.3.5</a> <a id="status.304" href="#status.304">304 Not Modified</a></h3> |
2553 | | <p id="rfc.section.10.3.5.p.1">If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server <em class="bcp14">SHOULD</em> respond with this status code. The 304 response <em class="bcp14">MUST NOT</em> contain a message-body, and thus is always terminated by the first empty line after the header fields. |
2554 | | </p> |
2555 | | <p id="rfc.section.10.3.5.p.2">The response <em class="bcp14">MUST</em> include the following header fields: |
2556 | | </p> |
2557 | | <ul> |
2558 | | <li>Date, unless its omission is required by <a href="#clockless.origin.server.operation" title="Clockless Origin Server Operation">Section 14.18.1</a></li> |
2559 | | </ul> |
2560 | | <p id="rfc.section.10.3.5.p.3">If a clockless origin server obeys these rules, and proxies and clients add their own Date to any response received without |
2561 | | one (as already specified by [RFC 2068], section <a href="http://tools.ietf.org/html/rfc2068#section-14.19" id="rfc.xref.RFC2068.4">14.19</a>), caches will operate correctly. |
2562 | | </p> |
2563 | | <ul> |
2564 | | <li>ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request</li> |
2565 | | <li>Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same |
2566 | | variant |
2567 | | </li> |
2568 | | </ul> |
2569 | | <p id="rfc.section.10.3.5.p.4">If the conditional GET used a strong cache validator (see <a href="#weak.and.strong.validators" title="Weak and Strong Validators">Section 13.3.3</a>), the response <em class="bcp14">SHOULD NOT</em> include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response <em class="bcp14">MUST NOT</em> include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. |
2570 | | </p> |
2571 | | <p id="rfc.section.10.3.5.p.5">If a 304 response indicates an entity not currently cached, then the cache <em class="bcp14">MUST</em> disregard the response and repeat the request without the conditional. |
2572 | | </p> |
2573 | | <p id="rfc.section.10.3.5.p.6">If a cache uses a received 304 response to update a cache entry, the cache <em class="bcp14">MUST</em> update the entry to reflect any new field values given in the response. |
2574 | | </p> |
2575 | | <div id="rfc.iref.156"></div> |
2576 | | <div id="rfc.iref.s.18"></div> |
2577 | | <h3 id="rfc.section.10.3.6"><a href="#rfc.section.10.3.6">10.3.6</a> <a id="status.305" href="#status.305">305 Use Proxy</a></h3> |
2578 | | <p id="rfc.section.10.3.6.p.1">The requested resource <em class="bcp14">MUST</em> be accessed through the proxy given by the Location field. The Location field gives the URI of the proxy. The recipient is |
2579 | | expected to repeat this single request via the proxy. 305 responses <em class="bcp14">MUST</em> only be generated by origin servers. |
2580 | | </p> |
2581 | | <dl class="empty"> |
2582 | | <dd> <b>Note:</b> RFC 2068 was not clear that 305 was intended to redirect a single request, and to be generated by origin servers only. Not |
2583 | | observing these limitations has significant security consequences. |
2584 | | </dd> |
2585 | | </dl> |
2586 | | <div id="rfc.iref.157"></div> |
2587 | | <div id="rfc.iref.s.19"></div> |
2588 | | <h3 id="rfc.section.10.3.7"><a href="#rfc.section.10.3.7">10.3.7</a> <a id="status.306" href="#status.306">306 (Unused)</a></h3> |
2589 | | <p id="rfc.section.10.3.7.p.1">The 306 status code was used in a previous version of the specification, is no longer used, and the code is reserved.</p> |
2590 | | <div id="rfc.iref.158"></div> |
2591 | | <div id="rfc.iref.s.20"></div> |
2592 | | <h3 id="rfc.section.10.3.8"><a href="#rfc.section.10.3.8">10.3.8</a> <a id="status.307" href="#status.307">307 Temporary Redirect</a></h3> |
2593 | | <p id="rfc.section.10.3.8.p.1">The requested resource resides temporarily under a different URI. Since the redirection <em class="bcp14">MAY</em> be altered on occasion, the client <em class="bcp14">SHOULD</em> continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires |
2594 | | header field. |
2595 | | </p> |
2596 | | <p id="rfc.section.10.3.8.p.2">The temporary URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s) , since many pre-HTTP/1.1 user agents do not understand |
2597 | | the 307 status. Therefore, the note <em class="bcp14">SHOULD</em> contain the information necessary for a user to repeat the original request on the new URI. |
2598 | | </p> |
2599 | | <p id="rfc.section.10.3.8.p.3">If the 307 status code is received in response to a request other than GET or HEAD, the user agent <em class="bcp14">MUST NOT</em> automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which |
2600 | | the request was issued. |
2601 | | </p> |
2602 | | <h2 id="rfc.section.10.4"><a href="#rfc.section.10.4">10.4</a> <a id="status.4xx" href="#status.4xx">Client Error 4xx</a></h2> |
2603 | | <p id="rfc.section.10.4.p.1">The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD |
2604 | | request, the server <em class="bcp14">SHOULD</em> include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. |
2605 | | These status codes are applicable to any request method. User agents <em class="bcp14">SHOULD</em> display any included entity to the user. |
2606 | | </p> |
2607 | | <p id="rfc.section.10.4.p.2">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 |
2608 | | the input connection. If the client continues sending data to the server after the close, the server's TCP stack will send |
2609 | | a reset packet to the client, which may erase the client's unacknowledged input buffers before they can be read and interpreted |
2610 | | by the HTTP application. |
2611 | | </p> |
2612 | | <div id="rfc.iref.159"></div> |
2613 | | <div id="rfc.iref.s.21"></div> |
2614 | | <h3 id="rfc.section.10.4.1"><a href="#rfc.section.10.4.1">10.4.1</a> <a id="status.400" href="#status.400">400 Bad Request</a></h3> |
2615 | | <p id="rfc.section.10.4.1.p.1">The request could not be understood by the server due to malformed syntax. The client <em class="bcp14">SHOULD NOT</em> repeat the request without modifications. |
2616 | | </p> |
2617 | | <div id="rfc.iref.160"></div> |
2618 | | <div id="rfc.iref.s.22"></div> |
2619 | | <h3 id="rfc.section.10.4.2"><a href="#rfc.section.10.4.2">10.4.2</a> <a id="status.401" href="#status.401">401 Unauthorized</a></h3> |
2620 | | <p id="rfc.section.10.4.2.p.1">The request requires user authentication. The response <em class="bcp14">MUST</em> include a WWW-Authenticate header field (<a href="#header.www-authenticate" id="rfc.xref.header.www-authenticate.2" title="WWW-Authenticate">Section 14.47</a>) containing a challenge applicable to the requested resource. The client <em class="bcp14">MAY</em> repeat the request with a suitable Authorization header field (<a href="#header.authorization" id="rfc.xref.header.authorization.2" title="Authorization">Section 14.8</a>). If the request already included Authorization credentials, then the 401 response indicates that authorization has been |
2621 | | refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has |
2622 | | already attempted authentication at least once, then the user <em class="bcp14">SHOULD</em> be presented the entity that was given in the response, since that entity might include relevant diagnostic information. HTTP |
2623 | | access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication" <a href="#RFC2617" id="rfc.xref.RFC2617.1"><cite title="HTTP Authentication: Basic and Digest Access Authentication">[43]</cite></a>. |
2624 | | </p> |
2625 | | <div id="rfc.iref.161"></div> |
2626 | | <div id="rfc.iref.s.23"></div> |
2627 | | <h3 id="rfc.section.10.4.3"><a href="#rfc.section.10.4.3">10.4.3</a> <a id="status.402" href="#status.402">402 Payment Required</a></h3> |
2628 | | <p id="rfc.section.10.4.3.p.1">This code is reserved for future use.</p> |
2629 | | <div id="rfc.iref.162"></div> |
2630 | | <div id="rfc.iref.s.24"></div> |
2631 | | <h3 id="rfc.section.10.4.4"><a href="#rfc.section.10.4.4">10.4.4</a> <a id="status.403" href="#status.403">403 Forbidden</a></h3> |
2632 | | <p id="rfc.section.10.4.4.p.1">The server understood the request, but is refusing to fulfill it. Authorization will not help and the request <em class="bcp14">SHOULD NOT</em> be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, |
2633 | | it <em class="bcp14">SHOULD</em> describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, |
2634 | | the status code 404 (Not Found) can be used instead. |
2635 | | </p> |
2636 | | <div id="rfc.iref.163"></div> |
2637 | | <div id="rfc.iref.s.25"></div> |
2638 | | <h3 id="rfc.section.10.4.5"><a href="#rfc.section.10.4.5">10.4.5</a> <a id="status.404" href="#status.404">404 Not Found</a></h3> |
2639 | | <p id="rfc.section.10.4.5.p.1">The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or |
2640 | | permanent. The 410 (Gone) status code <em class="bcp14">SHOULD</em> be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable |
2641 | | and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request |
2642 | | has been refused, or when no other response is applicable. |
2643 | | </p> |
2644 | | <div id="rfc.iref.164"></div> |
2645 | | <div id="rfc.iref.s.26"></div> |
2646 | | <h3 id="rfc.section.10.4.6"><a href="#rfc.section.10.4.6">10.4.6</a> <a id="status.405" href="#status.405">405 Method Not Allowed</a></h3> |
2647 | | <p id="rfc.section.10.4.6.p.1">The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response <em class="bcp14">MUST</em> include an Allow header containing a list of valid methods for the requested resource. |
2648 | | </p> |
2649 | | <div id="rfc.iref.165"></div> |
2650 | | <div id="rfc.iref.s.27"></div> |
2651 | | <h3 id="rfc.section.10.4.7"><a href="#rfc.section.10.4.7">10.4.7</a> <a id="status.406" href="#status.406">406 Not Acceptable</a></h3> |
2652 | | <p id="rfc.section.10.4.7.p.1">The resource identified by the request is only capable of generating response entities which have content characteristics |
2653 | | not acceptable according to the accept headers sent in the request. |
2654 | | </p> |
2655 | | <p id="rfc.section.10.4.7.p.2">Unless it was a HEAD request, the response <em class="bcp14">SHOULD</em> include an entity containing a list of available entity characteristics and location(s) from which the user or user agent |
2656 | | can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. |
2657 | | Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice <em class="bcp14">MAY</em> be performed automatically. However, this specification does not define any standard for such automatic selection. |
2658 | | </p> |
2659 | | <dl class="empty"> |
2660 | | <dd> <b>Note:</b> HTTP/1.1 servers are allowed to return responses which are not acceptable according to the accept headers sent in the request. |
2661 | | In some cases, this may even be preferable to sending a 406 response. User agents are encouraged to inspect the headers of |
2662 | | an incoming response to determine if it is acceptable. |
2663 | | </dd> |
2664 | | </dl> |
2665 | | <p id="rfc.section.10.4.7.p.3">If the response could be unacceptable, a user agent <em class="bcp14">SHOULD</em> temporarily stop receipt of more data and query the user for a decision on further actions. |
2666 | | </p> |
2667 | | <div id="rfc.iref.166"></div> |
2668 | | <div id="rfc.iref.s.28"></div> |
2669 | | <h3 id="rfc.section.10.4.8"><a href="#rfc.section.10.4.8">10.4.8</a> <a id="status.407" href="#status.407">407 Proxy Authentication Required</a></h3> |
2670 | | <p id="rfc.section.10.4.8.p.1">This code is similar to 401 (Unauthorized), but indicates that the client must first authenticate itself with the proxy. The |
2671 | | proxy <em class="bcp14">MUST</em> return a Proxy-Authenticate header field (<a href="#header.proxy-authenticate" id="rfc.xref.header.proxy-authenticate.2" title="Proxy-Authenticate">Section 14.33</a>) containing a challenge applicable to the proxy for the requested resource. The client <em class="bcp14">MAY</em> repeat the request with a suitable Proxy-Authorization header field (<a href="#header.proxy-authorization" id="rfc.xref.header.proxy-authorization.2" title="Proxy-Authorization">Section 14.34</a>). HTTP access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication" <a href="#RFC2617" id="rfc.xref.RFC2617.2"><cite title="HTTP Authentication: Basic and Digest Access Authentication">[43]</cite></a>. |
2672 | | </p> |
2673 | | <div id="rfc.iref.167"></div> |
2674 | | <div id="rfc.iref.s.29"></div> |
2675 | | <h3 id="rfc.section.10.4.9"><a href="#rfc.section.10.4.9">10.4.9</a> <a id="status.408" href="#status.408">408 Request Timeout</a></h3> |
2676 | | <p id="rfc.section.10.4.9.p.1">The client did not produce a request within the time that the server was prepared to wait. The client <em class="bcp14">MAY</em> repeat the request without modifications at any later time. |
2677 | | </p> |
2678 | | <div id="rfc.iref.168"></div> |
2679 | | <div id="rfc.iref.s.30"></div> |
2680 | | <h3 id="rfc.section.10.4.10"><a href="#rfc.section.10.4.10">10.4.10</a> <a id="status.409" href="#status.409">409 Conflict</a></h3> |
2681 | | <p id="rfc.section.10.4.10.p.1">The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in |
2682 | | situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response |
2683 | | body <em class="bcp14">SHOULD</em> include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include |
2684 | | enough information for the user or user agent to fix the problem; however, that might not be possible and is not required. |
2685 | | </p> |
2686 | | <p id="rfc.section.10.4.10.p.2">Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity |
2687 | | being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might |
2688 | | use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain |
2689 | | a list of the differences between the two versions in a format defined by the response Content-Type. |
2690 | | </p> |
2691 | | <div id="rfc.iref.169"></div> |
2692 | | <div id="rfc.iref.s.31"></div> |
2693 | | <h3 id="rfc.section.10.4.11"><a href="#rfc.section.10.4.11">10.4.11</a> <a id="status.410" href="#status.410">410 Gone</a></h3> |
2694 | | <p id="rfc.section.10.4.11.p.1">The requested resource is no longer available at the server and no forwarding address is known. This condition is expected |
2695 | | to be considered permanent. Clients with link editing capabilities <em class="bcp14">SHOULD</em> delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether |
2696 | | or not the condition is permanent, the status code 404 (Not Found) <em class="bcp14">SHOULD</em> be used instead. This response is cacheable unless indicated otherwise. |
2697 | | </p> |
2698 | | <p id="rfc.section.10.4.11.p.2">The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource |
2699 | | is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event |
2700 | | is common for limited-time, promotional services and for resources belonging to individuals no longer working at the server's |
2701 | | site. It is not necessary to mark all permanently unavailable resources as "gone" or to keep the mark for any length of time |
2702 | | -- that is left to the discretion of the server owner. |
2703 | | </p> |
2704 | | <div id="rfc.iref.170"></div> |
2705 | | <div id="rfc.iref.s.32"></div> |
2706 | | <h3 id="rfc.section.10.4.12"><a href="#rfc.section.10.4.12">10.4.12</a> <a id="status.411" href="#status.411">411 Length Required</a></h3> |
2707 | | <p id="rfc.section.10.4.12.p.1">The server refuses to accept the request without a defined Content-Length. The client <em class="bcp14">MAY</em> repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request |
2708 | | message. |
2709 | | </p> |
2710 | | <div id="rfc.iref.171"></div> |
2711 | | <div id="rfc.iref.s.33"></div> |
2712 | | <h3 id="rfc.section.10.4.13"><a href="#rfc.section.10.4.13">10.4.13</a> <a id="status.412" href="#status.412">412 Precondition Failed</a></h3> |
2713 | | <p id="rfc.section.10.4.13.p.1">The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This |
2714 | | response code allows the client to place preconditions on the current resource metainformation (header field data) and thus |
2715 | | prevent the requested method from being applied to a resource other than the one intended. |
2716 | | </p> |
2717 | | <div id="rfc.iref.172"></div> |
2718 | | <div id="rfc.iref.s.34"></div> |
2719 | | <h3 id="rfc.section.10.4.14"><a href="#rfc.section.10.4.14">10.4.14</a> <a id="status.413" href="#status.413">413 Request Entity Too Large</a></h3> |
2720 | | <p id="rfc.section.10.4.14.p.1">The server is refusing to process a request because the request entity is larger than the server is willing or able to process. |
2721 | | The server <em class="bcp14">MAY</em> close the connection to prevent the client from continuing the request. |
2722 | | </p> |
2723 | | <p id="rfc.section.10.4.14.p.2">If the condition is temporary, the server <em class="bcp14">SHOULD</em> include a Retry-After header field to indicate that it is temporary and after what time the client <em class="bcp14">MAY</em> try again. |
2724 | | </p> |
2725 | | <div id="rfc.iref.173"></div> |
2726 | | <div id="rfc.iref.s.35"></div> |
2727 | | <h3 id="rfc.section.10.4.15"><a href="#rfc.section.10.4.15">10.4.15</a> <a id="status.414" href="#status.414">414 Request-URI Too Long</a></h3> |
2728 | | <p id="rfc.section.10.4.15.p.1">The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This |
2729 | | rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query |
2730 | | information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points |
2731 | | to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some |
2732 | | servers using fixed-length buffers for reading or manipulating the Request-URI. |
2733 | | </p> |
2734 | | <div id="rfc.iref.174"></div> |
2735 | | <div id="rfc.iref.s.36"></div> |
2736 | | <h3 id="rfc.section.10.4.16"><a href="#rfc.section.10.4.16">10.4.16</a> <a id="status.415" href="#status.415">415 Unsupported Media Type</a></h3> |
2737 | | <p id="rfc.section.10.4.16.p.1">The server is refusing to service the request because the entity of the request is in a format not supported by the requested |
2738 | | resource for the requested method. |
2739 | | </p> |
2740 | | <div id="rfc.iref.175"></div> |
2741 | | <div id="rfc.iref.s.37"></div> |
2742 | | <h3 id="rfc.section.10.4.17"><a href="#rfc.section.10.4.17">10.4.17</a> <a id="status.416" href="#status.416">416 Requested Range Not Satisfiable</a></h3> |
2743 | | <p id="rfc.section.10.4.17.p.1">A server <em class="bcp14">SHOULD</em> return a response with this status code if a request included a Range request-header field (<a href="#header.range" id="rfc.xref.header.range.5" title="Range">Section 14.35</a>), and none of the range-specifier values in this field overlap the current extent of the selected resource, and the request |
2744 | | did not include an If-Range request-header field. (For byte-ranges, this means that the first-byte-pos of all of the byte-range-spec |
2745 | | values were greater than the current length of the selected resource.) |
2746 | | </p> |
2747 | | <p id="rfc.section.10.4.17.p.2">When this status code is returned for a byte-range request, the response <em class="bcp14">SHOULD</em> include a Content-Range entity-header field specifying the current length of the selected resource (see <a href="#header.content-range" id="rfc.xref.header.content-range.5" title="Content-Range">Section 14.16</a>). This response <em class="bcp14">MUST NOT</em> use the multipart/byteranges content-type. |
2748 | | </p> |
2749 | | <div id="rfc.iref.176"></div> |
2750 | | <div id="rfc.iref.s.38"></div> |
2751 | | <h3 id="rfc.section.10.4.18"><a href="#rfc.section.10.4.18">10.4.18</a> <a id="status.417" href="#status.417">417 Expectation Failed</a></h3> |
2752 | | <p id="rfc.section.10.4.18.p.1">The expectation given in an Expect request-header field (see <a href="#header.expect" id="rfc.xref.header.expect.4" title="Expect">Section 14.20</a>) could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could |
2753 | | not be met by the next-hop server. |
2754 | | </p> |
2755 | | <h2 id="rfc.section.10.5"><a href="#rfc.section.10.5">10.5</a> <a id="status.5xx" href="#status.5xx">Server Error 5xx</a></h2> |
2756 | | <p id="rfc.section.10.5.p.1">Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable |
2757 | | of performing the request. Except when responding to a HEAD request, the server <em class="bcp14">SHOULD</em> include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. |
2758 | | User agents <em class="bcp14">SHOULD</em> display any included entity to the user. These response codes are applicable to any request method. |
2759 | | </p> |
2760 | | <div id="rfc.iref.177"></div> |
2761 | | <div id="rfc.iref.s.39"></div> |
2762 | | <h3 id="rfc.section.10.5.1"><a href="#rfc.section.10.5.1">10.5.1</a> <a id="status.500" href="#status.500">500 Internal Server Error</a></h3> |
2763 | | <p id="rfc.section.10.5.1.p.1">The server encountered an unexpected condition which prevented it from fulfilling the request.</p> |
2764 | | <div id="rfc.iref.178"></div> |
2765 | | <div id="rfc.iref.s.40"></div> |
2766 | | <h3 id="rfc.section.10.5.2"><a href="#rfc.section.10.5.2">10.5.2</a> <a id="status.501" href="#status.501">501 Not Implemented</a></h3> |
2767 | | <p id="rfc.section.10.5.2.p.1">The server does not support the functionality required to fulfill the request. This is the appropriate response when the server |
2768 | | does not recognize the request method and is not capable of supporting it for any resource. |
2769 | | </p> |
2770 | | <div id="rfc.iref.179"></div> |
2771 | | <div id="rfc.iref.s.41"></div> |
2772 | | <h3 id="rfc.section.10.5.3"><a href="#rfc.section.10.5.3">10.5.3</a> <a id="status.502" href="#status.502">502 Bad Gateway</a></h3> |
2773 | | <p id="rfc.section.10.5.3.p.1">The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting |
2774 | | to fulfill the request. |
2775 | | </p> |
2776 | | <div id="rfc.iref.180"></div> |
2777 | | <div id="rfc.iref.s.42"></div> |
2778 | | <h3 id="rfc.section.10.5.4"><a href="#rfc.section.10.5.4">10.5.4</a> <a id="status.503" href="#status.503">503 Service Unavailable</a></h3> |
2779 | | <p id="rfc.section.10.5.4.p.1">The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication |
2780 | | is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay <em class="bcp14">MAY</em> be indicated in a Retry-After header. If no Retry-After is given, the client <em class="bcp14">SHOULD</em> handle the response as it would for a 500 response. |
2781 | | </p> |
2782 | | <dl class="empty"> |
2783 | | <dd> <b>Note:</b> The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish |
2784 | | to simply refuse the connection. |
2785 | | </dd> |
2786 | | </dl> |
2787 | | <div id="rfc.iref.181"></div> |
2788 | | <div id="rfc.iref.s.43"></div> |
2789 | | <h3 id="rfc.section.10.5.5"><a href="#rfc.section.10.5.5">10.5.5</a> <a id="status.504" href="#status.504">504 Gateway Timeout</a></h3> |
2790 | | <p id="rfc.section.10.5.5.p.1">The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the |
2791 | | URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request. |
2792 | | </p> |
2793 | | <dl class="empty"> |
2794 | | <dd> <b>Note:</b> Note to implementors: some deployed proxies are known to return 400 or 500 when DNS lookups time out. |
2795 | | </dd> |
2796 | | </dl> |
2797 | | <div id="rfc.iref.182"></div> |
2798 | | <div id="rfc.iref.s.44"></div> |
2799 | | <h3 id="rfc.section.10.5.6"><a href="#rfc.section.10.5.6">10.5.6</a> <a id="status.505" href="#status.505">505 HTTP Version Not Supported</a></h3> |
2800 | | <p id="rfc.section.10.5.6.p.1">The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server |
2801 | | is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described |
2802 | | in <a href="#http.version" title="HTTP Version">Section 3.1</a>, other than with this error message. The response <em class="bcp14">SHOULD</em> contain an entity describing why that version is not supported and what other protocols are supported by that server. |
2803 | | </p> |
2804 | | <h1 id="rfc.section.11"><a href="#rfc.section.11">11.</a> <a id="access.authentication" href="#access.authentication">Access Authentication</a></h1> |
2805 | | <p id="rfc.section.11.p.1">HTTP provides several <em class="bcp14">OPTIONAL</em> challenge-response authentication mechanisms which can be used by a server to challenge a client request and by a client to |
2806 | | provide authentication information. The general framework for access authentication, and the specification of "basic" and |
2807 | | "digest" authentication, are specified in "HTTP Authentication: Basic and Digest Access Authentication" <a href="#RFC2617" id="rfc.xref.RFC2617.3"><cite title="HTTP Authentication: Basic and Digest Access Authentication">[43]</cite></a>. This specification adopts the definitions of "challenge" and "credentials" from that specification. |
2808 | | </p> |
2809 | | <h1 id="rfc.section.12"><a href="#rfc.section.12">12.</a> <a id="content.negotiation" href="#content.negotiation">Content Negotiation</a></h1> |
2810 | | <p id="rfc.section.12.p.1">Most HTTP responses include an entity which contains information for interpretation by a human user. Naturally, it is desirable |
2811 | | to supply the user with the "best available" entity corresponding to the request. Unfortunately for servers and caches, not |
2812 | | all users have the same preferences for what is "best," and not all user agents are equally capable of rendering all entity |
2813 | | types. For that reason, HTTP has provisions for several mechanisms for "content negotiation" -- the process of selecting the |
2814 | | best representation for a given response when there are multiple representations available. |
2815 | | </p> |
2816 | | <dl class="empty"> |
2817 | | <dd> <b>Note:</b> This is not called "format negotiation" because the alternate representations may be of the same media type, but use different |
2818 | | capabilities of that type, be in different languages, etc. |
2819 | | </dd> |
2820 | | </dl> |
2821 | | <p id="rfc.section.12.p.2">Any response containing an entity-body <em class="bcp14">MAY</em> be subject to negotiation, including error responses. |
2822 | | </p> |
2823 | | <p id="rfc.section.12.p.3">There are two kinds of content negotiation which are possible in HTTP: server-driven and agent-driven negotiation. These two |
2824 | | kinds of negotiation are orthogonal and thus may be used separately or in combination. One method of combination, referred |
2825 | | to as transparent negotiation, occurs when a cache uses the agent-driven negotiation information provided by the origin server |
2826 | | in order to provide server-driven negotiation for subsequent requests. |
2827 | | </p> |
2828 | | <h2 id="rfc.section.12.1"><a href="#rfc.section.12.1">12.1</a> <a id="server-driven.negotiation" href="#server-driven.negotiation">Server-driven Negotiation</a></h2> |
2829 | | <p id="rfc.section.12.1.p.1">If the selection of the best representation for a response is made by an algorithm located at the server, it is called server-driven |
2830 | | negotiation. Selection is based on the available representations of the response (the dimensions over which it can vary; e.g. |
2831 | | language, content-coding, etc.) and the contents of particular header fields in the request message or on other information |
2832 | | pertaining to the request (such as the network address of the client). |
2833 | | </p> |
2834 | | <p id="rfc.section.12.1.p.2">Server-driven negotiation is advantageous when the algorithm for selecting from among the available representations is difficult |
2835 | | to describe to the user agent, or when the server desires to send its "best guess" to the client along with the first response |
2836 | | (hoping to avoid the round-trip delay of a subsequent request if the "best guess" is good enough for the user). In order to |
2837 | | improve the server's guess, the user agent <em class="bcp14">MAY</em> include request header fields (Accept, Accept-Language, Accept-Encoding, etc.) which describe its preferences for such a response. |
2838 | | </p> |
2839 | | <p id="rfc.section.12.1.p.3">Server-driven negotiation has disadvantages: </p> |
2840 | | <ol> |
2841 | | <li>It is impossible for the server to accurately determine what might be "best" for any given user, since that would require |
2842 | | complete knowledge of both the capabilities of the user agent and the intended use for the response (e.g., does the user want |
2843 | | to view it on screen or print it on paper?). |
2844 | | </li> |
2845 | | <li>Having the user agent describe its capabilities in every request can be both very inefficient (given that only a small percentage |
2846 | | of responses have multiple representations) and a potential violation of the user's privacy. |
2847 | | </li> |
2848 | | <li>It complicates the implementation of an origin server and the algorithms for generating responses to a request.</li> |
2849 | | <li>It may limit a public cache's ability to use the same response for multiple user's requests.</li> |
2850 | | </ol> |
2851 | | <p id="rfc.section.12.1.p.4">HTTP/1.1 includes the following request-header fields for enabling server-driven negotiation through description of user agent |
2852 | | capabilities and user preferences: Accept (<a href="#header.accept" id="rfc.xref.header.accept.3" title="Accept">Section 14.1</a>), Accept-Charset (<a href="#header.accept-charset" id="rfc.xref.header.accept-charset.2" title="Accept-Charset">Section 14.2</a>), Accept-Encoding (<a href="#header.accept-encoding" id="rfc.xref.header.accept-encoding.3" title="Accept-Encoding">Section 14.3</a>), Accept-Language (<a href="#header.accept-language" id="rfc.xref.header.accept-language.2" title="Accept-Language">Section 14.4</a>), and User-Agent (<a href="#header.user-agent" id="rfc.xref.header.user-agent.2" title="User-Agent">Section 14.43</a>). However, an origin server is not limited to these dimensions and <em class="bcp14">MAY</em> vary the response based on any aspect of the request, including information outside the request-header fields or within extension |
2853 | | header fields not defined by this specification. |
2854 | | </p> |
2855 | | <p id="rfc.section.12.1.p.5">The Vary header field can be used to express the parameters the server uses to select a representation that is subject to |
2856 | | server-driven negotiation. See <a href="#caching.negotiated.responses" title="Caching Negotiated Responses">Section 13.6</a> for use of the Vary header field by caches and <a href="#header.vary" id="rfc.xref.header.vary.2" title="Vary">Section 14.44</a> for use of the Vary header field by servers. |
2857 | | </p> |
2858 | | <h2 id="rfc.section.12.2"><a href="#rfc.section.12.2">12.2</a> <a id="agent-driven.negotiation" href="#agent-driven.negotiation">Agent-driven Negotiation</a></h2> |
2859 | | <p id="rfc.section.12.2.p.1">With agent-driven negotiation, selection of the best representation for a response is performed by the user agent after receiving |
2860 | | an initial response from the origin server. Selection is based on a list of the available representations of the response |
2861 | | included within the header fields or entity-body of the initial response, with each representation identified by its own URI. |
2862 | | Selection from among the representations may be performed automatically (if the user agent is capable of doing so) or manually |
2863 | | by the user selecting from a generated (possibly hypertext) menu. |
2864 | | </p> |
2865 | | <p id="rfc.section.12.2.p.2">Agent-driven negotiation is advantageous when the response would vary over commonly-used dimensions (such as type, language, |
2866 | | or encoding), when the origin server is unable to determine a user agent's capabilities from examining the request, and generally |
2867 | | when public caches are used to distribute server load and reduce network usage. |
2868 | | </p> |
2869 | | <p id="rfc.section.12.2.p.3">Agent-driven negotiation suffers from the disadvantage of needing a second request to obtain the best alternate representation. |
2870 | | This second request is only efficient when caching is used. In addition, this specification does not define any mechanism |
2871 | | for supporting automatic selection, though it also does not prevent any such mechanism from being developed as an extension |
2872 | | and used within HTTP/1.1. |
2873 | | </p> |
2874 | | <p id="rfc.section.12.2.p.4">HTTP/1.1 defines the 300 (Multiple Choices) and 406 (Not Acceptable) status codes for enabling agent-driven negotiation when |
2875 | | the server is unwilling or unable to provide a varying response using server-driven negotiation. |
2876 | | </p> |
2877 | | <h2 id="rfc.section.12.3"><a href="#rfc.section.12.3">12.3</a> <a id="transparent.negotiation" href="#transparent.negotiation">Transparent Negotiation</a></h2> |
2878 | | <p id="rfc.section.12.3.p.1">Transparent negotiation is a combination of both server-driven and agent-driven negotiation. When a cache is supplied with |
2879 | | a form of the list of available representations of the response (as in agent-driven negotiation) and the dimensions of variance |
2880 | | are completely understood by the cache, then the cache becomes capable of performing server-driven negotiation on behalf of |
2881 | | the origin server for subsequent requests on that resource. |
2882 | | </p> |
2883 | | <p id="rfc.section.12.3.p.2">Transparent negotiation has the advantage of distributing the negotiation work that would otherwise be required of the origin |
2884 | | server and also removing the second request delay of agent-driven negotiation when the cache is able to correctly guess the |
2885 | | right response. |
2886 | | </p> |
2887 | | <p id="rfc.section.12.3.p.3">This specification does not define any mechanism for transparent negotiation, though it also does not prevent any such mechanism |
2888 | | from being developed as an extension that could be used within HTTP/1.1. |
2889 | | </p> |
2890 | | <h1 id="rfc.section.13"><a href="#rfc.section.13">13.</a> <a id="caching" href="#caching">Caching in HTTP</a></h1> |
2891 | | <p id="rfc.section.13.p.1">HTTP is typically used for distributed information systems, where performance can be improved by the use of response caches. |
2892 | | The HTTP/1.1 protocol includes a number of elements intended to make caching work as well as possible. Because these elements |
2893 | | are inextricable from other aspects of the protocol, and because they interact with each other, it is useful to describe the |
2894 | | basic caching design of HTTP separately from the detailed descriptions of methods, headers, response codes, etc. |
2895 | | </p> |
2896 | | <p id="rfc.section.13.p.2">Caching would be useless if it did not significantly improve performance. The goal of caching in HTTP/1.1 is to eliminate |
2897 | | the need to send requests in many cases, and to eliminate the need to send full responses in many other cases. The former |
2898 | | reduces the number of network round-trips required for many operations; we use an "expiration" mechanism for this purpose |
2899 | | (see <a href="#expiration.model" title="Expiration Model">Section 13.2</a>). The latter reduces network bandwidth requirements; we use a "validation" mechanism for this purpose (see <a href="#validation.model" title="Validation Model">Section 13.3</a>). |
2900 | | </p> |
2901 | | <p id="rfc.section.13.p.3">Requirements for performance, availability, and disconnected operation require us to be able to relax the goal of semantic |
2902 | | transparency. The HTTP/1.1 protocol allows origin servers, caches, and clients to explicitly reduce transparency when necessary. |
2903 | | However, because non-transparent operation may confuse non-expert users, and might be incompatible with certain server applications |
2904 | | (such as those for ordering merchandise), the protocol requires that transparency be relaxed |
2905 | | </p> |
2906 | | <ul> |
2907 | | <li>only by an explicit protocol-level request when relaxed by client or origin server</li> |
2908 | | <li>only with an explicit warning to the end user when relaxed by cache or client</li> |
2909 | | </ul> |
2910 | | <p id="rfc.section.13.p.4">Therefore, the HTTP/1.1 protocol provides these important elements: </p> |
2911 | | <ol> |
2912 | | <li>Protocol features that provide full semantic transparency when this is required by all parties.</li> |
2913 | | <li>Protocol features that allow an origin server or user agent to explicitly request and control non-transparent operation.</li> |
2914 | | <li>Protocol features that allow a cache to attach warnings to responses that do not preserve the requested approximation of semantic |
2915 | | transparency. |
2916 | | </li> |
2917 | | </ol> |
2918 | | <p id="rfc.section.13.p.5">A basic principle is that it must be possible for the clients to detect any potential relaxation of semantic transparency. </p> |
2919 | | <dl class="empty"> |
2920 | | <dd> <b>Note:</b> The server, cache, or client implementor might be faced with design decisions not explicitly discussed in this specification. |
2921 | | If a decision might affect semantic transparency, the implementor ought to err on the side of maintaining transparency unless |
2922 | | a careful and complete analysis shows significant benefits in breaking transparency. |
2923 | | </dd> |
2924 | | </dl> |
2925 | | <h2 id="rfc.section.13.1"><a href="#rfc.section.13.1">13.1</a> |
2926 | | </h2> |
2927 | | <h3 id="rfc.section.13.1.1"><a href="#rfc.section.13.1.1">13.1.1</a> <a id="cache.correctness" href="#cache.correctness">Cache Correctness</a></h3> |
2928 | | <p id="rfc.section.13.1.1.p.1">A correct cache <em class="bcp14">MUST</em> respond to a request with the most up-to-date response held by the cache that is appropriate to the request (see sections <a href="#disambiguating.expiration.values" title="Disambiguating Expiration Values">13.2.5</a>, <a href="#disambiguating.multiple.responses" title="Disambiguating Multiple Responses">13.2.6</a>, and <a href="#cache.replacement" title="Cache Replacement">13.12</a>) which meets one of the following conditions: |
2929 | | </p> |
2930 | | <ol> |
2931 | | <li>It has been checked for equivalence with what the origin server would have returned by revalidating the response with the |
2932 | | origin server (<a href="#validation.model" title="Validation Model">Section 13.3</a>); |
2933 | | </li> |
2934 | | <li>It is "fresh enough" (see <a href="#expiration.model" title="Expiration Model">Section 13.2</a>). In the default case, this means it meets the least restrictive freshness requirement of the client, origin server, and |
2935 | | cache (see <a href="#header.cache-control" id="rfc.xref.header.cache-control.2" title="Cache-Control">Section 14.9</a>); if the origin server so specifies, it is the freshness requirement of the origin server alone. If a stored response is |
2936 | | not "fresh enough" by the most restrictive freshness requirement of both the client and the origin server, in carefully considered |
2937 | | circumstances the cache <em class="bcp14">MAY</em> still return the response with the appropriate Warning header (see section <a href="#exceptions.to.the.rules.and.warnings" title="Exceptions to the Rules and Warnings">13.1.5</a> and <a href="#header.warning" id="rfc.xref.header.warning.2" title="Warning">14.46</a>), unless such a response is prohibited (e.g., by a "no-store" cache-directive, or by a "no-cache" cache-request-directive; |
2938 | | see <a href="#header.cache-control" id="rfc.xref.header.cache-control.3" title="Cache-Control">Section 14.9</a>). |
2939 | | </li> |
2940 | | <li>It is an appropriate 304 (Not Modified), 305 (Proxy Redirect), or error (4xx or 5xx) response message.</li> |
2941 | | </ol> |
2942 | | <p id="rfc.section.13.1.1.p.2">If the cache can not communicate with the origin server, then a correct cache <em class="bcp14">SHOULD</em> respond as above if the response can be correctly served from the cache; if not it <em class="bcp14">MUST</em> return an error or warning indicating that there was a communication failure. |
2943 | | </p> |
2944 | | <p id="rfc.section.13.1.1.p.3">If a cache receives a response (either an entire response, or a 304 (Not Modified) response) that it would normally forward |
2945 | | to the requesting client, and the received response is no longer fresh, the cache <em class="bcp14">SHOULD</em> forward it to the requesting client without adding a new Warning (but without removing any existing Warning headers). A cache <em class="bcp14">SHOULD NOT</em> attempt to revalidate a response simply because that response became stale in transit; this might lead to an infinite loop. |
2946 | | A user agent that receives a stale response without a Warning <em class="bcp14">MAY</em> display a warning indication to the user. |
2947 | | </p> |
2948 | | <h3 id="rfc.section.13.1.2"><a href="#rfc.section.13.1.2">13.1.2</a> <a id="warnings" href="#warnings">Warnings</a></h3> |
2949 | | <p id="rfc.section.13.1.2.p.1">Whenever a cache returns a response that is neither first-hand nor "fresh enough" (in the sense of condition 2 in <a href="#cache.correctness" title="Cache Correctness">Section 13.1.1</a>), it <em class="bcp14">MUST</em> attach a warning to that effect, using a Warning general-header. The Warning header and the currently defined warnings are |
2950 | | described in <a href="#header.warning" id="rfc.xref.header.warning.3" title="Warning">Section 14.46</a>. The warning allows clients to take appropriate action. |
2951 | | </p> |
2952 | | <p id="rfc.section.13.1.2.p.2">Warnings <em class="bcp14">MAY</em> be used for other purposes, both cache-related and otherwise. The use of a warning, rather than an error status code, distinguish |
2953 | | these responses from true failures. |
2954 | | </p> |
2955 | | <p id="rfc.section.13.1.2.p.3">Warnings are assigned three digit warn-codes. The first digit indicates whether the Warning <em class="bcp14">MUST</em> or <em class="bcp14">MUST NOT</em> be deleted from a stored cache entry after a successful revalidation: |
2956 | | </p> |
2957 | | <p id="rfc.section.13.1.2.p.4"> </p> |
2958 | | <dl> |
2959 | | <dt>1xx</dt> |
2960 | | <dd>Warnings that describe the freshness or revalidation status of the response, and so <em class="bcp14">MUST</em> be deleted after a successful revalidation. 1XX warn-codes <em class="bcp14">MAY</em> be generated by a cache only when validating a cached entry. It <em class="bcp14">MUST NOT</em> be generated by clients. |
2961 | | </dd> |
2962 | | <dt>2xx</dt> |
2963 | | <dd>Warnings that describe some aspect of the entity body or entity headers that is not rectified by a revalidation (for example, |
2964 | | a lossy compression of the entity bodies) and which <em class="bcp14">MUST NOT</em> be deleted after a successful revalidation. |
2965 | | </dd> |
2966 | | </dl> |
2967 | | <p id="rfc.section.13.1.2.p.5">See <a href="#header.warning" id="rfc.xref.header.warning.4" title="Warning">Section 14.46</a> for the definitions of the codes themselves. |
2968 | | </p> |
2969 | | <p id="rfc.section.13.1.2.p.6">HTTP/1.0 caches will cache all Warnings in responses, without deleting the ones in the first category. Warnings in responses |
2970 | | that are passed to HTTP/1.0 caches carry an extra warning-date field, which prevents a future HTTP/1.1 recipient from believing |
2971 | | an erroneously cached Warning. |
2972 | | </p> |
2973 | | <p id="rfc.section.13.1.2.p.7">Warnings also carry a warning text. The text <em class="bcp14">MAY</em> be in any appropriate natural language (perhaps based on the client's Accept headers), and include an <em class="bcp14">OPTIONAL</em> indication of what character set is used. |
2974 | | </p> |
2975 | | <p id="rfc.section.13.1.2.p.8">Multiple warnings <em class="bcp14">MAY</em> be attached to a response (either by the origin server or by a cache), including multiple warnings with the same code number. |
2976 | | For example, a server might provide the same warning with texts in both English and Basque. |
2977 | | </p> |
2978 | | <p id="rfc.section.13.1.2.p.9">When multiple warnings are attached to a response, it might not be practical or reasonable to display all of them to the user. |
2979 | | This version of HTTP does not specify strict priority rules for deciding which warnings to display and in what order, but |
2980 | | does suggest some heuristics. |
2981 | | </p> |
2982 | | <h3 id="rfc.section.13.1.3"><a href="#rfc.section.13.1.3">13.1.3</a> <a id="cache-control.mechanisms" href="#cache-control.mechanisms">Cache-control Mechanisms</a></h3> |
2983 | | <p id="rfc.section.13.1.3.p.1">The basic cache mechanisms in HTTP/1.1 (server-specified expiration times and validators) are implicit directives to caches. |
2984 | | In some cases, a server or client might need to provide explicit directives to the HTTP caches. We use the Cache-Control header |
2985 | | for this purpose. |
2986 | | </p> |
2987 | | <p id="rfc.section.13.1.3.p.2">The Cache-Control header allows a client or server to transmit a variety of directives in either requests or responses. These |
2988 | | directives typically override the default caching algorithms. As a general rule, if there is any apparent conflict between |
2989 | | header values, the most restrictive interpretation is applied (that is, the one that is most likely to preserve semantic transparency). |
2990 | | However, in some cases, cache-control directives are explicitly specified as weakening the approximation of semantic transparency |
2991 | | (for example, "max-stale" or "public"). |
2992 | | </p> |
2993 | | <p id="rfc.section.13.1.3.p.3">The cache-control directives are described in detail in <a href="#header.cache-control" id="rfc.xref.header.cache-control.4" title="Cache-Control">Section 14.9</a>. |
2994 | | </p> |
2995 | | <h3 id="rfc.section.13.1.4"><a href="#rfc.section.13.1.4">13.1.4</a> <a id="explicit.ua.warnings" href="#explicit.ua.warnings">Explicit User Agent Warnings</a></h3> |
2996 | | <p id="rfc.section.13.1.4.p.1">Many user agents make it possible for users to override the basic caching mechanisms. For example, the user agent might allow |
2997 | | the user to specify that cached entities (even explicitly stale ones) are never validated. Or the user agent might habitually |
2998 | | add "Cache-Control: max-stale=3600" to every request. The user agent <em class="bcp14">SHOULD NOT</em> default to either non-transparent behavior, or behavior that results in abnormally ineffective caching, but <em class="bcp14">MAY</em> be explicitly configured to do so by an explicit action of the user. |
2999 | | </p> |
3000 | | <p id="rfc.section.13.1.4.p.2">If the user has overridden the basic caching mechanisms, the user agent <em class="bcp14">SHOULD</em> explicitly indicate to the user whenever this results in the display of information that might not meet the server's transparency |
3001 | | requirements (in particular, if the displayed entity is known to be stale). Since the protocol normally allows the user agent |
3002 | | to determine if responses are stale or not, this indication need only be displayed when this actually happens. The indication |
3003 | | need not be a dialog box; it could be an icon (for example, a picture of a rotting fish) or some other indicator. |
3004 | | </p> |
3005 | | <p id="rfc.section.13.1.4.p.3">If the user has overridden the caching mechanisms in a way that would abnormally reduce the effectiveness of caches, the user |
3006 | | agent <em class="bcp14">SHOULD</em> continually indicate this state to the user (for example, by a display of a picture of currency in flames) so that the user |
3007 | | does not inadvertently consume excess resources or suffer from excessive latency. |
3008 | | </p> |
3009 | | <h3 id="rfc.section.13.1.5"><a href="#rfc.section.13.1.5">13.1.5</a> <a id="exceptions.to.the.rules.and.warnings" href="#exceptions.to.the.rules.and.warnings">Exceptions to the Rules and Warnings</a></h3> |
3010 | | <p id="rfc.section.13.1.5.p.1">In some cases, the operator of a cache <em class="bcp14">MAY</em> choose to configure it to return stale responses even when not requested by clients. This decision ought not be made lightly, |
3011 | | but may be necessary for reasons of availability or performance, especially when the cache is poorly connected to the origin |
3012 | | server. Whenever a cache returns a stale response, it <em class="bcp14">MUST</em> mark it as such (using a Warning header) enabling the client software to alert the user that there might be a potential problem. |
3013 | | </p> |
3014 | | <p id="rfc.section.13.1.5.p.2">It also allows the user agent to take steps to obtain a first-hand or fresh response. For this reason, a cache <em class="bcp14">SHOULD NOT</em> return a stale response if the client explicitly requests a first-hand or fresh one, unless it is impossible to comply for |
3015 | | technical or policy reasons. |
3016 | | </p> |
3017 | | <h3 id="rfc.section.13.1.6"><a href="#rfc.section.13.1.6">13.1.6</a> <a id="client-controlled.behavior" href="#client-controlled.behavior">Client-controlled Behavior</a></h3> |
3018 | | <p id="rfc.section.13.1.6.p.1">While the origin server (and to a lesser extent, intermediate caches, by their contribution to the age of a response) are |
3019 | | the primary source of expiration information, in some cases the client might need to control a cache's decision about whether |
3020 | | to return a cached response without validating it. Clients do this using several directives of the Cache-Control header. |
3021 | | </p> |
3022 | | <p id="rfc.section.13.1.6.p.2">A client's request <em class="bcp14">MAY</em> specify the maximum age it is willing to accept of an unvalidated response; specifying a value of zero forces the cache(s) |
3023 | | to revalidate all responses. A client <em class="bcp14">MAY</em> also specify the minimum time remaining before a response expires. Both of these options increase constraints on the behavior |
3024 | | of caches, and so cannot further relax the cache's approximation of semantic transparency. |
3025 | | </p> |
3026 | | <p id="rfc.section.13.1.6.p.3">A client <em class="bcp14">MAY</em> also specify that it will accept stale responses, up to some maximum amount of staleness. This loosens the constraints on |
3027 | | the caches, and so might violate the origin server's specified constraints on semantic transparency, but might be necessary |
3028 | | to support disconnected operation, or high availability in the face of poor connectivity. |
3029 | | </p> |
3030 | | <h2 id="rfc.section.13.2"><a href="#rfc.section.13.2">13.2</a> <a id="expiration.model" href="#expiration.model">Expiration Model</a></h2> |
3031 | | <h3 id="rfc.section.13.2.1"><a href="#rfc.section.13.2.1">13.2.1</a> <a id="server-specified.expiration" href="#server-specified.expiration">Server-Specified Expiration</a></h3> |
3032 | | <p id="rfc.section.13.2.1.p.1">HTTP caching works best when caches can entirely avoid making requests to the origin server. The primary mechanism for avoiding |
3033 | | requests is for an origin server to provide an explicit expiration time in the future, indicating that a response <em class="bcp14">MAY</em> be used to satisfy subsequent requests. In other words, a cache can return a fresh response without first contacting the server. |
3034 | | </p> |
3035 | | <p id="rfc.section.13.2.1.p.2">Our expectation is that servers will assign future explicit expiration times to responses in the belief that the entity is |
3036 | | not likely to change, in a semantically significant way, before the expiration time is reached. This normally preserves semantic |
3037 | | transparency, as long as the server's expiration times are carefully chosen. |
3038 | | </p> |
3039 | | <p id="rfc.section.13.2.1.p.3">The expiration mechanism applies only to responses taken from a cache and not to first-hand responses forwarded immediately |
3040 | | to the requesting client. |
3041 | | </p> |
3042 | | <p id="rfc.section.13.2.1.p.4">If an origin server wishes to force a semantically transparent cache to validate every request, it <em class="bcp14">MAY</em> assign an explicit expiration time in the past. This means that the response is always stale, and so the cache <em class="bcp14">SHOULD</em> validate it before using it for subsequent requests. See <a href="#cache.revalidation.and.reload.controls" title="Cache Revalidation and Reload Controls">Section 14.9.4</a> for a more restrictive way to force revalidation. |
3043 | | </p> |
3044 | | <p id="rfc.section.13.2.1.p.5">If an origin server wishes to force any HTTP/1.1 cache, no matter how it is configured, to validate every request, it <em class="bcp14">SHOULD</em> use the "must-revalidate" cache-control directive (see <a href="#header.cache-control" id="rfc.xref.header.cache-control.5" title="Cache-Control">Section 14.9</a>). |
3045 | | </p> |
3046 | | <p id="rfc.section.13.2.1.p.6">Servers specify explicit expiration times using either the Expires header, or the max-age directive of the Cache-Control header.</p> |
3047 | | <p id="rfc.section.13.2.1.p.7">An expiration time cannot be used to force a user agent to refresh its display or reload a resource; its semantics apply only |
3048 | | to caching mechanisms, and such mechanisms need only check a resource's expiration status when a new request for that resource |
3049 | | is initiated. See <a href="#history.lists" title="History Lists">Section 13.13</a> for an explanation of the difference between caches and history mechanisms. |
3050 | | </p> |
3051 | | <h3 id="rfc.section.13.2.2"><a href="#rfc.section.13.2.2">13.2.2</a> <a id="heuristic.expiration" href="#heuristic.expiration">Heuristic Expiration</a></h3> |
3052 | | <p id="rfc.section.13.2.2.p.1">Since origin servers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, |
3053 | | employing algorithms that use other header values (such as the Last-Modified time) to estimate a plausible expiration time. |
3054 | | The HTTP/1.1 specification does not provide specific algorithms, but does impose worst-case constraints on their results. |
3055 | | Since heuristic expiration times might compromise semantic transparency, they ought to used cautiously, and we encourage origin |
3056 | | servers to provide explicit expiration times as much as possible. |
3057 | | </p> |
3058 | | <h3 id="rfc.section.13.2.3"><a href="#rfc.section.13.2.3">13.2.3</a> <a id="age.calculations" href="#age.calculations">Age Calculations</a></h3> |
3059 | | <p id="rfc.section.13.2.3.p.1">In order to know if a cached entry is fresh, a cache needs to know if its age exceeds its freshness lifetime. We discuss how |
3060 | | to calculate the latter in <a href="#expiration.calculations" title="Expiration Calculations">Section 13.2.4</a>; this section describes how to calculate the age of a response or cache entry. |
3061 | | </p> |
3062 | | <p id="rfc.section.13.2.3.p.2">In this discussion, we use the term "now" to mean "the current value of the clock at the host performing the calculation." |
3063 | | Hosts that use HTTP, but especially hosts running origin servers and caches, <em class="bcp14">SHOULD</em> use NTP <a href="#RFC1305" id="rfc.xref.RFC1305.1"><cite title="Network Time Protocol (Version 3) Specification, Implementation">[28]</cite></a> or some similar protocol to synchronize their clocks to a globally accurate time standard. |
3064 | | </p> |
3065 | | <p id="rfc.section.13.2.3.p.3">HTTP/1.1 requires origin servers to send a Date header, if possible, with every response, giving the time at which the response |
3066 | | was generated (see <a href="#header.date" id="rfc.xref.header.date.2" title="Date">Section 14.18</a>). We use the term "date_value" to denote the value of the Date header, in a form appropriate for arithmetic operations. |
3067 | | </p> |
3068 | | <p id="rfc.section.13.2.3.p.4">HTTP/1.1 uses the Age response-header to convey the estimated age of the response message when obtained from a cache. The |
3069 | | Age field value is the cache's estimate of the amount of time since the response was generated or revalidated by the origin |
3070 | | server. |
3071 | | </p> |
3072 | | <p id="rfc.section.13.2.3.p.5">In essence, the Age value is the sum of the time that the response has been resident in each of the caches along the path |
3073 | | from the origin server, plus the amount of time it has been in transit along network paths. |
3074 | | </p> |
3075 | | <p id="rfc.section.13.2.3.p.6">We use the term "age_value" to denote the value of the Age header, in a form appropriate for arithmetic operations.</p> |
3076 | | <p id="rfc.section.13.2.3.p.7">A response's age can be calculated in two entirely independent ways: </p> |
3077 | | <ol> |
3078 | | <li>now minus date_value, if the local clock is reasonably well synchronized to the origin server's clock. If the result is negative, |
3079 | | the result is replaced by zero. |
3080 | | </li> |
3081 | | <li>age_value, if all of the caches along the response path implement HTTP/1.1.</li> |
3082 | | </ol> |
3083 | | <p id="rfc.section.13.2.3.p.8">Given that we have two independent ways to compute the age of a response when it is received, we can combine these as</p> |
3084 | | <div id="rfc.figure.u.52"></div><pre class="text"> corrected_received_age = max(now - date_value, age_value) |
3085 | | </pre><p id="rfc.section.13.2.3.p.10">and as long as we have either nearly synchronized clocks or all-HTTP/1.1 paths, one gets a reliable (conservative) result.</p> |
3086 | | <p id="rfc.section.13.2.3.p.11">Because of network-imposed delays, some significant interval might pass between the time that a server generates a response |
3087 | | and the time it is received at the next outbound cache or client. If uncorrected, this delay could result in improperly low |
3088 | | ages. |
3089 | | </p> |
3090 | | <p id="rfc.section.13.2.3.p.12">Because the request that resulted in the returned Age value must have been initiated prior to that Age value's generation, |
3091 | | we can correct for delays imposed by the network by recording the time at which the request was initiated. Then, when an Age |
3092 | | value is received, it <em class="bcp14">MUST</em> be interpreted relative to the time the request was initiated, not the time that the response was received. This algorithm |
3093 | | results in conservative behavior no matter how much delay is experienced. So, we compute: |
3094 | | </p> |
3095 | | <div id="rfc.figure.u.53"></div><pre class="text"> corrected_initial_age = corrected_received_age |
| 579 | extension-header = <a href="#message.headers" class="smpl">message-header</a> |
| 580 | </pre><p id="rfc.section.7.1.p.3">The extension-header mechanism allows additional entity-header fields to be defined without changing the protocol, but these fields cannot be assumed to be recognizable by the recipient. Unrecognized header fields <em class="bcp14">SHOULD</em> be ignored by the recipient and <em class="bcp14">MUST</em> be forwarded by transparent proxies.</p><h2 id="rfc.section.7.2"><a href="#rfc.section.7.2">7.2</a> <a id="entity.body" href="#entity.body">Entity Body</a></h2><p id="rfc.section.7.2.p.1">The entity-body (if any) sent with an HTTP request or response is in a format and encoding defined by the entity-header fields.</p><div id="rfc.figure.u.52"></div><pre class="inline"><span id="rfc.iref.g.93"></span> <a href="#entity.body" class="smpl">entity-body</a> = *<a href="#basic.rules" class="smpl" id="rfc.extref.o.7">OCTET</a> |
| 581 | </pre><p id="rfc.section.7.2.p.3">An entity-body is only present in a message when a message-body is present, as described in <a href="#message.body" title="Message Body">Section 4.3</a>. The entity-body is obtained from the message-body by decoding any Transfer-Encoding that might have been applied to ensure safe and proper transfer of the message.</p><h3 id="rfc.section.7.2.1"><a href="#rfc.section.7.2.1">7.2.1</a> <a id="type" href="#type">Type</a></h3><p id="rfc.section.7.2.1.p.1">When an entity-body is included with a message, the data type of that body is determined via the header fields Content-Type and Content-Encoding. These define a two-layer, ordered encoding model:</p><div id="rfc.figure.u.53"></div><pre class="text"> entity-body := Content-Encoding( Content-Type( data ) ) |
| 582 | </pre><p id="rfc.section.7.2.1.p.3">Content-Type specifies the media type of the underlying data. Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. There is no default encoding.</p><p id="rfc.section.7.2.1.p.4">Any HTTP/1.1 message containing an entity-body <em class="bcp14">SHOULD</em> include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient <em class="bcp14">MAY</em> attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient <em class="bcp14">SHOULD</em> treat it as type "application/octet-stream".</p><h3 id="rfc.section.7.2.2"><a href="#rfc.section.7.2.2">7.2.2</a> <a id="entity.length" href="#entity.length">Entity Length</a></h3><p id="rfc.section.7.2.2.p.1">The entity-length of a message is the length of the message-body before any transfer-codings have been applied. <a href="#message.length" title="Message Length">Section 4.4</a> defines how the transfer-length of a message-body is determined.</p><hr class="noprint"><h1 id="rfc.section.8" class="np"><a href="#rfc.section.8">8.</a> <a id="connections" href="#connections">Connections</a></h1><h2 id="rfc.section.8.1"><a href="#rfc.section.8.1">8.1</a> <a id="persistent.connections" href="#persistent.connections">Persistent Connections</a></h2><h3 id="rfc.section.8.1.1"><a href="#rfc.section.8.1.1">8.1.1</a> <a id="persistent.purpose" href="#persistent.purpose">Purpose</a></h3><p id="rfc.section.8.1.1.p.1">Prior to persistent connections, a separate TCP connection was established to fetch each URL, increasing the load on HTTP servers and causing congestion on the Internet. The use of inline images and other associated data often require a client to make multiple requests of the same server in a short amount of time. Analysis of these performance problems and results from a prototype implementation are available <a href="#Pad1995" id="rfc.xref.Pad1995.1"><cite title="Improving HTTP Latency">[26]</cite></a> <a href="#Spe" id="rfc.xref.Spe.1"><cite title="Analysis of HTTP Performance Problems">[30]</cite></a>. Implementation experience and measurements of actual HTTP/1.1 (RFC 2068) implementations show good results <a href="#Nie1997" id="rfc.xref.Nie1997.1"><cite title="Network Performance Effects of HTTP/1.1, CSS1, and PNG">[39]</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">[27]</cite></a>.</p><p id="rfc.section.8.1.1.p.2">Persistent HTTP connections have a number of advantages: </p><ul><li>By opening and closing fewer TCP connections, CPU time is saved in routers and hosts (clients, servers, proxies, gateways, tunnels, or caches), and memory used for TCP protocol control blocks can be saved in hosts.</li><li>HTTP requests and responses can be pipelined on a connection. Pipelining allows a client to make multiple requests without waiting for each response, allowing a single TCP connection to be used much more efficiently, with much lower elapsed time.</li><li>Network congestion is reduced by reducing the number of packets caused by TCP opens, and by allowing TCP sufficient time to determine the congestion state of the network.</li><li>Latency on subsequent requests is reduced since there is no time spent in TCP's connection opening handshake.</li><li>HTTP can evolve more gracefully, since errors can be reported without the penalty of closing the TCP connection. Clients using future versions of HTTP might optimistically try a new feature, but if communicating with an older server, retry with old semantics after an error is reported.</li></ul><p id="rfc.section.8.1.1.p.3">HTTP implementations <em class="bcp14">SHOULD</em> implement persistent connections.</p><h3 id="rfc.section.8.1.2"><a href="#rfc.section.8.1.2">8.1.2</a> <a id="persistent.overall" href="#persistent.overall">Overall Operation</a></h3><p id="rfc.section.8.1.2.p.1">A significant difference between HTTP/1.1 and earlier versions of HTTP is that persistent connections are the default behavior 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.</p><p id="rfc.section.8.1.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 takes place using the Connection header field (<a href="#header.connection" id="rfc.xref.header.connection.2" title="Connection">Section 14.10</a>). Once a close has been signaled, the client <em class="bcp14">MUST NOT</em> send any more requests on that connection.</p><h4 id="rfc.section.8.1.2.1"><a href="#rfc.section.8.1.2.1">8.1.2.1</a> <a id="persistent.negotiation" href="#persistent.negotiation">Negotiation</a></h4><p id="rfc.section.8.1.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 including the connection-token "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 including the connection-token close.</p><p id="rfc.section.8.1.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 a Connection header with the connection-token close. In case the client does not want to maintain a connection for more than that request, it <em class="bcp14">SHOULD</em> send a Connection header including the connection-token close.</p><p id="rfc.section.8.1.2.1.p.3">If either the client or the server sends the close token in the Connection header, that request becomes the last one for the connection.</p><p id="rfc.section.8.1.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="Compatibility with HTTP/1.0 Persistent Connections">Appendix 19.6.2</a> for more information on backward compatibility with HTTP/1.0 clients.</p><p id="rfc.section.8.1.2.1.p.5">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.length" title="Message Length">Section 4.4</a>.</p><h4 id="rfc.section.8.1.2.2"><a href="#rfc.section.8.1.2.2">8.1.2.2</a> <a id="pipelining" href="#pipelining">Pipelining</a></h4><p id="rfc.section.8.1.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.</p><p id="rfc.section.8.1.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.</p><p id="rfc.section.8.1.2.2.p.3">Clients <em class="bcp14">SHOULD NOT</em> pipeline requests using non-idempotent methods or non-idempotent sequences of methods (see <a href="#idempotent.methods" title="Idempotent Methods">Section 9.1.2</a>). Otherwise, a premature termination of the transport connection could lead to indeterminate results. A client wishing to send a non-idempotent request <em class="bcp14">SHOULD</em> wait to send that request until it has received the response status for the previous request.</p><h3 id="rfc.section.8.1.3"><a href="#rfc.section.8.1.3">8.1.3</a> <a id="persistent.proxy" href="#persistent.proxy">Proxy Servers</a></h3><p id="rfc.section.8.1.3.p.1">It is especially important that proxies correctly implement the properties of the Connection header field as specified in <a href="#header.connection" id="rfc.xref.header.connection.3" title="Connection">Section 14.10</a>.</p><p id="rfc.section.8.1.3.p.2">The proxy server <em class="bcp14">MUST</em> signal persistent connections separately with its clients and the origin servers (or other proxy servers) that it connects to. Each persistent connection applies to only one transport link.</p><p id="rfc.section.8.1.3.p.3">A proxy server <em class="bcp14">MUST NOT</em> establish a HTTP/1.1 persistent connection with an HTTP/1.0 client (but see RFC 2068 <a href="#RFC2068" id="rfc.xref.RFC2068.3"><cite title="Hypertext Transfer Protocol -- HTTP/1.1">[33]</cite></a> for information and discussion of the problems with the Keep-Alive header implemented by many HTTP/1.0 clients).</p><h3 id="rfc.section.8.1.4"><a href="#rfc.section.8.1.4">8.1.4</a> <a id="persistent.practical" href="#persistent.practical">Practical Considerations</a></h3><p id="rfc.section.8.1.4.p.1">Servers will usually have some time-out value beyond which they will no longer maintain an inactive connection. Proxy servers might make this a higher value since it is likely that the client will be making more connections through the same server. The use of persistent connections places no requirements on the length (or existence) of this time-out for either the client or the server.</p><p id="rfc.section.8.1.4.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 not detect the other side's close promptly it could cause unnecessary resource drain on the network.</p><p id="rfc.section.8.1.4.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 that the server has decided to close the "idle" connection. From the server's point of view, the connection is being closed while it was idle, but from the client's point of view, a request is in progress.</p><p id="rfc.section.8.1.4.p.4">This means that clients, servers, and proxies <em class="bcp14">MUST</em> be able to recover from asynchronous close events. Client software <em class="bcp14">SHOULD</em> reopen the transport connection and retransmit the aborted sequence of requests without user interaction so long as the request sequence is idempotent (see <a href="#idempotent.methods" title="Idempotent Methods">Section 9.1.2</a>). Non-idempotent 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 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.</p><p id="rfc.section.8.1.4.p.5">Servers <em class="bcp14">SHOULD</em> always respond to at least one request per connection, if at all possible. Servers <em class="bcp14">SHOULD NOT</em> close a connection in the middle of transmitting a response, unless a network or client failure is suspected.</p><p id="rfc.section.8.1.4.p.6">Clients that use persistent connections <em class="bcp14">SHOULD</em> limit the number of simultaneous connections that they maintain to a given server. A single-user client <em class="bcp14">SHOULD NOT</em> maintain more than 2 connections with any server or proxy. A proxy <em class="bcp14">SHOULD</em> use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.</p><h2 id="rfc.section.8.2"><a href="#rfc.section.8.2">8.2</a> <a id="message.transmission.requirements" href="#message.transmission.requirements">Message Transmission Requirements</a></h2><h3 id="rfc.section.8.2.1"><a href="#rfc.section.8.2.1">8.2.1</a> <a id="persistent.flow" href="#persistent.flow">Persistent Connections and Flow Control</a></h3><p id="rfc.section.8.2.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 connections with the expectation that clients will retry. The latter technique can exacerbate network congestion.</p><h3 id="rfc.section.8.2.2"><a href="#rfc.section.8.2.2">8.2.2</a> <a id="persistent.monitor" href="#persistent.monitor">Monitoring Connections for Error Status Messages</a></h3><p id="rfc.section.8.2.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 while it is transmitting the request. If the client sees an error status, 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 3.6</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, the client <em class="bcp14">MUST</em> close the connection.</p><h3 id="rfc.section.8.2.3"><a href="#rfc.section.8.2.3">8.2.3</a> <a id="use.of.the.100.status" href="#use.of.the.100.status">Use of the 100 (Continue) Status</a></h3><p id="rfc.section.8.2.3.p.1">The purpose of the <a href="#status.100" class="smpl">100 (Continue)</a> status (see <a href="#status.100" id="rfc.xref.status.100.2" title="100 Continue">Section 10.1.1</a>) is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body.</p><p id="rfc.section.8.2.3.p.2">Requirements for HTTP/1.1 clients: </p><ul><li>If a client will wait for a <a href="#status.100" class="smpl">100 (Continue)</a> response before sending the request body, it <em class="bcp14">MUST</em> send an Expect request-header field (<a href="#header.expect" id="rfc.xref.header.expect.2" title="Expect">Section 14.20</a>) with the "100-continue" expectation.</li><li>A client <em class="bcp14">MUST NOT</em> send an Expect request-header field (<a href="#header.expect" id="rfc.xref.header.expect.3" title="Expect">Section 14.20</a>) with the "100-continue" expectation if it does not intend to send a request body.</li></ul><p id="rfc.section.8.2.3.p.3">Because of the presence of older implementations, the protocol allows ambiguous situations in which a client may send "Expect: 100-continue" without receiving either a <a href="#status.417" class="smpl">417 (Expectation Failed)</a> status or a <a href="#status.100" class="smpl">100 (Continue)</a> status. Therefore, when a client sends this header field to an origin server (possibly via a proxy) from which it has never seen a <a href="#status.100" class="smpl">100 (Continue)</a> status, the client <em class="bcp14">SHOULD NOT</em> wait for an indefinite period before sending the request body.</p><p id="rfc.section.8.2.3.p.4">Requirements for HTTP/1.1 origin servers: </p><ul><li>Upon receiving a request which includes an Expect request-header field with the "100-continue" expectation, an origin server <em class="bcp14">MUST</em> either respond with <a href="#status.100" class="smpl">100 (Continue)</a> status and continue to read from the input stream, or respond with a final status code. The origin server <em class="bcp14">MUST NOT</em> wait for the request body before sending the <a href="#status.100" class="smpl">100 (Continue)</a> 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 requested method if it returns a final status code.</li><li>An origin server <em class="bcp14">SHOULD NOT</em> send a <a href="#status.100" class="smpl">100 (Continue)</a> response if the request message does not include an Expect request-header field with the "100-continue" expectation, and <em class="bcp14">MUST NOT</em> send a <a href="#status.100" class="smpl">100 (Continue)</a> response if such a request comes from an HTTP/1.0 (or earlier) client. There is an exception to this rule: for compatibility with RFC 2068, a server <em class="bcp14">MAY</em> send a <a href="#status.100" class="smpl">100 (Continue)</a> status in response to an HTTP/1.1 PUT or POST request that does not include an Expect request-header field with the "100-continue" expectation. This exception, the purpose of which is to minimize any client processing delays associated with an undeclared wait for <a href="#status.100" class="smpl">100 (Continue)</a> status, applies only to HTTP/1.1 requests, and not to requests with any other HTTP-version value.</li><li>An origin server <em class="bcp14">MAY</em> omit a <a href="#status.100" class="smpl">100 (Continue)</a> response if it has already received some or all of the request body for the corresponding request.</li><li>An origin server that sends a <a href="#status.100" class="smpl">100 (Continue)</a> 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 prematurely.</li><li>If an origin server receives a request that does not include an Expect request-header field with the "100-continue" expectation, the request includes a request body, and the server responds with a final status code before reading the entire request body from 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, the client might not reliably receive the response message. However, this requirement is not be construed as preventing a server from defending itself against denial-of-service attacks, or from badly broken client implementations.</li></ul><p id="rfc.section.8.2.3.p.5">Requirements for HTTP/1.1 proxies: </p><ul><li>If a proxy receives a request that includes an Expect request-header field with the "100-continue" expectation, and the proxy either 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, it <em class="bcp14">MUST</em> forward the request, including the Expect header field.</li><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 <a href="#status.417" class="smpl">417 (Expectation Failed)</a> status.</li><li>Proxies <em class="bcp14">SHOULD</em> maintain a cache recording the HTTP version numbers received from recently-referenced next-hop servers.</li><li>A proxy <em class="bcp14">MUST NOT</em> forward a <a href="#status.100" class="smpl">100 (Continue)</a> response if the request message was received from an HTTP/1.0 (or earlier) client and did not include an Expect request-header field with the "100-continue" expectation. This requirement overrides the general rule for forwarding of 1xx responses (see <a href="#status.1xx" title="Informational 1xx">Section 10.1</a>).</li></ul><h3 id="rfc.section.8.2.4"><a href="#rfc.section.8.2.4">8.2.4</a> <a id="connection.premature" href="#connection.premature">Client Behavior if Server Prematurely Closes Connection</a></h3><p id="rfc.section.8.2.4.p.1">If an HTTP/1.1 client sends a request which includes a request body, but which does not include an Expect request-header field with the "100-continue" expectation, and if the client is not directly connected to an HTTP/1.1 origin server, and if the client sees the connection close before receiving any status from the server, the client <em class="bcp14">SHOULD</em> retry the request. If the client does retry this request, it <em class="bcp14">MAY</em> use the following "binary exponential backoff" algorithm to be assured of obtaining a reliable response: </p><ol><li>Initiate a new connection to the server</li><li>Transmit the request-headers</li><li>Initialize a variable R to the estimated round-trip time to the server (e.g., based on the time it took to establish the connection), or to a constant value of 5 seconds if the round-trip time is not available.</li><li>Compute T = R * (2**N), where N is the number of previous retries of this request.</li><li>Wait either for an error response from the server, or for T seconds (whichever comes first)</li><li>If no error response is received, after T seconds transmit the body of the request.</li><li>If client sees that the connection is closed prematurely, repeat from step 1 until the request is accepted, an error response is received, or the user becomes impatient and terminates the retry process.</li></ol><p id="rfc.section.8.2.4.p.2">If at any point an error status is received, the client </p><ul><li><em class="bcp14">SHOULD NOT</em> continue and</li><li><em class="bcp14">SHOULD</em> close the connection if it has not completed sending the request message.</li></ul><hr class="noprint"><h1 id="rfc.section.9" class="np"><a href="#rfc.section.9">9.</a> <a id="method.definitions" href="#method.definitions">Method Definitions</a></h1><p id="rfc.section.9.p.1">The set of common methods for HTTP/1.1 is defined below. Although this set can be expanded, additional methods cannot be assumed to share the same semantics for separately extended clients and servers.</p><p id="rfc.section.9.p.2">The Host request-header field (<a href="#header.host" id="rfc.xref.header.host.2" title="Host">Section 14.23</a>) <em class="bcp14">MUST</em> accompany all HTTP/1.1 requests.</p><h2 id="rfc.section.9.1"><a href="#rfc.section.9.1">9.1</a> <a id="safe.and.idempotent" href="#safe.and.idempotent">Safe and Idempotent Methods</a></h2><h3 id="rfc.section.9.1.1"><a href="#rfc.section.9.1.1">9.1.1</a> <a id="safe.methods" href="#safe.methods">Safe Methods</a></h3><p id="rfc.section.9.1.1.p.1">Implementors should be aware that the software represents the user in their interactions over the Internet, and should be careful to allow the user to be aware of any actions they might take which may have an unexpected significance to themselves or others.</p><p id="rfc.section.9.1.1.p.2">In particular, the convention has been established that the GET and HEAD methods <em class="bcp14">SHOULD NOT</em> have the significance of taking an action other than retrieval. These methods ought to be considered "safe". This allows user agents to represent other methods, such as POST, PUT and DELETE, in a special way, so that the user is made aware of the fact that a possibly unsafe action is being requested.</p><p id="rfc.section.9.1.1.p.3">Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them.</p><h3 id="rfc.section.9.1.2"><a href="#rfc.section.9.1.2">9.1.2</a> <a id="idempotent.methods" href="#idempotent.methods">Idempotent Methods</a></h3><p id="rfc.section.9.1.2.p.1">Methods can also have the property of "idempotence" in that (aside from error or expiration issues) the side-effects of N > 0 identical requests is the same as for a single request. The methods GET, HEAD, PUT and DELETE share this property. Also, the methods OPTIONS and TRACE <em class="bcp14">SHOULD NOT</em> have side effects, and so are inherently idempotent.</p><p id="rfc.section.9.1.2.p.2">However, it is possible that a sequence of several requests is non-idempotent, even if all of the methods executed in that sequence are idempotent. (A sequence is idempotent if a single execution of the entire sequence always yields a result that is not changed by a reexecution of all, or part, of that sequence.) For example, a sequence is non-idempotent if its result depends on a value that is later modified in the same sequence.</p><p id="rfc.section.9.1.2.p.3">A sequence that never has side effects is idempotent, by definition (provided that no concurrent operations are being executed on the same set of resources).</p><div id="rfc.iref.o.3"></div><div id="rfc.iref.m.2"></div><h2 id="rfc.section.9.2"><a href="#rfc.section.9.2">9.2</a> <a id="OPTIONS" href="#OPTIONS">OPTIONS</a></h2><p id="rfc.section.9.2.p.1">The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.</p><p id="rfc.section.9.2.p.2">Responses to this method are not cacheable.</p><p id="rfc.section.9.2.p.3">If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding), then the media type <em class="bcp14">MUST</em> be indicated by a Content-Type field. Although this specification does not define any use for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed queries on the server. A server that does not support such an extension <em class="bcp14">MAY</em> discard the request body.</p><p id="rfc.section.9.2.p.4">If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof).</p><p id="rfc.section.9.2.p.5">If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating with that resource.</p><p id="rfc.section.9.2.p.6">A 200 response <em class="bcp14">SHOULD</em> include any header fields that indicate optional features implemented by the server and applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The response body, if any, <em class="bcp14">SHOULD</em> also include information about the communication options. The format for such a body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation <em class="bcp14">MAY</em> be used to select the appropriate response format. If no response body is included, the response <em class="bcp14">MUST</em> include a Content-Length field with a field-value of "0".</p><p id="rfc.section.9.2.p.7">The Max-Forwards request-header field <em class="bcp14">MAY</em> be used to target a specific proxy in the request chain. When a proxy receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy <em class="bcp14">MUST</em> check for a Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy <em class="bcp14">MUST NOT</em> forward the message; instead, the proxy <em class="bcp14">SHOULD</em> respond with its own communication options. If the Max-Forwards field-value is an integer greater than zero, the proxy <em class="bcp14">MUST</em> decrement the field-value when it forwards the request. If no Max-Forwards field is present in the request, then the forwarded request <em class="bcp14">MUST NOT</em> include a Max-Forwards field.</p><div id="rfc.iref.g.94"></div><div id="rfc.iref.m.3"></div><h2 id="rfc.section.9.3"><a href="#rfc.section.9.3">9.3</a> <a id="GET" href="#GET">GET</a></h2><p id="rfc.section.9.3.p.1">The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.</p><p id="rfc.section.9.3.p.2">The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client.</p><p id="rfc.section.9.3.p.3">The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial GET requests that only part of the entity be transferred, as described in <a href="#header.range" id="rfc.xref.header.range.3" title="Range">Section 14.35</a>. The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed without transferring data already held by the client.</p><p id="rfc.section.9.3.p.4">The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching described in <a href="#caching" title="Caching in HTTP">Section 13</a>.</p><p id="rfc.section.9.3.p.5">See <a href="#encoding.sensitive.information.in.uris" title="Encoding Sensitive Information in URI's">Section 15.1.3</a> for security considerations when used for forms.</p><div id="rfc.iref.h.3"></div><div id="rfc.iref.m.4"></div><h2 id="rfc.section.9.4"><a href="#rfc.section.9.4">9.4</a> <a id="HEAD" href="#HEAD">HEAD</a></h2><p id="rfc.section.9.4.p.1">The HEAD method is identical to GET except that the server <em class="bcp14">MUST NOT</em> return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request <em class="bcp14">SHOULD</em> be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.</p><p id="rfc.section.9.4.p.2">The response to a HEAD request <em class="bcp14">MAY</em> be cacheable in the sense that the information contained in the response <em class="bcp14">MAY</em> be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache <em class="bcp14">MUST</em> treat the cache entry as stale.</p><div id="rfc.iref.p.2"></div><div id="rfc.iref.m.5"></div><h2 id="rfc.section.9.5"><a href="#rfc.section.9.5">9.5</a> <a id="POST" href="#POST">POST</a></h2><p id="rfc.section.9.5.p.1">The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions: </p><ul><li>Annotation of existing resources;</li><li>Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;</li><li>Providing a block of data, such as the result of submitting a form, to a data-handling process;</li><li>Extending a database through an append operation.</li></ul><p id="rfc.section.9.5.p.2">The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database.</p><p id="rfc.section.9.5.p.3">The action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either <a href="#status.200" class="smpl">200 (OK)</a> or <a href="#status.204" class="smpl">204 (No Content)</a> is the appropriate response status, depending on whether or not the response includes an entity that describes the result.</p><p id="rfc.section.9.5.p.4">If a resource has been created on the origin server, the response <em class="bcp14">SHOULD</em> be <a href="#status.201" class="smpl">201 (Created)</a> and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see <a href="#header.location" id="rfc.xref.header.location.2" title="Location">Section 14.30</a>).</p><p id="rfc.section.9.5.p.5">Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. However, the <a href="#status.303" class="smpl">303 (See Other)</a> response can be used to direct the user agent to retrieve a cacheable resource.</p><p id="rfc.section.9.5.p.6">POST requests <em class="bcp14">MUST</em> obey the message transmission requirements set out in <a href="#message.transmission.requirements" title="Message Transmission Requirements">Section 8.2</a>.</p><p id="rfc.section.9.5.p.7">See <a href="#encoding.sensitive.information.in.uris" title="Encoding Sensitive Information in URI's">Section 15.1.3</a> for security considerations.</p><div id="rfc.iref.p.3"></div><div id="rfc.iref.m.6"></div><h2 id="rfc.section.9.6"><a href="#rfc.section.9.6">9.6</a> <a id="PUT" href="#PUT">PUT</a></h2><p id="rfc.section.9.6.p.1">The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity <em class="bcp14">SHOULD</em> be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server <em class="bcp14">MUST</em> inform the user agent via the <a href="#status.201" class="smpl">201 (Created)</a> response. If an existing resource is modified, either the <a href="#status.200" class="smpl">200 (OK)</a> or <a href="#status.204" class="smpl">204 (No Content)</a> response codes <em class="bcp14">SHOULD</em> be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response <em class="bcp14">SHOULD</em> be given that reflects the nature of the problem. The recipient of the entity <em class="bcp14">MUST NOT</em> ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and <em class="bcp14">MUST</em> return a <a href="#status.501" class="smpl">501 (Not Implemented)</a> response in such cases.</p><p id="rfc.section.9.6.p.2">If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries <em class="bcp14">SHOULD</em> be treated as stale. Responses to this method are not cacheable.</p><p id="rfc.section.9.6.p.3">The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server <em class="bcp14">MUST NOT</em> attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it <em class="bcp14">MUST</em> send a <a href="#status.301" class="smpl">301 (Moved Permanently)</a> response; the user agent <em class="bcp14">MAY</em> then make its own decision regarding whether or not to redirect the request.</p><p id="rfc.section.9.6.p.4">A single resource <em class="bcp14">MAY</em> be identified by many different URIs. For example, an article might have a URI for identifying "the current version" which is separate from the URI identifying each particular version. In this case, a PUT request on a general URI might result in several other URIs being defined by the origin server.</p><p id="rfc.section.9.6.p.5">HTTP/1.1 does not define how a PUT method affects the state of an origin server.</p><p id="rfc.section.9.6.p.6">PUT requests <em class="bcp14">MUST</em> obey the message transmission requirements set out in <a href="#message.transmission.requirements" title="Message Transmission Requirements">Section 8.2</a>.</p><p id="rfc.section.9.6.p.7">Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request <em class="bcp14">SHOULD</em> be applied to the resource created or modified by the PUT.</p><div id="rfc.iref.d.3"></div><div id="rfc.iref.m.7"></div><h2 id="rfc.section.9.7"><a href="#rfc.section.9.7">9.7</a> <a id="DELETE" href="#DELETE">DELETE</a></h2><p id="rfc.section.9.7.p.1">The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method <em class="bcp14">MAY</em> be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server <em class="bcp14">SHOULD NOT</em> indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.</p><p id="rfc.section.9.7.p.2">A successful response <em class="bcp14">SHOULD</em> be <a href="#status.200" class="smpl">200 (OK)</a> if the response includes an entity describing the status, <a href="#status.202" class="smpl">202 (Accepted)</a> if the action has not yet been enacted, or <a href="#status.204" class="smpl">204 (No Content)</a> if the action has been enacted but the response does not include an entity.</p><p id="rfc.section.9.7.p.3">If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries <em class="bcp14">SHOULD</em> be treated as stale. Responses to this method are not cacheable.</p><div id="rfc.iref.t.2"></div><div id="rfc.iref.m.8"></div><h2 id="rfc.section.9.8"><a href="#rfc.section.9.8">9.8</a> <a id="TRACE" href="#TRACE">TRACE</a></h2><p id="rfc.section.9.8.p.1">The TRACE method is used to invoke a remote, application-layer loop-back of the request message. The final recipient of the request <em class="bcp14">SHOULD</em> reflect the message received back to the client as the entity-body of a <a href="#status.200" class="smpl">200 (OK)</a> response. The final recipient is either the origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see <a href="#header.max-forwards" id="rfc.xref.header.max-forwards.2" title="Max-Forwards">Section 14.31</a>). A TRACE request <em class="bcp14">MUST NOT</em> include an entity.</p><p id="rfc.section.9.8.p.2">TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information. The value of the Via header field (<a href="#header.via" id="rfc.xref.header.via.2" title="Via">Section 14.45</a>) is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop.</p><p id="rfc.section.9.8.p.3">If the request is valid, the response <em class="bcp14">SHOULD</em> contain the entire request message in the entity-body, with a Content-Type of "message/http". Responses to this method <em class="bcp14">MUST NOT</em> be cached.</p><div id="rfc.iref.c.12"></div><div id="rfc.iref.m.9"></div><h2 id="rfc.section.9.9"><a href="#rfc.section.9.9">9.9</a> <a id="CONNECT" href="#CONNECT">CONNECT</a></h2><p id="rfc.section.9.9.p.1">This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel (e.g. SSL tunneling <a href="#Luo1998" id="rfc.xref.Luo1998.1"><cite title="Tunneling TCP based protocols through Web proxy servers">[44]</cite></a>).</p><hr class="noprint"><h1 id="rfc.section.10" class="np"><a href="#rfc.section.10">10.</a> <a id="status.codes" href="#status.codes">Status Code Definitions</a></h1><p id="rfc.section.10.p.1">Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response.</p><h2 id="rfc.section.10.1"><a href="#rfc.section.10.1">10.1</a> <a id="status.1xx" href="#status.1xx">Informational 1xx</a></h2><p id="rfc.section.10.1.p.1">This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did not define any 1xx status codes, servers <em class="bcp14">MUST NOT</em> send a 1xx response to an HTTP/1.0 client except under experimental conditions.</p><p id="rfc.section.10.1.p.2">A client <em class="bcp14">MUST</em> be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a <a href="#status.100" class="smpl">100 (Continue)</a> status message. Unexpected 1xx status responses <em class="bcp14">MAY</em> be ignored by a user agent.</p><p id="rfc.section.10.1.p.3">Proxies <em class="bcp14">MUST</em> forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding <a href="#status.100" class="smpl">100 (Continue)</a> response(s).)</p><div id="rfc.iref.149"></div><div id="rfc.iref.s.4"></div><h3 id="rfc.section.10.1.1"><a href="#rfc.section.10.1.1">10.1.1</a> <a id="status.100" href="#status.100">100 Continue</a></h3><p id="rfc.section.10.1.1.p.1">The client <em class="bcp14">SHOULD</em> continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client <em class="bcp14">SHOULD</em> continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server <em class="bcp14">MUST</em> send a final response after the request has been completed. See <a href="#use.of.the.100.status" title="Use of the 100 (Continue) Status">Section 8.2.3</a> for detailed discussion of the use and handling of this status code.</p><div id="rfc.iref.150"></div><div id="rfc.iref.s.5"></div><h3 id="rfc.section.10.1.2"><a href="#rfc.section.10.1.2">10.1.2</a> <a id="status.101" href="#status.101">101 Switching Protocols</a></h3><p id="rfc.section.10.1.2.p.1">The server understands and is willing to comply with the client's request, via the Upgrade message header field (<a href="#header.upgrade" id="rfc.xref.header.upgrade.2" title="Upgrade">Section 14.42</a>), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response's Upgrade header field immediately after the empty line which terminates the 101 response.</p><p id="rfc.section.10.1.2.p.2">The protocol <em class="bcp14">SHOULD</em> be switched only when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features.</p><h2 id="rfc.section.10.2"><a href="#rfc.section.10.2">10.2</a> <a id="status.2xx" href="#status.2xx">Successful 2xx</a></h2><p id="rfc.section.10.2.p.1">This class of status code indicates that the client's request was successfully received, understood, and accepted.</p><div id="rfc.iref.151"></div><div id="rfc.iref.s.6"></div><h3 id="rfc.section.10.2.1"><a href="#rfc.section.10.2.1">10.2.1</a> <a id="status.200" href="#status.200">200 OK</a></h3><p id="rfc.section.10.2.1.p.1">The request has succeeded. The information returned with the response is dependent on the method used in the request, for example: </p><dl><dt>GET</dt><dd>an entity corresponding to the requested resource is sent in the response;</dd><dt>HEAD</dt><dd>the entity-header fields corresponding to the requested resource are sent in the response without any message-body;</dd><dt>POST</dt><dd>an entity describing or containing the result of the action;</dd><dt>TRACE</dt><dd>an entity containing the request message as received by the end server.</dd></dl><div id="rfc.iref.152"></div><div id="rfc.iref.s.7"></div><h3 id="rfc.section.10.2.2"><a href="#rfc.section.10.2.2">10.2.2</a> <a id="status.201" href="#status.201">201 Created</a></h3><p id="rfc.section.10.2.2.p.1">The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header field. The response <em class="bcp14">SHOULD</em> include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. The origin server <em class="bcp14">MUST</em> create the resource before returning the 201 status code. If the action cannot be carried out immediately, the server <em class="bcp14">SHOULD</em> respond with <a href="#status.202" class="smpl">202 (Accepted)</a> response instead.</p><p id="rfc.section.10.2.2.p.2">A 201 response <em class="bcp14">MAY</em> contain an ETag response header field indicating the current value of the entity tag for the requested variant just created, see <a href="#header.etag" id="rfc.xref.header.etag.3" title="ETag">Section 14.19</a>.</p><div id="rfc.iref.153"></div><div id="rfc.iref.s.8"></div><h3 id="rfc.section.10.2.3"><a href="#rfc.section.10.2.3">10.2.3</a> <a id="status.202" href="#status.202">202 Accepted</a></h3><p id="rfc.section.10.2.3.p.1">The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. There is no facility for re-sending a status code from an asynchronous operation such as this.</p><p id="rfc.section.10.2.3.p.2">The 202 response is intentionally non-committal. Its purpose is to allow a server to accept a request for some other process (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The entity returned with this response <em class="bcp14">SHOULD</em> include an indication of the request's current status and either a pointer to a status monitor or some estimate of when the user can expect the request to be fulfilled.</p><div id="rfc.iref.154"></div><div id="rfc.iref.s.9"></div><h3 id="rfc.section.10.2.4"><a href="#rfc.section.10.2.4">10.2.4</a> <a id="status.203" href="#status.203">203 Non-Authoritative Information</a></h3><p id="rfc.section.10.2.4.p.1">The returned metainformation in the entity-header is not the definitive set as available from the origin server, but is gathered from a local or a third-party copy. The set presented <em class="bcp14">MAY</em> be a subset or superset of the original version. For example, including local annotation information about the resource might result in a superset of the metainformation known by the origin server. Use of this response code is not required and is only appropriate when the response would otherwise be <a href="#status.200" class="smpl">200 (OK)</a>.</p><div id="rfc.iref.155"></div><div id="rfc.iref.s.10"></div><h3 id="rfc.section.10.2.5"><a href="#rfc.section.10.2.5">10.2.5</a> <a id="status.204" href="#status.204">204 No Content</a></h3><p id="rfc.section.10.2.5.p.1">The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response <em class="bcp14">MAY</em> include new or updated metainformation in the form of entity-headers, which if present <em class="bcp14">SHOULD</em> be associated with the requested variant.</p><p id="rfc.section.10.2.5.p.2">If the client is a user agent, it <em class="bcp14">SHOULD NOT</em> change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation <em class="bcp14">SHOULD</em> be applied to the document currently in the user agent's active view.</p><p id="rfc.section.10.2.5.p.3">The 204 response <em class="bcp14">MUST NOT</em> include a message-body, and thus is always terminated by the first empty line after the header fields.</p><div id="rfc.iref.156"></div><div id="rfc.iref.s.11"></div><h3 id="rfc.section.10.2.6"><a href="#rfc.section.10.2.6">10.2.6</a> <a id="status.205" href="#status.205">205 Reset Content</a></h3><p id="rfc.section.10.2.6.p.1">The server has fulfilled the request and the user agent <em class="bcp14">SHOULD</em> reset the document view which caused the request to be sent. This response is primarily intended to allow input for actions to take place via user input, followed by a clearing of the form in which the input is given so that the user can easily initiate another input action. The response <em class="bcp14">MUST NOT</em> include an entity.</p><div id="rfc.iref.157"></div><div id="rfc.iref.s.12"></div><h3 id="rfc.section.10.2.7"><a href="#rfc.section.10.2.7">10.2.7</a> <a id="status.206" href="#status.206">206 Partial Content</a></h3><p id="rfc.section.10.2.7.p.1">The server has fulfilled the partial GET request for the resource. The request <em class="bcp14">MUST</em> have included a Range header field (<a href="#header.range" id="rfc.xref.header.range.4" title="Range">Section 14.35</a>) indicating the desired range, and <em class="bcp14">MAY</em> have included an If-Range header field (<a href="#header.if-range" id="rfc.xref.header.if-range.3" title="If-Range">Section 14.27</a>) to make the request conditional.</p><p id="rfc.section.10.2.7.p.2">The response <em class="bcp14">MUST</em> include the following header fields: </p><ul><li>Either a Content-Range header field (<a href="#header.content-range" id="rfc.xref.header.content-range.4" title="Content-Range">Section 14.16</a>) indicating the range included with this response, or a multipart/byteranges Content-Type including Content-Range fields for each part. If a Content-Length header field is present in the response, its value <em class="bcp14">MUST</em> match the actual number of <a href="#basic.rules" class="smpl" id="rfc.extref.o.8">OCTET</a>s transmitted in the message-body.</li><li>Date</li><li>ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request</li><li>Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same variant</li></ul><p id="rfc.section.10.2.7.p.3">If the 206 response is the result of an If-Range request that used a strong cache validator (see <a href="#weak.and.strong.validators" title="Weak and Strong Validators">Section 13.3.3</a>), the response <em class="bcp14">SHOULD NOT</em> include other entity-headers. If the response is the result of an If-Range request that used a weak validator, the response <em class="bcp14">MUST NOT</em> include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. Otherwise, the response <em class="bcp14">MUST</em> include all of the entity-headers that would have been returned with a <a href="#status.200" class="smpl">200 (OK)</a> response to the same request.</p><p id="rfc.section.10.2.7.p.4">A cache <em class="bcp14">MUST NOT</em> combine a 206 response with other previously cached content if the ETag or Last-Modified headers do not match exactly, see <a href="#combining.byte.ranges" title="Combining Byte Ranges">13.5.4</a>.</p><p id="rfc.section.10.2.7.p.5">A cache that does not support the Range and Content-Range headers <em class="bcp14">MUST NOT</em> cache <a href="#status.206" class="smpl">206 (Partial)</a> responses.</p><h2 id="rfc.section.10.3"><a href="#rfc.section.10.3">10.3</a> <a id="status.3xx" href="#status.3xx">Redirection 3xx</a></h2><p id="rfc.section.10.3.p.1">This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request. The action required <em class="bcp14">MAY</em> be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. A client <em class="bcp14">SHOULD</em> detect infinite redirection loops, since such loops generate network traffic for each redirection. </p><dl class="empty"><dd> <b>Note:</b> previous versions of this specification recommended a maximum of five redirections. Content developers should be aware that there might be clients that implement such a fixed limitation.</dd></dl><div id="rfc.iref.158"></div><div id="rfc.iref.s.13"></div><h3 id="rfc.section.10.3.1"><a href="#rfc.section.10.3.1">10.3.1</a> <a id="status.300" href="#status.300">300 Multiple Choices</a></h3><p id="rfc.section.10.3.1.p.1">The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent-driven negotiation information (<a href="#content.negotiation" title="Content Negotiation">Section 12</a>) is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that location.</p><p id="rfc.section.10.3.1.p.2">Unless it was a HEAD request, the response <em class="bcp14">SHOULD</em> include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice <em class="bcp14">MAY</em> be performed automatically. However, this specification does not define any standard for such automatic selection.</p><p id="rfc.section.10.3.1.p.3">If the server has a preferred choice of representation, it <em class="bcp14">SHOULD</em> include the specific URI for that representation in the Location field; user agents <em class="bcp14">MAY</em> use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise.</p><div id="rfc.iref.159"></div><div id="rfc.iref.s.14"></div><h3 id="rfc.section.10.3.2"><a href="#rfc.section.10.3.2">10.3.2</a> <a id="status.301" href="#status.301">301 Moved Permanently</a></h3><p id="rfc.section.10.3.2.p.1">The requested resource has been assigned a new permanent URI and any future references to this resource <em class="bcp14">SHOULD</em> use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.</p><p id="rfc.section.10.3.2.p.2">The new permanent URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s).</p><p id="rfc.section.10.3.2.p.3">If the 301 status code is received in response to a request other than GET or HEAD, the user agent <em class="bcp14">MUST NOT</em> automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. </p><dl class="empty"><dd> <b>Note:</b> When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request.</dd></dl><div id="rfc.iref.160"></div><div id="rfc.iref.s.15"></div><h3 id="rfc.section.10.3.3"><a href="#rfc.section.10.3.3">10.3.3</a> <a id="status.302" href="#status.302">302 Found</a></h3><p id="rfc.section.10.3.3.p.1">The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client <em class="bcp14">SHOULD</em> continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.</p><p id="rfc.section.10.3.3.p.2">The temporary URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s).</p><p id="rfc.section.10.3.3.p.3">If the 302 status code is received in response to a request other than GET or HEAD, the user agent <em class="bcp14">MUST NOT</em> automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. </p><dl class="empty"><dd> <b>Note:</b> RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client.</dd></dl><div id="rfc.iref.161"></div><div id="rfc.iref.s.16"></div><h3 id="rfc.section.10.3.4"><a href="#rfc.section.10.3.4">10.3.4</a> <a id="status.303" href="#status.303">303 See Other</a></h3><p id="rfc.section.10.3.4.p.1">The response to the request can be found under a different URI and <em class="bcp14">SHOULD</em> be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response <em class="bcp14">MUST NOT</em> be cached, but the response to the second (redirected) request might be cacheable.</p><p id="rfc.section.10.3.4.p.2">The different URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s). </p><dl class="empty"><dd> <b>Note:</b> Many pre-HTTP/1.1 user agents do not understand the 303 status. When interoperability with such clients is a concern, the 302 status code may be used instead, since most user agents react to a 302 response as described here for 303.</dd></dl><div id="rfc.iref.162"></div><div id="rfc.iref.s.17"></div><h3 id="rfc.section.10.3.5"><a href="#rfc.section.10.3.5">10.3.5</a> <a id="status.304" href="#status.304">304 Not Modified</a></h3><p id="rfc.section.10.3.5.p.1">If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server <em class="bcp14">SHOULD</em> respond with this status code. The 304 response <em class="bcp14">MUST NOT</em> contain a message-body, and thus is always terminated by the first empty line after the header fields.</p><p id="rfc.section.10.3.5.p.2">The response <em class="bcp14">MUST</em> include the following header fields: </p><ul><li>Date, unless its omission is required by <a href="#clockless.origin.server.operation" title="Clockless Origin Server Operation">Section 14.18.1</a></li></ul><p id="rfc.section.10.3.5.p.3">If a clockless origin server obeys these rules, and proxies and clients add their own Date to any response received without one (as already specified by [RFC 2068], section <a href="http://tools.ietf.org/html/rfc2068#section-14.19" id="rfc.xref.RFC2068.4">14.19</a>), caches will operate correctly. </p><ul><li>ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request</li><li>Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same variant</li></ul><p id="rfc.section.10.3.5.p.4">If the conditional GET used a strong cache validator (see <a href="#weak.and.strong.validators" title="Weak and Strong Validators">Section 13.3.3</a>), the response <em class="bcp14">SHOULD NOT</em> include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response <em class="bcp14">MUST NOT</em> include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers.</p><p id="rfc.section.10.3.5.p.5">If a 304 response indicates an entity not currently cached, then the cache <em class="bcp14">MUST</em> disregard the response and repeat the request without the conditional.</p><p id="rfc.section.10.3.5.p.6">If a cache uses a received 304 response to update a cache entry, the cache <em class="bcp14">MUST</em> update the entry to reflect any new field values given in the response.</p><div id="rfc.iref.163"></div><div id="rfc.iref.s.18"></div><h3 id="rfc.section.10.3.6"><a href="#rfc.section.10.3.6">10.3.6</a> <a id="status.305" href="#status.305">305 Use Proxy</a></h3><p id="rfc.section.10.3.6.p.1">The requested resource <em class="bcp14">MUST</em> be accessed through the proxy given by the Location field. The Location field gives the URI of the proxy. The recipient is expected to repeat this single request via the proxy. 305 responses <em class="bcp14">MUST</em> only be generated by origin servers. </p><dl class="empty"><dd> <b>Note:</b> RFC 2068 was not clear that 305 was intended to redirect a single request, and to be generated by origin servers only. Not observing these limitations has significant security consequences.</dd></dl><div id="rfc.iref.164"></div><div id="rfc.iref.s.19"></div><h3 id="rfc.section.10.3.7"><a href="#rfc.section.10.3.7">10.3.7</a> <a id="status.306" href="#status.306">306 (Unused)</a></h3><p id="rfc.section.10.3.7.p.1">The 306 status code was used in a previous version of the specification, is no longer used, and the code is reserved.</p><div id="rfc.iref.165"></div><div id="rfc.iref.s.20"></div><h3 id="rfc.section.10.3.8"><a href="#rfc.section.10.3.8">10.3.8</a> <a id="status.307" href="#status.307">307 Temporary Redirect</a></h3><p id="rfc.section.10.3.8.p.1">The requested resource resides temporarily under a different URI. Since the redirection <em class="bcp14">MAY</em> be altered on occasion, the client <em class="bcp14">SHOULD</em> continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.</p><p id="rfc.section.10.3.8.p.2">The temporary URI <em class="bcp14">SHOULD</em> be given by the Location field in the response. Unless the request method was HEAD, the entity of the response <em class="bcp14">SHOULD</em> contain a short hypertext note with a hyperlink to the new URI(s) , since many pre-HTTP/1.1 user agents do not understand the 307 status. Therefore, the note <em class="bcp14">SHOULD</em> contain the information necessary for a user to repeat the original request on the new URI.</p><p id="rfc.section.10.3.8.p.3">If the 307 status code is received in response to a request other than GET or HEAD, the user agent <em class="bcp14">MUST NOT</em> automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.</p><h2 id="rfc.section.10.4"><a href="#rfc.section.10.4">10.4</a> <a id="status.4xx" href="#status.4xx">Client Error 4xx</a></h2><p id="rfc.section.10.4.p.1">The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server <em class="bcp14">SHOULD</em> include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents <em class="bcp14">SHOULD</em> display any included entity to the user.</p><p id="rfc.section.10.4.p.2">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 the input connection. If the client continues sending data to the server after the close, the server's TCP stack will send a reset packet to the client, which may erase the client's unacknowledged input buffers before they can be read and interpreted by the HTTP application.</p><div id="rfc.iref.166"></div><div id="rfc.iref.s.21"></div><h3 id="rfc.section.10.4.1"><a href="#rfc.section.10.4.1">10.4.1</a> <a id="status.400" href="#status.400">400 Bad Request</a></h3><p id="rfc.section.10.4.1.p.1">The request could not be understood by the server due to malformed syntax. The client <em class="bcp14">SHOULD NOT</em> repeat the request without modifications.</p><div id="rfc.iref.167"></div><div id="rfc.iref.s.22"></div><h3 id="rfc.section.10.4.2"><a href="#rfc.section.10.4.2">10.4.2</a> <a id="status.401" href="#status.401">401 Unauthorized</a></h3><p id="rfc.section.10.4.2.p.1">The request requires user authentication. The response <em class="bcp14">MUST</em> include a WWW-Authenticate header field (<a href="#header.www-authenticate" id="rfc.xref.header.www-authenticate.2" title="WWW-Authenticate">Section 14.47</a>) containing a challenge applicable to the requested resource. The client <em class="bcp14">MAY</em> repeat the request with a suitable Authorization header field (<a href="#header.authorization" id="rfc.xref.header.authorization.2" title="Authorization">Section 14.8</a>). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user <em class="bcp14">SHOULD</em> be presented the entity that was given in the response, since that entity might include relevant diagnostic information. HTTP access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication" <a href="#RFC2617" id="rfc.xref.RFC2617.1"><cite title="HTTP Authentication: Basic and Digest Access Authentication">[43]</cite></a>.</p><div id="rfc.iref.168"></div><div id="rfc.iref.s.23"></div><h3 id="rfc.section.10.4.3"><a href="#rfc.section.10.4.3">10.4.3</a> <a id="status.402" href="#status.402">402 Payment Required</a></h3><p id="rfc.section.10.4.3.p.1">This code is reserved for future use.</p><div id="rfc.iref.169"></div><div id="rfc.iref.s.24"></div><h3 id="rfc.section.10.4.4"><a href="#rfc.section.10.4.4">10.4.4</a> <a id="status.403" href="#status.403">403 Forbidden</a></h3><p id="rfc.section.10.4.4.p.1">The server understood the request, but is refusing to fulfill it. Authorization will not help and the request <em class="bcp14">SHOULD NOT</em> be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it <em class="bcp14">SHOULD</em> describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.</p><div id="rfc.iref.170"></div><div id="rfc.iref.s.25"></div><h3 id="rfc.section.10.4.5"><a href="#rfc.section.10.4.5">10.4.5</a> <a id="status.404" href="#status.404">404 Not Found</a></h3><p id="rfc.section.10.4.5.p.1">The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The <a href="#status.410" class="smpl">410 (Gone)</a> status code <em class="bcp14">SHOULD</em> be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.</p><div id="rfc.iref.171"></div><div id="rfc.iref.s.26"></div><h3 id="rfc.section.10.4.6"><a href="#rfc.section.10.4.6">10.4.6</a> <a id="status.405" href="#status.405">405 Method Not Allowed</a></h3><p id="rfc.section.10.4.6.p.1">The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response <em class="bcp14">MUST</em> include an Allow header containing a list of valid methods for the requested resource.</p><div id="rfc.iref.172"></div><div id="rfc.iref.s.27"></div><h3 id="rfc.section.10.4.7"><a href="#rfc.section.10.4.7">10.4.7</a> <a id="status.406" href="#status.406">406 Not Acceptable</a></h3><p id="rfc.section.10.4.7.p.1">The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.</p><p id="rfc.section.10.4.7.p.2">Unless it was a HEAD request, the response <em class="bcp14">SHOULD</em> include an entity containing a list of available entity characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice <em class="bcp14">MAY</em> be performed automatically. However, this specification does not define any standard for such automatic selection. </p><dl class="empty"><dd> <b>Note:</b> HTTP/1.1 servers are allowed to return responses which are not acceptable according to the accept headers sent in the request. In some cases, this may even be preferable to sending a 406 response. User agents are encouraged to inspect the headers of an incoming response to determine if it is acceptable.</dd></dl><p id="rfc.section.10.4.7.p.3">If the response could be unacceptable, a user agent <em class="bcp14">SHOULD</em> temporarily stop receipt of more data and query the user for a decision on further actions.</p><div id="rfc.iref.173"></div><div id="rfc.iref.s.28"></div><h3 id="rfc.section.10.4.8"><a href="#rfc.section.10.4.8">10.4.8</a> <a id="status.407" href="#status.407">407 Proxy Authentication Required</a></h3><p id="rfc.section.10.4.8.p.1">This code is similar to <a href="#status.401" class="smpl">401 (Unauthorized)</a>, but indicates that the client must first authenticate itself with the proxy. The proxy <em class="bcp14">MUST</em> return a Proxy-Authenticate header field (<a href="#header.proxy-authenticate" id="rfc.xref.header.proxy-authenticate.2" title="Proxy-Authenticate">Section 14.33</a>) containing a challenge applicable to the proxy for the requested resource. The client <em class="bcp14">MAY</em> repeat the request with a suitable Proxy-Authorization header field (<a href="#header.proxy-authorization" id="rfc.xref.header.proxy-authorization.2" title="Proxy-Authorization">Section 14.34</a>). HTTP access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication" <a href="#RFC2617" id="rfc.xref.RFC2617.2"><cite title="HTTP Authentication: Basic and Digest Access Authentication">[43]</cite></a>.</p><div id="rfc.iref.174"></div><div id="rfc.iref.s.29"></div><h3 id="rfc.section.10.4.9"><a href="#rfc.section.10.4.9">10.4.9</a> <a id="status.408" href="#status.408">408 Request Timeout</a></h3><p id="rfc.section.10.4.9.p.1">The client did not produce a request within the time that the server was prepared to wait. The client <em class="bcp14">MAY</em> repeat the request without modifications at any later time.</p><div id="rfc.iref.175"></div><div id="rfc.iref.s.30"></div><h3 id="rfc.section.10.4.10"><a href="#rfc.section.10.4.10">10.4.10</a> <a id="status.409" href="#status.409">409 Conflict</a></h3><p id="rfc.section.10.4.10.p.1">The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body <em class="bcp14">SHOULD</em> include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required.</p><p id="rfc.section.10.4.10.p.2">Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain a list of the differences between the two versions in a format defined by the response Content-Type.</p><div id="rfc.iref.176"></div><div id="rfc.iref.s.31"></div><h3 id="rfc.section.10.4.11"><a href="#rfc.section.10.4.11">10.4.11</a> <a id="status.410" href="#status.410">410 Gone</a></h3><p id="rfc.section.10.4.11.p.1">The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities <em class="bcp14">SHOULD</em> delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code <a href="#status.404" class="smpl">404 (Not Found)</a> <em class="bcp14">SHOULD</em> be used instead. This response is cacheable unless indicated otherwise.</p><p id="rfc.section.10.4.11.p.2">The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer working at the server's site. It is not necessary to mark all permanently unavailable resources as "gone" or to keep the mark for any length of time -- that is left to the discretion of the server owner.</p><div id="rfc.iref.177"></div><div id="rfc.iref.s.32"></div><h3 id="rfc.section.10.4.12"><a href="#rfc.section.10.4.12">10.4.12</a> <a id="status.411" href="#status.411">411 Length Required</a></h3><p id="rfc.section.10.4.12.p.1">The server refuses to accept the request without a defined Content-Length. The client <em class="bcp14">MAY</em> repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message.</p><div id="rfc.iref.178"></div><div id="rfc.iref.s.33"></div><h3 id="rfc.section.10.4.13"><a href="#rfc.section.10.4.13">10.4.13</a> <a id="status.412" href="#status.412">412 Precondition Failed</a></h3><p id="rfc.section.10.4.13.p.1">The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.</p><div id="rfc.iref.179"></div><div id="rfc.iref.s.34"></div><h3 id="rfc.section.10.4.14"><a href="#rfc.section.10.4.14">10.4.14</a> <a id="status.413" href="#status.413">413 Request Entity Too Large</a></h3><p id="rfc.section.10.4.14.p.1">The server is refusing to process a request because the request entity is larger than the server is willing or able to process. The server <em class="bcp14">MAY</em> close the connection to prevent the client from continuing the request.</p><p id="rfc.section.10.4.14.p.2">If the condition is temporary, the server <em class="bcp14">SHOULD</em> include a Retry-After header field to indicate that it is temporary and after what time the client <em class="bcp14">MAY</em> try again.</p><div id="rfc.iref.180"></div><div id="rfc.iref.s.35"></div><h3 id="rfc.section.10.4.15"><a href="#rfc.section.10.4.15">10.4.15</a> <a id="status.414" href="#status.414">414 Request-URI Too Long</a></h3><p id="rfc.section.10.4.15.p.1">The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI.</p><div id="rfc.iref.181"></div><div id="rfc.iref.s.36"></div><h3 id="rfc.section.10.4.16"><a href="#rfc.section.10.4.16">10.4.16</a> <a id="status.415" href="#status.415">415 Unsupported Media Type</a></h3><p id="rfc.section.10.4.16.p.1">The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.</p><div id="rfc.iref.182"></div><div id="rfc.iref.s.37"></div><h3 id="rfc.section.10.4.17"><a href="#rfc.section.10.4.17">10.4.17</a> <a id="status.416" href="#status.416">416 Requested Range Not Satisfiable</a></h3><p id="rfc.section.10.4.17.p.1">A server <em class="bcp14">SHOULD</em> return a response with this status code if a request included a Range request-header field (<a href="#header.range" id="rfc.xref.header.range.5" title="Range">Section 14.35</a>), and none of the range-specifier values in this field overlap the current extent of the selected resource, and the request did not include an If-Range request-header field. (For byte-ranges, this means that the first-byte-pos of all of the byte-range-spec values were greater than the current length of the selected resource.)</p><p id="rfc.section.10.4.17.p.2">When this status code is returned for a byte-range request, the response <em class="bcp14">SHOULD</em> include a Content-Range entity-header field specifying the current length of the selected resource (see <a href="#header.content-range" id="rfc.xref.header.content-range.5" title="Content-Range">Section 14.16</a>). This response <em class="bcp14">MUST NOT</em> use the multipart/byteranges content-type.</p><div id="rfc.iref.183"></div><div id="rfc.iref.s.38"></div><h3 id="rfc.section.10.4.18"><a href="#rfc.section.10.4.18">10.4.18</a> <a id="status.417" href="#status.417">417 Expectation Failed</a></h3><p id="rfc.section.10.4.18.p.1">The expectation given in an Expect request-header field (see <a href="#header.expect" id="rfc.xref.header.expect.4" title="Expect">Section 14.20</a>) could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could not be met by the next-hop server.</p><h2 id="rfc.section.10.5"><a href="#rfc.section.10.5">10.5</a> <a id="status.5xx" href="#status.5xx">Server Error 5xx</a></h2><p id="rfc.section.10.5.p.1">Response status codes beginning with the digit "5" indicate cases in which the server is aware that it has erred or is incapable of performing the request. Except when responding to a HEAD request, the server <em class="bcp14">SHOULD</em> include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. User agents <em class="bcp14">SHOULD</em> display any included entity to the user. These response codes are applicable to any request method.</p><div id="rfc.iref.184"></div><div id="rfc.iref.s.39"></div><h3 id="rfc.section.10.5.1"><a href="#rfc.section.10.5.1">10.5.1</a> <a id="status.500" href="#status.500">500 Internal Server Error</a></h3><p id="rfc.section.10.5.1.p.1">The server encountered an unexpected condition which prevented it from fulfilling the request.</p><div id="rfc.iref.185"></div><div id="rfc.iref.s.40"></div><h3 id="rfc.section.10.5.2"><a href="#rfc.section.10.5.2">10.5.2</a> <a id="status.501" href="#status.501">501 Not Implemented</a></h3><p id="rfc.section.10.5.2.p.1">The server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.</p><div id="rfc.iref.186"></div><div id="rfc.iref.s.41"></div><h3 id="rfc.section.10.5.3"><a href="#rfc.section.10.5.3">10.5.3</a> <a id="status.502" href="#status.502">502 Bad Gateway</a></h3><p id="rfc.section.10.5.3.p.1">The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.</p><div id="rfc.iref.187"></div><div id="rfc.iref.s.42"></div><h3 id="rfc.section.10.5.4"><a href="#rfc.section.10.5.4">10.5.4</a> <a id="status.503" href="#status.503">503 Service Unavailable</a></h3><p id="rfc.section.10.5.4.p.1">The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay <em class="bcp14">MAY</em> be indicated in a Retry-After header. If no Retry-After is given, the client <em class="bcp14">SHOULD</em> handle the response as it would for a 500 response. </p><dl class="empty"><dd> <b>Note:</b> The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.</dd></dl><div id="rfc.iref.188"></div><div id="rfc.iref.s.43"></div><h3 id="rfc.section.10.5.5"><a href="#rfc.section.10.5.5">10.5.5</a> <a id="status.504" href="#status.504">504 Gateway Timeout</a></h3><p id="rfc.section.10.5.5.p.1">The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request. </p><dl class="empty"><dd> <b>Note:</b> Note to implementors: some deployed proxies are known to return 400 or 500 when DNS lookups time out.</dd></dl><div id="rfc.iref.189"></div><div id="rfc.iref.s.44"></div><h3 id="rfc.section.10.5.6"><a href="#rfc.section.10.5.6">10.5.6</a> <a id="status.505" href="#status.505">505 HTTP Version Not Supported</a></h3><p id="rfc.section.10.5.6.p.1">The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described in <a href="#http.version" title="HTTP Version">Section 3.1</a>, other than with this error message. The response <em class="bcp14">SHOULD</em> contain an entity describing why that version is not supported and what other protocols are supported by that server.</p><hr class="noprint"><h1 id="rfc.section.11" class="np"><a href="#rfc.section.11">11.</a> <a id="access.authentication" href="#access.authentication">Access Authentication</a></h1><p id="rfc.section.11.p.1">HTTP provides several <em class="bcp14">OPTIONAL</em> challenge-response authentication mechanisms which can be used by a server to challenge a client request and by a client to provide authentication information. The general framework for access authentication, and the specification of "basic" and "digest" authentication, are specified in "HTTP Authentication: Basic and Digest Access Authentication" <a href="#RFC2617" id="rfc.xref.RFC2617.3"><cite title="HTTP Authentication: Basic and Digest Access Authentication">[43]</cite></a>. This specification adopts the definitions of "challenge" and "credentials" from that specification.</p><hr class="noprint"><h1 id="rfc.section.12" class="np"><a href="#rfc.section.12">12.</a> <a id="content.negotiation" href="#content.negotiation">Content Negotiation</a></h1><p id="rfc.section.12.p.1">Most HTTP responses include an entity which contains information for interpretation by a human user. Naturally, it is desirable to supply the user with the "best available" entity corresponding to the request. Unfortunately for servers and caches, not all users have the same preferences for what is "best," and not all user agents are equally capable of rendering all entity types. For that reason, HTTP has provisions for several mechanisms for "content negotiation" -- the process of selecting the best representation for a given response when there are multiple representations available. </p><dl class="empty"><dd> <b>Note:</b> This is not called "format negotiation" because the alternate representations may be of the same media type, but use different capabilities of that type, be in different languages, etc.</dd></dl><p id="rfc.section.12.p.2">Any response containing an entity-body <em class="bcp14">MAY</em> be subject to negotiation, including error responses.</p><p id="rfc.section.12.p.3">There are two kinds of content negotiation which are possible in HTTP: server-driven and agent-driven negotiation. These two kinds of negotiation are orthogonal and thus may be used separately or in combination. One method of combination, referred to as transparent negotiation, occurs when a cache uses the agent-driven negotiation information provided by the origin server in order to provide server-driven negotiation for subsequent requests.</p><h2 id="rfc.section.12.1"><a href="#rfc.section.12.1">12.1</a> <a id="server-driven.negotiation" href="#server-driven.negotiation">Server-driven Negotiation</a></h2><p id="rfc.section.12.1.p.1">If the selection of the best representation for a response is made by an algorithm located at the server, it is called server-driven negotiation. Selection is based on the available representations of the response (the dimensions over which it can vary; e.g. language, content-coding, etc.) and the contents of particular header fields in the request message or on other information pertaining to the request (such as the network address of the client).</p><p id="rfc.section.12.1.p.2">Server-driven negotiation is advantageous when the algorithm for selecting from among the available representations is difficult to describe to the user agent, or when the server desires to send its "best guess" to the client along with the first response (hoping to avoid the round-trip delay of a subsequent request if the "best guess" is good enough for the user). In order to improve the server's guess, the user agent <em class="bcp14">MAY</em> include request header fields (Accept, Accept-Language, Accept-Encoding, etc.) which describe its preferences for such a response.</p><p id="rfc.section.12.1.p.3">Server-driven negotiation has disadvantages: </p><ol><li>It is impossible for the server to accurately determine what might be "best" for any given user, since that would require complete knowledge of both the capabilities of the user agent and the intended use for the response (e.g., does the user want to view it on screen or print it on paper?).</li><li>Having the user agent describe its capabilities in every request can be both very inefficient (given that only a small percentage of responses have multiple representations) and a potential violation of the user's privacy.</li><li>It complicates the implementation of an origin server and the algorithms for generating responses to a request.</li><li>It may limit a public cache's ability to use the same response for multiple user's requests.</li></ol><p id="rfc.section.12.1.p.4">HTTP/1.1 includes the following request-header fields for enabling server-driven negotiation through description of user agent capabilities and user preferences: Accept (<a href="#header.accept" id="rfc.xref.header.accept.3" title="Accept">Section 14.1</a>), Accept-Charset (<a href="#header.accept-charset" id="rfc.xref.header.accept-charset.2" title="Accept-Charset">Section 14.2</a>), Accept-Encoding (<a href="#header.accept-encoding" id="rfc.xref.header.accept-encoding.3" title="Accept-Encoding">Section 14.3</a>), Accept-Language (<a href="#header.accept-language" id="rfc.xref.header.accept-language.2" title="Accept-Language">Section 14.4</a>), and User-Agent (<a href="#header.user-agent" id="rfc.xref.header.user-agent.2" title="User-Agent">Section 14.43</a>). However, an origin server is not limited to these dimensions and <em class="bcp14">MAY</em> vary the response based on any aspect of the request, including information outside the request-header fields or within extension header fields not defined by this specification.</p><p id="rfc.section.12.1.p.5">The Vary header field can be used to express the parameters the server uses to select a representation that is subject to server-driven negotiation. See <a href="#caching.negotiated.responses" title="Caching Negotiated Responses">Section 13.6</a> for use of the Vary header field by caches and <a href="#header.vary" id="rfc.xref.header.vary.2" title="Vary">Section 14.44</a> for use of the Vary header field by servers.</p><h2 id="rfc.section.12.2"><a href="#rfc.section.12.2">12.2</a> <a id="agent-driven.negotiation" href="#agent-driven.negotiation">Agent-driven Negotiation</a></h2><p id="rfc.section.12.2.p.1">With agent-driven negotiation, selection of the best representation for a response is performed by the user agent after receiving an initial response from the origin server. Selection is based on a list of the available representations of the response included within the header fields or entity-body of the initial response, with each representation identified by its own URI. Selection from among the representations may be performed automatically (if the user agent is capable of doing so) or manually by the user selecting from a generated (possibly hypertext) menu.</p><p id="rfc.section.12.2.p.2">Agent-driven negotiation is advantageous when the response would vary over commonly-used dimensions (such as type, language, or encoding), when the origin server is unable to determine a user agent's capabilities from examining the request, and generally when public caches are used to distribute server load and reduce network usage.</p><p id="rfc.section.12.2.p.3">Agent-driven negotiation suffers from the disadvantage of needing a second request to obtain the best alternate representation. This second request is only efficient when caching is used. In addition, this specification does not define any mechanism for supporting automatic selection, though it also does not prevent any such mechanism from being developed as an extension and used within HTTP/1.1.</p><p id="rfc.section.12.2.p.4">HTTP/1.1 defines the <a href="#status.300" class="smpl">300 (Multiple Choices)</a> and <a href="#status.406" class="smpl">406 (Not Acceptable)</a> status codes for enabling agent-driven negotiation when the server is unwilling or unable to provide a varying response using server-driven negotiation.</p><h2 id="rfc.section.12.3"><a href="#rfc.section.12.3">12.3</a> <a id="transparent.negotiation" href="#transparent.negotiation">Transparent Negotiation</a></h2><p id="rfc.section.12.3.p.1">Transparent negotiation is a combination of both server-driven and agent-driven negotiation. When a cache is supplied with a form of the list of available representations of the response (as in agent-driven negotiation) and the dimensions of variance are completely understood by the cache, then the cache becomes capable of performing server-driven negotiation on behalf of the origin server for subsequent requests on that resource.</p><p id="rfc.section.12.3.p.2">Transparent negotiation has the advantage of distributing the negotiation work that would otherwise be required of the origin server and also removing the second request delay of agent-driven negotiation when the cache is able to correctly guess the right response.</p><p id="rfc.section.12.3.p.3">This specification does not define any mechanism for transparent negotiation, though it also does not prevent any such mechanism from being developed as an extension that could be used within HTTP/1.1.</p><hr class="noprint"><h1 id="rfc.section.13" class="np"><a href="#rfc.section.13">13.</a> <a id="caching" href="#caching">Caching in HTTP</a></h1><p id="rfc.section.13.p.1">HTTP is typically used for distributed information systems, where performance can be improved by the use of response caches. The HTTP/1.1 protocol includes a number of elements intended to make caching work as well as possible. Because these elements are inextricable from other aspects of the protocol, and because they interact with each other, it is useful to describe the basic caching design of HTTP separately from the detailed descriptions of methods, headers, response codes, etc.</p><p id="rfc.section.13.p.2">Caching would be useless if it did not significantly improve performance. The goal of caching in HTTP/1.1 is to eliminate the need to send requests in many cases, and to eliminate the need to send full responses in many other cases. The former reduces the number of network round-trips required for many operations; we use an "expiration" mechanism for this purpose (see <a href="#expiration.model" title="Expiration Model">Section 13.2</a>). The latter reduces network bandwidth requirements; we use a "validation" mechanism for this purpose (see <a href="#validation.model" title="Validation Model">Section 13.3</a>).</p><p id="rfc.section.13.p.3">Requirements for performance, availability, and disconnected operation require us to be able to relax the goal of semantic transparency. The HTTP/1.1 protocol allows origin servers, caches, and clients to explicitly reduce transparency when necessary. However, because non-transparent operation may confuse non-expert users, and might be incompatible with certain server applications (such as those for ordering merchandise), the protocol requires that transparency be relaxed </p><ul><li>only by an explicit protocol-level request when relaxed by client or origin server</li><li>only with an explicit warning to the end user when relaxed by cache or client</li></ul><p id="rfc.section.13.p.4">Therefore, the HTTP/1.1 protocol provides these important elements: </p><ol><li>Protocol features that provide full semantic transparency when this is required by all parties.</li><li>Protocol features that allow an origin server or user agent to explicitly request and control non-transparent operation.</li><li>Protocol features that allow a cache to attach warnings to responses that do not preserve the requested approximation of semantic transparency.</li></ol><p id="rfc.section.13.p.5">A basic principle is that it must be possible for the clients to detect any potential relaxation of semantic transparency. </p><dl class="empty"><dd> <b>Note:</b> The server, cache, or client implementor might be faced with design decisions not explicitly discussed in this specification. If a decision might affect semantic transparency, the implementor ought to err on the side of maintaining transparency unless a careful and complete analysis shows significant benefits in breaking transparency.</dd></dl><h2 id="rfc.section.13.1"><a href="#rfc.section.13.1">13.1</a> </h2><h3 id="rfc.section.13.1.1"><a href="#rfc.section.13.1.1">13.1.1</a> <a id="cache.correctness" href="#cache.correctness">Cache Correctness</a></h3><p id="rfc.section.13.1.1.p.1">A correct cache <em class="bcp14">MUST</em> respond to a request with the most up-to-date response held by the cache that is appropriate to the request (see sections <a href="#disambiguating.expiration.values" title="Disambiguating Expiration Values">13.2.5</a>, <a href="#disambiguating.multiple.responses" title="Disambiguating Multiple Responses">13.2.6</a>, and <a href="#cache.replacement" title="Cache Replacement">13.12</a>) which meets one of the following conditions: </p><ol><li>It has been checked for equivalence with what the origin server would have returned by revalidating the response with the origin server (<a href="#validation.model" title="Validation Model">Section 13.3</a>);</li><li>It is "fresh enough" (see <a href="#expiration.model" title="Expiration Model">Section 13.2</a>). In the default case, this means it meets the least restrictive freshness requirement of the client, origin server, and cache (see <a href="#header.cache-control" id="rfc.xref.header.cache-control.2" title="Cache-Control">Section 14.9</a>); if the origin server so specifies, it is the freshness requirement of the origin server alone. If a stored response is not "fresh enough" by the most restrictive freshness requirement of both the client and the origin server, in carefully considered circumstances the cache <em class="bcp14">MAY</em> still return the response with the appropriate Warning header (see section <a href="#exceptions.to.the.rules.and.warnings" title="Exceptions to the Rules and Warnings">13.1.5</a> and <a href="#header.warning" id="rfc.xref.header.warning.2" title="Warning">14.46</a>), unless such a response is prohibited (e.g., by a "no-store" cache-directive, or by a "no-cache" cache-request-directive; see <a href="#header.cache-control" id="rfc.xref.header.cache-control.3" title="Cache-Control">Section 14.9</a>).</li><li>It is an appropriate <a href="#status.304" class="smpl">304 (Not Modified)</a>, <a href="#status.305" class="smpl">305 (Proxy Redirect)</a>, or error (4xx or 5xx) response message.</li></ol><p id="rfc.section.13.1.1.p.2">If the cache can not communicate with the origin server, then a correct cache <em class="bcp14">SHOULD</em> respond as above if the response can be correctly served from the cache; if not it <em class="bcp14">MUST</em> return an error or warning indicating that there was a communication failure.</p><p id="rfc.section.13.1.1.p.3">If a cache receives a response (either an entire response, or a 304 (Not Modified) response) that it would normally forward to the requesting client, and the received response is no longer fresh, the cache <em class="bcp14">SHOULD</em> forward it to the requesting client without adding a new Warning (but without removing any existing Warning headers). A cache <em class="bcp14">SHOULD NOT</em> attempt to revalidate a response simply because that response became stale in transit; this might lead to an infinite loop. A user agent that receives a stale response without a Warning <em class="bcp14">MAY</em> display a warning indication to the user.</p><h3 id="rfc.section.13.1.2"><a href="#rfc.section.13.1.2">13.1.2</a> <a id="warnings" href="#warnings">Warnings</a></h3><p id="rfc.section.13.1.2.p.1">Whenever a cache returns a response that is neither first-hand nor "fresh enough" (in the sense of condition 2 in <a href="#cache.correctness" title="Cache Correctness">Section 13.1.1</a>), it <em class="bcp14">MUST</em> attach a warning to that effect, using a Warning general-header. The Warning header and the currently defined warnings are described in <a href="#header.warning" id="rfc.xref.header.warning.3" title="Warning">Section 14.46</a>. The warning allows clients to take appropriate action.</p><p id="rfc.section.13.1.2.p.2">Warnings <em class="bcp14">MAY</em> be used for other purposes, both cache-related and otherwise. The use of a warning, rather than an error status code, distinguish these responses from true failures.</p><p id="rfc.section.13.1.2.p.3">Warnings are assigned three digit warn-codes. The first digit indicates whether the Warning <em class="bcp14">MUST</em> or <em class="bcp14">MUST NOT</em> be deleted from a stored cache entry after a successful revalidation:</p><p id="rfc.section.13.1.2.p.4"> </p><dl><dt>1xx</dt><dd>Warnings that describe the freshness or revalidation status of the response, and so <em class="bcp14">MUST</em> be deleted after a successful revalidation. 1XX warn-codes <em class="bcp14">MAY</em> be generated by a cache only when validating a cached entry. It <em class="bcp14">MUST NOT</em> be generated by clients.</dd><dt>2xx</dt><dd>Warnings that describe some aspect of the entity body or entity headers that is not rectified by a revalidation (for example, a lossy compression of the entity bodies) and which <em class="bcp14">MUST NOT</em> be deleted after a successful revalidation.</dd></dl><p id="rfc.section.13.1.2.p.5">See <a href="#header.warning" id="rfc.xref.header.warning.4" title="Warning">Section 14.46</a> for the definitions of the codes themselves.</p><p id="rfc.section.13.1.2.p.6">HTTP/1.0 caches will cache all Warnings in responses, without deleting the ones in the first category. Warnings in responses that are passed to HTTP/1.0 caches carry an extra warning-date field, which prevents a future HTTP/1.1 recipient from believing an erroneously cached Warning.</p><p id="rfc.section.13.1.2.p.7">Warnings also carry a warning text. The text <em class="bcp14">MAY</em> be in any appropriate natural language (perhaps based on the client's Accept headers), and include an <em class="bcp14">OPTIONAL</em> indication of what character set is used.</p><p id="rfc.section.13.1.2.p.8">Multiple warnings <em class="bcp14">MAY</em> be attached to a response (either by the origin server or by a cache), including multiple warnings with the same code number. For example, a server might provide the same warning with texts in both English and Basque.</p><p id="rfc.section.13.1.2.p.9">When multiple warnings are attached to a response, it might not be practical or reasonable to display all of them to the user. This version of HTTP does not specify strict priority rules for deciding which warnings to display and in what order, but does suggest some heuristics.</p><h3 id="rfc.section.13.1.3"><a href="#rfc.section.13.1.3">13.1.3</a> <a id="cache-control.mechanisms" href="#cache-control.mechanisms">Cache-control Mechanisms</a></h3><p id="rfc.section.13.1.3.p.1">The basic cache mechanisms in HTTP/1.1 (server-specified expiration times and validators) are implicit directives to caches. In some cases, a server or client might need to provide explicit directives to the HTTP caches. We use the Cache-Control header for this purpose.</p><p id="rfc.section.13.1.3.p.2">The Cache-Control header allows a client or server to transmit a variety of directives in either requests or responses. These directives typically override the default caching algorithms. As a general rule, if there is any apparent conflict between header values, the most restrictive interpretation is applied (that is, the one that is most likely to preserve semantic transparency). However, in some cases, cache-control directives are explicitly specified as weakening the approximation of semantic transparency (for example, "max-stale" or "public").</p><p id="rfc.section.13.1.3.p.3">The cache-control directives are described in detail in <a href="#header.cache-control" id="rfc.xref.header.cache-control.4" title="Cache-Control">Section 14.9</a>.</p><h3 id="rfc.section.13.1.4"><a href="#rfc.section.13.1.4">13.1.4</a> <a id="explicit.ua.warnings" href="#explicit.ua.warnings">Explicit User Agent Warnings</a></h3><p id="rfc.section.13.1.4.p.1">Many user agents make it possible for users to override the basic caching mechanisms. For example, the user agent might allow the user to specify that cached entities (even explicitly stale ones) are never validated. Or the user agent might habitually add "Cache-Control: max-stale=3600" to every request. The user agent <em class="bcp14">SHOULD NOT</em> default to either non-transparent behavior, or behavior that results in abnormally ineffective caching, but <em class="bcp14">MAY</em> be explicitly configured to do so by an explicit action of the user.</p><p id="rfc.section.13.1.4.p.2">If the user has overridden the basic caching mechanisms, the user agent <em class="bcp14">SHOULD</em> explicitly indicate to the user whenever this results in the display of information that might not meet the server's transparency requirements (in particular, if the displayed entity is known to be stale). Since the protocol normally allows the user agent to determine if responses are stale or not, this indication need only be displayed when this actually happens. The indication need not be a dialog box; it could be an icon (for example, a picture of a rotting fish) or some other indicator.</p><p id="rfc.section.13.1.4.p.3">If the user has overridden the caching mechanisms in a way that would abnormally reduce the effectiveness of caches, the user agent <em class="bcp14">SHOULD</em> continually indicate this state to the user (for example, by a display of a picture of currency in flames) so that the user does not inadvertently consume excess resources or suffer from excessive latency.</p><h3 id="rfc.section.13.1.5"><a href="#rfc.section.13.1.5">13.1.5</a> <a id="exceptions.to.the.rules.and.warnings" href="#exceptions.to.the.rules.and.warnings">Exceptions to the Rules and Warnings</a></h3><p id="rfc.section.13.1.5.p.1">In some cases, the operator of a cache <em class="bcp14">MAY</em> choose to configure it to return stale responses even when not requested by clients. This decision ought not be made lightly, but may be necessary for reasons of availability or performance, especially when the cache is poorly connected to the origin server. Whenever a cache returns a stale response, it <em class="bcp14">MUST</em> mark it as such (using a Warning header) enabling the client software to alert the user that there might be a potential problem.</p><p id="rfc.section.13.1.5.p.2">It also allows the user agent to take steps to obtain a first-hand or fresh response. For this reason, a cache <em class="bcp14">SHOULD NOT</em> return a stale response if the client explicitly requests a first-hand or fresh one, unless it is impossible to comply for technical or policy reasons.</p><h3 id="rfc.section.13.1.6"><a href="#rfc.section.13.1.6">13.1.6</a> <a id="client-controlled.behavior" href="#client-controlled.behavior">Client-controlled Behavior</a></h3><p id="rfc.section.13.1.6.p.1">While the origin server (and to a lesser extent, intermediate caches, by their contribution to the age of a response) are the primary source of expiration information, in some cases the client might need to control a cache's decision about whether to return a cached response without validating it. Clients do this using several directives of the Cache-Control header.</p><p id="rfc.section.13.1.6.p.2">A client's request <em class="bcp14">MAY</em> specify the maximum age it is willing to accept of an unvalidated response; specifying a value of zero forces the cache(s) to revalidate all responses. A client <em class="bcp14">MAY</em> also specify the minimum time remaining before a response expires. Both of these options increase constraints on the behavior of caches, and so cannot further relax the cache's approximation of semantic transparency.</p><p id="rfc.section.13.1.6.p.3">A client <em class="bcp14">MAY</em> also specify that it will accept stale responses, up to some maximum amount of staleness. This loosens the constraints on the caches, and so might violate the origin server's specified constraints on semantic transparency, but might be necessary to support disconnected operation, or high availability in the face of poor connectivity.</p><h2 id="rfc.section.13.2"><a href="#rfc.section.13.2">13.2</a> <a id="expiration.model" href="#expiration.model">Expiration Model</a></h2><h3 id="rfc.section.13.2.1"><a href="#rfc.section.13.2.1">13.2.1</a> <a id="server-specified.expiration" href="#server-specified.expiration">Server-Specified Expiration</a></h3><p id="rfc.section.13.2.1.p.1">HTTP caching works best when caches can entirely avoid making requests to the origin server. The primary mechanism for avoiding requests is for an origin server to provide an explicit expiration time in the future, indicating that a response <em class="bcp14">MAY</em> be used to satisfy subsequent requests. In other words, a cache can return a fresh response without first contacting the server.</p><p id="rfc.section.13.2.1.p.2">Our expectation is that servers will assign future explicit expiration times to responses in the belief that the entity is not likely to change, in a semantically significant way, before the expiration time is reached. This normally preserves semantic transparency, as long as the server's expiration times are carefully chosen.</p><p id="rfc.section.13.2.1.p.3">The expiration mechanism applies only to responses taken from a cache and not to first-hand responses forwarded immediately to the requesting client.</p><p id="rfc.section.13.2.1.p.4">If an origin server wishes to force a semantically transparent cache to validate every request, it <em class="bcp14">MAY</em> assign an explicit expiration time in the past. This means that the response is always stale, and so the cache <em class="bcp14">SHOULD</em> validate it before using it for subsequent requests. See <a href="#cache.revalidation.and.reload.controls" title="Cache Revalidation and Reload Controls">Section 14.9.4</a> for a more restrictive way to force revalidation.</p><p id="rfc.section.13.2.1.p.5">If an origin server wishes to force any HTTP/1.1 cache, no matter how it is configured, to validate every request, it <em class="bcp14">SHOULD</em> use the "must-revalidate" cache-control directive (see <a href="#header.cache-control" id="rfc.xref.header.cache-control.5" title="Cache-Control">Section 14.9</a>).</p><p id="rfc.section.13.2.1.p.6">Servers specify explicit expiration times using either the Expires header, or the max-age directive of the Cache-Control header.</p><p id="rfc.section.13.2.1.p.7">An expiration time cannot be used to force a user agent to refresh its display or reload a resource; its semantics apply only to caching mechanisms, and such mechanisms need only check a resource's expiration status when a new request for that resource is initiated. See <a href="#history.lists" title="History Lists">Section 13.13</a> for an explanation of the difference between caches and history mechanisms.</p><h3 id="rfc.section.13.2.2"><a href="#rfc.section.13.2.2">13.2.2</a> <a id="heuristic.expiration" href="#heuristic.expiration">Heuristic Expiration</a></h3><p id="rfc.section.13.2.2.p.1">Since origin servers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, employing algorithms that use other header values (such as the Last-Modified time) to estimate a plausible expiration time. The HTTP/1.1 specification does not provide specific algorithms, but does impose worst-case constraints on their results. Since heuristic expiration times might compromise semantic transparency, they ought to used cautiously, and we encourage origin servers to provide explicit expiration times as much as possible.</p><h3 id="rfc.section.13.2.3"><a href="#rfc.section.13.2.3">13.2.3</a> <a id="age.calculations" href="#age.calculations">Age Calculations</a></h3><p id="rfc.section.13.2.3.p.1">In order to know if a cached entry is fresh, a cache needs to know if its age exceeds its freshness lifetime. We discuss how to calculate the latter in <a href="#expiration.calculations" title="Expiration Calculations">Section 13.2.4</a>; this section describes how to calculate the age of a response or cache entry.</p><p id="rfc.section.13.2.3.p.2">In this discussion, we use the term "now" to mean "the current value of the clock at the host performing the calculation." Hosts that use HTTP, but especially hosts running origin servers and caches, <em class="bcp14">SHOULD</em> use NTP <a href="#RFC1305" id="rfc.xref.RFC1305.1"><cite title="Network Time Protocol (Version 3) Specification, Implementation">[28]</cite></a> or some similar protocol to synchronize their clocks to a globally accurate time standard.</p><p id="rfc.section.13.2.3.p.3">HTTP/1.1 requires origin servers to send a Date header, if possible, with every response, giving the time at which the response was generated (see <a href="#header.date" id="rfc.xref.header.date.2" title="Date">Section 14.18</a>). We use the term "date_value" to denote the value of the Date header, in a form appropriate for arithmetic operations.</p><p id="rfc.section.13.2.3.p.4">HTTP/1.1 uses the Age response-header to convey the estimated age of the response message when obtained from a cache. The Age field value is the cache's estimate of the amount of time since the response was generated or revalidated by the origin server.</p><p id="rfc.section.13.2.3.p.5">In essence, the Age value is the sum of the time that the response has been resident in each of the caches along the path from the origin server, plus the amount of time it has been in transit along network paths.</p><p id="rfc.section.13.2.3.p.6">We use the term "age_value" to denote the value of the Age header, in a form appropriate for arithmetic operations.</p><p id="rfc.section.13.2.3.p.7">A response's age can be calculated in two entirely independent ways: </p><ol><li>now minus date_value, if the local clock is reasonably well synchronized to the origin server's clock. If the result is negative, the result is replaced by zero.</li><li>age_value, if all of the caches along the response path implement HTTP/1.1.</li></ol><p id="rfc.section.13.2.3.p.8">Given that we have two independent ways to compute the age of a response when it is received, we can combine these as</p><div id="rfc.figure.u.54"></div><pre class="text"> corrected_received_age = max(now - date_value, age_value) |
| 583 | </pre><p id="rfc.section.13.2.3.p.10">and as long as we have either nearly synchronized clocks or all-HTTP/1.1 paths, one gets a reliable (conservative) result.</p><p id="rfc.section.13.2.3.p.11">Because of network-imposed delays, some significant interval might pass between the time that a server generates a response and the time it is received at the next outbound cache or client. If uncorrected, this delay could result in improperly low ages.</p><p id="rfc.section.13.2.3.p.12">Because the request that resulted in the returned Age value must have been initiated prior to that Age value's generation, we can correct for delays imposed by the network by recording the time at which the request was initiated. Then, when an Age value is received, it <em class="bcp14">MUST</em> be interpreted relative to the time the request was initiated, not the time that the response was received. This algorithm results in conservative behavior no matter how much delay is experienced. So, we compute:</p><div id="rfc.figure.u.55"></div><pre class="text"> corrected_initial_age = corrected_received_age |