3 HTTP Working Group R. Fielding, UC Irvine
4 INTERNET-DRAFT H. Frystyk, MIT/LCS
5 <draft-ietf-http-v11-spec-03.html> T. Berners-Lee, MIT/LCS
8 Expires October 2, 1996 May 2, 1996
10 Hypertext Transfer Protocol -- HTTP/1.1
14 This document is an Internet-Draft. Internet-Drafts are working
15 documents of the Internet Engineering Task Force (IETF), its areas, and
16 its working groups. Note that other groups may also distribute working
17 documents as Internet-Drafts.
19 Internet-Drafts are draft documents valid for a maximum of six months
20 and may be updated, replaced, or made obsolete by other documents at any
21 time. It is inappropriate to use Internet-Drafts as reference material
22 or to cite them other than as "work in progress".
24 To learn the current status of any Internet-Draft, please check the
25 "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow
26 Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
27 munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
28 ftp.isi.edu (US West Coast).
30 Distribution of this document is unlimited. Please send comments to the
31 HTTP working group at <http-wg@cuckoo.hpl.hp.com>. Discussions of the
32 working group are archived at
33 <URL:http://www.ics.uci.edu/pub/ietf/http/>. General discussions about
34 HTTP and the applications which use HTTP should take place on the <www-
35 talk@w3.org> mailing list.
37 NOTE: This specification is for discussion purposes only. It is not
38 claimed to represent the consensus of the HTTP working group, and
39 contains a number of proposals that either have not been discussed
40 or are controversial. The working group is discussing significant
41 changes in many areas, including - support for caching, persistent
42 connections, range retrieval, content negotiation, MIME
43 compatibility, authentication, timing of the PUT operation.
47 The Hypertext Transfer Protocol (HTTP) is an application-level protocol
48 for distributed, collaborative, hypermedia information systems. It is a
49 generic, stateless, object-oriented protocol which can be used for many
50 tasks, such as name servers and distributed object management systems,
51 through extension of its request methods (commands). A feature of HTTP
52 is the typing and negotiation of data representation, allowing systems
53 to be built independently of the data being transferred.
56 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 1]
61 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
64 HTTP has been in use by the World-Wide Web global information initiative
65 since 1990. This specification defines the protocol referred to as
68 3 Note to Readers of This Document
71 We believe this draft to be very close to consensus of the working group
72 in terms of functionality for HTTP/1.1, and the text substantially
73 correct. One final technical change NOT reflected in this draft is to
74 make persistent connections the default behavior for HTTP/1.1; editorial
75 changes to reflect this in the next, and we hope final draft, are being
76 circulated in the working group mailing list.
78 This draft has undergone extensive reorganization to improve
79 presentation. Let us know if there are remaining problems.
81 The terminology used in this draft has changed to reduce confusion.
82 While we are converging on a shared set of terminology and definitions,
83 it is possible there will be a final set of terminology adopted in the
84 next draft. Despite any terminology changes that may occur to improve
85 the presentation of the specification, we do not expect to change the
86 name of any header field or parameter name.
88 There are a very few remaining issues indicated by Editor's Note: in
118 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 2]
130 HYPERTEXT TRANSFER PROTOCOL -- HTTP/1.1
132 1 Status of this Memo
136 3 Note to Readers of This Document
144 5.4 Overall Operation
147 6 Notational Conventions and Generic Grammar
151 7 Protocol Parameters
153 7.2 Uniform Resource Identifiers
154 7.3 Date/Time Formats
165 7.14 Range Protocol Parameters
170 8.3 General Header Fields
174 9.2 The Resource Identified by a Request
175 9.3 Request Header Fields
179 10.2 Response Header Fields
181 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 3]
186 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
190 11.1 Entity Header Fields
193 12 Status Code Definitions
194 12.1 Informational 1xx
197 12.4 Client Error 4xx
198 12.5 Server Error 5xx
200 13 Method Definitions
209 14 Access Authentication
210 14.1 Basic Authentication Scheme
211 14.2 Digest Authentication Scheme
213 15 Content Negotiation
214 15.1 Negotiation Facilities Defined in this Specification
217 16.1 Semantic Transparency
218 16.2 Expiration Model
219 16.3 Validation Model
220 16.4 Constructing Responses From Caches
221 16.5 Caching and Generic Resources
222 16.6 Shared and Non-Shared Caches
223 16.7 Selecting a Cached Response
224 16.8 Errors or Incomplete Response Cache Behavior
225 16.9 Side Effects of GET and HEAD
226 16.10 Invalidation After Updates or Deletions
227 16.11 Write-Through Mandatory
228 16.12 Generic Resources and HTTP/1.0 Proxy Caches
229 16.13 Cache Replacement
230 16.14 Caching of Negative Responses
233 17 Persistent Connections
235 17.2 Overall Operation
237 17.4 Interaction with Security Protocols
238 17.5 Practical Considerations
240 18 Header Field Definitions
244 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 4]
249 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
262 18.13 Content-Encoding
263 18.14 Content-Language
265 18.16 Content-Location
274 18.25 If-Modified-Since
278 18.29 If-Unmodified-Since
284 18.35 Proxy-Authenticate
285 18.36 Proxy-Authorization
292 18.43 Transfer Encoding
298 18.49 WWW-Authenticate
300 19 Security Considerations
301 19.1 Authentication of Clients
303 19.3 Abuse of Server Log Information
304 19.4 Transfer of Sensitive Information
305 19.5 Attacks Based On File and Path Names
307 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 5]
312 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
315 19.6 Personal Information
316 19.7 Privacy Issues Connected to Accept headers
318 19.9 Location Headers and Spoofing
324 22 Authors' Addresses
327 23.1 Internet Media Type message/http
328 23.2 Tolerant Applications
329 23.3 Differences Between HTTP Bodies and RFC 1521 Internet Message
331 23.4 Changes from HTTP/1.0
332 23.5 Additional Features
370 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 6]
380 The Hypertext Transfer Protocol (HTTP) is an application-level protocol
381 for distributed, collaborative, hypermedia information systems. HTTP has
382 been in use by the World-Wide Web global information initiative since
383 1990. The first version of HTTP, referred to as HTTP/0.9, was a simple
384 protocol for raw data transfer across the Internet. HTTP/1.0, as defined
385 by RFC xxxx , improved the protocol by allowing messages to be in the
386 format of MIME-like entities, containing metainformation about the data
387 transferred and modifiers on the request/response semantics. However,
388 HTTP/1.0 does not sufficiently take into consideration the effect of
389 hierarchical proxies , caching, the need for persistent connections and
390 virtual hosts.. In addition, the proliferation of incompletely-
391 implemented applications calling themselves "HTTP/1.0" has necessitated
392 a protocol version change in order for two communicating applications to
393 determine each other's true capabilities.
395 This specification defines the protocol referred to as "HTTP/1.1". This
396 protocol is backwards-compatible with HTTP/1.0, but includes more
397 stringent requirements in order to ensure reliable implementation of its
400 Practical information systems require more functionality than simple
401 retrieval, including search, front-end update, and annotation. HTTP
402 allows an open-ended set of methods that indicate the purpose of a
403 request. It builds on the discipline of reference provided by the
404 Uniform Resource Identifier (URI) , as a location (URL) or name (URN)
406 for indicating the resource to which a method is to be applied. Messages
407 are passed in a format similar to that used by Internet Mail and the
408 Multipurpose Internet Mail Extensions (MIME) .
410 HTTP is also used as a generic protocol for communication between user
411 agents and proxies/gateways to other Internet protocols, such as SMTP ,
412 NNTP , FTP , Gopher , and WAIS , allowing basic hypermedia access to
413 resources available from diverse applications and simplifying the
414 implementation of user agents.
418 This specification uses the same words as RFC 1123 for defining the
419 significance of each particular requirement. These words are:
423 This word or the adjective "required" means that the item is an
424 absolute requirement of the specification.
427 This word or the adjective "recommended" means that there may
429 valid reasons in particular circumstances to ignore this item, but
430 the full implications should be understood and the case carefully
431 weighed before choosing a different course.
435 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 7]
440 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
444 This word or the adjective "optional" means that this item is
446 optional. One vendor may choose to include the item because a
447 particular marketplace requires it or because it enhances the
448 product, for example; another vendor may omit the same item.
449 An implementation is not compliant if it fails to satisfy one or more of
450 the MUST requirements for the protocols it implements. An implementation
451 that satisfies all the MUST and all the SHOULD requirements for its
452 protocols is said to be "unconditionally compliant"; one that satisfies
453 all the MUST requirements but not all the SHOULD requirements for its
454 protocols is said to be "conditionally compliant".
458 This specification uses a number of terms to refer to the roles played
459 by participants in, and objects of, the HTTP communication.
463 A transport layer virtual circuit established between two programs
464 for the purpose of communication.
467 The basic unit of HTTP communication, consisting of a structured
468 sequence of octets matching the syntax defined in section 8 and
469 transmitted via the connection.
472 An HTTP request message as defined in section 9.
475 An HTTP response message as defined in section 10.
478 A network data object or service that can be identified by a URI
479 (section 7.2). At any point in time, a resource may be either a
480 plain resource, which corresponds to only one possible
481 representation, or a generic resource.
484 A resource that is a set of closely related representations of the
485 same document, form, applet, etc. A generic resource is always
486 identified by a URI. The individual representations may each be
487 identified by a unique URI, or by the combination of the generic
488 resource's URI and a variant-ID, or by the combination of the generic
489 resource's URI and some "content-negotiation" mechanism. In this
490 case, other URIs may exist which identify a resource more
494 A resource that is not a generic resource. A plain resource is
495 always identified by a URI.
499 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 8]
504 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
508 The set of information transferred as the payload of a request or
509 response An entity consists of metainformation in the form of
510 Entity-Header fields and content in the form of an Entity-Body, as
511 described in section 11.
514 A specific representation, rendition, encoding, or presentation of a
515 network data object or service, either a plain resource or a specific
516 member of a generic resource. A resource entity might be identified
517 by a URI, or by the combination of a URI and a variant-ID, or by the
518 combination of a URI and some other mechanism. An plain resource MUST
519 be bound to a single resource entity at any instant in time.
522 A resource entity that is a member of at least one generic resource.
523 Sometimes called a resource variant. Note that the set of variants
524 of a generic resource may change over time as well.
527 The mechanism for selecting the appropriate variant of a generic
528 resource when servicing a request, as described in section 15.
531 An opaque string associated with an entity and used to distinguish it
532 from other entities of the requested resource . A "strong entity
533 tag" is one that may be shared by two entities of a resource only if
534 they are equivalent by octet equality. A "weak entity tag" is one
535 that may be shared by two entities of a resource if they are
536 equivalent and could be substituted for each other with no
537 significant change in semantics. A given entity tag value may be
538 used for entities obtained by requests on different URIs without
539 implying anything about the equivalence of these entities.
542 An application program that establishes connections for the purpose
546 The client which initiates a request. These are often browsers,
547 editors, spiders (web-traversing robots), or other end user tools.
550 An application program that accepts connections in order to service
551 requests by sending back responses. Any given program MAY be capable
552 of being both a client and a server; our use of these terms refers
553 only to the role being performed by the program for a particular
554 connection, rather than to the program's capabilities in general.
555 Likewise, any server MAY act as an origin server, proxy, gateway, or
556 tunnel, switching behavior based on the nature of each request.
559 The server on which a given resource resides or is to be created.
562 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 9]
567 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
571 An intermediary program which acts as both a server and a client for
572 the purpose of making requests on behalf of other clients. Requests
573 are serviced internally or by passing them on, with possible
574 translation, to other servers. A proxy MUST interpret and, if
575 necessary, rewrite a request message before forwarding it. Proxies
576 are often used as client-side portals through network firewalls and
577 as helper applications for handling requests via protocols not
578 implemented by the user agent.
581 A server which acts as an intermediary for some other server. Unlike
582 a proxy, a gateway receives requests as if it were the origin server
583 for the requested resource; the requesting client may not be aware
584 that it is communicating with a gateway. Gateways are often used as
585 server-side portals through network firewalls and as protocol
586 translators for access to resources stored on non-HTTP systems.
589 An intermediary program which is acting as a blind relay between two
590 connections. Once active, a tunnel is not considered a party to the
591 HTTP communication, though the tunnel may have been initiated by an
592 HTTP request. The tunnel ceases to exist when both ends of the
593 relayed connections are closed. Tunnels are used when a portal is
594 necessary and the intermediary cannot, or should not, interpret the
595 relayed communication.
598 A program's local store of response messages and the subsystem that
599 controls its message storage, retrieval, and deletion. A cache stores
600 cachable responses in order to reduce the response time and network
601 bandwidth consumption on future, equivalent requests. Any client or
602 server MAY include a cache, though a cache cannot be used by a server
603 that acts acting as a tunnel.
606 A response is cachable if a cache is allowed to store a copy of the
607 response message for use in answering subsequent requests. The rules
608 for determining the cachability of HTTP responses are defined in
609 Section 16. Even if a resource is cachable, there may be additional
610 constraints on when and if a cache can use the cached copy for a
614 A response is firsthand if it comes directly and without unnecessary
615 delay from the origin server, perhaps via one or more proxies. A
616 response is also firsthand if its validity has just been checked
617 directly with the origin server.
619 explicit expiration time
620 The time at which the origin server intends that an entity should no
621 longer be returned by a cache without further validation.
625 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 10]
630 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
633 heuristic expiration time
634 An expiration time assigned by a cache when no explicit expiration
638 The age of a response is the time since it was generated by, or
639 successfully validated with, the origin server.
642 The length of time between the generation of a response and its
646 A response is fresh if its age has not yet exceeded its freshness
650 A response is stale if its age has passed its freshness lifetime. A
651 cache may use a fresh response without validating it, but "normally"
652 may not use a stale response without first validating it.
653 ("Normally" means "unless configured to provide better performance at
654 the expense of transparency.")
655 Therefore, what expires is the cache's authority to use a cached
656 response, without validation, in its reply to a subsequent request.
658 semantically transparent
659 Ideally, an HTTP/1.1 cache would be "semantically transparent." That
660 is, use of the cache would not affect either the clients or the
661 servers in any way except to improve performance. When a client makes
662 a request via a semantically transparent cache, it receives exactly
663 the same entity headers and entity body it would have received if it
664 had made the same request to the origin server, at the same time.
667 An entity tag, or a Last-Modified time, which is used to find out
668 whether a cache entry is a semantically transparent copy of a
669 resource entity. A cache entry is semantically transparent if its
670 validator exactly matches the validator that the server would provide
671 for current instance of that resource entity.
673 5.4 Overall Operation
674 The HTTP protocol is a request/response protocol. A client sends a
675 request to the server in the form of a request method, URI, and protocol
676 version, followed by a MIME-like message containing request modifiers,
677 client information, and possible body content over a connection with a
678 server. The server responds with a status line, including the message's
679 protocol version and a success or error code, followed by a MIME-like
680 message containing server information, entity metainformation, and
681 possible entity body content.
683 Most HTTP communication is initiated by a user agent and consists of a
684 request to be applied to a resource on some origin server. In the
685 simplest case, this may be accomplished via a single connection (v)
686 between the user agent (UA) and the origin server (O).
688 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 11]
693 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
696 request chain ------------------------>
697 UA -------------------v------------------- O
698 <----------------------- response chain
700 A more complicated situation occurs when one or more intermediaries are
701 present in the request/response chain. There are three common forms of
702 intermediary: proxy, gateway, and tunnel. A proxy is a forwarding
704 receiving requests for a URI in its absolute form, rewriting all or part
705 of the message, and forwarding the reformatted request toward the server
706 identified by the URI. A gateway is a receiving agent, acting as a layer
707 above some other server(s) and, if necessary, translating the requests
708 to the underlying server's protocol. A tunnel acts as a relay point
709 between two connections without changing the messages; tunnels are used
710 when the communication needs to pass through an intermediary (such as a
711 firewall) even when the intermediary cannot understand the contents of
714 request chain -------------------------------------->
715 UA -----v----- A -----v----- B -----v----- C -----v----- O
716 <------------------------------------- response chain
718 The figure above shows three intermediaries (A, B, and C) between the
719 user agent and origin server. A request or response message that travels
720 the whole chain MUST pass through four separate connections. This
721 distinction is important because some HTTP communication options may
722 apply only to the connection with the nearest, non-tunnel neighbor, only
723 to the end-points of the chain, or to all connections along the chain.
724 Although the diagram is linear, each participant may be engaged in
725 multiple, simultaneous communications. For example, B may be receiving
726 requests from many clients other than A, and/or forwarding requests to
727 servers other than C, at the same time that it is handling A's request.
729 Any party to the communication which is not acting as a tunnel may
730 employ an internal cache for handling requests. The effect of a cache is
731 that the request/response chain is shortened if one of the participants
732 along the chain has a cached response applicable to that request. The
733 following illustrates the resulting chain if B has a cached copy of an
734 earlier response from O (via C) for a request which has not been cached
737 request chain ---------->
738 UA -----v----- A -----v----- B - - - - - - C - - - - - - O
739 <--------- response chain
741 Not all responses are cachable, and some requests may contain modifiers
742 which place special requirements on cache behavior. HTTP requirements
743 for cache behavior and cachable responses are defined in section 16.
745 HTTP communication usually takes place over TCP/IP connections. The
746 default port is TCP 80 , but other ports can be used. This does not
747 preclude HTTP from being implemented on top of any other protocol on the
748 Internet, or on other networks. HTTP only presumes a reliable
750 any protocol that provides such guarantees can be used; the mapping of
751 the HTTP/1.1 request and response structures onto the transport data
753 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 12]
758 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
761 units of the protocol in question is outside the scope of this
764 However, HTTP/1.1 implementations SHOULD implement persistent
765 connections (See section 17). Both clients and servers MUST be capable
766 of handling cases where either party closes the connection prematurely,
767 due to user action, automated time-out, or program failure. In any
769 the closing of the connection by either or both parties always
770 terminates the current request, regardless of its status.
774 HTTP/1.1 uses many of the constructs defined for MIME, as defined in RFC
775 1521 . Appendix 23.3 describes the ways in which the context of HTTP
776 allows for different use of Internet Media Types than is typically found
777 in Internet mail, and gives the rationale for those differences.
780 6 Notational Conventions and Generic Grammar
783 All of the mechanisms specified in this document are described in both
784 prose and an augmented Backus-Naur Form (BNF) similar to that used by
785 RFC 822 . Implementers will need to be familiar with the notation in
786 order to understand this specification. The augmented BNF includes the
787 following constructs:
791 The name of a rule is simply the name itself (without any enclosing
792 "<" and ">") and is separated from its definition by the equal
793 character "=". Whitespace is only significant in that indentation
794 of continuation lines is used to indicate a rule definition that
795 spans more than one line. Certain basic rules are in uppercase,
796 such as SP, LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle brackets are
797 used within definitions whenever their presence will facilitate
798 discerning the use of rule names.
801 Quotation marks surround literal text. Unless stated otherwise, the
802 text is case-insensitive.
805 Elements separated by a bar ("I") are alternatives, e.g., "yes |
806 no" will accept yes or no.
809 Elements enclosed in parentheses are treated as a single element.
810 Thus, "(elem (foo | bar) elem)" allows the token sequences "elem
811 foo elem" and "elem bar elem".
814 The character "*" preceding an element indicates repetition. The
815 full form is "<n>*<m>element" indicating at least <n> and at most
817 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 13]
822 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
825 <m> occurrences of element. Default values are 0 and infinity so
826 that "*(element)" allows any number, including zero; "1*element"
827 requires at least one; and "1*2element" allows one or two.
830 Square brackets enclose optional elements; "[foo bar]" is
831 equivalent to "*1(foo bar)".
834 Specific repetition: "<n>(element)" is equivalent to
835 "<n>*<n>(element)"; that is, exactly <n> occurrences of (element).
836 Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three
837 alphabetic characters.
840 A construct "#" is defined, similar to "*", for defining lists of
841 elements. The full form is "<n>#<m>element " indicating at least
842 <n> and at most <m> elements, each separated by one or more commas
843 (",") and optional linear whitespace (LWS). This makes the usual
844 form of lists very easy; a rule such as "( *LWS element *( *LWS
846 *LWS element )) " can be shown as "1#element". Wherever this
847 construct is used, null elements are allowed, but do not contribute
848 to the count of elements present. That is, "(element), , (element)
849 " is permitted, but counts as only two elements. Therefore, where
850 at least one element is required, at least one non-null element
851 MUST be present. Default values are 0 and infinity so that
852 "#(element) " allows any number, including zero; "1#element"
853 requires at least one; and "1#2element" allows one or two.
856 A semi-colon, set off some distance to the right of rule text,
857 starts a comment that continues to the end of line. This is a
858 simple way of including useful notes in parallel with the
862 The grammar described by this specification is word-based. Except
863 where noted otherwise, linear whitespace (LWS) can be included
864 between any two adjacent words (token or quoted-string), and
865 between adjacent tokens and delimiters (tspecials), without
866 changing the interpretation of a field. At least one delimiter
867 (tspecials) MUST exist between any two tokens, since they would
868 otherwise be interpreted as a single token. However, applications
869 SHOULD attempt to follow "common form" when generating HTTP
870 constructs, since there exist some implementations that fail to
871 accept anything beyond the common forms.
874 The following rules are used throughout this specification to describe
875 basic parsing constructs. The US-ASCII coded character set is defined by.
877 OCTET = <any 8-bit sequence of data>
878 CHAR = <any US-ASCII character (octets 0 - 127)>
880 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 14]
885 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
888 UPALPHA = <any US-ASCII uppercase letter "A".."Z">
889 LOALPHA = <any US-ASCII lowercase letter "a".."z">
890 ALPHA = UPALPHA | LOALPHA
891 DIGIT = <any US-ASCII digit "0".."9">
892 CTL = <any US-ASCII control character
893 (octets 0 - 31) and DEL (127)>
894 CR = <US-ASCII CR, carriage return (13)>
895 LF = <US-ASCII LF, linefeed (10)>
896 SP = <US-ASCII SP, space (32)>
897 HT = <US-ASCII HT, horizontal-tab (9)>
898 <"> = <US-ASCII double-quote mark (34)>
900 HTTP/1.1 defines the octet sequence CR LF as the end-of-line marker for
901 all protocol elements except the Entity-Body (see appendix 23.2 for
902 tolerant applications). The end-of-line marker within an Entity-Body is
903 defined by its associated media type, as described in section 7.7.
907 HTTP/1.1 headers can be folded onto multiple lines if the continuation
908 line begins with a space or horizontal tab. All linear whitespace,
909 including folding, has the same semantics as SP.
911 LWS = [CRLF] 1*( SP | HT )
913 The TEXT rule is only used for descriptive field contents and values
914 that are not intended to be interpreted by the message parser. Words of
915 *TEXT MAY contain octets from character sets other than US-ASCII only
916 when encoded according to the rules of RFC 1522 .
918 TEXT = <any OCTET except CTLs,
921 Recipients of header field TEXT containing octets outside the US-ASCII
922 character set range MAY assume that they represent ISO-8859-1 characters
923 if there is no other encoding indicated by an RFC 1522 mechanism.
925 Hexadecimal numeric characters are used in several protocol elements.
927 HEX = "A" | "B" | "C" | "D" | "E" | "F"
928 | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT
930 Many HTTP/1.1 header field values consist of words separated by LWS or
931 special characters. These special characters MUST be in a quoted string
932 to be used within a parameter value.
934 word = token | quoted-string
936 token = 1*<any CHAR except CTLs or tspecials>
938 tspecials = "(" | ")" | "<" | ">" | "@"
939 | "," | ";" | ":" | "\" | <">
940 | "/" | "[" | "]" | "?" | "="
941 | "{" | "}" | SP | HT
943 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 15]
948 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
951 Comments can be included in some HTTP header fields by surrounding the
952 comment text with parentheses. Comments are only allowed in fields
953 containing "comment" as part of their field value definition. In all
954 other fields, parentheses are considered part of the field value.
956 comment = "(" *( ctext | comment ) ")"
957 ctext = <any TEXT excluding "(" and ")">
959 A string of text is parsed as a single word if it is quoted using
962 quoted-string = ( <"> *(qdtext) <"> )
965 qdtext = <any CHAR except <"> and CTLs,
968 The backslash character ("\") may be used as a single-character quoting
969 mechanism only within quoted-string and comment constructs.
971 quoted-pair = "\" CHAR
974 7 Protocol Parameters
977 HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of
978 the protocol. The protocol versioning policy is intended to allow the
979 sender to indicate the format of a message and its capacity for
980 understanding further HTTP communication, rather than the features
981 obtained via that communication. No change is made to the version number
982 for the addition of message components which do not affect communication
983 behavior or which only add to extensible field values. The <minor>
984 number is incremented when the changes made to the protocol add features
985 which do not change the general message parsing algorithm, but which may
986 add to the message semantics and imply additional capabilities of the
987 sender. The <major> number is incremented when the format of a message
988 within the protocol is changed.
990 The version of an HTTP message is indicated by an HTTP-Version field in
991 the first line of the message. If the protocol version is not specified,
992 the recipient MUST assume that the message is in the simple HTTP/0.9
995 HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
997 Note that the major and minor numbers SHOULD be treated as separate
998 integers and that each MAY be incremented higher than a single digit.
999 Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is lower
1000 than HTTP/12.3. Leading zeros SHOULD be ignored by recipients and never
1001 generated by senders.
1003 Applications sending Full-Request or Full-Response messages, as defined
1004 by this specification, MUST include an HTTP-Version of "HTTP/1.1". Use
1006 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 16]
1011 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1014 of this version number indicates that the sending application is at
1015 least conditionally compliant with this specification.
1017 Proxy and gateway applications MUST be careful in forwarding requests
1018 that are received in a format different from that of the application's
1019 native HTTP version. Since the protocol version indicates the protocol
1020 capability of the sender, a proxy/gateway MUST never send a message with
1021 a version indicator which is greater than its native version; if a
1022 higher version request is received, the proxy/gateway MUST either
1023 downgrade the request version, respond with an error, or switch to
1024 tunnel behavior. Requests with a version lower than that of the
1025 application's native format MAY be upgraded before being forwarded; the
1026 proxy/gateway's response to that request MUST follow the server
1027 requirements listed above.
1029 Note: Converting between versions of HTTP may involve addition or
1030 deletion of headers required or forbidden by the version involved.
1031 It is likely more involved than just changing the version
1035 7.2 Uniform Resource Identifiers
1036 URIs have been known by many names: WWW addresses, Universal Document
1037 Identifiers, Universal Resource Identifiers , and finally the
1038 combination of Uniform Resource Locators (URL) and Names (URN) . As far
1039 as HTTP is concerned, Uniform Resource Identifiers are simply formatted
1040 strings which identify--via name, location, or any other characteristic--
1044 7.2.1 General Syntax
1045 URIs in HTTP can be represented in absolute form or relative to some
1046 known base URI , depending upon the context of their use. The two forms
1047 are differentiated by the fact that absolute URIs always begin with a
1048 scheme name followed by a colon.
1050 URI = ( absoluteURI | relativeURI ) [ "#" fragment ]
1052 absoluteURI = scheme ":" *( uchar | reserved )
1054 relativeURI = net_path | abs_path | rel_path
1056 net_path = "//" net_loc [ abs_path ] abs_path
1058 rel_path = [ path ] [ ";" params ] [ "?" query ]
1060 path = fsegment *( "/" segment )
1064 params = param *( ";" param )
1065 param = *( pchar | "/" )
1069 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 17]
1074 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1077 scheme = 1*( ALPHA | DIGIT | "+" | "-" | "." )
1078 net_loc = *( pchar | ";" | "?" )
1079 query = *( uchar | reserved )
1080 fragment = *( uchar | reserved )
1082 pchar = uchar | ":" | "@" | "&" | "=" | "+"
1083 uchar = unreserved | escape
1084 unreserved = ALPHA | DIGIT | safe | extra | national
1086 escape = "%" HEX HEX
1087 reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+"
1088 extra = "!" | "*" | "'" | "(" | ")" | ","
1089 safe = "$" | "-" | "_" | "."
1090 unsafe = CTL | SP | <"> | "#" | "%" | "<" | ">"
1091 national = <any OCTET excluding ALPHA, DIGIT,
1092 reserved, extra, safe, and unsafe>
1094 For definitive information on URL syntax and semantics, see RFC 1738
1095 and RFC 1808 . The BNF above includes national characters not allowed in
1096 valid URLs as specified by RFC 1738, since HTTP servers are not
1097 restricted in the set of unreserved characters allowed to represent the
1098 rel_path part of addresses, and HTTP proxies may receive requests for
1099 URIs not defined by RFC 1738.
1101 The HTTP protocol does not place any a priori limit on the length of a
1102 URI. Servers MUST be able to handle the URI of any resource they
1103 serve, and SHOULD be able to handle URIs of unbounded length if they
1104 provide GET-based forms that could generate such URIs. A server SHOULD
1105 return a status code of
1107 414 Request-URI Too Large
1109 if a URI is longer than the server can handle. See section 12.4.1.15.
1111 Note: Servers should be cautious about depending on URI lengths
1112 above 255 bytes, because some older client or proxy implementations
1113 may not properly support these.
1115 All client and proxy implementations MUST be able to handle a URI of
1120 The "http" scheme is used to locate network resources via the HTTP
1121 protocol. This section defines the scheme-specific syntax and semantics
1124 http_URL = "http:" "//" host [ ":" port ] [ abs_path ]
1126 host = <A legal Internet host domain name
1127 or IP address (in dotted-decimal form),
1128 as defined by Section 2.1 of RFC 1123>
1132 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 18]
1137 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1140 If the port is empty or not given, port 80 is assumed. The semantics are
1141 that the identified resource is located at the server listening for TCP
1142 connections on that port of that host, and the Request-URI for the
1143 resource is abs_path. The use of IP addresses in URL's SHOULD be
1144 avoided whenever possible. See RFC 1900. If the abs_path is not
1145 present in the URL, it MUST be given as "/" when used as a Request-URI
1146 for a resource (section 9.1.2).
1148 Note: Although the HTTP protocol is independent of the transport
1149 layer protocol, the http URL only identifies resources by their TCP
1150 location, and thus non-TCP resources MUST be identified by some
1153 The canonical form for "http" URLs is obtained by converting any UPALPHA
1154 characters in host to their LOALPHA equivalent (hostnames are case-
1155 insensitive), eliding the [ ":" port ] if the port is 80, and replacing
1156 an empty abs_path with "/".
1159 7.2.3 URI Canonicalization
1160 A cache, when comparing two URIs to decide if they match or not, a cache
1161 MUST use a case-sensitive octet-by-octet comparison of the entire URIs,
1162 with these exceptions:
1164 Following the rules from section 7.2.2:
1166 . A port that is empty or not given is equivalent to port 80.
1167 . Comparisons of host names MUST be case-insensitive.
1168 . Comparisons of scheme names MUST be case-insensitive.
1169 . An empty abs_path is equivalent to an abs_path of "/"
1170 Characters except those in the reserved set and the unsafe set (see
1171 section 7.2) are equivalent to their ""%" HEX HEX" encodings.
1173 For example, the following three URIs are equivalent:
1175 http://abc.com:80/~smith/home.html
1176 http://ABC.com/%7Esmith/home.html
1177 http://ABC.com:/%7esmith/home.html
1182 7.3 Date/Time Formats
1185 HTTP applications have historically allowed three different formats for
1186 the representation of date/time stamps:
1188 Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
1189 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
1190 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
1192 The first format is preferred as an Internet standard and represents a
1193 fixed-length subset of that defined by RFC 1123 (an update to RFC 822).
1195 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 19]
1200 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1203 The second format is in common use, but is based on the obsolete RFC
1204 850 date format and lacks a four-digit year. HTTP/1.1 clients and
1205 servers that parse the date value MUST accept all three formats, though
1206 they MUST generate only the RFC 1123 format for representing date/time
1207 stamps in HTTP message fields.
1209 Note: Recipients of date values are encouraged to be robust in
1210 accepting date values that may have been generated by non-HTTP
1211 applications, as is sometimes the case when retrieving or posting
1212 messages via proxies/gateways to SMTP or NNTP.
1214 All HTTP date/time stamps MUST be represented in Universal Time (UT),
1215 also known as Greenwich Mean Time (GMT), without exception. This is
1216 indicated in the first two formats by the inclusion of "GMT" as the
1217 three-letter abbreviation for time zone, and SHOULD be assumed when
1218 reading the asctime format.
1220 HTTP-date = rfc1123-date | rfc850-date | asctime-date
1222 rfc1123-date = wkday "," SP date1 SP time SP "GMT"
1223 rfc850-date = weekday "," SP date2 SP time SP "GMT"
1224 asctime-date = wkday SP date3 SP time SP 4DIGIT
1226 date1 = 2DIGIT SP month SP 4DIGIT
1227 ; day month year (e.g., 02 Jun 1982)
1228 date2 = 2DIGIT "-" month "-" 2DIGIT
1229 ; day-month-year (e.g., 02-Jun-82)
1230 date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
1231 ; month day (e.g., Jun 2)
1233 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
1234 ; 00:00:00 - 23:59:59
1236 wkday = "Mon" | "Tue" | "Wed"
1237 | "Thu" | "Fri" | "Sat" | "Sun"
1239 weekday = "Monday" | "Tuesday" | "Wednesday"
1240 | "Thursday" | "Friday" | "Saturday" | "Sunday"
1242 month = "Jan" | "Feb" | "Mar" | "Apr"
1243 | "May" | "Jun" | "Jul" | "Aug"
1244 | "Sep" | "Oct" | "Nov" | "Dec"
1246 Note: HTTP requirements for the date/time stamp format apply only
1247 to their usage within the protocol stream. Clients and servers are
1248 not required to use these formats for user presentation, request
1251 Additional rules for requirements on parsing and representation of dates
1252 and other potential problems with date representations include:
1254 . HTTP/1.1 clients and caches should assume that an RFC-850 date
1255 which appears to be more than 50 years in the future is in fact in
1256 the past (this helps solve the "year 2000" problem).
1258 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 20]
1263 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1266 . An HTTP/1.1 implementation may internally represent a parsed
1267 Expires date as earlier than the proper value, but MUST NOT
1268 internally represent a parsed Expires date as later than the proper
1270 . All expiration-related calculations must be done in Universal Time
1271 (GMT). The local time zone MUST NOT influence the calculation or
1272 comparison of an age or expiration time.
1273 . If an HTTP header incorrectly carries a date value with a time zone
1274 other than GMT, it must be converted into GMT using the most
1275 conservative possible conversion.
1281 Some HTTP header fields allow a time value to be specified as an integer
1282 number of seconds, represented in decimal, after the time that the
1283 message was received. This format SHOULD only be used to represent short
1284 time periods or periods that cannot start until receipt of the message.
1286 delta-seconds = 1*DIGIT
1290 HTTP uses the same definition of the term "character set" as that
1293 The term "character set" is used in this document to refer to a
1294 method used with one or more tables to convert a sequence of octets
1295 into a sequence of characters. Note that unconditional conversion
1296 in the other direction is not required, in that not all characters
1297 may be available in a given character set and a character set may
1298 provide more than one sequence of octets to represent a particular
1299 character. This definition is intended to allow various kinds of
1300 character encodings, from simple single-table mappings such as US-
1301 ASCII to complex table switching methods such as those that use ISO
1302 2022's techniques. However, the definition associated with a MIME
1303 character set name MUST fully specify the mapping to be performed
1304 from octets to characters. In particular, use of external profiling
1305 information to determine the exact mapping is not permitted.
1307 Note: This use of the term "character set" is more commonly
1308 referred to as a "character encoding." However, since HTTP and MIME
1309 share the same registry, it is important that the terminology also
1312 HTTP character sets are identified by case-insensitive tokens. The
1313 complete set of tokens is defined by the IANA Character Set registry .
1314 However, because that registry does not define a single, consistent
1315 token for each character set, we define here the preferred names for
1316 those character sets most likely to be used with HTTP entities. These
1317 character sets include those registered by RFC 1521 -- the US-ASCII
1318 and ISO-8859 character sets -- and other names specifically recommended
1319 for use within MIME charset parameters.
1321 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 21]
1326 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1329 charset = "US-ASCII"
1330 | "ISO-8859-1" | "ISO-8859-2" | "ISO-8859-3"
1331 | "ISO-8859-4" | "ISO-8859-5" | "ISO-8859-6"
1332 | "ISO-8859-7" | "ISO-8859-8" | "ISO-8859-9"
1333 | "ISO-2022-JP" | "ISO-2022-JP-2" | "ISO-2022-KR"
1334 | "UNICODE-1-1" | "UNICODE-1-1-UTF-7"
1335 | "UNICODE-1-1-UTF-8" | token
1337 Although HTTP allows an arbitrary token to be used as a charset value,
1338 any token that has a predefined value within the IANA Character Set
1339 registry MUST represent the character set defined by that registry.
1340 Applications SHOULD limit their use of character sets to those defined
1341 by the IANA registry.
1343 The character set of an entity body SHOULD be labeled as the lowest
1344 common denominator of the character codes used within that body, with
1345 the exception that no label is preferred over the labels US-ASCII or
1350 Content coding values indicate an encoding transformation that has been
1351 or can be applied to a resource entity. Content codings are primarily
1352 used to allow a document to be compressed or encrypted without losing
1353 the identity of its underlying media type. Typically, the resource
1354 entity is stored in this encoding and only decoded before rendering or
1357 content-coding = "gzip" | "x-gzip"
1358 | "compress" | "x-compress" | token
1360 Note: For historical reasons, HTTP applications SHOULD consider "x-
1361 gzip" and "x-compress" to be equivalent to "gzip" and "compress",
1364 All content-coding values are case-insensitive. HTTP/1.1 uses content-
1365 coding values in the Accept-Encoding (section 18.3) and
1367 (section 18.13) header fields. Although the value describes the
1369 coding, what is more important is that it indicates what decoding
1370 mechanism will be required to remove the encoding. Note that a single
1371 program MAY be capable of decoding multiple content-coding formats. Two
1372 values are defined by this specification:
1376 An encoding format produced by the file compression program "gzip"
1377 (GNU zip) developed by Jean-loup Gailly. This format is typically a
1378 Lempel-Ziv coding (LZ77) with a 32 bit CRC.
1381 The encoding format produced by the file compression program
1382 "compress". This format is an adaptive Lempel-Ziv-Welch coding
1386 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 22]
1391 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1394 Note: Use of program names for the identification of encoding
1395 formats is not desirable and should be discouraged for future
1396 encodings. Their use here is representative of historical practice,
1399 HTTP defines a registration process which uses the Internet Assigned
1400 Numbers Authority (IANA) as a central registry for content-coding value
1401 tokens. Additional content-coding value tokens beyond the four defined
1402 in this document (gzip x-gzip compress x-compress) SHOULD be registered
1403 with the IANA. To allow interoperability between clients and servers,
1404 specifications of the content coding algorithms used to implement a new
1405 value SHOULD be publicly available and adequate for independent
1406 implementation, and MUST conform to the purpose of content coding
1407 defined in this section.
1410 7.6 Transfer Codings
1411 Transfer coding values are used to indicate an encoding transformation
1412 that has been, can be, or may need to be applied to an Entity-Body in
1413 order to ensure safe transport through the network. This differs from a
1414 content coding in that the transfer coding is a property of the
1416 not of the original resource entity.
1418 transfer-coding = "chunked" | transfer-extension
1420 transfer-extension = token
1422 All transfer-coding values are case-insensitive. HTTP/1.1 uses transfer
1423 coding values in the Transfer-Encoding header field (section 18.43).
1425 Transfer codings are analogous to the Content-Transfer-Encoding values
1426 of MIME , which were designed to enable safe transport of binary data
1427 over a 7-bit transport service. However, "safe transport" has a
1428 different focus for an 8bit-clean transfer protocol. In HTTP, the only
1429 unsafe characteristic of message bodies is the difficulty in determining
1430 the exact body length (section 11.2.2), or the desire to encrypt data
1431 over a shared transport.
1433 All HTTP/1.1 applications MUST be able to receive and decode the
1434 "chunked" transfer coding , and MUST ignore transfer coding extensions
1435 they do not understand. A server which receives a an entity-body with a
1436 transfer-coding it does not understand SHOULD return
1438 and close the connection. A server MUST NOT send transfer-codings to a
1439 client that were not defined in the version of HTTP used in the client's
1440 request. Clients sending entity-bodies with transfer-codings SHOULD must
1441 be prepared for the connection to be closed if the server doesn't
1442 understand the transfer-coding. The chunked encoding modifies the body
1443 of a message in order to transfer it as a series of chunks, each with
1444 its own size indicator, followed by an optional footer containing
1445 entity-header fields. This allows dynamically-produced content to be
1446 transferred along with the information necessary for the recipient to
1447 verify that it has received the full message.
1451 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 23]
1456 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1459 Chunked-Body = *chunk
1464 chunk = chunk-size [ chunk-ext ] CRLF
1467 chunk-size = hex-no-zero *HEX
1468 chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-value ] )
1469 chunk-ext-name = token
1470 chunk-ext-val = token | quoted-string
1471 chunk-data = chunk-size(OCTET)
1473 footer = *<<Content-MD5 and future headers that specify
1474 they are allowed in footer>>
1476 hex-no-zero = <HEX excluding "0">
1478 Note that the chunks are ended by a zero-sized chunk, followed by the
1479 footer and terminated by an empty line. An example process for decoding
1480 a Chunked-Body is presented in appendix 23.3.6.
1484 HTTP uses Internet Media Types in the Content-Type (section 18.19) and
1485 Accept (section 18.1) header fields in order to provide open and
1486 extensible data typing and type negotiation.
1488 media-type = type "/" subtype *( ";" parameter )
1492 Parameters may follow the type/subtype in the form of attribute/value
1495 parameter = attribute "=" value
1497 value = token | quoted-string
1499 The type, subtype, and parameter attribute names are case-insensitive.
1500 Parameter values may or may not be case-sensitive, depending on the
1501 semantics of the parameter name. LWS MUST NOT be generated between the
1502 type and subtype, nor between an attribute and its value. Upon receipt
1503 of a media type with an unrecognized parameter, a user agent SHOULD
1504 treat the media type as if the unrecognized parameter and its value were
1507 Some older HTTP applications do not recognize media type parameters.
1508 HTTP/1.1 applications SHOULD only use media type parameters when they
1509 are necessary to define the content of a message.
1514 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 24]
1519 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1522 Media-type values are registered with the Internet Assigned Number
1523 Authority (IANA ). The media type registration process is outlined in
1524 RFC 1590 . Use of non-registered media types is discouraged.
1527 7.7.1 Canonicalization and Text Defaults
1528 Internet media types are registered with a canonical form. In general,
1529 an Entity-Body transferred via HTTP MUST be represented in the
1530 appropriate canonical form prior to its transmission; the exception is
1531 "text" types, as defined in the next paragraph..
1533 when in canonical form , media subtypes of the "text" type use CRLF as
1534 the text line break. However, HTTP allows the transport of text media
1535 with plain CR or LF alone representing a line break when if it is done
1536 consistently for an entire Entity-Body.. HTTP applications MUST accept
1537 CRLF, bare CR, and bare LF as being representative of a line break in
1538 text media received via HTTP.In addition, if the text media is
1539 represented in a character set that does not use octets 13 and 10 for CR
1540 and LF respectively, as is the case for some multi-byte character sets,
1541 HTTP allows the use of whatever octet sequences are defined by that
1542 character set to represent the equivalent of CR and LF for line breaks.
1543 This flexibility regarding line breaks applies only to text media in the
1544 Entity-Body; a bare CR or LF MUST NOT be substituted for CRLF within any
1545 of the HTTP control structures (such as header fields and multipart
1548 If an Entity-Body is encoded with a Content-Encoding, the underlying
1549 data MUST be in a form defined above prior to being encoded.
1551 The "charset" parameter is used with some media types to define the
1552 character set (section 7.4) of the data. When no explicit charset
1553 parameter is provided by the sender, media subtypes of the "text" type
1554 are defined to have a default charset value of "ISO-8859-1" when
1555 received via HTTP. Data in character sets other than "ISO-8859-1" or its
1556 subsets MUST be labeled with an appropriate charset value in order to be
1557 consistently interpreted by the recipient.
1559 Note: Many current HTTP servers provide data using charsets other
1560 than "ISO-8859-1" without proper labeling. This situation reduces
1561 interoperability and is not recommended. To compensate for this,
1562 some HTTP user agents provide a configuration option to allow the
1563 user to change the default interpretation of the media type
1564 character set when no charset parameter is given.
1569 7.7.2 Multipart Types
1570 MIME provides for a number of "multipart" types -- encapsulations of one
1571 or more entities within a single message's Entity-Body. All multipart
1572 types share a common syntax, as defined in section 7.2.1 of RFC 1521 ,
1573 and MUST include a boundary parameter as part of the media type value.
1574 The message body is itself a protocol element and MUST therefore use
1575 only CRLF to represent line breaks between body-parts. Unlike in RFC
1577 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 25]
1582 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1585 1521, the epilogue of any multipart message MUST be empty; HTTP
1586 applications MUST NOT transmit the epilogue even if the original
1587 resource entity contains an epilogue.
1589 In HTTP, multipart body-parts MAY contain header fields which are
1590 significant to the meaning of that part.
1592 In general, an HTTP user agent SHOULD follow the same or similar
1593 behavior as a MIME user agent would upon receipt of a multipart type. If
1594 an application receives an unrecognized multipart subtype, the
1595 application MUST treat it as being equivalent to "multipart/mixed".
1597 Note: The "multipart/form-data" type has been specifically defined
1598 for carrying form data suitable for processing via the POST request
1599 method, as described in RFC 1867 .
1605 Product tokens are used to allow communicating applications to identify
1606 themselves via a simple product token, with an optional slash and
1607 version designator. Most fields using product tokens also allow sub-
1608 products which form a significant part of the application to be listed,
1609 separated by whitespace. By convention, the products are listed in order
1610 of their significance for identifying the application.
1612 product = token ["/" product-version]
1613 product-version = token
1617 User-Agent: CERN-LineMode/2.15 libwww/2.17b3
1618 Server: Apache/0.8.4
1620 Product tokens should be short and to the point -- use of them for
1621 advertising or other non-essential information is explicitly forbidden.
1622 Although any token character may appear in a product-version, this token
1623 SHOULD only be used for a version identifier (i.e., successive versions
1624 of the same product SHOULD only differ in the product-version portion of
1629 HTTP content negotiation (section 15) uses short "floating point"
1630 numbers to indicate the relative importance ("weight") of various
1631 negotiable parameters. The weights are normalized to a real number in
1632 the range 0 through 1, where 0 is the minimum and 1 the maximum value.
1633 In order to discourage misuse of this feature, HTTP/1.1 applications
1634 MUST NOT generate more than three digits after the decimal point. User
1635 configuration of these values SHOULD also be limited in this fashion.
1637 qvalue = ( "0" [ "." 0*3DIGIT ] )
1638 | ( "1" [ "." 0*3("0") ] )
1640 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 26]
1645 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1648 "Quality values" is a slight misnomer, since these values actually
1649 measure relative degradation in perceived quality. Thus, a value of
1650 "0.8" represents a 20% degradation from the optimum rather than a
1651 statement of 80% quality.
1655 A language tag identifies a natural language spoken, written, or
1656 otherwise conveyed by human beings for communication of information to
1657 other human beings. Computer languages are explicitly excluded. HTTP
1658 uses language tags within the Accept-Language, and Content-Language
1661 The syntax and registry of HTTP language tags is the same as that
1662 defined by RFC 1766 . In summary, a language tag is composed of 1 or
1663 more parts: A primary language tag and a possibly empty series of
1666 language-tag = primary-tag *( "-" subtag )
1668 primary-tag = 1*8ALPHA
1671 Whitespace is not allowed within the tag and all tags are case-
1672 insensitive. The name space of language tags is administered by the
1673 IANA. Example tags include:
1675 en, en-US, en-cockney, i-cherokee, x-pig-latin
1677 where any two-letter primary-tag is an ISO 639 language abbreviation and
1678 any two-letter initial subtag is an ISO 3166 country code. (The last
1679 three tags above are not registered tags; all but the last are examples
1680 of tags which could be registered in future.)
1684 Entity tags are quoted strings whose internal structure is not visible
1685 to clients or caches. Entity tags are used as cache validators in
1688 entity-tag = strong-entity-tag | weak-entity-tag
1690 strong-entity-tag = quoted-string
1691 weak-entity-tag = quoted-string "/W"
1692 null-entity-tag = <"> <">
1694 Note that the "/W" tag is considered part of a weak entity tag; it
1695 MUST NOT be removed by any cache or client.
1697 There are two comparison functions on validators:
1699 . The strong comparison function: in order to be considered equal,
1700 both validators must be identical in every way, and neither may be
1703 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 27]
1708 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1711 . The weak comparison function: in order to be considered equal, both
1712 validators must be identical in every way, except for the presence
1713 or absence of a "weak" tag.
1714 The weak comparison function MAY be used for simple (non-subrange) GET
1715 requests. The strong comparison function MUST be used in all other
1718 The null validator is a special value, defined as never matching the
1719 current validator of an existing resource entity, and always matching
1720 the "current" validator of a resource entity that does not exist.
1724 A cache stores instances of resource entities, not instances of generic
1725 resources per se. Therefore, the URI of a generic resource is not
1726 sufficient for use as an identifier for a specific resource entity. In
1727 certain interactions between a cache and an origin server, it is
1728 convenient to encode that identifier using a more compact
1729 representation than the full set of selecting request headers (which may
1730 not even be possible if the selection criteria are not known to the
1733 For these reasons, the HTTP protocol provides an optional mechanism for
1734 identifying a specific entity source of a generic resource, called a
1737 Variant-IDs are used to identify specific variants of a generic
1738 resource; see section 16.5.3 for how they are used.
1740 variant-id = quoted-string
1742 Variant-IDs are compared using string octet-equality; case is
1745 All responses from generic resources SHOULD include variant-IDs. If
1746 these are not present, the resource author can expect caches to
1747 correctly handle requests on the generic resource, but cannot expect the
1748 caching to be efficient.
1754 Validator sets are used for doing conditional retrievals on generic
1755 resources; see section 16.5.3.
1757 variant-set = 1#variant-set-item
1758 variant-set-item = opaque-validator ";" variant-id
1761 7.14 Range Protocol Parameters
1762 This section defines certain HTTP protocol parameters used in range
1763 requests and related responses.
1766 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 28]
1771 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1775 A resource entity may be broken down into subranges according to various
1778 range-unit = bytes-unit | other-range-unit
1780 bytes-unit = "bytes"
1781 other-range-unit = token
1783 The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
1784 implementations may ignore ranges specified using other units.
1788 Since all HTTP entities are represented in HTTP messages as sequences of
1789 bytes, the concept of a byte range is meaningful for any HTTP entity.
1790 (However, not all clients and servers need to support byte-range
1793 Byte range specifications in HTTP apply to the sequence of bytes that
1794 would be transferred by the protocol if no transfer-coding were being
1797 This means that if Content-coding is applied to the data, the byte
1798 range specification applies to the resulting content-encoded byte
1799 stream, not to the unencoded byte stream. It also means that if
1800 the entity-body's media-type is a composite type (e.g., multipart/*
1801 and message/rfc822), then the composite's body-parts may have their
1802 own content-encoding and content-transfer-encoding, and the byte
1803 range applies to the result of the those encodings.
1805 A byte range operation may specify a single range of bytes, or a set of
1806 ranges within a single entity.
1808 ranges-specifier = byte-ranges-specifier
1810 byte-ranges-specifier = bytes-unit "=" byte-range-set
1812 byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec )
1814 byte-range-spec = first-byte-pos "-" [last-byte-pos]
1816 first-byte-pos = 1*DIGIT
1818 last-byte-pos = 1*DIGIT
1820 The first-byte-pos value in a byte-range-spec gives the byte-offset of
1821 the first byte in a range. The last-byte-pos value gives the byte-
1822 offset of the last byte in the range; that is, the byte positions
1823 specified are inclusive. Byte offsets start at zero.
1825 If the last-byte-pos value is present, it must be greater than or equal
1826 to the first-byte-pos in that byte-range-spec, or the byte-range-spec is
1827 invalid. The recipient of an invalid byte-range-spec must ignore it.
1829 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 29]
1834 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1837 If the last-byte-pos value is absent, it is assumed to be equal to the
1838 current length of the entity in bytes.
1840 If the last-byte-pos value is larger than the current length of the
1841 entity, it is assumed to be equal to the current length of the entity.
1843 suffix-byte-range-spec = "-" suffix-length
1845 suffix-length = 1*DIGIT
1847 A suffix-byte-range-spec is used to specify the suffix of the entity, of
1848 a length given by the suffix-length value. (That is, this form
1849 specifies the last N bytes of an entity.) If the entity is shorter than
1850 the specified suffix-length, the entire entity is used.
1852 Examples of byte-ranges-specifier values (assuming an entity of length
1855 . The first 500 bytes (byte offsets 0-499, inclusive):
1858 . The second 500 bytes (byte offsets 500-999, inclusive):
1861 . The final 500 bytes (byte offsets 9500-9999, inclusive):
1867 . The first and last bytes only (bytes 0 and 9999):
1870 . Several legal but not canonical specifications of the second 500
1871 bytes (byte offsets 500-999, inclusive):
1872 bytes=500-600,601-999
1874 bytes=500-700,601-999
1877 7.14.3 Content Ranges
1878 When a server returns a partial response to a client, it must describe
1879 both the extent of the range covered by the response, and the length of
1882 content-range-spec = byte-content-range-spec
1884 byte-content-range-spec = bytes-unit SP first-byte-pos "-"
1885 last-byte-pos "/" entity-length
1887 entity-length = 1*DIGIT
1892 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 30]
1897 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1900 Unlike byte-ranges-specifier values, a byte-content-range-spec may only
1901 specify one range, and must contain absolute byte positions for both the
1902 first and last byte of the range.
1904 A byte-content-range-spec whose last-byte-pos value is less than its
1905 first-byte-pos value, or whose entity-length value is less than or equal
1906 to its last-byte-pos value, is invalid. The recipient of an invalid
1907 byte-content-range-spec MUST ignore it and any content transferred along
1910 Examples of byte-content-range-spec values, assuming that the entity
1911 contains a total of 1234 bytes:
1913 . The first 500 bytes:
1916 . The second 500 bytes:
1919 . All except for the first 500 bytes:
1922 . The last 500 bytes:
1929 HTTP messages consist of requests from client to server and responses
1930 from server to client.
1932 HTTP-message = Full-Request ; HTTP/1.1 messages
1935 Full-Request and Full-Response use the generic message format of RFC 822
1936 for transferring entities. Both messages may include optional header
1937 fields (also known as "headers") and an entity body. The entity body is
1938 separated from the headers by a null line (i.e., a line with nothing
1939 preceding the CRLF).
1943 HTTP header fields, which include General-Header (Section 8.3),
1945 Header (Section 9.2), Response-Header (Section 10.2), and Entity-Header
1946 (Section 11.1) fields, follow the same generic format as that given in
1947 Section 3.1 of RFC 822 . Each header field consists of a name followed
1948 by a colon (":") and the field value. Field names are case-insensitive.
1949 The field value may be preceded by any amount of LWS, though a single SP
1950 is preferred. Header fields can be extended over multiple lines by
1951 preceding each extra line with at least one SP or HT.
1953 HTTP-header = field-name ":" [ field-value ] CRLF
1956 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 31]
1961 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1965 field-value = *( field-content | LWS )
1967 field-content = <the OCTETs making up the field-value
1968 and consisting of either *TEXT or combinations
1969 of token, tspecials, and quoted-string>
1971 The order in which header fields with differing field names are received
1972 is not significant. However, it is "good practice" to send General-
1973 Header fields first, followed by Request-Header or Response-Header
1974 fields, and ending with the Entity-Header fields.
1976 Multiple HTTP-header fields with the same field-name may be present in a
1977 message if and only if the entire field-value for that header field is
1978 defined as a comma-separated list [i.e., #(values)]. It MUST be possible
1979 to combine the multiple header fields into one "field-name:
1981 pair, without changing the semantics of the message, by appending each
1982 subsequent field-value to the first, each separated by a comma. Thus,
1983 the order in which multiple header fields with the same field-name are
1984 received may be significant to the interpretation of the combined
1989 8.3 General Header Fields
1990 There are a few header fields which have general applicability for both
1991 request and response messages, but which do not apply to the entity
1992 being transferred. These headers apply only to the message being
1995 General-Header = Cache-Control ; Section 18.10
1996 | Connection ; Section 18.11
1997 | Date ; Section 18.20
1998 | Via ; Section 18.47
1999 | Keep-Alive ; Section 23.5.2.5.1
2000 | Pragma ; Section 18.34
2001 | Upgrade ; Section 18.44
2003 General header field names can be extended reliably only in combination
2004 with a change in the protocol version. However, new or experimental
2005 header fields may be given the semantics of general header fields if all
2006 parties in the communication recognize them to be general header
2008 Unrecognized header fields are treated as Entity-Header fields.
2012 A request message from a client to a server includes, within the first
2013 line of that message, the method to be applied to the resource, the
2014 identifier of the resource, and the protocol version in use. For
2015 backwards compatibility with the more limited HTTP/0.9 protocol, there
2016 are two valid formats for an HTTP request:
2018 Request = Full-Request
2022 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 32]
2027 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2030 Full-Request = Request-Line ; Section 9.1
2031 *( General-Header ; Section 8.3
2032 | Request-Header ; Section 9.2
2033 | Entity-Header ) ; Section 11.1
2035 [ Entity-Body ] ; Section 11.2
2041 The Request-Line begins with a method token, followed by the
2043 and the protocol version, and ending with CRLF. The elements are
2044 separated by SP characters. No CR or LF are allowed except in the final
2047 Request-Line = CRLF | Method SP Request-URI SP HTTP-Version CRLF
2049 In the interest of robustness, HTTP/1.1 servers SHOULD ignore null
2050 request lines (ones that comprise just CRLF). An HTTP/1.1 client MUST
2051 NOT preface a request with CRLF.
2055 The Method token indicates the method to be performed on the resource
2056 identified by the Request-URI. The method is case-sensitive.
2058 Method = "OPTIONS" ; Section 13.1
2059 | "GET" ; Section 13.2
2060 | "HEAD" ; Section 13.3
2061 | "POST" ; Section 13.4
2062 | "PUT" ; Section 13.5
2063 | "DELETE" ; Section 13.6
2064 | "TRACE" ; Section 13.7
2067 extension-method = token
2069 The list of methods acceptable by a plain resource can be specified in
2070 an Allow header field (section 18.7). However, the client is always
2071 notified through the return code of the response whether a method is
2072 currently allowed on a plain resource, as this can change dynamically.
2073 Servers SHOULD return the status code 405 (method not allowed) if the
2074 method is known by the server but not allowed for the requested
2075 resource, and 501 (not implemented) if the method is unrecognized or not
2076 implemented by the server. The list of methods known by a server can be
2077 listed in a Public response header field (section 18.37).
2079 The methods GET and HEAD MUST be supported by all general-purpose
2080 servers. Servers which provide Last-Modified dates for resources MUST
2081 also support the conditional GET method. All other methods are
2083 however, if the above methods are implemented, they MUST be implemented
2084 with the same semantics as those specified in section 13.
2086 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 33]
2091 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2095 The Request-URI is a Uniform Resource Identifier (section 7.2) and
2096 identifies the resource upon which to apply the request.
2098 Request-URI = "*" | absoluteURI | abs_path
2100 The three options for Request-URI are dependent on the nature of the
2101 request. The asterisk "*" means that the request does not apply to a
2102 particular resource, but to the server itself, and is only allowed when
2103 the Method used does not necessarily apply to a resource. One example
2108 The absoluteURI form is required when the request is being made to a
2109 proxy. The proxy is requested to forward the request or service it from
2110 a valid cache, and return the response.. Note that the proxy MAY forward
2111 the request on to another proxy or directly to the server specified by
2112 the absoluteURI. In order to avoid request loops, a proxy MUST be able
2113 to recognize all of its server names, including any aliases, local
2114 variations, and the numeric IP address. An example Request-Line would
2117 GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
2119 To allow for transition to absoluteURIs in all requests in future
2120 versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form
2121 in requests, even though HTTP/1.1 clients will only generate them in
2122 requests to proxies. The Host request-header field MUST be ignored in
2123 requests using an absoluteURL as the Request-URI.
2125 The most common form of Request-URI is that used to identify a resource
2126 on an origin server or gateway. In this case the absolute path of the
2127 URI MUST be transmitted (see 7.2.1, abs_path) as the Request-URI, and
2128 the network location of the URI (net_loc) MUST be transmitted in a Host
2129 header field.. For example, a client wishing to retrieve the resource
2130 above directly from the origin server would create a TCP connection to
2131 port 80 of the host "www.w3.org" and send the lines:
2133 GET /pub/WWW/TheProject.html HTTP/1.1
2136 followed by the remainder of the Full-Request. Note that the absolute
2137 path cannot be empty; if none is present in the original URI, it MUST be
2138 given as "/" (the server root).
2140 If a proxy receives a request without any path in the Request-URI and
2141 the method specified is capable of supporting the asterisk form of
2142 request, then the last proxy on the request chain MUST forward the
2143 request with "*" as the final Request-URI. For example, the request
2145 OPTIONS http://www.ics.uci.edu:8001 HTTP/1.1
2147 would be forwarded by the proxy as
2149 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 34]
2154 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2158 Host: www.ics.uci.edu:8001
2160 after connecting to port 8001 of host "www.ics.uci.edu".
2162 The Request-URI is transmitted as an encoded string, where some
2163 characters may be escaped using the "% HEX HEX" encoding defined by RFC
2164 1738 . The origin server MUST decode the Request-URI in order to
2165 properly interpret the request. In requests that they forward, proxies
2166 MUST NOT rewrite the "abs_path" part of a Request-URI in any way except
2167 as noted above to replace a null abs_path with "*". Illegal
2169 SHOULD be responded to with an appropriate status code. Proxies MAY
2170 transform the Request-URI for internal processing purposes, but SHOULD
2171 NOT send such a transformed Request-URI in forwarded requests.
2173 The main reason for this rule is to make sure that the form of
2174 Request-URI is well specified, to enable future extensions without
2175 fear that they will break in the face of some rewritings. Another
2176 is that one consequence of rewriting the Request-URI is that
2177 integrity or authentication checks by the server may fail; since
2178 rewriting MUST be avoided in this case, it may as well be
2179 proscribed in general. Implementers should be aware that some pre-
2180 HTTP/1.1 proxies do some rewriting.
2183 9.2 The Resource Identified by a Request
2184 HTTP/1.1 origin servers SHOULD be aware that the exact resource
2185 identified by an Internet request is determined by examining both the
2186 Request-URI and the Host header field. An origin server that does not
2187 allow resources to differ by the requested host MAY ignore the Host
2188 header field. An origin server that does differentiate resources based
2189 on the host requested (sometimes referred to as virtual hosts or vanity
2190 hostnames) MUST use the following rules for determining the requested
2191 resource on an HTTP/1.1 request:.
2193 1. If Request-URI is an absoluteURI, the host is included in the
2194 Request-URI. Any Host header field in the request MUST be
2196 2. If the Request-URI is not an absoluteURI, and the request includes
2197 a Host header field, the host is determined by the Host header
2199 3. If the request-URI is not an absoluteURI and no Host header field
2200 is present (or does not represent a valid host on that server),
2201 the response MUST be a 400 (Bad Request) error message.
2202 Recipients of an HTTP/1.0 request lacking a Host header field MAY
2203 attempt to use heuristics (e.g., examination of the URI path for
2204 something unique to a particular host) in order to determine what exact
2205 resource is being requested.
2208 9.3 Request Header Fields
2209 The request header fields allow the client to pass additional
2210 information about the request, and about the client itself, to the
2211 server. These fields act as request modifiers, with semantics
2215 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 35]
2220 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2223 to the parameters on a programming language method (procedure)
2226 Request-Header = Accept ; Section 18.1
2227 | Accept-Charset ; Section 18.2
2228 | Accept-Encoding ; Section 18.3
2229 | Accept-Language ; Section 18.4
2230 | Authorization ; Section 18.8
2231 | From ; Section 18.23
2232 | Host ; Section 18.24
2233 | If-Modified-Since ; Section 18.25
2234 | If-Range ; Section 18.28
2235 | Proxy-Authorization ; Section 18.36
2236 | Range ; Section 18.38
2237 | Referer ; Section 18.39
2238 | User-Agent ; Section 18.45
2239 | Max-Forwards ; Section 18.32
2241 Request-Header field names can be extended reliably only in combination
2242 with a change in the protocol version. However, new or experimental
2243 header fields MAY be given the semantics of request header fields if all
2244 parties in the communication recognize them to be request header
2246 Unrecognized header fields are treated as Entity-Header fields.
2250 After receiving and interpreting a request message, a server responds in
2251 the form of an HTTP response message.
2253 Response = Full-Response
2255 Full-Response = Status-Line ; Section 10.1
2256 *( General-Header ; Section 8.3
2257 | Response-Header ; Section 10.2
2258 | Entity-Header ) ; Section 11.1
2260 [ Entity-Body ] ; Section 11.2
2264 The first line of a Full-Response message is the Status-Line, consisting
2265 of the protocol version followed by a numeric status code and its
2266 associated textual phrase, with each element separated by SP
2268 No CR or LF is allowed except in the final CRLF sequence.
2270 Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
2273 10.1.1 Status Code and Reason Phrase
2274 The Status-Code element is a 3-digit integer result code of the attempt
2275 to understand and satisfy the request. The Reason-Phrase is intended to
2276 give a short textual description of the Status-Code. The Status-Code is
2277 intended for use by automata and the Reason-Phrase is intended for the
2280 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 36]
2285 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2288 human user. The client is not required to examine or display the
2292 The first digit of the Status-Code defines the class of response. The
2293 last two digits do not have any categorization role. There are 5 values
2294 for the first digit:
2297 . 1xx: Informational - Request received, continuing process
2299 . 2xx: Success - The action was successfully received, understood,
2302 . 3xx: Redirection - Further action must be taken in order to
2303 complete the request
2305 . 4xx: Client Error - The request contains bad syntax or cannot be
2308 . 5xx: Server Error - The server failed to fulfill an apparently
2310 The individual values of the numeric status codes defined for HTTP/1.1,
2311 and an example set of corresponding Reason-Phrase's, are presented
2312 below. The reason phrases listed here are only recommended -- they may
2313 be replaced by local equivalents without affecting the protocol. These
2314 codes are fully defined in section 12.
2316 Status-Code = "100" ; Continue
2317 | "101" ; Switching Protocols
2321 | "203" ; Non-Authoritative Information
2322 | "204" ; No Content
2323 | "205" ; Reset Content
2324 | "206" ; Partial Content
2325 | "300" ; Multiple Choices
2326 | "301" ; Moved Permanently
2327 | "302" ; Moved Temporarily
2329 | "304" ; Not Modified
2331 | "400" ; Bad Request
2332 | "401" ; Unauthorized
2333 | "402" ; Payment Required
2336 | "405" ; Method Not Allowed
2337 | "406" ; Not Acceptable
2338 | "407" ; Proxy Authentication Required
2339 | "408" ; Request Time-out
2342 | "411" ; Length Required
2344 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 37]
2349 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2352 | "412" ; Precondition Failed
2353 | "413" ; Request Entity Too Large
2354 | "414" ; Request URI Too Large
2355 | "415" ; Unsupported Media Type
2356 | "500" ; Internal Server Error
2357 | "501" ; Not Implemented
2358 | "502" ; Bad Gateway
2359 | "503" ; Service Unavailable
2360 | "504" ; Gateway Time-out
2361 | "505" ; HTTP Version not supported
2364 extension-code = 3DIGIT
2366 Reason-Phrase = *<TEXT, excluding CR, LF>
2368 HTTP status codes are extensible. HTTP applications are not required to
2369 understand the meaning of all registered status codes, though such
2370 understanding is obviously desirable. However, applications MUST
2371 understand the class of any status code, as indicated by the first
2372 digit, and treat any unrecognized response as being equivalent to the
2373 x00 status code of that class, with the exception that an unrecognized
2374 response MUST NOT be cached. For example, if an unrecognized status code
2375 of 431 is received by the client, it can safely assume that there was
2376 something wrong with its request and treat the response as if it had
2377 received a 400 status code. In such cases, user agents SHOULD present to
2378 the user the entity returned with the response, since that entity is
2379 likely to include human-readable information which will explain the
2383 10.2 Response Header Fields
2384 The response header fields allow the server to pass additional
2385 information about the response which cannot be placed in the Status-
2386 Line. These header fields give information about the server and about
2387 further access to the resource identified by the Request-URI.
2389 Response-Header = Location ; Section 18.31
2390 | Proxy-Authenticate ; Section 18.35
2391 | Public ; Section 18.37
2392 | Retry-After ; Section 18.40
2393 | Server ; Section 18.41
2394 | WWW-Authenticate ; Section 18.46
2396 Response-Header field names can be extended reliably only in combination
2397 with a change in the protocol version. However, new or experimental
2398 header fields MAY be given the semantics of response header fields if
2399 all parties in the communication recognize them to be response header
2400 fields. Unrecognized header fields are treated as Entity-Header fields.
2404 Full-Request and Full-Response messages MAY transfer an entity within
2405 some requests and responses. An entity consists of Entity-Header fields
2407 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 38]
2412 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2415 and (usually) an Entity-Body. In this section, both sender and recipient
2416 refer to either the client or the server, depending on who sends and who
2417 receives the entity.
2420 11.1 Entity Header Fields
2421 Entity-Header fields define optional metainformation about the Entity-
2422 Body or, if no body is present, about the resource identified by the
2425 Entity-Header = Allow ; Section 18.7
2426 | Content-Base ; Section 18.12
2427 | Content-Encoding ; Section 18.3
2428 | Content-Language ; Section 18.14
2429 | Content-Length ; Section 18.15
2430 | Content-Location ; Section 18.16
2431 | Content-MD5 ; Section 0
2432 | Content-Range ; Section 18.18
2433 | Content-Type ; Section 18.19
2434 | Expires ; Section 18.22
2435 | Last-Modified ; Section 18.30
2436 | Title ; Section 18.42
2437 | Transfer-Encoding ; Section 18.43
2440 extension-header = HTTP-header
2442 The extension-header mechanism allows additional Entity-Header fields to
2443 be defined without changing the protocol, but these fields cannot be
2444 assumed to be recognizable by the recipient. Unrecognized header fields
2445 SHOULD be ignored by the recipient and forwarded by proxies.
2449 The entity body (if any) sent with an HTTP request or response is in a
2450 format and encoding defined by the Entity-Header fields.
2452 Entity-Body = *OCTET
2454 An entity body MUST ONLY be included with a request message when the
2455 request method calls for one. The presence of an entity body in a
2456 request is signaled by the inclusion of a Content-Length and/or
2458 Type header field in the request message headers.
2460 For response messages, whether or not an entity body is included with a
2461 message is dependent on both the request method and the response code.
2462 All responses to the HEAD request method MUST NOT include a body, even
2463 though the presence of entity header fields may lead one to believe they
2464 do. All 1xx (informational), 204 (no content), and 304 (not modified)
2465 responses MUST NOT include a body. All other responses MUST include an
2466 entity body or a Content-Length header field defined with a value of
2471 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 39]
2476 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2480 When an entity body is included with a message, the data type of that
2481 body is determined via the header fields Content-Type,
2483 and Transfer-Encoding. These define a three-layer, ordered encoding
2487 Transfer-Encoding( Content-Encoding( Content-Type( data ) ) )
2489 The default for both encodings is none (i.e., the identity function).
2490 Content-Type specifies the media type of the underlying data. Content-
2491 Encoding may be used to indicate any additional content codings applied
2492 to the type, usually for the purpose of data compression, that are a
2493 property of the resource entity requested. Transfer-Encoding may be
2494 used to indicate any additional transfer codings applied by an
2495 application to ensure safe and proper transfer of the message. Note that
2496 Transfer-Encoding is a property of the message, not of the resource
2499 Any HTTP/1.1 message containing an entity body SHOULD include a
2501 Type header field defining the media type of that body. If and only if
2502 the media type is not given by a Content-Type header, the recipient may
2503 attempt to guess the media type via inspection of its content and/or the
2504 name extension(s) of the URL used to identify the resource. If the media
2505 type remains unknown, the recipient SHOULD treat it as type
2506 "application/octet-stream".
2510 When an entity body is included with a message, the length of that body
2511 may be determined in one of several ways. If a Content-Length header
2512 field is present, its value in bytes represents the length of the entity
2513 body. Otherwise, the body length is determined by the Transfer-Encoding
2514 (if the "chunked" transfer coding has been applied) or by the server
2515 closing the connection.
2517 Note: Any response message which MUST NOT include an entity body
2518 (such as the 1xx, 204, and 304 responses and any response to a HEAD
2519 request) is always terminated by the first empty line after the
2520 header fields, regardless of the entity header fields present in
2523 Closing the connection cannot be used to indicate the end of a request
2524 body, since it leaves no possibility for the server to send back a
2525 response. For compatibility with HTTP/1.0 applications, HTTP/1.1
2526 requests containing an entity body MUST include a valid Content-Length
2527 header field unless the server is known to be HTTP/1.1 compliant.
2528 HTTP/1.1 servers MUST accept the "chunked" transfer coding (section
2529 7.6), thus allowing this mechanism to be used for a request when
2530 Content-Length is unknown.
2532 If a request contains an entity body and Content-Length is not
2533 specified, the server SHOULD respond with 400 (bad request) if it cannot
2534 determine the length of the request message's content, or with 411
2536 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 40]
2541 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2544 (length required) if it wishes to insist on receiving a valid Content-
2547 Messages MUST NOT include both a Content-Length header field and the
2548 "chunked" transfer coding. If both are received, the Content-Length MUST
2551 When a Content-Length is given in a message where an entity body is
2552 allowed, its field value MUST exactly match the number of OCTETs in the
2553 entity body. HTTP/1.1 user agents MUST notify the user when an invalid
2554 length is received and detected.
2557 12 Status Code Definitions
2558 Each Status-Code is described below, including a description of which
2559 method(s) it can follow and any metainformation required in the
2563 12.1 Informational 1xx
2564 This class of status code indicates a provisional response, consisting
2565 only of the Status-Line and optional headers, and is terminated by an
2566 empty line. Since HTTP/1.0 did not define any 1xx status codes, servers
2567 MUST NOT send a 1xx response to an HTTP/1.0 client except under
2568 experimental conditions.
2571 12.1.1.1 100 Continue
2572 The client may continue with its request. This interim response is used
2573 to inform the client that the initial part of the request has been
2574 received and has not yet been rejected by the server. The client SHOULD
2575 continue by sending the remainder of the request or, if the request has
2576 already been completed, ignore this response. The server MUST send a
2577 final response after the request has been completed.
2580 12.1.1.2 101 Switching Protocols
2581 The server understands and is willing to comply with the client's
2582 request, via the Upgrade message header field (section 18.44), for a
2583 change in the application protocol being used on this connection. The
2584 server will switch protocols to those defined by the response's Upgrade
2585 header field immediately after the empty line which terminates the 101
2588 The protocol should only be switched when it is advantageous to do so.
2589 For example, switching to a newer version of HTTP is advantageous over
2590 older versions, and switching to a real-time, synchronous protocol may
2591 be advantageous when delivering resources that use such features.
2595 This class of status code indicates that the client's request was
2596 successfully received, understood, and accepted.
2599 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 41]
2604 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2608 The request has succeeded. The information returned with the response is
2609 dependent on the method used in the request, as follows:
2613 an entity corresponding to the requested resource is sent in the
2617 the response MUST only contain the header information and no Entity-
2621 an entity describing or containing the result of the action;
2624 an entity containing the request message as received by the end
2628 an entity describing the result of the action;
2629 If the entity corresponds to a resource, the response MAY include a
2630 Content-Location header field giving the actual location of that plain
2631 resource for later reference.
2634 12.2.1.2 201 Created
2635 The request has been fulfilled and resulted in a new resource being
2636 created. The newly created resource can be referenced by the URI(s)
2637 returned in the entity of the response, with the most specific URL for
2638 the resource given by a Location header field. The origin server SHOULD
2639 create the resource before returning this status code. If the action
2640 cannot be carried out immediately, the server MUST include in the
2641 response body a description of when the resource will be available;
2642 otherwise, the server SHOULD respond with 202 (Accepted).
2645 12.2.1.3 202 Accepted
2646 The request has been accepted for processing, but the processing has not
2647 been completed. The request MAY or MAY NOT eventually be acted upon, as
2648 it MAY be disallowed when processing actually takes place. There is no
2649 facility for re-sending a status code from an asynchronous operation
2652 The 202 response is intentionally non-committal. Its purpose is to allow
2653 a server to accept a request for some other process (perhaps a batch-
2654 oriented process that is only run once per day) without requiring that
2655 the user agent's connection to the server persist until the process is
2656 completed. The entity returned with this response SHOULD include an
2657 indication of the request's current status and either a pointer to a
2658 status monitor or some estimate of when the user can expect the request
2662 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 42]
2667 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2670 12.2.1.4 203 Non-Authoritative Information
2671 The returned metainformation in the Entity-Header is not the definitive
2672 set as available from the origin server, but is gathered from a local or
2673 a third-party copy. The set presented MAY be a subset or superset of the
2674 original version. For example, including local annotation information
2675 about the resource MAY result in a superset of the metainformation known
2676 by the origin server. Use of this response code is not required and is
2677 only appropriate when the response would otherwise be 200 (OK).
2680 12.2.1.5 204 No Content
2681 The server has fulfilled the request but there is no new information to
2682 send back. If the client is a user agent, it SHOULD NOT change its
2683 document view from that which caused the request to be generated. This
2684 response is primarily intended to allow input for actions to take place
2685 without causing a change to the user agent's active document view. The
2686 response MAY include new metainformation in the form of entity headers,
2687 which SHOULD apply to the document currently in the user agent's active
2690 The 204 response MUST NOT include an entity body, and thus is always
2691 terminated by the first empty line after the header fields.
2694 12.2.1.6 205 Reset Content
2695 The server has fulfilled the request and the user agent SHOULD reset the
2696 document view which caused the request to be generated. This response is
2697 primarily intended to allow input for actions to take place via user
2698 input, followed by a clearing of the form in which the input is given so
2699 that the user can easily initiate another input action. The response
2700 MUST include a Content-Length with a value of zero (0) and no entity
2704 12.2.1.7 206 Partial Content
2705 The server has fulfilled the partial GET request for the resource. The
2706 request MUST have included a Range header field (section 18.38)
2707 indicating the desired range. The response MUST include a Content-Range
2708 header field (section 18.18) indicating the range included with this
2709 response. All entity header fields in the response MUST describe the
2710 partial entity transmitted rather than what would have been transmitted
2711 in a full response. In particular, the Content-Length header field in
2712 the response MUST match the actual number of OCTETs transmitted in the
2713 entity body. It is assumed that the client already has the complete
2714 entity's header field data.
2717 12.3 Redirection 3xx
2718 This class of status code indicates that further action needs to be
2719 taken by the user agent in order to fulfill the request. The action
2720 required MAY be carried out by the user agent without interaction with
2721 the user if and only if the method used in the second request is GET or
2722 HEAD. A user agent SHOULD NOT automatically redirect a request more than
2723 5 times, since such redirections usually indicate an infinite loop.
2725 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 43]
2730 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2733 12.3.1.1 300 Multiple Choices
2734 This status code is reserved for future use by a planned content
2735 negotiation mechanism. HTTP/1.1 user agents receiving a 300 response
2736 which includes a Location header field can treat this response as they
2737 would treat a 303 (See Other) response. If no Location header field is
2738 included, the appropriate action is to display the entity enclosed in
2739 the response to the user.
2742 12.3.1.2 301 Moved Permanently
2743 The requested resource has been assigned a new permanent URI and any
2744 future references to this resource SHOULD be done using one of the
2745 returned URIs. Clients with link editing capabilities SHOULD
2746 automatically re-link references to the Request-URI to one or more of
2747 the new references returned by the server, where possible. This response
2748 is cachable unless indicated otherwise.
2750 If the new URI is a location, its URL MUST be given by the Location
2751 field in the response. Unless it was a HEAD request, the Entity-Body of
2752 the response SHOULD contain a short hypertext note with a hyperlink to
2755 If the 301 status code is received in response to a request other than
2756 GET or HEAD, the user agent MUST NOT automatically redirect the request
2757 unless it can be confirmed by the user, since this might change the
2758 conditions under which the request was issued.
2760 Note: When automatically redirecting a POST request after receiving
2761 a 301 status code, some existing HTTP/1.0 user agents will
2762 erroneously change it into a GET request.
2765 12.3.1.3 302 Moved Temporarily
2766 The requested resource resides temporarily under a different URI. Since
2767 the redirection may be altered on occasion, the client SHOULD continue
2768 to use the Request-URI for future requests. This response is only
2769 cachable if indicated by a Cache-Control or Expires header field.
2771 If the new URI is a location, its URL MUST be given by the Location
2772 field in the response. Unless it was a HEAD request, the Entity-Body of
2773 the response SHOULD contain a short hypertext note with a hyperlink to
2776 If the 302 status code is received in response to a request other than
2777 GET or HEAD, the user agent MUST NOT automatically redirect the request
2778 unless it can be confirmed by the user, since this might change the
2779 conditions under which the request was issued.
2781 Note: When automatically redirecting a POST request after receiving
2782 a 302 status code, some existing HTTP/1.0 user agents will
2783 erroneously change it into a GET request.
2788 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 44]
2793 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2796 12.3.1.4 303 See Other
2797 The response to the request can be found under a different URI and
2798 SHOULD be retrieved using a GET method on that resource. This method
2799 exists primarily to allow the output of a POST-activated script to
2800 redirect the user agent to a selected resource. The new resource is not
2801 a update reference for the original Request-URI. The 303 response is not
2802 cachable, but the response to the second request MAY be cachable.
2804 If the new URI is a location, its URL MUST be given by the Location
2805 field in the response. Unless it was a HEAD request, the Entity-Body of
2806 the response SHOULD contain a short hypertext note with a hyperlink to
2810 12.3.1.5 304 Not Modified
2811 If the client has performed a conditional GET request and access is
2812 allowed, but the document has not been modified since the date and time
2813 specified in the If-Modified-Since field, the server MUST respond with
2814 this status code and not send an Entity-Body to the client. Header
2815 fields contained in the response SHOULD only include information which
2816 is relevant to cache managers or which MAY have changed independently of
2817 the entity's Last-Modified date. Examples of relevant header fields
2818 include: Date, Server, Content-Length, Content-MD5, Content-Version,
2819 Cache-Control and Expires.
2821 A cache SHOULD update its cached entity to reflect any new field values
2822 given in the 304 response. If the new field values indicate that the
2823 cached entity differs from the current resource entity (as would be
2824 indicated by a change in Content-Length, Content-MD5, or Content-
2825 Version), then the cache MUST disregard the 304 response and repeat the
2826 request without an If-Modified-Since field.
2828 The 304 response MUST NOT include an entity body, and thus is always
2829 terminated by the first empty line after the header fields.
2832 12.3.1.6 305 Use Proxy
2833 The requested resource MUST be accessed through the proxy given by the
2834 Location field in the response. In other words, this is a proxy
2838 12.4 Client Error 4xx
2839 The 4xx class of status code is intended for cases in which the client
2840 seems to have erred. If the client has not completed the request when a
2841 4xx code is received, it SHOULD immediately cease sending data to the
2842 server. Except when responding to a HEAD request, the server SHOULD
2843 include an entity containing an explanation of the error situation, and
2844 whether it is a temporary or permanent condition. These status codes are
2845 applicable to any request method.
2847 Note: If the client is sending data, server implementations using
2848 TCP SHOULD be careful to ensure that the client acknowledges
2849 receipt of the packet(s) containing the response prior to closing
2851 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 45]
2856 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2859 the input connection. If the client continues sending data to the
2860 server after the close, the server's controller will send a reset
2861 packet to the client, which may erase the client's unacknowledged
2862 input buffers before they can be read and interpreted by the HTTP
2866 12.4.1.1 400 Bad Request
2867 The request could not be understood by the server due to malformed
2868 syntax. The client SHOULD NOT repeat the request without modifications.
2871 12.4.1.2 401 Unauthorized
2872 The request requires user authentication. The response MUST include a
2873 WWW-Authenticate header field (section 18.46) containing a challenge
2874 applicable to the requested resource. The client MAY repeat the request
2875 with a suitable Authorization header field (section 18.8). If the
2876 request already included Authorization credentials, then the 401
2877 response indicates that authorization has been refused for those
2878 credentials. If the 401 response contains the same challenge as the
2879 prior response, and the user agent has already attempted authentication
2880 at least once, then the user SHOULD be presented the entity that was
2881 given in the response, since that entity MAY include relevant diagnostic
2882 information. HTTP access authentication is explained in section 14.
2885 12.4.1.3 402 Payment Required
2886 This code is reserved for future use.
2889 12.4.1.4 403 Forbidden
2890 The server understood the request, but is refusing to fulfill it.
2891 Authorization will not help and the request SHOULD not be repeated. If
2892 the request method was not HEAD and the server wishes to make public why
2893 the request has not been fulfilled, it SHOULD describe the reason for
2894 the refusal in the entity body. This status code is commonly used when
2895 the server does not wish to reveal exactly why the request has been
2896 refused, or when no other response is applicable.
2899 12.4.1.5 404 Not Found
2900 The server has not found anything matching the Request-URI. No
2901 indication is given of whether the condition is temporary or permanent.
2902 If the server does not wish to make this information available to the
2903 client, the status code 403 (Forbidden) can be used instead. The 410
2904 (Gone) status code SHOULD be used if the server knows, through some
2905 internally configurable mechanism, that an old resource is permanently
2906 unavailable and has no forwarding address.
2909 12.4.1.6 405 Method Not Allowed
2910 The method specified in the Request-Line is not allowed for the resource
2911 identified by the Request-URI. The response MUST include an Allow header
2912 containing a list of valid methods for the requested resource.
2914 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 46]
2919 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2922 12.4.1.7 406 Not Acceptable
2923 The resource identified by the request is only capable of generating
2924 response entities which have content characteristics not acceptable
2925 according to the accept headers sent in the request.
2927 HTTP/1.1 servers are allowed to return responses which are not
2928 acceptable according to the accept headers sent in the request. In some
2929 cases, this may even be preferable to sending a 406 response. User
2930 agents are encouraged to inspect the headers of an incoming response to
2931 determine if it is acceptable. If the response is not acceptable, user
2932 agents SHOULD interrupt the receipt of the response if doing so would
2933 save network resources. If it is unknown whether an incoming response
2934 would be acceptable, a user agent SHOULD temporarily stop receipt of
2935 more data and query the user for a decision on furtheractions.
2938 12.4.1.8 407 Proxy Authentication Required
2939 This code is similar to 401 (Unauthorized), but indicates that the
2940 client MUST first authenticate itself with the proxy. The proxy MUST
2941 return a Proxy-Authenticate header field (section 18.35) containing a
2942 challenge applicable to the proxy for the requested resource. The client
2943 MAY repeat the request with a suitable Proxy-Authorization header field
2944 (section 18.36). HTTP access authentication is explained in section 14.
2947 12.4.1.9 408 Request Timeout
2948 The client did not produce a request within the time that the server was
2949 prepared to wait. The client MAY repeat the request without
2950 modifications at any later time.
2953 12.4.1.10 409 Conflict
2954 The request could not be completed due to a conflict with the current
2955 state of the resource. This code is only allowed in situations where it
2956 is expected that the user MAY be able to resolve the conflict and
2957 resubmit the request. The response body SHOULD include enough
2958 information for the user to recognize the source of the conflict.
2959 Ideally, the response entity would include enough information for the
2960 user or user-agent to fix the problem; however, that MAY not be possible
2961 and is not required.
2963 Conflicts are most likely to occur in response to a PUT request. If
2964 versioning is being used and the entity being PUT includes changes to a
2965 resource which conflict with those made by an earlier (third-party)
2966 request, the server MAY use the 409 response to indicate that it can't
2967 complete the request. In this case, the response entity SHOULD contain a
2968 list of the differences between the two versions in a format defined by
2969 the response Content-Type.
2973 The requested resource is no longer available at the server and no
2974 forwarding address is known. This condition SHOULD be considered
2975 permanent. Clients with link editing capabilities SHOULD delete
2977 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 47]
2982 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2985 references to the Request-URI after user approval. If the server does
2986 not know, or has no facility to determine, whether or not the condition
2987 is permanent, the status code 404 (Not Found) SHOULD be used instead.
2988 This response is cachable unless indicated otherwise.
2990 The 410 response is primarily intended to assist the task of web
2991 maintenance by notifying the recipient that the resource is
2992 intentionally unavailable and that the server owners desire that remote
2993 links to that resource be removed. Such an event is common for limited-
2994 time, promotional services and for resources belonging to individuals no
2995 longer working at the server's site. It is not necessary to mark all
2996 permanently unavailable resources as "gone" or to keep the mark for any
2997 length of time -- that is left to the discretion of the server owner.
3000 12.4.1.12 411 Length Required
3001 The server refuses to accept the request without a defined Content-
3002 Length. The client MAY repeat the request if it adds a valid Content-
3003 Length header field containing the length of the entity body in the
3007 12.4.1.13 412 Precondition Failed
3008 The precondition given in one or more of the request header fields
3009 evaluated to false when it was tested on the server. This response code
3010 allows the client to place preconditions on the current resource
3011 metainformation (header field data) and thus prevent the requested
3012 method from being applied to a resource other than the one intended.
3015 12.4.1.14 413 Request Entity Too Large
3016 The server is refusing to process a request because it considers the
3017 request entity to be larger than it is willing or able to process. The
3018 server SHOULD close the connection if that is necessary to prevent the
3019 client from continuing the request.
3021 If the client manages to read the 413 response, it MUST honor it and
3022 SHOULD reflect it to the user.
3024 If this restriction is considered temporary, the server MAY include a
3025 Retry-After header field to indicate that it is temporary and after what
3026 time the client MAY try again.
3029 12.4.1.15 414 Request-URI Too Long
3030 The server is refusing to service the request because the Request-URI is
3031 longer than the server is willing to interpret. This rare condition is
3032 only likely to occur when a client has improperly converted a POST
3033 request to a GET request with long query information, when the client
3034 has descended into a URL "black hole" of redirection (e.g., a redirected
3035 URL prefix that points to a suffix of itself), or when the server is
3036 under attack by a client attempting to exploit security holes present in
3037 some servers using fixed-length buffers for reading or manipulating the
3040 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 48]
3045 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3048 12.4.1.16 415 Unsupported Media Type
3049 The server is refusing to service the request because the entity body of
3050 the request is in a format not supported by the requested resource for
3051 the requested method.
3054 12.5 Server Error 5xx
3055 Response status codes beginning with the digit "5" indicate cases in
3056 which the server is aware that it has erred or is incapable of
3057 performing the request. If the client has not completed the request when
3058 a 5xx code is received, it SHOULD immediately cease sending data to the
3059 server. Except when responding to a HEAD request, the server SHOULD
3060 include an entity containing an explanation of the error situation, and
3061 whether it is a temporary or permanent condition. These response codes
3062 are applicable to any request method and there are no required header
3066 12.5.1.1 500 Internal Server Error
3067 The server encountered an unexpected condition which prevented it from
3068 fulfilling the request.
3071 12.5.1.2 501 Not Implemented
3072 The server does not support the functionality required to fulfill the
3073 request. This is the appropriate response when the server does not
3074 recognize the request method and is not capable of supporting it for any
3078 12.5.1.3 502 Bad Gateway
3079 The server, while acting as a gateway or proxy, received an invalid
3080 response from the upstream server it accessed in attempting to fulfill
3084 12.5.1.4 503 Service Unavailable
3085 The server is currently unable to handle the request due to a temporary
3086 overloading or maintenance of the server. The implication is that this
3087 is a temporary condition which will be alleviated after some delay. If
3088 known, the length of the delay MAY be indicated in a Retry-After
3090 If no Retry-After is given, the client SHOULD handle the response as it
3091 would for a 500 response.
3093 Note: The existence of the 503 status code does not imply that a
3094 server must use it when becoming overloaded. Some servers MAY wish
3095 to simply refuse the connection.
3098 12.5.1.5 504 Gateway Timeout
3099 The server, while acting as a gateway or proxy, did not receive a timely
3100 response from the upstream server it accessed in attempting to complete
3104 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 49]
3109 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3112 12.5.1.6 505 HTTP Version Not Supported
3113 The server does not support, or refuses to support, the HTTP protocol
3114 version that was used in the request message. The server is indicating
3115 that it is unable or unwilling to complete the request using the same
3116 major version as the client, as described in section 7.1, other than
3117 with this error message. The response SHOULD contain an entity
3118 describing why that version is not supported and what other protocols
3119 are supported by that server.
3122 13 Method Definitions
3123 The set of common methods for HTTP/1.1 is defined below. Although this
3124 set can be expanded, additional methods cannot be assumed to share the
3125 same semantics for separately extended clients and servers.
3127 The Host request-header field (section 18.24) MUST accompany all
3132 The OPTIONS method represents a request for information about the
3133 communication options available on the request/response chain identified
3134 by the Request-URI. This method allows the client to determine the
3135 options and/or requirements associated with a resource, or the
3136 capabilities of a server, without implying a resource action or
3137 initiating a resource retrieval.
3139 Unless the server's response is an error, the response MUST NOT include
3140 entity information other than what can be considered as communication
3141 options (e.g., Allow is appropriate, but Content-Type is not) and MUST
3142 include a Content-Length with a value of zero (0). Responses to this
3143 method are not cachable.
3145 If the Request-URI is an asterisk ("*"), the OPTIONS request is intended
3146 to apply to the server as a whole. A 200 response SHOULD include any
3147 header fields which indicate optional features implemented by the server
3148 (e.g., Public), including any extensions not defined by this
3149 specification, in addition to any applicable general or response header
3150 fields. As described in section 9.1.2, an "OPTIONS *" request can be
3151 applied through a proxy by specifying the destination server in the
3152 Request-URI without any path information.
3154 If the Request-URI is not an asterisk, the OPTIONS request applies only
3155 to the options that are available when communicating with that
3157 A 200 response SHOULD include any header fields which indicate optional
3158 features implemented by the server and applicable to that resource
3159 (e.g., Allow), including any extensions not defined by this
3160 specification, in addition to any applicable general or response header
3161 fields. If the OPTIONS request passes through a proxy, the proxy MUST
3162 edit the response to exclude those options known to be unavailable
3168 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 50]
3173 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3177 The GET method means retrieve whatever information (in the form of an
3178 entity) is identified by the Request-URI. If the Request-URI refers to a
3179 data-producing process, it is the produced data which shall be returned
3180 as the entity in the response and not the source text of the process,
3181 unless that text happens to be the output of the process.
3183 The semantics of the GET method change to a "conditional GET" if the
3184 request message includes an If-Modified-Since header field. A
3185 conditional GET method requests that the identified resource entity be
3186 transferred only if it has been modified since the date given by the
3188 Modified-Since header, as described in section 18.25. The conditional
3189 GET method is intended to reduce unnecessary network usage by allowing
3190 cached entities to be refreshed without requiring multiple requests or
3191 transferring data already held by the client.
3193 The semantics of the GET method change to a "partial GET" if the request
3194 message includes a Range header field. A partial GET requests that only
3195 part of the identified resource entity be transferred, as described in
3196 section 18.38. The partial GET method is intended to reduce unnecessary
3197 network usage by allowing partially-retrieved entities to be completed
3198 without transferring data already held by the client.
3200 The response to a GET request may be cachable if and only if it meets
3201 the requirements for HTTP caching described in section 16.
3205 The HEAD method is identical to GET except that the server MUST NOT
3206 return any Entity-Body in the response. The metainformation contained in
3207 the HTTP headers in response to a HEAD request SHOULD be identical to
3208 the information sent in response to a GET request. This method can be
3209 used for obtaining metainformation about the resource entity identified
3210 by the Request-URI without transferring the Entity-Body itself. This
3211 method is often used for testing hypertext links for validity,
3212 accessibility, and recent modification.
3214 The response to a HEAD request may be cachable in the sense that the
3215 information contained in the response may be used to update a previously
3216 cached entity from that resource. If the new field values indicate that
3217 the cached entity differs from the current resource entity (as would be
3218 indicated by a change in Content-Length, Content-MD5, or Content-
3219 Version), then the cache MUST mark the cache entry stale.
3221 There is no "conditional HEAD" or "partial HEAD" request analogous to
3222 those associated with the GET method. If an If-Modified-Since and/or
3223 Range header field is included with a HEAD request, they SHOULD be
3228 The POST method is used to request that the destination server accept
3229 the entity enclosed in the request as a new subordinate of the resource
3232 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 51]
3237 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3240 identified by the Request-URI in the Request-Line. POST is designed to
3241 allow a uniform method to cover the following functions:
3244 . Annotation of existing resources;
3246 . Posting a message to a bulletin board, newsgroup, mailing list, or
3247 similar group of articles;
3249 . Providing a block of data, such as the result of submitting a form
3250 , to a data-handling process;
3252 . Extending a database through an append operation.
3253 The actual function performed by the POST method is determined by the
3254 server and is usually dependent on the Request-URI. The posted entity is
3255 subordinate to that URI in the same way that a file is subordinate to a
3256 directory containing it, a news article is subordinate to a newsgroup to
3257 which it is posted, or a record is subordinate to a database.
3259 For compatibility with HTTP/1.0 applications, all POST requests MUST
3260 include a valid Content-Length header field unless the server is known
3261 to be HTTP/1.1 compliant. When sending a POST request to an HTTP/1.1
3262 server, a client MUST use a valid Content-Length or the "chunked"
3263 Transfer-Encoding. The server SHOULD respond with a 400 (bad request)
3264 message if it cannot determine the length of the request message's
3265 content, or with 411 (length required) if it wishes to insist on
3266 receiving a valid Content-Length.
3268 A successful POST does not require that the entity be created as a
3269 resource on the origin server or made accessible for future reference.
3270 That is, the action performed by the POST method might not result in a
3271 resource that can be identified by a URI. In this case, either 200 (OK)
3272 or 204 (no content) is the appropriate response status, depending on
3273 whether or not the response includes an entity that describes the
3276 If a resource has been created on the origin server, the response SHOULD
3277 be 201 (Created) and contain an entity (preferably of type "text/html")
3278 which describes the status of the request and refers to the new
3281 Responses to this method are not cachable. However, the 303 (See Other)
3282 response can be used to direct the user agent to retrieve a cachable
3285 POST requests must obey the entity transmission requirements set out in
3289 13.4.1 SLUSHY: Entity Transmission Requirements
3290 Editor's Note: The issues here around reliable transmission of large
3291 entities to servers, particularly HTTP/1.0 servers, are complicated and
3292 subtle, particularly since we'd like optimistic transmission to be the
3295 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 52]
3300 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3303 normal situation. We would like it if we can redraft this section to be
3304 simpler in the next draft
3306 General requirements:
3308 . HTTP/1.1 servers should maintain persistent connections and use
3309 TCP's flow control mechanisms to resolve temporary overloads,
3310 rather than terminating connections with the expectation that
3311 clients will retry. The latter technique can exacerbate network
3313 . An HTTP/1.1 (or later) client doing a PUT-like method SHOULD
3314 monitor the network connection for an error status while it is
3315 transmitting the request. If the client sees an error status, it
3316 should immediately cease transmitting the body. If the body is
3317 being sent using a "Chunked" encoding, a zero length chunk is used
3318 to mark the end of the message. If the body was preceded by a
3319 Content-length header, the client MUST close the connection.
3320 . An HTTP/1.1 (or later) client MUST be prepared to accept a "100
3321 Continue" status followed by a regular response.
3322 . An HTTP/1.1 (or later) server that receives a request from a
3323 HTTP/1.0 (or earlier) client MUST NOT transmit the 100 (continue)
3324 response; it SHOULD either wait for the request to be completed
3325 normally (thus avoiding an interrupted request) or close the
3326 connection prematurely.
3327 Upon receiving a method subject to these requirements from an HTTP/1.1
3328 (or later) client, an HTTP/1.1 (or later) server MUST either immediately
3329 respondwith 100 (continue) and continue to read from the input stream,
3330 or respond with an error status. If it responds with an error status,
3331 it MAY close the transport (TCP) connection or it MAY continue to read
3332 and discard the rest of the request. It MUST NOT perform the requested
3333 method if it returns an error status.
3335 If an HTTP/1.1 client has seen an HTTP/1.1 or later response from the
3336 server (clients SHOULD remember the version number of at least the most
3337 recently used server), and it sees the connection close before receiving
3338 any status from the server, the client SHOULD retry the request. If the
3339 client does retry the request,
3341 . it MUST first send the request headers,
3342 . and then MUST wait for the server to respond with either a 100
3343 (continue) response, in which case the client should continue, or
3344 with an error status.
3345 If an HTTP/1.1 client has not seen an HTTP/1.1 or later response from
3346 the server, it should assume that the server implements HTTP/1.0 or
3347 older and will not use the 100 (Continue) response. If in this case the
3348 client sees the connection close before receiving any status from the
3349 server, the client SHOULD retry the request. If the client does retry
3350 the request, it should use the following "binary exponential backoff"
3351 algorithm to be assured of obtaining a reliable response:
3354 Initiate a new connection to the server
3356 Transmit the request headers
3358 Initialize a variable R to the estimated round-trip time to the
3359 server (e.g., based on the time it took to establish the
3361 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 53]
3366 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3369 connection), or to a constant value of 5 seconds if the round-trip
3370 time is not available.
3372 Compute T = R * (2**N), where N is the number of previous retries
3375 Wait either for an error response from the server, or for T seconds
3376 (whichever comes first)
3378 If no error response is received, after T seconds transmit the body
3381 If client sees that the connection is closed prematurely, repeat
3382 from step 1 until the request is accepted, an error response is
3383 received, or the user becomes impatient.
3384 No matter what the server version, if an error status is received,
3386 . the client MUST NOT continue and
3387 . MUST close the connection if it has not already completed sending
3388 the full request body including any encoding mechanism used to
3390 An HTTP/1.1 (or later) client that sees the connection close after
3391 receiving a 100 (continue) but before receiving any other status SHOULD
3392 retry the request, and need not wait for 100 (continue) response (but
3393 MAY do so if this simplifies the implementation).
3397 The PUT method requests that the enclosed entity be stored under the
3398 supplied Request-URI. If the Request-URI refers to an already existing
3399 resource, the enclosed entity SHOULD be considered as a modified version
3400 of the one residing on the origin server. If the Request-URI does not
3401 point to an existing resource, and that URI is capable of being defined
3402 as a new resource by the requesting user agent, the origin server can
3403 create the resource with that URI. If a new resource is created, the
3404 origin server MUST inform the user agent via the 201 (created)
3406 If an existing resource is modified, either the 200 (OK) or 204 (No
3407 Content) response codes SHOULD be sent to indicate successful completion
3408 of the request. If the resource could not be created or modified with
3409 the Request-URI, an appropriate error response SHOULD be given that
3410 reflects the nature of the problem.
3412 If the request passes through a cache and the Request-URI identifies a
3413 currently cached entity, that entity MUST be removed from the cache.
3414 Responses to this method are not cachable.
3416 The fundamental difference between the POST and PUT requests is
3417 reflected in the different meaning of the Request-URI. The URI in a POST
3418 request identifies the resource that will handle the enclosed entity as
3419 an appendage. That resource may be a data-accepting process, a gateway
3420 to some other protocol, or a separate entity that accepts annotations.
3421 In contrast, the URI in a PUT request identifies the entity enclosed
3422 with the request -- the user agent knows what URI is intended and the
3423 server MUST NOT attempt to apply the request to some other resource. If
3424 the server desires that the request be applied to a different URI, it
3425 MUST send a 301 (Moved Permanently) response; the user agent MAY then
3426 make its own decision regarding whether or not to redirect the request.
3429 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 54]
3434 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3437 A single resource MAY be identified by many different URIs. For
3439 an article may have a URI for identifying "the current version" which is
3440 separate from the URI identifying each particular version. In this
3442 a PUT request on a general URI may result in several other URIs being
3443 defined by the origin server.
3445 For compatibility with HTTP/1.0 applications, all PUT requests MUST
3446 include a valid Content-Length header field unless the server is known
3447 to be HTTP/1.1 compliant. When sending a PUT request to an HTTP/1.1
3448 server, a client MUST use a valid Content-Length or the "chunked"
3449 Transfer-Encoding. The server SHOULD respond with a 400 (bad request)
3450 message if it cannot determine the length of the request message's
3451 content, or with 411 (length required) if it wishes to insist on
3452 receiving a valid Content-Length.
3454 The actual method for determining how the resource entity is placed, and
3455 what happens to its predecessor, is defined entirely by the origin
3458 PUT requests must obey the entity transmission requirements set out in
3463 The DELETE method requests that the origin server delete the resource
3464 identified by the Request-URI. This method MAY be overridden by human
3465 intervention (or other means) on the origin server. The client cannot be
3466 guaranteed that the operation has been carried out, even if the status
3467 code returned from the origin server indicates that the action has been
3468 completed successfully. However, the server SHOULD not indicate success
3469 unless, at the time the response is given, it intends to delete the
3470 resource or move it to an inaccessible location.
3472 A successful response SHOULD be 200 (OK) if the response includes an
3473 entity describing the status, 202 (Accepted) if the action has not yet
3474 been enacted, or 204 (No Content) if the response is OK but does not
3477 If the request passes through a cache and the Request-URI identifies a
3478 currently cached entity, that entity MUST be removed from the cache.
3479 Responses to this method are not cachable.
3483 The TRACE method is used to invoke a remote, application-layer
3485 of the request message. The final recipient of the request SHOULD
3486 reflect the message received back to the client as the entity body of a
3487 200 (OK) response. The final recipient is either the origin server or
3488 the first proxy or gateway to receive a Max-Forwards value of zero (0)
3489 in the request (see section 18.32). A TRACE request MUST NOT include an
3492 TRACE allows the client to see what is being received at the other end
3493 of the request chain and use that data for testing or diagnostic
3495 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 55]
3500 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3503 information. The value of the Via header field (section 18.47) is of
3504 particular interest, since it acts as a trace of the request chain. Use
3505 of the Max-Forwards header field allows the client to limit the length
3506 of the request chain, which is useful for testing a chain of proxies
3507 forwarding messages in an infinite loop.
3509 If successful, the response SHOULD contain the entire request message in
3510 the entity body, with a Content-Type of "message/http",
3511 "application/http", or "text/plain". Responses to this method MUST NOT
3515 14 Access Authentication
3516 HTTP provides a simple challenge-response authentication mechanism which
3517 MAY be used by a server to challenge a client request and by a client to
3518 provide authentication information. It uses an extensible, case-
3519 insensitive token to identify the authentication scheme, followed by a
3520 comma-separated list of attribute-value pairs which carry the parameters
3521 necessary for achieving authentication via that scheme.
3525 auth-param = token "=" quoted-string
3527 The 401 (Unauthorized) response message is used by an origin server to
3528 challenge the authorization of a user agent. This response MUST include
3529 a WWW-Authenticate header field containing at least one challenge
3530 applicable to the requested resource.
3532 challenge = auth-scheme 1*SP realm *( "," auth-param )
3534 realm = "realm" "=" realm-value
3535 realm-value = quoted-string
3537 The realm attribute (case-insensitive) is required for all
3538 authentication schemes which issue a challenge. The realm value (case-
3539 sensitive), in combination with the canonical root URL of the server
3540 being accessed, defines the protection space. These realms allow the
3541 protected resources on a server to be partitioned into a set of
3542 protection spaces, each with its own authentication scheme and/or
3543 authorization database. The realm value is a string, generally assigned
3544 by the origin server, which may have additional semantics specific to
3545 the authentication scheme.
3547 A user agent that wishes to authenticate itself with a server--usually,
3548 but not necessarily, after receiving a 401 or 411 response--MAY do so by
3549 including an Authorization header field with the request. The
3550 Authorization field value consists of credentials containing the
3551 authentication information of the user agent for the realm of the
3552 resource being requested.
3554 credentials = basic-credentials
3555 | auth-scheme 0#auth-param
3558 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 56]
3563 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3566 The domain over which credentials can be automatically applied by a user
3567 agent is determined by the protection space. If a prior request has been
3568 authorized, the same credentials MAY be reused for all other requests
3569 within that protection space for a period of time determined by the
3570 authentication scheme, parameters, and/or user preference. Unless
3571 otherwise defined by the authentication scheme, a single protection
3572 space cannot extend outside the scope of its server.
3574 If the server does not wish to accept the credentials sent with a
3575 request, it SHOULD return a 401 (Unauthorized) response. The response
3576 MUST include a WWW-Authenticate header field containing the (possibly
3577 new) challenge applicable to the requested resource and an entity
3578 explaining the refusal.
3580 The HTTP protocol does not restrict applications to this simple
3581 challenge-response mechanism for access authentication. Additional
3582 mechanisms MAY be used, such as encryption at the transport level or via
3583 message encapsulation, and with additional header fields specifying
3584 authentication information. However, these additional mechanisms are not
3585 defined by this specification.
3587 Proxies MUST be completely transparent regarding user agent
3588 authentication. That is, they MUST forward the WWW-Authenticate and
3589 Authorization headers untouched, and MUST NOT cache the response to a
3590 request containing Authorization.
3592 HTTP/1.1 allows a client to pass authentication information to and from
3593 a proxy via the Proxy-Authenticate and Proxy-Authorization headers.
3596 14.1 Basic Authentication Scheme
3597 The "basic" authentication scheme is based on the model that the user
3598 agent must authenticate itself with a user-ID and a password for each
3599 realm. The realm value should be considered an opaque string which can
3600 only be compared for equality with other realms on that server. The
3601 server will service the request only if it can validate the user-ID and
3602 password for the protection space of the Request-URI. There are no
3603 optional authentication parameters.
3605 Upon receipt of an unauthorized request for a URI within the protection
3606 space, the server SHOULD respond with a challenge like the following:
3608 WWW-Authenticate: Basic realm="WallyWorld"
3610 where "WallyWorld" is the string assigned by the server to identify the
3611 protection space of the Request-URI.
3613 To receive authorization, the client sends the user-ID and password,
3614 separated by a single colon (":") character, within a base64 encoded
3615 string in the credentials.
3617 basic-credentials = "Basic" SP basic-cookie
3621 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 57]
3626 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3629 basic-cookie = <base64 [7] encoding of user-pass,
3630 except not limited to 76 char/line>
3632 user-pass = userid ":" password
3638 If the user agent wishes to send the user-ID "Aladdin" and password
3639 "open sesame", it would use the following header field:
3641 Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
3643 The basic authentication scheme is a non-secure method of filtering
3644 unauthorized access to resources on an HTTP server. It is based on the
3645 assumption that the connection between the client and the server can be
3646 regarded as a trusted carrier. As this is not generally true on an open
3647 network, the basic authentication scheme should be used accordingly. In
3648 spite of this, clients SHOULD implement the scheme in order to
3649 communicate with servers that use it.
3652 14.2 Digest Authentication Scheme
3653 The "digest" authentication scheme is [currently described in an expired
3654 Internet-Draft, and this description will have to be improved to
3655 reference a new draft or include the old one].
3658 15 Content Negotiation
3659 A generic resource has multiple entities associated with it, all of
3660 which are representations of the content of the resource. Content
3661 negotiation is the process of selecting the best representation when a
3662 GET or HEAD request is made on the generic resource. HTTP/1.1 has
3663 provisions for two kinds of content negotiation: opaque negotiation and
3664 transparent negotiation.
3666 With opaque negotiation, the selection of the best representation is
3667 done by an algorithm located at the origin server, and unknown to the
3668 proxies and user agents involved. Selection is based on the contents of
3669 particular header fields in the request message, or on other information
3670 pertaining to the request, like the network address of the sending
3671 client. A typical example of opaque negotiation would be the selection
3672 of a text/html response in a particular language based on the contents
3673 of the Accept-Language request header field. A disadvantage of opaque
3674 negotiation is that the request headers may not always contain enough
3675 information to allow for selection. If the Accept header
3677 Accept: text/*: q=0.3, text/html, */*: q=0.5
3679 is sent in a request on a generic resource which has a video/mpeg and a
3680 video/quicktime representation, the selection algorithm in the origin
3681 server will either have to make a default choice, or return an error
3682 response which allows the user to decide on further actions.
3684 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 58]
3689 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3692 With transparent negotiation, the selection of the best representation
3693 is done by a distributed algorithm which can perform computation steps
3694 in the origin server, in proxies, or in the user agent. Transparent
3695 negotiation guarantees that, if the user agent supports the transparent
3696 negotiation algorithm and is correctly configured, the request will
3697 always correctly yield either the video/mpeg representation, the
3698 video/quicktime representation, or an error message indicating that the
3699 resource cannot be displayed by the user agent.
3702 15.1 Negotiation Facilities Defined in this Specification
3703 This specification defines all protocol facilities for opaque
3704 negotiation, but does not define the distributed algorithm for
3705 transparent negotiation. This specification only defines the basic
3706 facilities (Vary, Alternates, Accept) in the core protocol allowing
3707 requests on transparently negotiated resources to be correctly handled
3708 by HTTP/1.1 caches. All other information about transparent content
3709 negotiation is found in a separate document[29].
3711 If a generic resource is opaquely negotiated, successful responses to
3712 requests on the resource will always include a Vary header. If a
3713 generic resource is transparently negotiated, successful responses to
3714 requests on the resource will always include an Alternates header. If a
3715 successful response contains an Alternates header, it will also always
3716 contain a Content-Location header. A future specification may allow a
3717 combination of opaque and transparent negotiation that would lead to the
3718 inclusion of both a Vary header and an Alternates header in a response.
3722 The World Wide Web is a distributed system, and so its performance can
3723 be improved by the use of caches. These caches are typically placed at
3724 proxies and in the clients themselves. The HTTP/1.1 protocol includes a
3725 number of elements intended to make caching work as well as possible.
3726 Because these elements are inextricable from other aspects of the
3727 protocol, and because they interact with each other, it is useful to
3728 describe the basic caching design of HTTP separately from the detailed
3729 descriptions of methods, headers, response codes, etc.
3732 16.1 Semantic Transparency
3733 Requirements for performance, availability, and disconnected operation
3734 require us to be able to relax the goal of semantic transparency. The
3735 HTTP/1.1 protocol allows origin servers, caches, and clients to
3736 explicitly reduce transparency when necessary. However, because non-
3737 transparent operation may confuse non-expert users, and may be
3738 incompatible with certain server applications (such as those for
3739 ordering merchandise), the protocol requires that transparency may not
3742 . without an explicit protocol-level request (when relaxed by client
3744 . without a means for warning the end user (when relaxed by cache or
3747 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 59]
3752 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3755 Therefore, the HTTP/1.1 protocol provides these important elements:
3757 1. Protocol features that provide full semantic transparency when this
3758 is desired by all parties.
3759 2. Protocol features that allow an origin server or end-user client to
3760 explicitly request and control non-transparent operation.
3761 3. Protocol features that allow a cache to attach warnings to
3762 responses that do not preserve semantic transparency.
3763 A basic principle is that it must be possible for the clients to detect
3764 any potential breakdown of semantic transparency.
3766 Caching would be useless if it did not significantly improve
3767 performance. The goal of caching in HTTP/1.1 is to eliminate the need to
3768 send requests in many cases, and to eliminate the need to send full
3769 responses in many other cases. The former reduces the number of network
3770 round-trips required for many operations; we use an "expiration"
3771 mechanism for this purpose (see section 16.1.2). The latter reduces
3772 network bandwidth requirements; we use a "validation" mechanism for this
3773 purpose (see section 13.3).
3775 The server, cache, or client implementer may be faced with design
3776 decisions not explicitly discussed in this specification. If a decision
3777 may affect semantic transparency, the implementer ought to err on the
3778 side of maintaining transparency unless a careful and complete analysis
3779 shows significant benefits in breaking transparency.
3782 16.1.1 Cache Correctness
3783 If the cache can communicate with the origin-server, then a correct
3784 cache MUST respond to a request with a response that meets all the
3785 following conditions:
3787 1. its end-to-end headers (see section 16.4.1) and entity-body value
3788 are equivalent to what the server would have returned for that
3789 request if the resource had not been modified since the response
3790 was cached. This may be accomplished by revalidating the response
3791 with the origin server, if is not fresh.
3792 2. it is "fresh enough" (see section 16.1.2). In the default case,
3793 this means it meets the least restrictive freshness requirement of
3794 the client, server, and cache (see section 18.10); if the origin-
3795 server so specifies, it is the freshness requirement of the
3798 3. it includes a warning if the freshness demand of the client or the
3799 origin-server is violated (see section 16.1.5 and 18.48).
3800 4. it is the most up-to-date response appropriate to the request the
3801 cache has seen (see section 16.2.6, 16.2.8, and 16.13).
3802 If the cache can not communicate with the origin server, then a correct
3803 cache SHOULD respond as above if the response can be correctly served
3804 from the cache; if not it MUST return an error or warning indicating
3805 that there was a communication.
3811 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 60]
3816 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3819 16.1.2 Cache-control Mechanisms
3820 The basic cache mechanisms in HTTP/1.1 (server-specified expiration
3821 times and validators) are implicit directives to caches. In some cases,
3822 a server or client may need to provide explicit directives to the HTTP
3823 caches. We use the Cache-Control header for this purpose.
3825 The Cache-Control header allows a client or server to transmit a variety
3826 of directives in either requests or responses. These directives
3827 typically override the default caching algorithms. As a general rule, if
3828 there is any apparent conflict between header values, the most
3829 restrictive interpretation should be applied (that is, the one that is
3830 most likely to preserve semantic transparency). However, in some cases,
3831 Cache-Control directives are explicitly specified as weakening semantic
3832 transparency (for example, "max-stale" or "public").
3834 The Cache-Control directives are described in detail in section 18.10.
3838 Whenever a cache returns a response that is not semantically
3839 transparent, it must attach a warning to that effect, using a Warning
3840 response header. This warning allows clients and user agents to take
3843 Warnings may be used for other purposes, both cache-related and
3844 otherwise. The use of a warning, rather than an error status code,
3845 distinguish these responses from true failures.
3847 Warnings are always cachable, because they never weaken the transparency
3848 of a response. This means that warnings can be passed to HTTP/1.0 caches
3849 without danger; such caches will simply pass the warning along as a
3850 entity header in the response.
3852 Warnings are assigned numbers between 0 and 99. This specification
3853 defines the code numbers and meanings of each warning, allowing a client
3854 or cache to take automated action in some (but not all) cases.
3856 Warnings also carry a warning message text in any appropriate natural
3857 language (perhaps based on the client's Accept headers), and an optional
3858 indication of what language and character set are used.
3860 Multiple warning messages may be attached to a response (either by the
3861 origin server or by a cache), including multiple warnings with the same
3862 code number. For example, a server may provide the same warning with
3863 texts in both English and Basque.
3865 When multiple warnings are attached to a response, it may not be
3866 practical or reasonable to display all of them to the user. This version
3867 of HTTP does not specify strict priority rules for deciding which
3868 warnings to display and in what order, but does suggest some
3871 The Warning header and the currently defined warnings are described in
3875 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 61]
3880 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3883 16.1.4 Explicit User Agent Warnings
3884 Many user agents make it possible for users to override the basic
3885 caching mechanisms. For example, the user agent may allow the user to
3886 specify that cached entities (even explicitly stale ones) are never
3887 validated. Or the user agent might habitually add "Cache-Control: max-
3888 stale=3600" or "Cache-Control: reload" to every request. We recognize
3889 that there may be situations which require such overrides, although user
3890 agents SHOULD NOT default to any behavior contrary to the HTTP/1.1
3891 specification. That is, the user should have to explicitly request
3892 either non-transparent behavior, or behavior that results in abnormally
3893 ineffective caching.
3895 If the user has overridden the basic caching mechanisms, the user agent
3896 should explicitly indicate to the user whenever this results in the
3897 display of information that might not meet the server's transparency
3898 requirements (in particular, if the displayed entity is known to be
3899 stale). Since the protocol normally allows the user agent to determine
3900 if responses are stale or not, this indication need only be displayed
3901 when this actually happens. The indication need not be a dialog box; it
3902 could be an icon (for example, a picture of a rotting fish) or some
3903 other visual indicator.
3905 If the user has overridden the caching mechanisms in a way that would
3906 abnormally reduce the effectiveness of caches, the user agent should
3907 continually display an indication (for example, a picture of currency in
3908 flames) so that the user does not inadvertently consume excess resources
3909 or suffer from excessive latency.
3912 16.1.5 Exceptions to the Rules and Warnings
3913 In some cases, the operator of a cache may choose to configure it to
3914 return stale responses even when not requested by clients. This decision
3915 not be made lightly, but may be necessary for reasons of availability or
3916 performance, especially when the cache is poorly connected to the origin
3917 server. Whenever a cache returns a stale response, it MUST mark it as
3918 such (using a Warning header). This allows the client software to alert
3919 the user that there may be a potential problem.
3921 It also allows the user to take steps to obtain a firsthand or fresh
3922 response, if the user so desires. For this reason, a cache MUST NOT
3923 return a stale response if the client explicitly requests a first-hand
3924 or fresh one, unless it is impossible to comply.
3927 16.1.6 Client-controlled Behavior
3928 While the origin server (and to a lesser extent, intermediate caches, by
3929 their contribution to the age of a response) are the primary source of
3930 expiration information, in some cases the client may need to control a
3931 cache's decision about whether to return a cached response without
3932 validating it. Clients do this using several directives of the Cache-
3935 A client's request may specify the maximum age it is willing to accept
3936 for an unvalidated response; specifying a value of zero forces the
3938 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 62]
3943 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3946 cache(s) to revalidate all responses. A client may also specify the
3947 minimum time remaining before a response expires. Both of these options
3948 increase constraints on the behavior of caches, and so cannot decrease
3949 semantic transparency.
3951 A client may also specify that it will accept stale responses, up to
3952 some maximum amount of staleness. This loosens the constraints on the
3953 caches, and so may violate semantic transparency, but may be necessary
3954 to support disconnected operation, or high availability in the face of
3958 16.2 Expiration Model
3960 16.2.1 Server-Specified Expiration
3961 HTTP caching works best when caches can entirely avoid making requests
3962 to the origin server. The primary mechanism for avoiding requests is for
3963 an origin server to provide an explicit expiration time in the future,
3964 indicating that a response may be used to satisfy subsequent requests.
3965 In other words, a cache can return a fresh response without first
3966 contacting the server.
3968 Our expectation is that servers will assign future explicit expiration
3969 times to responses in the belief that the entity is not likely to
3970 change, in a semantically significant way, before the expiration time is
3971 reached. This normally preserves semantic transparency, as long as the
3972 server's expiration times are carefully chosen.
3974 If an origin server wishes to force a semantically transparent cache to
3975 validate every request, it may assign an explicit expiration time in the
3976 past. This means that the response is always stale, and so the cache
3977 SHOULD validate it before using it for subsequent requests. (See
3978 section 18.10.4 for a more restrictive way to force revalidation).
3980 Note that a firsthand response MUST always be returned to the
3981 requesting client, independent of its expiration time, unless the
3982 connection to the client is lost.
3984 If an origin server wishes to force any HTTP/1.1 cache, no matter how it
3985 is configured, to validate every request, it should use the "must-
3986 revalidate" Cache-Control directive. See section 18.10.
3988 Servers specify explicit expiration times using either the Expires
3989 header, or the max-age directive of the Cache-Control header.
3992 16.2.2 Limitations on the Effect of Expiration Times
3993 An expiration time cannot be used to force a user agent to refresh its
3994 display or reload a resource entity; its semantics apply only to caching
3995 mechanisms, and such mechanisms need only check a resource's expiration
3996 status when a new request for that resource is initiated.
3998 User agents often have history mechanisms, such as "Back" buttons and
3999 history lists, which can be used to redisplay an entity retrieved
4001 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 63]
4006 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4009 earlier in a session. By default, an expiration time does not apply to
4010 history mechanisms. If the entity is still in storage, a history
4011 mechanism should display it even if the entity has expired, unless the
4012 user has specifically configured the agent to refresh expired history
4016 16.2.3 Heuristic Expiration
4017 Since origin servers do not always provide explicit expiration times,
4018 HTTP caches typically assign heuristic expiration times, employing
4019 algorithms that use other header values (such as the Last-Modified
4021 to estimate a plausible expiration time. The HTTP/1.1 specification does
4022 not provide specific algorithms, but does impose worst-case constraints
4023 on their results. Since heuristic expiration times may compromise
4024 semantic transparency, they should be used cautiously, and we encourage
4025 origin servers to provide explicit expiration times as much as
4029 16.2.4 Age Calculations
4030 In order to know if a cached entry is fresh, a cache needs to know if
4031 its age exceeds its freshness lifetime. We discuss how to calculate the
4032 latter in section 0; this section describes how to calculate the age of
4033 a response or cache entry.
4035 In this discussion, we use the term "now" to mean "the current value of
4036 the clock at the host performing the calculation." All HTTP
4037 implementations, but especially origin servers and caches, should use
4038 NTP [RFC1305] or some similar protocol to synchronize their clocks to a
4039 globally accurate time standard.
4041 Also note that HTTP/1.1 requires origin servers to send a Date header
4042 with every response, giving the time at which the response was
4043 generated. We use the term "date_value" to denote a representation of
4044 the value of the Date header, in a form appropriate for arithmetic
4047 HTTP/1.1 uses the "Age" response header to help convey age information
4048 between caches. The Age header value is the sender's estimate of the
4049 amount of time since the response was generated at the origin server. In
4050 the case of a cached response that has been revalidated with the origin
4051 server, the Age value is based on the time of revalidation, not of the
4054 In essence, the Age value is the sum of the time that the response has
4055 been resident in each of the caches along the path from the origin
4056 server, plus the amount of time it has been in transit along network
4059 We use the term "age_value" to denote a representation of the value of
4060 the Age header, in a form appropriate for arithmetic operations.
4062 An response's age can be calculated in two entirely independent ways:
4066 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 64]
4071 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4074 1. now - date_value, if the local clock is reasonably well
4075 synchronized to the origin server's clock. If the result is
4076 negative, this is replaced by zero.
4077 2. age_value, if all of the caches along the response path implement
4079 Given that we have two independent ways to compute the age of a response
4080 when it is received, we can combine these as
4082 corrected_received_age = max(now - date_value, age_value)
4084 and as long as we have either nearly synchronized clocks or
4086 paths, one gets a reliable (conservative) result.
4088 Note that this correction is applied at each HTTP/1.1 cache along the
4089 path, so that if there is an HTTP/1.0 cache in the path, the correct
4090 received age is computed as long as the receiving cache's clock is
4091 nearly in sync. We don't need end-to-end clock synchronization
4093 it is good to have), and there is no explicit clock synchronization
4096 Because of network-imposed delays, some significant interval may pass
4097 from the time that a server generates a response, and the time it is
4098 received at the next outbound cache or client. If uncorrected, this
4099 delay could result in improperly low ages.
4101 Because the request that resulted in the returned Age value must have
4102 been initiated prior to that Age value's generation, we can correct for
4103 delays imposed by the network by recording the time at which the request
4104 was initiated. Then, when an Age value is received, it MUST be
4105 interpreted relative to the time the request was initiated, not the time
4106 that the response was received. This algorithm results in conservative
4107 behavior no matter how much delay is experienced. So, we compute:
4109 corrected_initial_age = corrected_received_age
4110 + (now - request_time)
4112 where "request_time" is the time (according to the local clock) when the
4113 request that elicited this response was sent.
4115 Summary of age calculation algorithm, when a cache receives a response:
4119 * is the value of Age: header received by the cache with
4122 * is the value of the origin server's Date: header
4124 * is the (local) time when the cache made the request
4125 * that resulted in this cached response
4127 * is the (local) time when the cache received the
4131 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 65]
4136 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4139 * is the current (local) time
4141 apparent_age = max(0, now - date_value);
4142 corrected_received_age = max(apparent_age, age_value);
4143 response_delay = now - request_time;
4144 corrected_initial_age = corrected_received_age + response_delay;
4145 resident_time = now - response_time;
4146 current_age = corrected_initial_age + resident_time;
4148 When a cache sends a response, it must add to the corrected_initial_age
4149 the amount of time that the response was resident locally. It must then
4150 transmit this total age, using the Age header, to the next recipient
4153 Note that a client can usually tell if a response is firsthand by
4154 comparing the Date to its local request-time, and hoping that the
4155 clocks are not badly skewed.
4160 16.2.5 Expiration Calculations
4161 In order to decide whether a response is fresh or stale, we need to
4162 compare its freshness lifetime to its age. The age is calculated as
4163 described in section 16.2.4; this section describes how to calculate the
4164 freshness lifetime, and to determine if a response has expired.
4166 We use the term "expires_value" to denote a representation of the value
4167 of the Expires header, in a form appropriate for arithmetic operations.
4168 We use the term "max_age_value" to denote an appropriate representation
4169 of the number of seconds carried by the max-age directive of the Cache-
4170 Control header in a response (see section 18.11).
4172 The max-age directive takes priority over Expires, so if max-age is
4173 present in a response, the calculation is simply:
4175 freshness_lifetime = max_age_value
4177 Otherwise, if Expires is present in the response, the calculation is:
4179 freshness_lifetime = expires_value - date_value
4181 Note that neither of these calculations is vulnerable to clock skew,
4182 since all of the information comes from the origin server.
4184 If neither Expires nor Cache-Control max-age appears in the response,
4185 and the response does not include other restrictions on caching, the
4186 cache MAY compute a freshness lifetime using a heuristic. This heuristic
4187 is subject to certain limitations; the minimum value may be zero, and
4188 the maximum value MUST be no more than 24 hours.
4190 Also, if the response does have a Last-Modified time, the heuristic
4191 expiration value SHOULD be no more than some fraction of the interval
4192 since that time. A typical setting of this fraction might be 10%.
4194 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 66]
4199 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4202 The calculation to determine if a response has expired is quite simple:
4204 response_is_fresh = (freshness_lifetime > current_age)
4207 16.2.6 Scope of Expiration
4208 HTTP/1.1's expiration model is that as soon as any variant of a URI
4209 becomes stale, all variants becomes stale as well. Thus, "freshness"
4210 applies to all the variants of URI, rather than any particular variant.
4211 Dates and expires etc. apply to any cached variant that a proxy might
4212 have with a URI and not just the one particular entity.
4214 Editor's note: This restriction may be dropped in the next draft; there
4215 are still discussions about whether this restriction is needed.
4218 16.2.7 Disambiguating Expiration Values
4219 Because expiration values are assigned optimistically, it is possible
4220 that two caches may contain fresh values for the same resource that are
4223 If a client performing a retrieval receives a non-firsthand response for
4224 a resource entity that was already fresh in its own cache, and the Date
4225 header in its existing cache entry is newer than the Date on the new
4226 response, then the client MAY ignore the response. If so, it MAY retry
4227 the request with a "Cache-Control: max-age=0" directive (see section
4228 18.10), to force a check with the origin server.
4230 If a cache that is pooling cached responses from other caches sees two
4231 fresh responses for the same resource entity with different validators,
4232 it SHOULD use the one with the newer Date header.
4235 16.2.8 Disambiguating Multiple Responses
4236 Because a client may be receiving responses via multiple paths, so that
4237 some responses flow through one set of caches and other responses flow
4238 through a different set of caches, a client may receive responses in an
4239 order different from that in which the origin server generated them. We
4240 would like the client to use the most recently generated response, even
4241 if older responses are still apparently fresh.
4243 Neither the entity tag nor the expiration value can impose an ordering
4244 on responses, since it is possible that a later response intentionally
4245 carries an earlier expiration time. However, the HTTP/1.1 specification
4246 requires the transmission of Date headers on every response, and the
4247 Date values are ordered to a granularity of one second.
4249 If a client performs a request for a resource entity that it already has
4250 in its cache, and the response it receives contains a Date header that
4251 appears to be older than the one it already has in its cache, then the
4252 client SHOULD repeat the request unconditionally, and include
4254 Cache-Control: max-age=0
4257 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 67]
4262 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4265 to force any intermediate caches to validate their copies directly with
4266 the origin server, or
4268 Cache-Control: no-cache
4270 to force any intermediate caches to obtain a new copy from the origin
4271 server. This prevents certain paradoxes arising from the use of multiple
4274 If the Date values are equal, then the client may use either response
4275 (or may, if it is being extremely prudent, request a new response).
4276 Servers MUST NOT depend on clients being able to choose
4277 deterministically between responses generated during the same second, if
4278 their expiration times overlap.
4281 16.3 Validation Model
4282 When a cache has a stale entry that it would like to use as a response
4283 to a client's request, it first has to check with the origin server (or
4284 possibly an intermediate cache with a fresh response) to see if its
4285 cached entry is still usable. We call this "validating" the cache
4287 Since we do not want to have to pay the overhead of retransmitting the
4288 full response if the cached entry is good, and we do not want to pay the
4289 overhead of an extra round trip if the cached entry is invalid, the
4290 HTTP/1.1 protocol supports the use of conditional methods.
4292 The key protocol features for supporting conditional methods are those
4293 concerned with "cache validators." When an origin server generates a
4294 full response, it attaches some sort of validator to it, which is kept
4295 with the cache entry. When a client (end-user or cache) makes a
4296 conditional request for a resource for which it has a cache entry, it
4297 includes the associated validator in the request.
4299 The server then checks that validator against the current validator for
4300 the resource entity, and, if they match, it responds with a special
4301 status code (usually, "304 Not Modified") and no entity body.
4303 it returns a full response (including entity body). Thus, we avoid
4304 transmitting the full response if the validator matches, and we avoid an
4305 extra round trip if it does not match.
4307 Note: the comparison functions used to decide if validators match
4308 are defined in section 16.3.3.
4310 In HTTP/1.1, a conditional request looks exactly the same as a normal
4311 request for the same resource, except that it carries a special header
4312 (which includes the validator) that implicitly turns the method
4313 (usually, GET) into a conditional.
4315 The protocol includes both positive and negative senses of cache-
4316 validating conditions. That is, it is possible to request either that a
4317 method be performed if and only if the validators match, or if and only
4318 if the validators do not match.
4322 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 68]
4327 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4330 Note: a response that lacks a cache validator may still be cached,
4331 and served from cache until it expires, unless this is explicitly
4332 prohibited by a Cache-Control directive. However, a cache cannot do
4333 a conditional retrieval if it does not have a cache validator for
4334 the entity, which means it will not be refreshable after it
4340 16.3.1 Last-modified Dates
4341 In HTTP/1.0, the only cache validator is the Last-Modified time carried
4342 by a response. Clients validate entities using the If-Modified-Since
4343 header. In simple terms, a cache entry is considered to be valid if the
4344 actual resource entity has not been modified since the original response
4349 HTTP/1.1 introduces the possibility of using an "opaque" validator,
4350 called an "entity tag," for situations where the Last-Modified date is
4351 not appropriate. This may include server implementations where it is not
4352 convenient to store modification dates, or where the one-second
4353 resolution of HTTP date values is insufficient, or where the origin
4354 server wishes to avoid certain paradoxes that may arise from the use of
4357 An entity tag is simply a string of octets whose internal structure is
4358 not known to clients or caches. Caches store entity tags and return them
4359 when making conditional requests. Also, when a cache receives a
4360 conditional request for a resource for which it has a fresh cache
4362 it may compare entity tags using strict octet-equality. Otherwise,
4363 entity tags have no semantic value to clients or caches.
4365 To preserve compatibility with HTTP/1.0 clients and caches, and because
4366 the Last-Modified date may be useful for purposes other than cache
4367 validation, HTTP/1.1 servers SHOULD send Last-Modified whenever
4370 The headers used to convey entity tags are described in sections Error!
4371 Reference source not found., Error! Reference source not found., 18.26,
4375 16.3.3 Weak and Strong Validators
4376 Since both origin servers and caches will compare two validator values
4377 to decide if they represent the same or different resource entities, one
4378 normally would expect that if the resource entity (the entity body or
4379 any entity headers) changes in any way, then the associated validator
4380 would change as well. If this is true, then we call this validator a
4383 However, there may be cases when a server prefers to change the
4384 validator only on semantically significant changes, and not when
4386 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 69]
4391 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4394 insignificant aspects of the resource entity change. A validator that
4395 does not always change when the resource changes is a "weak validator."
4397 One can think of a strong validator as one that changes whenever the
4398 bits of an entity changes, while a weak value changes whenever the
4399 meaning of an entity changes. Alternatively, one can think of a strong
4400 validator as part of an identifier for a specific entity, while a weak
4401 validator is part of an identifier for a set of semantically equivalent
4404 Note: One example of a strong validator is an integer that is
4405 incremented in stable storage every time an entity is changed.
4407 An entity's modification time, if represented with one-second
4408 resolution, could be a weak validator, since it is possible that
4409 the resource entity may be modified twice during a single second.
4411 Entity tags are normally "strong validators," but the protocol provides
4412 a mechanism to tag an entity tag as "weak."
4414 A "use" of a validator is either when a client generates a request and
4415 includes the validator in a validating header field, or when a server
4416 compares two validators.
4418 Strong validators are usable in any context. Weak validators are only
4419 usable in contexts that do not depend on exact equality of an entity.
4420 For example, either kind is usable for a conditional GET of a full
4421 entity. However, only a strong validator is usable for a sub-range
4422 retrieval, since otherwise the client may end up with an internally
4423 inconsistent entity body.
4425 The only function that the HTTP/1.1 protocol defines on validators is
4426 comparison. There are two validator comparison functions, depending on
4427 whether the comparison context allows the use of weak validators or
4430 . The strong comparison function: in order to be considered equal,
4431 both validators must be identical in every way, and neither may be
4433 . The weak comparison function: in order to be considered equal, both
4434 validators must be identical in every way, but either or both of
4435 them may be tagged as "weak" without affecting the result.
4436 The weak comparison function SHOULD be used for simple (non-subrange)
4437 GET requests. The strong comparison function MUST be used in all other
4440 An entity tag is strong unless it is explicitly tagged as weak. Section
4441 16.3 gives the syntax for entity tags.
4443 A Last-Modified time, when used as a validator in a request, is
4444 implicitly weak unless it is possible to deduce that it is strong, using
4445 the following rules:
4447 . The validator is being compared by an origin server to the actual
4448 current validator for the entity and,
4450 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 70]
4455 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4458 . That origin server reliably knows that the associated entity did
4459 not change twice during the second covered by the presented
4462 . The validator is about to be used by a client in an If-Modified-
4463 Since or If-Unmodified-Since header, because the client has a cache
4464 entry for the associated entity, and
4465 . That cache entry includes a Date value, which gives the time when
4466 the origin server generated the original response, and
4467 . The presented Last-Modified time is at least 60 seconds before the
4470 . The validator is being compared by an intermediate cache to the
4471 validator stored in its cache entry for the entity, and
4472 . That cache entry includes a Date value, which gives the time when
4473 the origin server generated the original response, and
4474 . The presented Last-Modified time is at least 60 seconds before the
4476 This method relies on the fact that if two different responses were
4477 generated by the origin server during the same second, but both had the
4478 same Last-Modified time, then at least one of those responses would have
4479 a Date value equal to its Last-Modified time. The arbitrary 60-second
4480 limit guards against the possibility that the Date and Last-Modified
4481 values are generated from different clocks, or at somewhat different
4482 times during the preparation of the response. An implementation may use
4483 a value larger than 60 seconds, if it is believed that 60 seconds is too
4486 If a client wishes to perform a sub-range retrieval on a value for which
4487 it has only a Last-Modified time and no opaque validator, it may do this
4488 only if the Last-Modified time is strong in the sense described here.
4490 A cache or origin server receiving a cache-conditional request, other
4491 than a full-body GET request, must use the strong comparison function to
4492 evaluate the condition.
4494 These rules allow HTTP/1.1 caches and clients to safely perform sub-
4495 range retrievals on values that have been obtained from HTTP/1.0
4499 16.3.4 Rules for When to Use Entity Tags and Last-modified Dates
4500 We adopt a set of rules and recommendations for origin servers,
4502 and caches regarding when various validator types should be used, and
4505 HTTP/1.1 origin servers:
4507 . SHOULD send an entity tag validator unless performance
4508 considerations support the use of weak entity tags, or unless it is
4509 unfeasible to send a strong entity tag.
4510 . MAY send a weak entity tag instead of a strong one.
4512 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 71]
4517 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4520 . MAY send no entity tag if it is not feasible to generate one.
4521 . SHOULD send a Last-Modified value if it is feasible to send one,
4522 unless the risk of a breakdown in semantic transparency that could
4523 result from using this date in an If-Modified-Since header would
4524 lead to serious problems.
4525 In other words, the preferred behavior for an HTTP/1.1 origin server is
4526 to send both a strong entity tag and a Last-Modified value.
4528 In order to be legal, a strong entity tag MUST change whenever the
4529 associated entity value changes in any way. A weak entity tag SHOULD
4530 change whenever the associated entity changes in a semantically
4533 Note: in order to provide semantically transparent caching, an
4534 origin server should avoid reusing a specific strong entity tag
4535 value for two different resource entities, or reusing a specific
4536 weak entity tag value for two semantically different instances of a
4537 resource entity. Cache entries may persist for arbitrarily long
4538 periods, regardless of expiration times, so it may be inappropriate
4539 to expect that a cache will never again attempt to validate an
4540 entry using a validator that it obtained at some point in the past.
4544 . If an entity tag has been provided by the origin server, MUST use
4545 that entity tag in any cache-conditional request (using If-Match or
4547 . If only a Last-Modified value has been provided by the origin
4548 server, SHOULD use that value in non-subrange cache-conditional
4549 requests (using If-Modified-Since).
4550 . If only a Last-Modified value has been provided by an HTTP/1.0
4551 origin server, MAY use that value in subrange cache-conditional
4552 requests (using If-Unmodified-Since:). The user agent should
4553 provide a way to disable this, in case of difficulty.
4554 . If both an entity tag and a Last-Modified value have been provided
4555 by the origin server, SHOULD use both validators in cache-
4556 conditional requests. This allows both HTTP/1.0 and HTTP/1.1 caches
4557 to respond appropriately.
4558 An HTTP/1.1 cache, upon receiving a request, MUST use the most
4559 restrictive validator when deciding whether the client's cache entry
4560 matches the cache's own cache entry. This is only an issue when the
4561 request contains both an entity tag and a last-modified-date validator
4562 (If-Modified-Since or If-Unmodified-Since).
4564 A note on rationale: The general principle behind these rules is
4565 that HTTP/1.1 servers and clients should transmit as much non-
4566 redundant information as is available in their responses and
4567 requests. HTTP/1.1 systems receiving this information will make the
4568 most conservative assumptions about the validators they receive.
4570 HTTP/1.0 clients and caches will ignore entity tags. Generally,
4571 last-modified values received or used by these systems will support
4572 transparent and efficient caching, and so HTTP/1.1 origin servers
4573 should provide Last-Modified values. In those rare cases where the
4575 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 72]
4580 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4583 use of a Last-Modified value as a validator by an HTTP/1.0 system
4584 could result in a serious problem, then HTTP/1.1 origin servers
4585 should not provide one.
4588 16.3.5 Non-validating Conditionals
4589 The principle behind entity tags is that only the service author knows
4590 the semantics of a resource well enough to select an appropriate cache
4591 validation mechanism, and the specification of any validator comparison
4592 function more complex than byte-equality would open up a can of worms.
4593 Thus, comparisons of any other headers (except Last-Modified, for
4594 compatibility with HTTP/1.0) are never used for purposes of validating a
4598 16.4 Constructing Responses From Caches
4599 The purpose of an HTTP cache is to store information received in
4600 response to requests, for use in responding to future requests. In many
4601 cases, a cache simply returns the appropriate parts of a response to the
4602 requester. However, if the cache holds a cache entry based on a previous
4603 response, it may have to combine parts of a new response with what is
4604 held in the cache entry.
4607 16.4.1 End-to-end and Hop-by-hop Headers
4608 For the purpose of defining the behavior of caches and non-caching
4609 proxies, we divide HTTP headers into two categories:
4611 . End-to-end headers, which must be transmitted to the ultimate
4612 recipient of a request or response. End-to-end headers in responses
4613 must be stored as part of a cache entry and transmitted in any
4614 response formed from a cache entry.
4615 . Hop-by-hop headers, which are meaningful only for a single
4616 transport-level connection, and are not stored by caches or
4617 forwarded by proxies.
4618 The following HTTP/1.1 headers are hop-by-hop headers:
4624 . Proxy-Authenticate
4626 All other headers defined by HTTP/1.1 are end-to-end headers.
4628 Hop-by-hop headers introduced in future versions of HTTP MUST be listed
4629 in a Connection header, as described in section 18.11.
4632 16.4.2 Non-modifiable Headers
4633 Some features of the HTTP/1.1 protocol, such as Digest Authentication,
4634 depend on the value of certain end-to-end headers. A cache or non-
4635 caching proxy SHOULD NOT modify an end-to-end header unless the
4636 definition of that header requires or specifically allows that.
4638 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 73]
4643 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4646 A cache or non-caching proxy MUST NOT modify any of the following fields
4647 in a request or response, nor may it add any of these fields if not
4657 Warning: unnecessary modification of end-to-end headers may cause
4658 authentication failures if stronger authentication mechanisms are
4659 introduced in later versions of HTTP. Such authentication
4660 mechanisms may rely on the values of header fields not listed here.
4665 16.4.3 Combining Headers
4666 When a cache makes a validating request to a server, and the server
4667 provides a 304 Not Modified response, the cache must construct a
4668 response to send to the requesting client. The cache uses the entity-
4669 body stored in the cache entry as the entity-body of this outgoing
4670 response. It uses the end-to-end headers from the incoming response, not
4671 from the cache entry. Unless it decides to remove the cache entry, it
4672 must also replace the end-to-end headers stored with the cache entry
4673 with those received in the incoming response.
4675 In other words, the complete set of end-to-end headers received in the
4676 incoming response overrides all end-to-end headers stored with the cache
4677 entry. The cache may add Warning headers (see section 18.48) to this
4680 A cache MUST preserve the order of all headers as received in an
4683 These rule allows an origin server to completely control the response
4684 seen by the client of a cache when the cache revalidates an entry, and
4685 may be necessary for preserving semantic transparency or for certain
4686 kinds of security mechanisms or future extensions.
4689 16.4.4 Combining Byte Ranges
4690 A response may transfer only a subrange of the bytes of an entity,
4691 either because the request included one or more Range specifications, or
4692 because a connection was broken prematurely. After several such
4693 transfers, a cache may have received several ranges of the same entity.
4695 If a cache has a stored non-empty set of subranges for an entity, and an
4696 incoming response transfers another subrange, the cache MAY combine the
4697 new subrange with the existing set if both the following conditions are
4701 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 74]
4706 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4709 . Both the incoming response and the cache entry must have a cache
4711 . The two cache validators must match using the strong comparison
4712 function (see section 16.3.3).
4713 If either requirement is not meant, the cache must use only the most
4714 recent partial response (based on the Date values transmitted with every
4715 response, and using the incoming response if these values are equal or
4716 missing), and must discard the other partial information.
4719 16.5 Caching and Generic Resources
4720 Generic resources interacts with caching in several ways:
4722 . A generic resource (one subject to content negotiation) may be
4723 bound to more than one entity. Each of these entities is called a
4724 "variant" of the resource.
4725 . The request-URI may be only one part of the cache key.
4727 16.5.1 Vary Header Use
4728 Origin servers may respond to requests for generic resources use the
4729 Vary header (see section 18.46 for a full description) to inform the
4730 cache which header fields of the request were used to select the variant
4731 returned in the response. A cache can use that response to reply to a
4732 subsequent request only if the two requests not only specify the same
4733 URI, but also have the same value for all headers specified in the Vary
4736 The Vary header may also inform the cache that the variant was selected
4737 using criteria not limited to the request headers; in this case, the
4738 response MUST NOT be used in a reply to a subsequent request except if
4739 the cache relays the new request to the origin server in a conditional
4740 request, and the origin server responds with 304 (Not Modified) and
4741 includes the same variant-ID (see 13.8.3).
4744 16.5.2 Alternates Header Use
4745 The Alternates header is present in the HTTP/1.1 to enable caching of
4746 entities from the planned content negotiation facilities. If a cache
4747 receives an Alternates header in a response from the origin server (and
4748 implement these planned facilities), it should act as if the response
4749 carried a "Vary:{accept-headers}" header. This means that the response
4750 may be returned in reply to a subsequent request with Accept-* headers
4751 identical to those in the current request.
4754 16.5.3 Variant-ID Use
4755 If an origin server chooses to use the variant-ID mechanism, it assigns
4756 a variant-ID (see section 7.12) to each distinct resource entity
4757 (variant). This assignment can only be made by the origin server. It
4758 then returns the appropriate variant-ID with each response that applies
4759 to a specific resource entity (variant), using the ETag header (see
4760 Error! Reference source not found.).
4764 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 75]
4769 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4772 When sending an entity derived from a particular variant in a response,
4773 an origin server SHOULD include a variant-ID identifying the variant in
4774 the ETag header (see section Error! Reference source not found.). This
4775 variant-ID can be used for cache replacement and in conditional requests
4776 on the generic resource. When a cache receives a successful response
4777 with a variant-ID, it SHOULD use this information to replace any
4778 existing cache entries for the same variant of the corresponding URI.
4779 That is, it forms a cache key using the URI of the request and the
4780 variant-ID of the response. If this key matches the key of an existing
4781 cache entry, it SHOULD replace the existing entry with the new response
4782 (subject to all of the other rules on caching). See section Error!
4783 Reference source not found. for more details on update.
4785 When a cache performs a conditional request on a generic resource, and
4786 it has one or more cache entries for the resource that include variant-
4787 IDs, the cache MUST transmit the (cache-validator, variant-ID) tuples in
4788 the conditional request, using the variant-set mechanism (see section
4789 7.13). This tells the server which variants are currently in the
4792 The client MAY choose to transmit only a subset of the (cache-
4793 validator, variant-ID) tuples corresponding to its cache entries
4796 When a server receives a conditional request that includes a variant-
4797 set, and the server is able to reply with an appropriate variant
4799 because it is the origin server, or because it is an intermediate cache
4800 that can properly implement the variant selection algorithm), once it
4801 has selected the variant it should examine the elements of the supplied
4802 variant-set. If one of these matches the variant-ID of the selected
4803 variant, and if the cache validators match, the server SHOULD reply with
4804 a 304 (Not Modified) response, including the variant-ID of the selected
4805 variant. Otherwise, the server should reply as if the request were
4808 The server may optionally use the variant-set information in its
4809 selection algorithm. For example, if the selection algorithm yields
4810 several variants with equal preference, and one of these is already in
4811 the requester's cache, the server could select that variant and avoid an
4812 extra data transfer. This is a performance optimization; otherwise, the
4813 variant-selection mechanism is orthogonal to the variant-ID mechanism.
4816 16.6 Shared and Non-Shared Caches
4817 For reasons of security and privacy, it is necessary to make a
4818 distinction between "shared" and "non-shared" caches. A non-shared cache
4819 is one that is accessible only to a single user. Accessibility in this
4820 case SHOULD be enforced by appropriate security mechanisms. All other
4821 caches are considered to be "shared." Other sections of this
4822 specification place certain constraints on the operation of shared
4823 caches in order to prevent loss of privacy or failure of access controls
4828 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 76]
4833 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4836 16.7 Selecting a Cached Response
4837 When a cache receives a request it tries to see if it has a cached
4838 response appropriate for that request, using the matching rules in this
4839 section. If such a response exists, then the cache can decide if it is
4840 fresh enough (using the expiration model in section 16.1.2 and the
4841 freshness requirements of client and origin-server expressed in the
4842 Cache-Control headers of the request and cached response) to return in
4843 reply to the request.
4844 If on a cache lookup there are two or more fresh entries that appear to
4845 match the request, then the one with the most recent Date value MUST be
4847 16.7.1 Plain Resources
4848 If the cached response was for a plain resource (that is, the response
4849 includes no Vary or Alternates headers), it matches if the Request-URI
4850 of the request matches the Request-URI of the of the request that caused
4851 the cached response to be stored. Request-URIs match if their canonical
4852 forms (see section 7.2.3) are equal.
4854 16.7.2 Generic Resources
4855 If the cached response was for a generic resource (that is, the response
4856 includes Vary, or Alternates headers), it matches if the Request-URI of
4857 the request matches the Request-URI of the request that caused the
4858 cached response to be stored, and the selecting request header field
4859 values of the request match those of the request that caused the cached
4860 response to be stored. (See section 18.46 on Vary, which defines the
4861 canonical form for selecting request headers and the matching rules for
4863 If the response contains "Vary: {other}", then the selecting request
4864 header field values for its request are defined as never matching a set
4867 16.8 Errors or Incomplete Response Cache Behavior
4868 A cache that receives an incomplete response (for example, with fewer
4869 bytes of data than specified in a Content-length: header) may store the
4870 response. However, the cache MUST treat this as a partial response.
4871 Partial responses may be combined as described in section 16.4.4; the
4872 result might be a full response or might still be partial. A cache MUST
4873 NOT return a partial response to a client without explicitly marking it
4874 as such, using the 206 (Partial Content) status code. A cache MUST NOT
4875 return a partial response using a status code of 200 (OK).
4877 A cache that receives a response with a zero-length Entity-body and no
4878 explicit indication that the correct length is zero (such as "Content-
4879 Length: 0") MUST NOT store the response. The same rule applies to a
4880 response of any length received without an explicit length indication if
4881 the transport connection was terminated in any unusual way.
4883 If a cache receives a response carrying Retry-After header (see section
4884 18.40), it may either forward this response to the requesting client, or
4885 act as if the server failed to respond. In the latter case, it MAY
4886 return a previously received response, although it MUST follow all of
4887 the rules applying to stale responses. In particular, it MUST NOT
4888 override the "must-revalidate" Cache-Control directive (see section
4891 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 77]
4896 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4899 16.8.1 Caching and Status Codes
4900 A response received with a status code of 200 or 206 may be stored by a
4901 cache and used in reply to a subsequent request, subject to the
4902 expiration mechanism, unless a Cache-control directive prohibits
4905 A response received with any other status code MUST NOT be returned in a
4906 reply to a subsequent request unless it carries at least one of the
4910 . a max-age Cache-control directive
4911 . a must-revalidate Cache-control directive
4912 . a public Cache-control directive
4914 16.8.2 Handling of Retry-After
4915 If a cache receives a response carrying a Retry-After header (see
4916 section 18.40), it may either forward this response to the requesting
4917 client, or act as if the server failed to respond. In the latter case,
4918 it MAY return a previously received response, although it MUST follow
4919 all of the rules applying to stale responses. In particular, it MUST
4920 NOT override the "must-revalidate" Cache-Control directive (see section
4924 16.9 Side Effects of GET and HEAD
4925 Unless the origin server explicitly prohibits the caching of their
4926 responses, the application of GET and HEAD methods to any resources
4927 SHOULD NOT have side effects that would lead to erroneous behavior if
4928 these responses are taken from a cache. They may still have side
4929 effects, but a cache is not required to consider such side effects in
4930 its caching decisions. Caches are always expected to observe an origin
4931 server's explicit restrictions on caching.
4933 We note one exception to this rule: since some applications have
4934 traditionally used GETs and HEADs with query URLs (those containing a
4935 "?" in the rel_path part) to perform operations with significant side
4936 effects, caches MUST NOT treat responses to such URLs as fresh unless
4937 the server provides an explicit expiration time.
4939 This specifically means that responses from HTTP/1.0 servers for such
4940 URIs should not be taken from a cache.
4942 See section 19.2 for related information.
4945 16.10 Invalidation After Updates or Deletions
4946 The effect of certain methods at the origin server may cause one or more
4947 existing cache entries to become non-transparently invalid. That is,
4948 although they may continue to be "fresh," they do not accurately reflect
4949 what the origin server would return for a new request.
4951 There is no way for the HTTP protocol to guarantee that all such cache
4952 entries are marked invalid. For example, the request that caused the
4954 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 78]
4959 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4962 change at the origin server may not have gone through the proxy where a
4963 cache entry is stored. However, several rules help reduce the
4964 likelihood of erroneous behavior.
4966 In this section, the phrase "invalidate an entity" means that the cache
4967 should either remove all instances of that entity from its storage, or
4968 should mark these as "invalid" and in need of a mandatory revalidation
4969 before they can be returned in response to a subsequent request.
4971 Some HTTP methods invalidate a single entity. This is either the entity
4972 referred to by the Request-URI, or by the Location or Content-Location
4973 response headers (if present). These methods are:
4978 In order to prevent denial of service attacks, an invalidation based on
4979 the URI in a Location or Content-Location header MUST only be performed
4980 if the host part is the same as in the Request-URI.
4983 16.11 Write-Through Mandatory
4984 All methods that may be expected to cause modifications to the origin
4985 server's resources MUST be written through to the origin server. This
4986 currently includes all methods except for GET and HEAD. A cache MUST NOT
4987 reply to such a request from a client before having transmitted the
4988 request to the inbound server, and having received a corresponding
4989 response from the inbound server.
4991 The alternative (known as "write-back" or "copy-back" caching) is not
4992 allowed in HTTP/1.1, due to the difficulty of providing consistent
4993 updates and the problems arising from server, cache, or network failure
4994 prior to write-back.
4997 16.12 Generic Resources and HTTP/1.0 Proxy Caches
4998 If the correct handling of responses from a generic resource (Section
4999 15) by HTTP/1.0 proxy caches in the response chain is important,
5000 HTTP/1.1 origin servers can include the following Expires (Section
5001 18.22) response header in all responses from the generic resource:
5003 Expires: Thu, 01 Jan 1980 00:00:00 GMT
5005 If this Expires header is included, the server should usually also
5006 include a Cache-Control header for the benefit of HTTP/1.1 caches, for example
5008 Cache-Control: max-age=604800
5010 which overrides the freshness lifetime of zero seconds specified by the
5011 included Expires header.
5016 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 79]
5021 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5024 16.13 Cache Replacement
5025 If a new cacheable response (see sections 18.10.2, 16.2.6, 16.2.8 and
5026 16.8) is received from a plain resource while any existing responses for
5027 the same resource are cached, the cache MUST NOT return any of those
5028 older responses to any future requests for the resource.
5030 Note: a new response that has an older Date header value than
5031 existing cached responses is not cacheable.
5033 If a new cacheable response is received from a generic resource with a
5034 certain variant-ID while any old responses with the same variant-ID for
5035 the same resource are cached, the cache MUST NOT return any of those old
5036 responses to any future requests for the resource.
5038 Note: In some cases, this may mean that the cache chooses to delete
5039 the old response(s) from cache storage to recover space. However,
5040 note that there will never be a new response to signal that a
5041 variant-ID is no longer in use. It is expected that the cache's
5042 update heuristics will eventually cause such old responses to be
5045 The cache SHOULD use the new response to reply to the current request.
5046 It may insert it into cache storage and may, if it meets all other
5047 requirements, use it to respond to any future requests that would
5048 previously have caused the old response to be returned. If it inserts
5049 the new response into cache storage it should follow the rules in
5053 16.14 Caching of Negative Responses
5054 Caching of negative responses has often been a significant performance
5055 advantage in distributed systems. In some future draft or specification
5056 we may have more to say about negative caching.
5060 History lists as implemented in many user agents and caches are
5061 different. In particular history lists SHOULD NOT try to show a
5062 semantically transparent view of the current state of a resource
5064 Rather, a history list is meant to show exactly what the user saw at the
5065 time when the resource was retrieved .
5067 This should not be construed to prohibit the history mechanism from
5068 telling the user that a view may be stale.
5071 17 Persistent Connections
5074 HTTP's greatest strength and its greatest weakness has been its
5075 simplicity. Prior to persistent connections, a separate TCP connection
5076 was established to fetch each URL, increasing the load on HTTP servers,
5077 and causing congestion on the Internet. The use of inline images and
5078 other associated data often requires a client to make multiple requests
5080 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 80]
5085 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5088 of the same server in a short amount of time. An excellent analysis of
5089 these performance problems is available [30]; analysis and results from
5090 a prototype implementation are in [33], [34].
5092 Persistent HTTP connections have a number of advantages:
5094 . By opening and closing fewer TCP connections, CPU time is saved,
5095 and memory used for TCP protocol control blocks is also saved
5096 . HTTP requests and responses can be pipe-lined on a connection.
5097 Pipe-lining allows a client to make multiple requests without
5098 waiting for each response, allowing a single TCP connection to be
5099 used much more efficiently, with much lower elapsed time.
5100 . Network congestion is reduced by reducing the number of packets
5101 caused by TCP opens, and by allowing TCP sufficient time to
5102 determine the congestion state of the network.
5103 . HTTP can evolve more gracefully; since errors can be reported
5104 without the penalty of closing the TCP connection. Clients using
5105 future versions of HTTP might optimistically try a new feature, but
5106 if communicating with an older server, retry with old semantics
5107 after an error is reported.
5108 HTTP implementations SHOULD implement persistent connections.
5111 17.2 Overall Operation
5112 Persistent connections provides a mechanism by which a client and a
5113 server can negotiate the use of a TCP connection for an extended
5114 conversation. This negotiation takes place using the Connection and
5115 Persist header fields. Once this option has been negotiated, the client
5116 can make multiple HTTP requests over a single transport connection.
5120 To request the use of persistent connections, a client sends a
5121 Connection header with a connection-token "Persist". If the server
5122 wishes to accept persistent connections, it will respond with the same
5123 connection-token. Both the client and server MUST send this connection-
5124 token with every request and response for the duration of the persistent
5125 connection. If either the client or the server omits the Persist token
5126 from the Connection header, that request becomes the last one for the
5129 A server MUST NOT establish a persistent connection with an HTTP/1.0
5130 client that uses the above form of the Persist header due to problems
5131 with the interactions between HTTP/1.1 clients and HTTP/1.0 proxy
5132 servers. (See section 23.5.2.5 for more information on backwards
5133 compatibility with HTTP/1.0 clients.)
5137 Clients and servers which support persistent connections MAY
5139 their requests and responses. When pipe-lining, a client will send
5140 multiple requests without waiting for the responses. The server MUST
5141 then send all of the responses in the same order that the requests were
5144 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 81]
5149 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5152 A client MAY assume that a server supports persistent connections if the
5153 same server has accepted persistent connections within the past 24
5154 hours. Clients which assume persistent connections and pipeline
5155 immediately SHOULD be prepared to retry their connection if the first
5156 pipe-lined attempt fails. If a client does such a retry, it MUST NOT
5157 pipeline without first receiving an explicit Persist token from the
5158 server. Clients MUST also be prepared to resend their requests if the
5159 server closes the connection before sending all of the corresponding
5163 17.2.3 Delimiting Entity-Bodies
5164 When using persistent connections, both the client and the server MUST
5165 mark the exact endings of transmitted entity-bodies using one of the
5166 following three techniques:
5168 1. Send a Content-length field in the header with the exact number of
5169 bytes in the entity-body.
5170 2. Send the message using chunked Transfer Coding as described in
5171 section 7.6. Chunked Transfer Coding allows the server to transmit
5172 the data to the client a piece at a time while still communicating
5173 an exact ending of the entity-body.
5174 3. Close the transport connection after the entity body.
5175 Sending the Content-length is the preferred technique. Chunked encoding
5176 SHOULD be used when the size of the entity-body is not known before
5177 beginning to transmit the entity-body. Finally, the connection MAY be
5178 closed and fall back to non-persistent connections, if neither 1 or 2
5181 Clients and servers that support persistent connections MUST correctly
5182 support receiving via all three techniques.
5186 It is especially important that proxies correctly implement the
5187 properties of the Connection header field as specified in 14.2.1.
5189 The proxy server MUST negotiate persistent connections separately with
5190 its clients and the origin servers (or other proxy servers) that it
5191 connects to. Each persistent connection applies to only one transport
5194 A proxy server MUST NOT establish a persistent connection with an
5198 17.4 Interaction with Security Protocols
5199 It is expected that persistent connections will operate with both SHTTP
5200 [31] and SSL [32]. When used in conjunction with SHTTP, the SHTTP
5201 request is prepared normally and the persist connection-token is placed
5202 in the outermost request block (the one containing the "Secure"
5204 When used in conjunction with SSL, a SSL session is started as normal
5205 and the first HTTP request made using SSL contains the persistent
5208 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 82]
5213 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5216 17.5 Practical Considerations
5217 Servers will usually have some time-out value beyond which they will no
5218 longer maintain an inactive connection. Proxy servers might make this a
5219 higher value since it is likely that the client will be making more
5220 connections through the same server. The use of persistent connections
5221 places no requirements on the length of this time-out for either the
5222 client or the server.
5224 When a client or server wishes to time-out it SHOULD issue a graceful
5225 close on the transport connection. Clients and servers SHOULD both
5226 constantly watch for the other side of the transport close, and respond
5227 to it as appropriate. If a client or server does not detect the other
5228 side's close promptly it could cause unnecessary resource drain on the
5231 A client, server, or proxy MAY close the transport connection at any
5232 time. For example, a client MAY have started to send a new request at
5233 the same time that the server has decided to close the "idle"
5234 connection. From the server's point of view, the connection is being
5235 closed while it was idle, but from the client's point of view, a request
5238 This means that clients, servers, and proxies MUST be able to recover
5239 from asynchronous close events. Client software SHOULD reopen the
5240 transport connection and retransmit the aborted request without user
5241 interaction. However, this automatic retry SHOULD NOT be repeated if the
5242 second request fails.
5244 Servers SHOULD always respond to at least one request per connection, if
5245 at all possible. Servers SHOULD NOT close a connection in the middle of
5246 transmitting a response, unless a network or client failure is
5249 It is suggested that clients which use persistent connections SHOULD
5250 limit the number of simultaneous connections that they maintain to a
5251 given server. A single-user client SHOULD maintain AT MOST 2 connections
5252 with any server of proxy. A proxy SHOULD use up to 2*N connections to
5253 another server or proxy, where N is the number of simultaneously active
5254 users. These guidelines are intended to improve HTTP response times and
5255 avoid congestion of the Internet or other networks.
5258 18 Header Field Definitions
5259 This section defines the syntax and semantics of all standard HTTP/1.1
5260 header fields. For Entity-Header fields, both sender and recipient refer
5261 to either the client or the server, depending on who sends and who
5262 receives the entity.
5266 The Accept request-header field can be used to specify certain media
5267 types which are acceptable for the response. Accept headers can be used
5268 to indicate that the request is specifically limited to a small set of
5269 desired types, as in the case of a request for an in-line image.
5271 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 83]
5276 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5279 The field MAY be folded onto several lines and more than one occurrence
5280 of the field is allowed, with the semantics being the same as if all the
5281 entries had been in one field value.
5283 Accept = "Accept" ":" #(
5289 *( ";" range-parameter ) ]
5293 media-range = ( "*/*"
5295 | ( type "/" subtype )
5296 ) *( ";" parameter )
5298 range-parameter = ( "q" "=" qvalue )
5299 | extension-range-parameter
5301 extension-range-parameter = ( token "=" token )
5303 extension-token = token
5305 The asterisk "*" character is used to group media types into ranges,
5306 with "*/*" indicating all media types and "type/*" indicating all
5307 subtypes of that type. The range-parameter q is used to indicate the
5308 media type quality factor for the range, which represents the user's
5309 preference for that range of media types. The default value is q=1. In
5310 Accept headers generated by HTTP/1.1 clients, the character separating
5311 media-ranges from range-parameters SHOULD be a ":". HTTP/1.1 servers
5312 SHOULD be tolerant of use of the ";" separator by HTTP/1.0 clients.
5316 Accept: audio/*: q=0.2, audio/basic
5318 SHOULD be interpreted as "I prefer audio/basic, but send me any audio
5319 type if it is the best available after an 80% mark-down in quality."
5321 If no Accept header is present, then it is assumed that the client
5322 accepts all media types. If Accept headers are present, and if the
5323 server cannot send a response which is acceptable according to the
5324 Accept headers, then the server SHOULD send an error response with the
5325 406 (not acceptable) status code, though the sending of an unacceptable
5326 response is also allowed.
5328 A more elaborate example is
5330 Accept: text/plain: q=0.5, text/html,
5331 text/x-dvi: q=0.8, text/x-c
5334 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 84]
5339 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5342 Verbally, this would be interpreted as "text/html and text/x-c are the
5343 preferred media types, but if they do not exist, then send the text/x-
5344 dvi entity, and if that does not exist, send the text/plain entity."
5346 Media ranges can be overridden by more specific media ranges or specific
5347 media types. If more than one media range applies to a given type, the
5348 most specific reference has precedence. For example,
5350 Accept: text/*, text/html, text/html;level=1, */*
5352 have the following precedence:
5354 1) text/html;level=1
5359 The media type quality factor associated with a given type is determined
5360 by finding the media range with the highest precedence which matches
5361 that type. For example,
5363 Accept: text/*:q=0.3, text/html:q=0.7, text/html;level=1,
5366 would cause the following values to be associated:
5368 text/html;level=1 = 1
5372 text/html;level=3 = 0.7
5374 Note: A user agent MAY be provided with a default set of quality
5375 values for certain media ranges. However, unless the user agent is
5376 a closed system which cannot interact with other rendering agents,
5377 this default set SHOULD be configurable by the user.
5383 The Accept-Charset request-header field can be used to indicate what
5384 character sets are acceptable for the response. This field allows
5385 clients capable of understanding more comprehensive or special-purpose
5386 character sets to signal that capability to a server which is capable of
5387 representing documents in those character sets. The ISO-8859-1 character
5388 set can be assumed to be acceptable to all user agents.
5390 Accept-Charset = "Accept-Charset" ":"
5392 1#( charset [ ";" "q" "=" qvalue ] )
5397 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 85]
5402 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5405 Character set values are described in section 7.4. Each charset may be
5406 given an associated quality value which represents the user's preference
5407 for that charset. The default value is q=1. An example is
5409 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
5411 If no Accept-Charset header is present, the default is that any
5412 character set is acceptable. If an Accept-Charset header is present, and
5413 if the server cannot send a response which is acceptable according to
5414 the Accept-Charset header, then the server SHOULD send an error response
5415 with the 406 (not acceptable) status code, though the sending of an
5416 unacceptable response is also allowed.
5421 18.3 Accept-Encoding
5422 The Accept-Encoding request-header field is similar to Accept, but
5423 restricts the content-coding values (18.13) which are acceptable in the
5426 Accept-Encoding = "Accept-Encoding" ":"
5429 An example of its use is
5431 Accept-Encoding: compress, gzip
5433 If no Accept-Encoding header is present in a request, the server MAY
5434 assume that the client will accept any content coding. If an Accept-
5435 Encoding header is present, and if the server cannot send a response
5436 which is acceptable according to the Accept-Encoding header, then the
5437 server SHOULD send an error response with the 406 (not acceptable)
5441 18.4 Accept-Language
5442 The Accept-Language request-header field is similar to Accept, but
5443 restricts the set of natural languages that are preferred as a response
5446 Accept-Language = "Accept-Language" ":"
5447 1#( language-range [ ";" "q" "=" qvalue ] )
5449 language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) )
5452 Each language-range MAY be given an associated quality value which
5453 represents an estimate of the user's comprehension of the languages
5454 specified by that range. The quality value defaults to "q=1" (100%
5455 comprehension).For example,
5457 Accept-Language: da, en-gb;q=0.8, en;q=0.7
5460 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 86]
5465 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5468 would mean: "I prefer Danish, but will accept British English (with 80%
5469 comprehension) and other types of English(with 70% comprehension)." A
5470 language-range matches a language-tag if it exactly equals the tag, or
5471 if it exactly equals a prefix (a sub-sequence starting at the first
5472 character) of the tag such that the first tag character following the
5473 prefix is "-". The special range "*", if present in the
5475 field, matches every tag not matched by any other ranges present in the
5476 Accept-Language field.
5478 Note: This use of a prefix matching rule does not imply that
5479 language tags are assigned to languages in such a way that it is
5480 always true that if a user understands a language with a certain
5481 tag, then this user will also understand all languages with tags
5482 for which this tag is a prefix. The prefix rule simply allows the
5483 use of prefix tags if this is the case.
5485 The language quality factor assigned to a language-tag by the Accept-
5486 Language field is the quality value of the longest language-range in the
5487 field that matches the language-range. If no language-range in the
5488 field matches the tag, the language quality factor assigned is 0. If no
5489 Accept-Language header is present in the request, the server SHOULD
5490 assume that all languages are equally acceptable. If an
5492 header is present, then all languages which are assigned a quality
5493 factor greater than 0 are acceptable. If the server cannot generate a
5494 response for an audience capable of understanding at least one
5495 acceptable language, it can send a response that uses one or more un-
5498 It may be contrary to the privacy expectations of the user to send an
5499 Accept-Language header with the complete linguistic preferences of the
5500 user in every request. For a discussion of this issue, see section
5503 Note: As intelligibility is highly dependent on the individual
5504 user, it is recommended that client applications make the choice of
5505 linguistic preference available to the user. If the choice is not
5506 made available, then the Accept-Language header field MUST NOT be
5507 given in the request.
5513 In some cases, a client may want to know if the server accepts range
5514 requests using a certain range unit. The server may indicate its
5515 acceptance of range requests for a resource entity by providing this
5516 header in a response for that resource:
5518 Accept-Ranges = "Accept-Ranges" ":" acceptable-ranges
5520 acceptable-ranges = 1#range-unit | "none"
5522 Origin servers that accept byte-range requests MAY send
5525 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 87]
5530 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5533 Accept-Ranges: bytes
5535 but are not required to do so. Clients MAY generate byte-range requests
5536 without having received this header for the plain resource involved, but
5537 the server MAY ignore such requests.
5539 Origin servers that do not accept any kind of range request for a plain
5544 to advise the client not to attempt a range request.
5548 Caches transmit age values using:
5550 Age = "Age" ":" age-value
5552 age-value = delta-seconds
5554 Age values are non-negative decimal integers, representing time in
5557 If a cache receives a value larger than the largest positive integer it
5558 can represent, or if any of its age calculations overflows, it MUST
5559 transmit an Age header with a value of 2147483648 (2^31). Otherwise,
5560 HTTP/1.1 caches MUST send an Age header in every response. Caches
5561 SHOULD use a representation with at least 31 bits of range..
5565 The Allow entity-header field lists the set of methods supported by the
5566 resource identified by the Request-URI. The purpose of this field is
5567 strictly to inform the recipient of valid methods associated with the
5568 resource. An Allow header field MUST be present in a 405 (method not
5569 allowed) response. The Allow header field is not permitted in a request
5570 using the POST method, and thus SHOULD be ignored if it is received as
5571 part of a POST entity.
5573 Allow = "Allow" ":" 1#method
5577 Allow: GET, HEAD, PUT
5579 This field cannot prevent a client from trying other methods. However,
5580 the indications given by the Allow header field value SHOULD be
5581 followed. The actual set of allowed methods is defined by the origin
5582 server at the time of each request.
5584 The Allow header field MAY be provided with a PUT request to recommend
5585 the methods to be supported by the new or modified resource. The server
5588 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 88]
5593 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5596 is not required to support these methods and SHOULD include an Allow
5597 header in the response giving the actual supported methods.
5599 A proxy MUST NOT modify the Allow header field even if it does not
5600 understand all the methods specified, since the user agent MAY have
5601 other means of communicating with the origin server.
5603 The Allow header field does not indicate what methods are implemented at
5604 the server level. Servers MAY use the Public response header field
5605 (section 18.37) to describe what methods are implemented on the server
5610 The Alternates response-header field is used by origin servers to signal
5611 that the resource identified by the current request has the capability
5612 to send different responses depending on the accept headers in the
5613 request message. This has an important effect on cache management,
5614 particularly for caching proxies which service a diverse set of user
5615 agents. This effect is covered in section 18.46.
5617 Alternates = "Alternates" ":" opaque-field
5619 opaque-field = field-value
5621 The Alternates header is included into HTTP/1.1 to make HTTP/1.1 caches
5622 compatible with a planned content negotiation mechanism. HTTP/1.1
5623 allows a future content negotiation standard to define the format of the
5624 Alternates header field-value, as long as the defined format satisfies
5625 the general rules in section 18.8.
5627 To ensure compatibility with future experimental or standardized
5628 software, caching HTTP/1.1 clients MUST treat all Alternates headers in
5629 a response as synonymous to the following Vary header:
5631 Vary: {accept-headers}
5633 and follow the caching rules associated with the presence of this Vary
5634 header, as covered in Section 18.46. HTTP/1.1 allows origin servers to
5635 send Alternates headers under experimental conditions.
5639 A user agent that wishes to authenticate itself with a server--usually,
5640 but not necessarily, after receiving a 401 response--MAY do so by
5641 including an Authorization request-header field with the request. The
5642 Authorization field value consists of credentials containing the
5643 authentication information of the user agent for the realm of the
5644 resource being requested.
5646 Authorization = "Authorization" ":" credentials
5651 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 89]
5656 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5659 HTTP access authentication is described in section 14. If a request is
5660 authenticated and a realm specified, the same credentials SHOULD be
5661 valid for all other requests within this realm.
5663 When a shared cache (see section 16.6) receives a request containing an
5664 Authorization field, it MUST NOT return the corresponding response as a
5665 reply to any other request, unless one of the following specific
5668 1. If the response includes the "proxy-revalidate" Cache-Control
5669 directive, the cache MAY use that response in replying to a
5670 subsequent request, but a proxy cache MUST first revalidate it with
5671 the origin server, using the request headers from the new request
5672 to allow the origin server to authenticate the new request.
5673 2. If the response includes the "must-revalidate" Cache-Control
5674 directive, the cache MAY use that response in replying to a
5675 subsequent request, but all caches MUST first revalidate it with
5676 the origin server, using the request headers from the new request
5677 to allow the origin server to authenticate the new request.
5678 3. If the response includes the "public" Cache-Control directive, it
5679 may be returned in reply to any subsequent request.
5682 The Cache-Control general-header field is used to specify directives
5683 that MUST be obeyed by all caching mechanisms along the
5685 chain. The directives specify behavior intended to prevent caches from
5686 adversely interfering with the request or response. . These directives
5687 typically override the default caching algorithms. Cache directives are
5688 unidirectional in that the presence of a directive in a request does not
5689 imply that the same directive should be given in the response.
5691 Cache directives must be passed through by a proxy or gateway
5692 application, regardless of their significance to that application, since
5693 the directives may be applicable to all recipients along the
5694 request/response chain. It is not possible to specify a cache-directive
5695 for a specific cache.
5697 Cache-Control = "Cache-Control" ":" 1#cache-directive
5699 cache-directive = "public"
5700 | "private" [ "=" <"> 1#field-name <"> ]
5701 | "no-cache" [ "=" <"> 1#field-name <"> ]
5705 | "proxy-revalidate"
5707 | "max-age" "=" delta-seconds
5708 | "max-stale" "=" delta-seconds
5709 | "min-fresh" "=" delta-seconds
5710 | "min-vers" "=" HTTP-Version
5712 When a directive appears without any 1#field-name parameter, the
5713 directive applies to the entire request or response. When such a
5715 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 90]
5720 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5723 directive appears with a 1#field-name parameter, it applies only to the
5724 named field or fields, and not to the rest of the request or response.
5725 This mechanism supports extensibility; implementations of future
5726 versions of the HTTP protocol may apply these directives to header
5727 fields not defined in HTTP/1.1.
5729 The cache-control directives can be broken down into these general
5732 . Restrictions on what is cachable; these may only be imposed by the
5734 . Restrictions on what may be stored by a cache; these may be imposed
5735 by either the origin server or the end-user client.
5736 . Modifications of the basic expiration mechanism; these may be
5737 imposed by either the origin server or the end-user client.
5738 . Controls over cache revalidation and reload; these may only be
5739 imposed by an end-user client.
5740 . Restrictions on the number of times a cache entry may be used, and
5741 related demographic reporting mechanisms.
5742 . Miscellaneous restrictions
5743 Caches never add or remove Cache-Control directives to requests or
5746 Check: is this true?
5749 18.10.1 Cache-Control Restrictions on What is Cachable
5750 Unless specifically constrained by a Cache-Control directive, a caching
5751 system may always store a successful response (see section 16.8) as a
5752 cache entry, may return it without validation if it is fresh, and may
5753 return it after successful validation. If there is neither a cache
5754 validator nor an explicit expiration time associated with a response, we
5755 do not expect it to be cached, but certain caches may violate this
5756 expectation (for example, when little or no network connectivity is
5757 available). A client can usually detect that such a response was taken
5758 from a cache by comparing the Date header to the current time.
5760 Note that some HTTP/1.0 caches are known to violate this
5761 expectation without providing any Warning.
5763 However, in some cases it may be inappropriate for a cache to retain a
5764 resource entity, or to return it in response to a subsequent request.
5765 This may be because absolute semantic transparency is deemed necessary
5766 by the service author, or because of security or privacy
5768 Certain Cache-Control directives are therefore provided so that the
5769 server can indicate that certain resource entities, or portions
5771 may not be cached regardless of other considerations.
5773 Note that section 18.8 normally prevents a shared cache from saving and
5774 returning a response to a previous request if that request included an
5775 Authorization header.
5777 The following Cache-Control response directives add or remove
5778 restrictions on what is cachable:
5780 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 91]
5785 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5789 Overrides the restriction in section 18.8 that prevents a shared
5790 cache from saving and returning a response to a previous request if
5791 that request included an Authorization header. However, any other
5792 constraints on caching still apply.
5794 Indicates that all or part of the response message is intended for a
5795 single user and MUST NOT be cached by a shared cache. This allows an
5796 origin server to state that the specified parts of the response are
5797 intended for only one user and are not a valid response for requests
5798 by other users. A private (non-shared) cache may ignore this
5800 Note: This usage of the word "private" only controls where the
5801 response may be cached, and cannot ensure the privacy of the
5802 message content. Note in particular that HTTP/1.0 caches will not
5803 recognize or obey this directive.
5807 indicates that all or partof the response message MUST NOT be cached
5808 anywhere. This allows an origin server to prevent caching even by
5809 caches that have been configured to return stale responses to client
5811 Note: HTTP/1.0 caches will not recognize or obey this directive.
5813 TBS: precedence relations between public, private, and no-cache.
5816 18.10.2 What May be Stored by Caches
5817 The "no-store" directive applies to the entire message, and may be sent
5818 either in a response or in a request. If sent in a request, a cache MUST
5819 NOT store any part of either this request or any response to it. If sent
5820 in a response, a cache MUST NOT store any part of either this response
5821 or the request that elicited it. This directive applies to both non-
5822 shared and shared caches.
5824 Even when this directive is associated with a response, users may
5825 explicitly store such a response outside of the caching system (e.g.,
5826 with a "Save As" dialog). History buffers may store such responses as
5827 part of their normal operation.
5829 The purpose of this directive is to meet the stated requirements of
5830 certain users and service authors who are concerned about accidental
5831 releases of information via unanticipated accesses to cache data
5832 structures. While the use of this directive may improve privacy in some
5833 cases, we caution that it is NOT in any way a reliable or sufficient
5834 mechanism for ensuring privacy. In particular, HTTP/1.0 caches will not
5835 recognize or obey this directive, malicious or compromised caches may
5836 not recognize or obey this directive, and communications networks may be
5837 vulnerable to eavesdropping.
5839 The "min-vers" directive applies to the entire message, and may be sent
5840 either in a response or in a request. If sent in a request, a cache
5842 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 92]
5847 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5850 whose HTTP version number is less than the specified version MUST NOT
5851 store any part of either this request or any response to it. If sent in
5852 a response, a cache whose HTTP version number is less than the specified
5853 version MUST NOT store any part of either this response or the request
5854 that elicited it, nor may any cache transmit a stored (non-firsthand)
5855 copy of the response to any client with a lower HTTP version number.
5856 This directive applies to both non-shared and shared caches, and is made
5857 mandatory to allow for future protocol extensions that may affect
5860 Note that the lowest version that can be sensibly included in a
5861 "min-vers" directive is HTTP/1.1, since HTTP/1.0 caches do not obey
5865 18.10.3 Modifications of the Basic Expiration Mechanism
5866 The expiration time of a resource entity may be specified by the origin
5867 server using the Expires header (see section 18.22). Alternatively, it
5868 may be specified using the "max-age" directive in a response.
5870 If a response includes both an Expires header and a max-age directive,
5871 the max-age directive overrides the Expires header, even if the Expires
5872 header is more restrictive. This rule allows an origin server to
5873 provide, for a given response, a longer expiration time to an HTTP/1.1
5874 (or later) cache than to an HTTP/1.0 cache. This may be useful if
5875 certain HTTP/1.0 caches improperly calculate ages or expiration times,
5876 perhaps due to synchronized clocks.
5878 Other directives allow an end-user client to modify the basic expiration
5879 mechanism, making it either stricter or looser. These directives may be
5880 specified on a request:
5884 Indicates that the client is willing to accept a response whose age
5885 is no greater than the specified time in seconds. Unless "max-stale"
5886 is also included, the client is not willing to accept a stale
5887 response. This directive overrides any policy of the cache.
5890 Indicates that the client is willing to accept a response whose
5891 freshness lifetime is no less than its current age plus the specified
5892 time in seconds. That is, the client wants a that response will still
5893 be fresh for at least the specified number of seconds.
5896 Indicates that the client is willing to accept a response that has
5897 exceeded its expiration time by no more than the specified number of
5898 seconds. If a cache returns a stale response in response to such a
5899 request, it MUST mark it as stale using the Warning header.
5900 Note that HTTP/1.0 caches will ignore these directives.
5902 If a cache returns a stale response, either because of a max-stale
5903 directive on a request, or because the cache is configured to override
5905 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 93]
5910 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5913 the expiration time of a response, the cache MUST attach a Warning
5914 header to the stale response, using Warning 10 (Response is stale).
5917 18.10.4 Cache Revalidation and Reload Controls
5918 Sometimes an end-user client may want or need to insist that a cache
5919 revalidate its cache entry with the origin server (and not just with the
5920 next cache along the path to the origin server), or to reload its cache
5921 entry from the origin server. End-to-end revalidation may be necessary
5922 if either the cache or the origin server has overestimated the
5923 expiration time of the cached response. End-to-end reload may be
5924 necessary if the cache entryhas become corrupted for some reason, and
5925 the fact that its validator is up-to-date is irrelevant.
5927 End-to-end revalidation may be requested either when the client does not
5928 have its own local cached copy, in which case we call it "unspecified
5929 end-to-end revalidation", or when the client does have a local cached
5930 copy, in which case we call it "specific end-to-end revalidation."
5932 The client can specify these three kinds of action using Cache-Control
5937 The request includes "Cache-Control: no-cache" or, for compatibility
5938 with HTTP/1.0 clients, "Pragma: no-cache". No field names may be
5939 included with the "no-cache" directive in a request. The server MUST
5940 NOT use a cached copy when responding to such a request.
5942 Specific end-to-end revalidation
5943 The request includes "Cache-Control: max-age=0", which forces each
5944 cache along the path to the origin server to revalidate its own
5945 entry, if any, with the next cache or server. The initial request
5946 includes a cache-validating conditional with the client's current
5949 Unspecified end-to-end revalidation
5950 The request includes "Cache-Control: max-age=0", which forces each
5951 cache along the path to the origin server to revalidate its own
5952 entry, if any, with the next cache or server. The initial request
5953 does not include a cache-validating conditional; the first cache
5954 along the path (if any) that holds a cache entry for this resource
5955 includes a cache-validating conditional with its current validator.
5956 Note that HTTP/1.0 caches will ignore these directives, except
5957 perhaps for "Pragma: no-cache".
5959 When an intermediate cache is forced, by means of a "max-age=0"
5960 directive, to revalidate its own cache entry, and the client has
5961 supplied its own validator in the request, the supplied validator may
5962 differ from the validator currently stored with the cache entry. In this
5963 case, the cache may use either validator in making its own request
5964 without affecting semantic transparency.
5968 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 94]
5973 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5976 However, the choice of validator may affect performance. The best
5977 approach is for the intermediate cache to use its own validator when
5978 making its request. If the server replies with 304 (Not Modified), then
5979 the cache should return its now validated copy to the client with a 200
5980 (OK) response. If the server replies with a new Entity-body and cache
5981 validator, however, the intermediate cache should compare the returned
5982 validator with the one provided in the client's request, using the
5983 strong comparison function. If the client's validator is equal to the
5984 origin server's, then the intermediate cache simply returns 304 (Not
5985 Modified). Otherwise, it returns the new Entity-body with a 200 (OK)
5988 If a request includes the "no-cache" directive, it should not include
5989 "min-fresh", "max-stale", or "max-age".
5991 In some cases, such as times of extremely poor network connectivity, a
5992 client may want a cache to return only those responses that it currently
5993 has stored, and not to reload or revalidate with the origin server. To
5994 do this, the client may include the "only-if-cached" directive in a
5995 request. If it receives this directive, a cache SHOULD either respond
5996 using a cached entry that is consistent with the other constraints of
5997 the request, or respond with a 504 (Gateway Timeout) status. However, if
5998 a group of caches is being operated as a unified system with good
5999 internal connectivity, such a request MAY be forwarded within that group
6002 Because a cache may be configured to ignore a server's specified
6003 expiration time, and because a client request may include a max-stale
6004 directive, which has a similar effect, the protocol also includes a
6005 mechanism for the origin server to require revalidation of a cache entry
6006 on any subsequent use. When the "must-revalidate" directive is present
6007 in a response received by a cache, that cache MUST NOT use the entry
6008 after it becomes stale to respond to a subsequent request without first
6009 revalidating it with the origin server. (I.e., the cache must do an
6011 to-end revalidation every time, if, based solely on the origin server's
6012 Expires or max-age value, the cached response is stale.)
6014 The "must-revalidate" directive is necessary to support reliable
6015 operation for certain protocol features. In all circumstances an
6016 HTTP/1.1 cache MUST obey the "must-revalidate" directive; in
6018 if the cache cannot reach the origin server for any reason, it MUST
6019 generate a 504 (Gateway Timeout) response. Note that HTTP/1.0 caches
6020 will ignore this directive.
6022 Servers should send the "must-revalidate" directive if and only if
6023 failure to revalidate a request on the entity could result in incorrect
6024 operation, such as a silently unexecuted financial transaction.
6025 Recipients MUST NOT take any automated action that violates this
6026 directive, and MUST NOT automatically provide an unvalidated copy of the
6027 entity if revalidation fails.
6029 Although this is not recommended, user agents operating under severe
6030 connectivity constraints may violate this directive but, if so, MUST
6031 explicitly warn the user that an unvalidated response has been
6034 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 95]
6039 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6042 The warning MUST be provided on each unvalidated access, and SHOULD
6043 require explicit user confirmation.
6045 The "proxy-revalidate" directive has the same meaning as the "must-
6046 revalidate" directive, except that it does not apply to user-agent
6050 18.10.5 Miscellaneous Restrictions
6051 In certain circumstances, an intermediate cache (proxy) may find it
6052 useful to convert the encoding of an entity body. For example, a proxy
6053 might use a compressed content-coding to transfer the body to a client
6056 Because end-to-end authentication of entity bodies and/or entity headers
6057 relies on the specific encoding of these values, such transformations
6058 may cause authentication failures. Therefore, an intermediate cache MUST
6059 NOT change the encoding of an entity body if the response includes the
6060 "no-transform" directive.
6062 Note: the use of hop-by-hop compression in conjunction with Range
6063 retrievals may require additional specification in a subsequent
6068 HTTP version 1.1 provides a new request and response header field called
6069 "Connection". This header field allows the client and server to specify
6070 options which should only exist over that particular connection and MUST
6071 NOT be communicated by proxies over further connections. The connection
6072 header field MAY have multiple tokens separated by commas (referred to
6073 as connection-tokens).
6075 HTTP version 1.1 proxies MUST parse the Connection header field and for
6076 every connection-token in this field, remove a corresponding header
6077 field from the request before the request is forwarded. The use of a
6078 connection option is specified by the presence of a connection token in
6079 the Connection header field, not by the corresponding additional header
6080 field (which may not be present).
6082 When a client wishes to establish a persistent connection it MUST send a
6083 "Persist" connection-token:
6087 The Connection header has the following grammar:
6089 Connection-header = "Connection" ":" 1#(connection-token)
6090 connection-token = token
6097 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 96]
6102 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6106 The Content-Base entity-header field may be used to specify the base URI
6107 for resolving relative URLs within the entity. This header field is
6108 described as "Base" in RFC 1808 , which is expected to be revised soon.
6110 Content-Base = "Content-Base" ":" absoluteURI
6112 If no Content-Base field is present, the base URI of an entity is
6113 defined either by its Content-Location or the URI used to initiate the
6114 request, in that order of precedence. Note, however, that the base URI
6115 of the contents within the entity body may be redefined within that
6119 18.13 Content-Encoding
6120 The Content-Encoding entity-header field is used as a modifier to the
6121 media-type. When present, its value indicates what additional content
6122 codings have been applied to the resource entity, and thus what decoding
6123 mechanisms MUST be applied in order to obtain the media-type referenced
6124 by the Content-Type header field. Content-Encoding is primarily used to
6125 allow a document to be compressed without losing the identity of its
6126 underlying media type.
6128 Content-Encoding = "Content-Encoding" ":"
6131 Content codings are defined in section 7.5. An example of its use is
6133 Content-Encoding: gzip
6135 The Content-Encoding is a characteristic of the resource entity
6136 identified by the Request-URI. Typically, the resource entity is stored
6137 with this encoding and is only decoded before rendering or analogous
6140 If multiple encodings have been applied to a resource entity, the
6141 content codings MUST be listed in the order in which they were applied.
6142 Additional information about the encoding parameters MAY be provided by
6143 other Entity-Header fields not defined by this specification.
6146 18.14 Content-Language
6147 The Content-Language entity-header field describes the natural
6148 language(s) of the intended audience for the enclosed entity. Note that
6149 this may not be equivalent to all the languages used within the entity.
6151 Content-Language = "Content-Language" ":" 1#language-tag
6153 Language tags are defined in section 7.10. The primary purpose of
6154 Content-Language is to allow a selective consumer to identify and
6155 differentiate resource variants according to the consumer's own
6156 preferred language. Thus, if the body content is intended only for a
6157 Danish-literate audience, the appropriate field is
6159 Content-Language: dk
6161 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 97]
6166 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6169 If no Content-Language is specified, the default is that the content is
6170 intended for all language audiences. This may mean that the sender does
6171 not consider it to be specific to any natural language, or that the
6172 sender does not know for which language it is intended.
6174 Multiple languages MAY be listed for content that is intended for
6175 multiple audiences. For example, a rendition of the "Treaty of
6176 Waitangi," presented simultaneously in the original Maori and English
6177 versions, would call for
6179 Content-Language: mi, en
6181 However, just because multiple languages are present within an entity
6182 does not mean that it is intended for multiple linguistic audiences. An
6183 example would be a beginner's language primer, such as "A First Lesson
6184 in Latin," which is clearly intended to be used by an English-literate
6185 audience. In this case, the Content-Language should only include "en".
6187 Content-Language MAY be applied to any media type -- it SHOULD not be
6188 limited to textual documents.
6191 18.15 Content-Length
6192 The Content-Length entity-header field indicates the size of the
6194 Body, in decimal number of octets, sent to the recipient or, in the case
6195 of the HEAD method, the size of the Entity-Body that would have been
6196 sent had the request been a GET.
6198 Content-Length = "Content-Length" ":" 1*DIGIT
6202 Content-Length: 3495
6204 Applications SHOULD use this field to indicate the size of the Entity-
6205 Body to be transferred, regardless of the media type of the entity. It
6206 must be possible for the recipient to reliably determine the end of a
6207 HTTP/1.1 request method containing an entity body, e.g., because the
6208 request has a valid Content-Length field, uses Transfer-Encoding:
6209 chunked or a multipart body.
6211 Any Content-Length greater than or equal to zero is a valid value.
6212 Section 11.2.2 describes how to determine the length of an Entity-Body
6213 if a Content-Length is not given.
6215 Note: The meaning of this field is significantly different from the
6216 corresponding definition in MIME, where it is an optional field
6217 used within the "message/external-body" content-type. In HTTP, it
6218 SHOULD be used whenever the entity's length can be determined prior
6219 to being transferred.
6225 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 98]
6230 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6233 18.16 Content-Location
6234 The Content-Location entity-header field is used to define the location
6235 of the plain resource associated with the entity enclosed in the
6236 message. A server SHOULD provide a Content-Location if, when including
6237 an entity in response to a GET request on a generic resource, the entity
6238 corresponds to a specific, non-negotiated location which can be accessed
6239 via the Content-Location URI. A server SHOULD provide a
6241 with any 200 (OK) response which was internally (not visible to the
6242 client) redirected to a resource other than the one identified by the
6243 request and for which correct interpretation of that resource MAY
6244 require knowledge of its actual location.
6246 Content-Location = "Content-Location" ":" absoluteURI
6248 If no Content-Base header field is present, the value of Content-
6249 Location also defines the base URL for the entity (see Section 18.12).
6251 Note that the Content-Location information is advisory, and that
6252 there is no guarantee that the URI of the Content-Location actually
6253 corresponds in any way to the original request URI. For example, a
6254 cache cannot reliably assume that the data returned as a result of
6255 the request can be returned from a new request on any URI other
6256 than the original request. See section 19.9.
6260 The Content-MD5 entity-header field is an MD5 digest of the
6262 as defined in RFC 1864 [], for the purpose of providing an end-to-end
6263 message integrity check (MIC) of the entity-body. (Note: an MIC is good
6264 for detecting accidental modification of the entity-body in transit, but
6265 is not proof against malicious attacks.)
6267 ContentMD5 = "Content-MD5" ":" md5-digest
6269 md5-digest = <base64 of 128 bit MD5 digest as per RFC
6272 The Content-MD5 header may be generated by an origin server to function
6273 as an integrity check of the entity-body. Only origin-servers may
6274 generate the Content-MD5 header field; proxies and gateways MUST NOT
6275 generate it, as this would defeat its value as an end-to-end integrity
6276 check. Any recipient of the entity-body, including gateways and
6278 MAY check that the digest value in this header field matches that of the
6279 entity-body as received.
6281 The MD5 digest is computed based on the content of the entity body,
6282 including any Content-Encoding that has been applied, but not including
6283 any Transfer-Encoding. If the entity is received with a Transfer-
6284 Encoding, that encoding must be removed prior to checking the Content-
6285 MD5 value against the received entity.
6287 This has the result that the digest is computed on the octets of the
6288 entity body exactly as, and in the order that, they would be sent if no
6289 Transfer-Encoding were being applied.
6292 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 99]
6297 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6300 HTTP extends RFC 1864 to permit the digest to be computed for MIME
6301 composite media-types (e.g., multipart/* and message/rfc822), but this
6302 does not change how the digest is computed as defined in the preceding
6305 Note: There are several consequences of this. The entity-body for
6306 composite types may contain many body-parts, each with its own MIME
6307 and HTTP headers (including Content-MD5, Content-Transfer-Encoding,
6308 and Content-Encoding headers). If a body-part has a Content-
6309 Transfer-Encoding or Content-Encoding header, it is assumed that
6310 the content of the body-part has had the encoding applied, and the
6311 body-part is included in the Content-MD5 digest as is -- i.e.,
6312 after the application. Also, the HTTP Transfer-Encoding header
6313 makes no sense within body-parts; if it is present, it is ignored -
6314 - i.e. treated as ordinary text.
6316 Note: while the definition of Content-MD5 is exactly the same for
6317 HTTP as in RFC 1864 for MIME entity-bodies, there are several ways
6318 in which the application of Content-MD5 to HTTP entity-bodies
6319 differs from its application to MIME entity-bodies. One is that
6320 HTTP, unlike MIME, does not use Content-Transfer-Encoding, and does
6321 use Transfer-Encoding and Content-Encoding. Another is that HTTP
6322 more frequently uses binary content types than MIME, so it is worth
6323 noting that in such cases, the byte order used to compute the
6324 digest is the transmission byte order defined for the type. Lastly,
6325 HTTP allows transmission of text types with any of several line
6326 break conventions and not just the canonical form using CRLF.
6327 Conversion of all line breaks to CRLF should not be done before
6328 computing or checking the digest: the line break convention used in
6329 the text actually transmitted should be left unaltered when
6330 computing the digest.
6336 The Content-Range header is sent with a partial entity body to specify
6337 where in the full entity body the partial body should be inserted. It
6338 also indicates the total size of the entity.
6340 Content-Range = "Content-Range" ":" content-range-spec
6342 When an HTTP message includes the content of a single range (for
6343 example, a response to a request for a single range, or to request for a
6344 set of ranges that overlap without any holes), this content is
6345 transmitted with a Content-Range header, and a Content-Length header
6346 showing the number of bytes actually transferred. For example,
6348 HTTP/1.0 206 Partial content
6349 Date: Wed, 15 Nov 1995 06:25:24 GMT
6350 Last-modified: Wed, 15 Nov 1995 04:58:08 GMT
6351 Content-Range: 21010-47021/47022
6352 Content-Length: 26012
6353 Content-Type: image/gif
6355 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 100]
6360 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6363 18.18.1 MIME multipart/byteranges Content-type
6364 When an HTTP message includes the content of multiple ranges (for
6366 example, a response to a request for multiple non-overlapping ranges),
6367 these are transmitted as a multipart MIME message. The multipart MIME
6368 content-type used for this purpose is defined in this specification to
6369 be "multipart/byteranges".
6371 The MIME multipart/byteranges content-type includes two or more parts,
6372 each with its own Content-Type and Content-Range fields. The parts are
6373 separated using a MIME boundary parameter.
6377 HTTP/1.0 206 Partial content
6378 Date: Wed, 15 Nov 1995 06:25:24 GMT
6379 Last-modified: Wed, 15 Nov 1995 04:58:08 GMT
6380 Content-type: multipart/byteranges;
6381 boundary=THIS_STRING_SEPARATES
6383 --THIS_STRING_SEPARATES
6384 Content-type: application/pdf
6385 Content-range: bytes 500-999/8000
6387 ...the first range...
6388 --THIS_STRING_SEPARATES
6389 Content-type: application/pdf
6390 Content-range: bytes 7000-7999/8000
6393 --THIS_STRING_SEPARATES_
6396 18.18.2 Additional Rules for Content-Range
6397 A client that cannot decode a MIME multipart/byteranges message should
6398 not ask for multiple byte-ranges in a single request.
6400 When a client requests multiple byte-ranges in one request, the server
6401 SHOULD return them in the order that they appeared in the request.
6403 If the server ignores a byte-range-spec because it is invalid, the
6404 server should treat the request as if the invalid Range header field did
6405 not exist (normally, this means return a 200 response containing the
6406 full resource entity). The reason is that the only time a client will
6407 make such an invalid request is when the resource entity has changed
6408 (shrunk) since the prior request.
6412 The Content-Type entity-header field indicates the media type of the
6413 Entity-Body sent to the recipient or, in the case of the HEAD method,
6414 the media type that would have been sent had the request been a GET.
6416 Content-Type = "Content-Type" ":" media-type
6419 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 101]
6424 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6427 Media types are defined in section 7.7. An example of the field is
6429 Content-Type: text/html; charset=ISO-8859-4
6431 Further discussion of methods for identifying the media type of an
6432 entity is provided in section 11.2.1.
6436 The Date general-header field represents the date and time at which the
6437 message was originated, having the same semantics as orig-date in RFC
6438 822. The field value is an HTTP-date, as described in section 7.3.1.
6440 Date = "Date" ":" HTTP-date
6444 Date: Tue, 15 Nov 1994 08:12:31 GMT
6446 If a message is received via direct connection with the user agent (in
6447 the case of requests) or the origin server (in the case of responses),
6448 then the date can be assumed to be the current date at the receiving
6449 end. However, since the date--as it is believed by the origin--is
6450 important for evaluating cached responses, origin servers SHOULD always
6451 include a Date header. Clients SHOULD only send a Date header field in
6452 messages that include an entity body, as in the case of the PUT and POST
6453 requests, and even then it is optional. A received message which does
6454 not have a Date header field SHOULD be assigned one by the recipient if
6455 the message will be cached by that recipient or gatewayed via a protocol
6456 which requires a Date.
6458 In theory, the date SHOULD represent the moment just before the entity
6459 is generated. In practice, the date can be generated at any time during
6460 the message origination without affecting its semantic value.
6462 Note: An earlier version of this document incorrectly specified
6463 that this field SHOULD contain the creation date of the enclosed
6464 Entity-Body. This has been changed to reflect actual (and proper)
6467 Origin servers MUST send a Date field in every response. However, if a
6468 cache receives a response without a Date field, it SHOULD attach one
6469 with the cache's best estimate of the time at which the response was
6470 originally generated.
6472 The format of the Date is an absolute date and time as defined by HTTP-
6473 date in Section 7.3; it MUST be in RFC1123-date format.
6479 The ETag header is used to transmit entity tags with variant id's in
6482 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 102]
6487 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6490 ETag = "ETag" ":" etag-info
6491 etag-info = entity-tag [ ";" variant-id ]
6501 Note that the variant-id is not part of the entity tag. The ETag
6502 field is used to transmit a variant-id simply as a matter of
6503 compact representation of responses.
6507 The Expires entity-header field gives the date/time after which the
6508 entity should be considered stale. A stale cache entry may not normally
6509 be returned by a cache (either a proxy cache or an end-user cache)
6510 unless it is first validated with the origin server (or with an
6511 intermediate cache that has a fresh copy of the resource entity). See
6512 section 16.1.2 for further discussion of the expiration model.
6514 The presence of an Expires field does not imply that the original
6515 resource will change or cease to exist at, before, or after that time.
6517 The format is an absolute date and time as defined by HTTP-date in
6518 section 7.3; it MUST be in rfc1123-date format:
6520 Expires = "Expires" ":" HTTP-date
6522 An example of its use is
6524 Expires: Thu, 01 Dec 1994 16:00:00 GMT
6526 Note: if a response includes a Cache-Control field with the max-age
6527 directive, that directive overrides the Expires field.
6529 HTTP/1.1 clients and caches MUST treat other invalid date formats,
6530 especially including the value "0", as in the past (i.e., "already
6533 To mark a response as "already expired," an origin server should use an
6534 Expires date that is equal to the Date header value. (See the rules for
6535 expiration calculations in section 0.)
6537 To mark a response as "never expires," an origin server should use an
6538 Expires date approximately one year from the time the response is
6539 generated. HTTP/1.1 servers should not send Expires dates more than one
6545 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 103]
6550 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6554 The From request-header field, if given, SHOULD contain an Internet e-
6555 mail address for the human user who controls the requesting user agent.
6556 The address SHOULD be machine-usable, as defined by mailbox in RFC 822
6557 (as updated by RFC 1123 ):
6559 From = "From" ":" mailbox
6563 From: webmaster@w3.org
6565 This header field MAY be used for logging purposes and as a means for
6566 identifying the source of invalid or unwanted requests. It SHOULD NOT be
6567 used as an insecure form of access protection. The interpretation of
6568 this field is that the request is being performed on behalf of the
6569 person given, who accepts responsibility for the method performed. In
6570 particular, robot agents SHOULD include this header so that the person
6571 responsible for running the robot can be contacted if problems occur on
6574 The Internet e-mail address in this field MAY be separate from the
6575 Internet host which issued the request. For example, when a request is
6576 passed through a proxy the original issuer's address SHOULD be used.
6578 Note: The client SHOULD not send the From header field without the
6579 user's approval, as it may conflict with the user's privacy
6580 interests or their site's security policy. It is strongly
6581 recommended that the user be able to disable, enable, and modify
6582 the value of this field at any time prior to a request.
6586 The Host request-header field specifies the Internet host and port
6587 number of the resource being requested, as obtained from the original
6588 URL given by the user or referring resource (generally an HTTP URL, as
6589 described in section 7.2.2). The Host field value MUST represent the
6590 network location of the origin server or gateway given by the original
6591 URL. This allows the origin server or gateway to differentiate between
6592 internally-ambiguous URLs, such as the root "/" URL of a server for
6593 multiple host names on a single IP address.
6595 Host = "Host" ":" host [ ":" port ] ; Section 7.2.2
6597 A "host" without any trailing port information implies the default port
6598 for the service requested (e.g., "80" for an HTTP URL). For example, a
6599 request on the origin server for <http://www.w3.org/pub/WWW/> MUST
6602 GET /pub/WWW/ HTTP/1.1
6605 The Host header field MUST be included in all HTTP/1.1 request messages
6606 on the Internet (i.e., on any message corresponding to a request for a
6608 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 104]
6613 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6616 URL which includes an Internet host address for the service being
6617 requested). If the Host field is not already present, an HTTP/1.1 proxy
6618 MUST add a Host field to the request message prior to forwarding it on
6619 the Internet. All Internet-based HTTP/1.1 servers MUST respond with a
6620 400 status code to any HTTP/1.1 request message which lacks a Host
6624 18.25 If-Modified-Since
6625 The If-Modified-Since request-header field is used with the GET method
6626 to make it conditional: if the requested resource entity has not been
6627 modified since the time specified in this field, a copy of the resource
6628 entity will not be returned from the server; instead, a 304 (not
6629 modified) response will be returned without any Entity-Body.
6631 If-Modified-Since = "If-Modified-Since" ":" HTTP-date
6633 An example of the field is:
6635 If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
6637 A GET method with an If-Modified-Since header and no Range header
6638 requests that the identified resource entity be transferred only if it
6639 has been modified since the date given by the If-Modified-Since header.
6640 The algorithm for determining this includes the following cases:
6643 a)If the request would normally result in anything other than a 200
6644 (OK) status, or if the passed If-Modified-Since date is invalid, the
6645 response is exactly the same as for a normal GET. A date which is
6646 later than the server's current time is invalid.
6648 b)If the resource entity has been modified since the If-Modified-Since
6649 date, the response is exactly the same as for a normal GET.
6651 c)If the resource entity has not been modified since a valid If-
6652 Modified-Since date, the server MUST return a 304 (not modified)
6654 The purpose of this feature is to allow efficient updates of cached
6655 information with a minimum amount of transaction overhead.
6657 Note that the Range request-header field modifies the meaning of
6658 If-Modified-Since; see section 18.38 for full details.
6660 Note that If-Modified-Since is ignored for generic resources.
6662 Note that If-Modified-Since times are interpreted by the server,
6663 whose clock may not be synchronized with the client.
6665 Note that if a client uses an arbitrary date in the If-Modified-
6666 Since header instead of a date taken from the Last-Modified header
6667 for the same request, the client should be aware of the fact that
6668 this date is interpreted in the server's understanding of time.
6669 The client should consider unsynchronized clocks and rounding
6671 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 105]
6676 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6679 problems due to the different representations of time between the
6680 client and server. This includes the possibility of race
6681 conditions if the document has changed between the time it was
6682 first requested and the If-Modified-Since date of a subsequent
6683 request, and the possibility of clock-skew-related problems if the
6684 If-Modified-Date date is derived from the client's clock without
6685 correction to the server's clock. Corrections for different time
6686 bases between client and server are at best approximate due to
6693 The If-Match request-header field is used with a method to make it
6694 conditional. A client that has a cache entry for the relevant entity
6695 supplies the associated entity tag using the If-Match header; if this
6696 entity tag matches the server's current entity tag for the entity, the
6697 server SHOULD perform the requested operation as if the If-Match header
6700 If the entity tags do not match, the server MUST NOT perform the
6701 requested operation, and MUST return a 412 (Precondition failed)
6702 response with no Entity-Body. This behavior is most useful when the
6703 client wants to prevent an updating method, such as PUT or POST, from
6704 modifying a resource entity that has changed since the client last
6707 When the If-Match header is used, the server should use the strong
6708 comparison function (see section 18.26) to compare entity tags.
6710 If the If-Match header is used to make a conditional request on generic
6711 resource, it may be used to pass a set of validators. This is done
6712 using the variant-set mechanism if the client has variant IDs for the
6713 corresponding cache entries (see sections 16.5.3 and 7.13 ). The server
6714 selects the appropriate variant based on other request headers; if the
6715 variant-ID for that resource entity is listed in the If-Match header,
6716 and if the entity-tag associated with that variant-ID in the header
6717 matches the current entity-tag of the resource entity, then the
6718 requested operation SHOULD be performed. Otherwise, it MUST NOT be
6721 If-Match = "If-Match" ":" if-match-rhs
6722 if-match-rhs = opaque-validator | variant-set
6724 An updating request (e.g., a PUT or POST) on a generic resource should
6725 include only one variant-set-item, the one associated with the
6726 particular variant whose value is being conditionally updated.
6728 Examples of plain resource form:
6734 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 106]
6739 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6742 Examples of generic resource form:
6744 If-Match: "xyzzy";"4"
6745 If-Match: "xyzzy";"3", "r2d2xxxx";"5", "c3piozzzz";"7"
6746 If-Match: "xyzzy"/W; "3", "r2d2xxxx"/W; "5", "c3piozzzz"/W; "7"
6748 If the request would, without the If-Match header, result in anything
6749 other than a 2xx status, then the If-Match header is ignored.
6751 The purpose of this feature is to allow efficient updates of cached
6752 information with a minimum amount of transaction overhead. It is also
6753 used, on updating requests, to prevent inadvertent modification of the
6754 wrong variant of a resource.
6758 The If-NoneMatch request-header field is used with a method to make it
6759 conditional. A client that has a cache entry for the relevant entity
6760 supplies the associated entity tag using the If-NoneMatch header; if
6761 this entity tag matches the server's current entity tag for the entity,
6762 the server SHOULD return a 304 (Not Modified) response without any
6765 If the entity tags do not match, the server should treat the request as
6766 if the If-NoneMatch header was not present.
6768 See section 18.26 for rules on how to determine if two entity tags
6771 If the If-NoneMatch header is used to make a conditional request on
6772 generic resource, it may be used to pass a set of validators. This is
6773 done using the variant-set mechanism if the client has variant IDs for
6774 the corresponding cache entries (see sections 16.5.3 and 7.13). The
6775 server selects the appropriate variant based on other request headers;
6776 if the variant-ID for that resource entity is listed in the
6778 header, and if the entity-tag associated with that variant-ID in the
6779 header matches the current entity-tag of the resource entity, then the
6780 requested operation SHOULD NOT be performed. Otherwise, it SHOULD be
6783 If-NoneMatch = "If-NoneMatch" ":" if-nonematch-rhs
6784 if-nonematch-rhs = opaque-validator | variant-set
6786 Examples of plain resource form:
6788 If-NoneMatch: "xyzzy"
6789 If-NoneMatch: "xyzzy"/W
6791 Examples of generic resource form:
6793 If-NoneMatch: "xyzzy";"4"
6794 If-NoneMatch: "xyzzy";"3", "r2d2xxxx";"5", "c3piozzzz";"7"
6795 If-NoneMatch: "xyzzy"/W; "3", "r2d2xxxx"/W; "5", "c3piozzzz"/W;7
6798 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 107]
6803 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6806 If the request would, without the If-NoneMatch header, result in
6807 anything other than a 2xx status, then the If-NoneMatch header is
6810 The purpose of this feature is to allow efficient updates of cached
6811 information with a minimum amount of transaction overhead.
6815 If a client has a partial copy of an entity in its cache, and wishes to
6816 have an up-to-date copy of the entire entity in its cache, it could use
6817 the Range request header with a conditional GET (using either or both of
6818 If-Unmodified-Since and If-Match.) However, if the condition fails
6819 because the entity has been modified, the client would then have to make
6820 a second request to obtain the entire current entity body.
6822 The If-Range header allows a client to "short-circuit" the second
6823 request. Informally, its meaning is "if the entity is unchanged, send
6824 me the part(s) that I am missing; otherwise, send me the entire new
6827 Range-If = "Range-If" ":" (if-valid-rhs | HTTP-date)
6829 If the client has no entity tag for a plain resource, but does have a
6830 Last-Modified date, it may use that date in a If-Range header. (The
6831 server can detect this because an HTTP-date, unlike any form of if-
6832 valid-rhs, does not start with a `"' quotation mark.) Dates may only be
6833 used in If-Range for plain resources, not for generic resources. The
6834 If-Range header should only be used together with a Range header, and
6835 must be ignored if the request does not include a Range header, or if
6836 the server does not support the sub-range operation.
6838 If the entity tag given in the If-Range header matches the current
6839 entity tag for the entity, then the server should provide the specified
6840 sub-range of the entity using a 206 (Partial content) response. If the
6841 entity tag does not match, then the server should return the entire
6842 entity using a 200 (OK) response.
6845 18.29 If-Unmodified-Since
6846 The If-Unmodified-Since request-header field is used with a method to
6847 make it conditional. If the requested resource entity has not been
6848 modified since the time specified in this field, the server should
6849 perform the requested operation as if the If-Unmodified-Since header
6852 If the requested resource entity has been modified since the specified
6853 time, the server MUST NOT perform the requested operation, and MUST
6854 return a 412 (Precondition Failed) response with no Entity-Body.
6856 If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
6858 An example of the field is:
6861 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 108]
6866 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6869 If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
6871 If the request normally (i.e., without the If-Unmodified-Since header)
6872 would result in anything other than a 2xx status, the If-Unmodified-
6873 Since header should be ignored.
6875 If the specified date is invalid, the header is ignored.
6879 The Last-Modified entity-header field indicates the date and time at
6880 which the sender believes the resource entity was last modified. The
6881 exact semantics of this field are defined in terms of how the recipient
6882 SHOULD interpret it: if the recipient has a copy of this resource entity
6883 which is older than the date given by the Last-Modified field, that copy
6884 SHOULD be considered stale.
6886 Last-Modified = "Last-Modified" ":" HTTP-date
6888 An example of its use is
6890 Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
6892 The exact meaning of this header field depends on the implementation of
6893 the sender and the nature of the original resource. For files, it may be
6894 just the file system last-modified time. For entities with dynamically
6895 included parts, it may be the most recent of the set of last-modify
6896 times for its component parts. For database gateways, it may be the
6897 last-update time stamp of the record. For virtual objects, it may be the
6898 last time the internal state changed.
6900 An origin server MUST NOT send a Last-Modified date which is later than
6901 the server's time of message origination. In such cases, where the
6902 resource's last modification would indicate some time in the future, the
6903 server MUST replace that date with the message origination date.
6905 An origin server should obtain the Last-Modified value of the entity as
6906 close as possible to the time that it generates the Date value of its
6907 response. This allows a recipient to make an accurate assessment of the
6908 entity's modification time, especially if the entity changes near the
6909 time that the response is generated.
6913 The Location response-header field is used to redirect the recipient to
6914 a location other than the Request-URI for completion of the request or
6915 identification of a new resource. For 201 (created) responses, the
6916 Location is that of the new resource which was created by the request.
6917 For 3xx responses, the location SHOULD indicate the server's preferred
6918 URL for automatic redirection to the resource. The field value consists
6919 of a single absolute URL.
6921 Location = "Location" ":" absoluteURI
6924 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 109]
6929 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6934 Location: http://www.w3.org/pub/WWW/People.html
6936 Note: The Content-Location header field (section 18.16) differs
6937 from Location in that the Content-Location identifies the original
6938 location of the entity enclosed in the request. It is therefore
6939 possible for a response to contain header fields for both Location
6940 and Content-Location.
6944 [JG14]The Max-Forwards general-header field may be used with the TRACE
6945 method (section 18.32) to limit the number of times that a proxy or
6946 gateway can forward the request to the next inbound server. This can be
6947 useful when the client is attempting to trace a request chain which
6948 appears to be failing or looping in mid-chain.
6950 Max-Forwards = "Max-Forwards" ":" 1*DIGIT
6952 The Max-Forwards value is a decimal integer indicating the remaining
6953 number of times this request message may be forwarded.
6955 Each proxy or gateway recipient of a TRACE request containing a Max-
6956 Forwards header field SHOULD check and update its value prior to
6957 forwarding the request. If the received value is zero (0), the
6958 recipient SHOULD NOT forward the request; instead, it SHOULD respond as
6959 the final recipient with a 200 (OK) response containing the received
6960 request message as the response entity body (as described in Section
6961 13.7). If the received Max-Forwards value is greater than zero, then
6962 the forwarded message SHOULD contain an updated Max-Forwards field with
6963 a value decremented by one (1).
6965 The Max-Forwards header field SHOULD be ignored for all other methods
6966 defined by this specification and for any extension methods for which it
6967 is not explicitly referred to as part of that method definition.
6971 When the Persist connection-token has been transmitted with a request or
6972 a response a Persist header field MAY also be included. The Persist
6973 header field takes the following form:
6975 Persist-header = "Persist" ":" 0#pers-param
6977 pers-param = param-name "=" word
6980 The Persist header itself is optional, and is used only if a parameter
6981 is being sent. HTTP/1.1 does not define any parameters.
6983 If the Persist header is sent, the corresponding connection token MUST
6984 be transmitted. The Persist header MUST be ignored if received without
6985 the connection token.
6987 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 110]
6992 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6996 The Pragma general-header field is used to include implementation-
6997 specific directives that may apply to any recipient along the
6998 request/response chain. All pragma directives specify optional behavior
6999 from the viewpoint of the protocol; however, some systems MAY require
7000 that behavior be consistent with the directives.
7002 Pragma = "Pragma" ":" 1#pragma-directive
7004 pragma-directive = "no-cache" | extension-pragma
7005 extension-pragma = token [ "=" word ]
7007 When the "no-cache" directive is present in a request message, an
7008 application SHOULD forward the request toward the origin server even if
7009 it has a cached copy of what is being requested. This pragma directive
7010 has the same semantics as the "no-cache" cache-directive (see section
7011 18.10) and is defined here for backwards compatibility with HTTP/1.0.
7012 Clients SHOULD include both header fields when a "no-cache" request is
7013 sent to a server not known to be HTTP/1.1 compliant.
7015 Pragma directives MUST be passed through by a proxy or gateway
7016 application, regardless of their significance to that application, since
7017 the directives may be applicable to all recipients along the
7018 request/response chain. It is not possible to specify a pragma for a
7019 specific recipient; however, any pragma directive not relevant to a
7020 recipient SHOULD be ignored by that recipient.
7022 HTTP/1.1 clients SHOULD NOT send the Pragma request header. HTTP/1.1
7023 caches SHOULD treat "Pragma: no-cache" as if the client had sent
7025 control: no-cache". No new Pragma directives will be defined in HTTP.
7028 18.35 Proxy-Authenticate
7029 The Proxy-Authenticate response-header field MUST be included as part of
7030 a 407 (Proxy Authentication Required) response. The field value consists
7031 of a challenge that indicates the authentication scheme and parameters
7032 applicable to the proxy for this Request-URI.
7034 Proxy-Authentication = "Proxy-Authentication" ":" challenge
7036 The HTTP access authentication process is described in section 14.
7037 Unlike WWW-Authenticate, the Proxy-Authenticate header field applies
7038 only to the current connection and MUST NOT be passed on to downstream
7042 18.36 Proxy-Authorization
7043 The Proxy-Authorization request-header field allows the client to
7044 identify itself (or its user) to a proxy which requires authentication.
7045 The Proxy-Authorization field value consists of credentials containing
7046 the authentication information of the user agent for the proxy and/or
7047 realm of the resource being requested.
7049 Proxy-Authorization = "Proxy-Authorization" ":" credentials
7051 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 111]
7056 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7059 The HTTP access authentication process is described in section 14.
7060 Unlike Authorization, the Proxy-Authorization applies only to the
7061 current connection and MUST NOT be passed on to upstream servers. If a
7062 request is authenticated and a realm specified, the same credentials
7063 SHOULD be valid for all other requests within this realm.
7067 The Public response-header field lists the set of non-standard methods
7068 supported by the server. The purpose of this field is strictly to inform
7069 the recipient of the capabilities of the server regarding unusual
7070 methods. The methods listed may or may not be applicable to the
7072 URI; the Allow header field (section 18.7) SHOULD be used to indicate
7073 methods allowed for a particular URI. This does not prevent a client
7074 from trying other methods. The field value SHOULD not include the
7075 methods predefined for HTTP/1.1 in section 9.1.1.
7077 Public = "Public" ":" 1#method
7081 Public: OPTIONS, MGET, MHEAD
7083 This header field applies only to the server directly connected to the
7084 client (i.e., the nearest neighbor in a chain of connections). If the
7085 response passes through a proxy, the proxy MUST either remove the Public
7086 header field or replace it with one applicable to its own capabilities.
7090 HTTP retrieval requests using conditional or unconditional GET methods
7091 may request one or more sub-ranges of the entity, instead of the entire
7092 entity. This is done using the Range request header:
7094 Range = "Range" ":" ranges-specifier
7096 A server MAY ignore the Range header. However, HTTP/1.1 origin servers
7097 and intermediate caches SHOULD support byte ranges whenever possible,
7098 since this supports efficient recovery from partially failed transfers,
7099 and it supports efficient partial retrieval of large entities.
7101 If the server supports the Range header and the specified range or
7102 ranges are appropriate for the entity:
7104 . The presence of a Range header in an unconditional GET modifies
7105 what is returned if the GET is otherwise successful. In other
7106 words, the response carries a status code of 206 (Partial Content)
7107 instead of 200 (OK).
7108 . The presence of a Range header in a conditional GET (a request
7109 using one or both of If-Modified-Since and If-NoneMatch, or one or
7110 both of If-Unmodified-Since and If-Match) modifies what is returned
7111 if the GET is otherwise successful and the condition is true. It
7112 does not affect the 304 (Not Modified) response returned if the
7113 conditional is false.
7115 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 112]
7120 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7123 In some cases, it may be more appropriate to use the If-Range header
7124 (see section 18.28) in addition to the Range header.
7128 The Referer[sic] request-header field allows the client to specify, for
7129 the server's benefit, the address (URI) of the resource from which the
7130 Request-URI was obtained. This allows a server to generate lists of
7131 back-links to resources for interest, logging, optimized caching, etc.
7132 It also allows obsolete or mistyped links to be traced for maintenance.
7133 The Referer field MUST NOT be sent if the Request-URI was obtained from
7134 a source that does not have its own URI, such as input from the user
7137 Referer = "Referer" ":" ( absoluteURI | relativeURI )
7141 Referer: http://www.w3.org/hypertext/DataSources/Overview.html
7143 If a partial URI is given, it SHOULD be interpreted relative to the
7144 Request-URI. The URI MUST NOT include a fragment.
7146 Note: Because the source of a link may be private information or
7147 may reveal an otherwise private information source, it is strongly
7148 recommended that the user be able to select whether or not the
7149 Referer field is sent. For example, a browser client could have a
7150 toggle switch for browsing openly/anonymously, which would
7151 respectively enable/disable the sending of Referer and From
7156 The Retry-After response-header field can be used with a 503 (Service
7157 Unavailable) response to indicate how long the service is expected to be
7158 unavailable to the requesting client. The value of this field can be
7159 either an HTTP-date or an integer number of seconds (in decimal) after
7160 the time of the response.
7162 Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds )
7164 Two examples of its use are
7166 Retry-After: Wed, 14 Dec 1994 18:22:54 GMT
7169 In the latter example, the delay is 2 minutes.
7173 The Server response-header field contains information about the software
7174 used by the origin server to handle the request. The field can contain
7175 multiple product tokens (section 7.8) and comments identifying the
7176 server and any significant subproducts. By convention, the product
7178 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 113]
7183 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7186 tokens are listed in order of their significance for identifying the
7189 Server = "Server" ":" 1*( product | comment )
7193 Server: CERN/3.0 libwww/2.17
7195 If the response is being forwarded through a proxy, the proxy
7196 application MUST NOT add its data to the product list. Instead, it
7197 SHOULD include a Via field (as described in section 18.47).
7199 Note: Revealing the specific software version of the server may
7200 allow the server machine to become more vulnerable to attacks
7201 against software that is known to contain security holes. Server
7202 implementers are encouraged to make this field a configurable
7207 The Title entity-header field indicates the title of the entity
7209 Title = "Title" ":" *TEXT
7211 An example of the field is
7213 Title: Hypertext Transfer Protocol -- HTTP/1.1
7215 This field is isomorphic with the <TITLE> element in HTML .
7218 18.43 Transfer Encoding
7219 The Transfer-Encoding general-header field indicates what (if any) type
7220 of transformation has been applied to the message body in order to
7221 safely transfer it between the sender and the recipient. This differs
7222 from the Content-Encoding in that the transfer coding is a property of
7223 the message, not of the original resource entity.
7225 Transfer-Encoding = "Transfer-Encoding" ":" 1#transfer- coding
7227 Transfer codings are defined in section 7.6. An example is:
7229 Transfer-Encoding: chunked
7231 Many older HTTP/1.0 applications do not understand the
7237 The Upgrade general-header allows the client to specify what additional
7238 communication protocols it supports and would like to use if the server
7239 finds it appropriate to switch protocols. The server MUST use the
7241 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 114]
7246 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7249 Upgrade header field within a 101 (Switching Protocols) response to
7250 indicate which protocol(s) are being switched.
7252 Upgrade = "Upgrade" ":" 1#product
7256 Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
7258 The Upgrade header field is intended to provide a simple mechanism for
7259 transition from HTTP/1.1 to some other, incompatible protocol. It does
7260 so by allowing the client to advertise its desire to use another
7261 protocol, such as a later version of HTTP with a higher major version
7262 number, even though the current request has been made using HTTP/1.1.
7263 This eases the difficult transition between incompatible protocols by
7264 allowing the client to initiate a request in the more commonly supported
7265 protocol while indicating to the server that it would like to use a
7266 "better" protocol if available (where "better" is determined by the
7267 server, possibly according to the nature of the method and/or resource
7270 The Upgrade header field only applies to switching application-layer
7271 protocols upon the existing transport-layer connection. Upgrade cannot
7272 be used to insist on a protocol change; its acceptance and use by the
7273 server is optional. The capabilities and nature of the application-
7274 layer communication after the protocol change is entirely dependent upon
7275 the new protocol chosen, although the first action after changing the
7276 protocol MUST be a response to the initial HTTP request containing the
7277 Upgrade header field.
7279 The Upgrade header field only applies to the immediate connection.
7280 Therefore, the "upgrade" keyword MUST be supplied within a Connection
7281 header field (section 18.11) whenever Upgrade is present in an HTTP/1.1
7284 The Upgrade header field cannot be used to indicate a switch to a
7285 protocol on a different connection. For that purpose, it is more
7286 appropriate to use a 301, 302, 303, or 305 redirection response.
7288 This specification only defines the protocol name "HTTP" for use by the
7289 family of Hypertext Transfer Protocols, as defined by the HTTP version
7290 rules of section 7.1 and future updates to this specification. Any
7291 token can be used as a protocol name; however, it will only be useful if
7292 both the client and server associate the name with the same protocol.
7296 The User-Agent request-header field contains information about the user
7297 agent originating the request. This is for statistical purposes, the
7298 tracing of protocol violations, and automated recognition of user agents
7299 for the sake of tailoring responses to avoid particular user agent
7300 limitations. Although it is not required, user agents SHOULD include
7301 this field with requests. The field can contain multiple product tokens
7302 (section 7.8) and comments identifying the agent and any subproducts
7304 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 115]
7309 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7312 which form a significant part of the user agent. By convention, the
7313 product tokens are listed in order of their significance for identifying
7316 User-Agent = "User-Agent" ":" 1*( product | comment )
7320 User-Agent: CERN-LineMode/2.15 libwww/2.17b3
7324 The Vary response-header field is used by an origin server to signal
7325 that the resource identified by the current request is a generic)
7326 resource. A generic resource has multiple entities associated with it,
7327 all of which are representations of the content of the resource. If a
7328 GET or HEAD request on a generic resource is received, the origin server
7329 will select one of the associated entities as the entity best matching
7330 the request. Selection of this entity is based on the contents of
7331 particular header fields in the request message, or on other information
7332 pertaining to the request, like the network address of the sending
7335 A resource being generic has an important effect on cache management,
7336 particularly for caching proxies which service a diverse set of user
7337 agents. All 200 (OK) responses from generic resources MUST contain at
7338 least one Vary header (section 18.46) or Alternates header (section
7339 18.8) to signal variance.
7341 If no Vary headers and no Alternates headers are present in a 200 (OK)
7342 response, then caches may assume, as long as the response is fresh, that
7343 the resource in question is plain, and has only one associated entity.
7344 Note however that this entity can still change through time, as possibly
7345 indicated by a Cache-Control response header (section 18.10).
7347 After selection of the entity best matching the current request, the
7348 origin server will usually generate a 200 (OK) response, but it can also
7349 generate other responses like 206 (Partial Content) or 304 (Not
7350 Modified) if headers which modify the semantics of the request, like
7351 Range (section 18.38) or If-Match (section 18.26), are present. An
7352 origin server need not be capable of selecting an entity for every
7353 possible incoming request on a generic resource; it can choose to
7354 generate a 3xx (redirection) or 4xx (client error) type response for
7357 In a request message on a generic resource, the selecting request
7358 headers are those request headers whose contents were used by the origin
7359 server to select the entity best matching the request. The Vary header
7360 field specifies the selecting request headers and any other selection
7361 parameters that were used by the origin server.
7363 Vary = "Vary" ":" 1#selection-parameter
7367 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 116]
7372 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7375 selection-parameter = request-header-name
7376 | "{accept-headers}"
7378 | "{" extension-parameter "}"
7380 request-header-name = field-name
7382 extension-parameter = token
7384 The presence of a request-header-name signals that the request-header
7385 field with this name is selecting. Note that the name need not belong
7386 to a request-header field defined in this specification, and that header
7387 names are case-insensitive. The presence of the "{accept-headers}"
7388 parameter signals that all request headers whose names start with
7389 "accept" are selecting.
7391 The inclusion of the "{other}" parameter in a Vary field signals that
7392 parameters other than the contents of request headers, for example the
7393 network address of the sending party, play a role in the selection of
7396 Note: This specification allows the origin server to express that
7397 other parameters were used, but does not allow the origin server to
7398 specify the exact nature of these parameters. This is left to
7401 If an extension-parameter unknown to the cache is present in a Vary
7402 header, the cache MUST treat it as the "{other}" parameter. If multiple
7403 Vary and Alternates header fields are present in a response, these MUST
7404 be combined to give all selecting parameters.
7406 The field name "Host" MUST never be included in a Vary header; clients
7407 MUST ignore it if it is present. The names of fields which change the
7408 semantics of a GET request, like "Range" and "If-Match" MUST also never
7409 be included, and MUST be ignored when present.
7411 Servers which use access authentication are not obliged to send "Vary:
7412 Authorization" headers in responses. It MUST be assumed that requests
7413 on authenticated resources can always produce different responses for
7414 different users. Note that servers can signal the absence of
7415 authentication by including "Cache-Control: public" header in the
7418 A cache MAY store and refresh 200 (OK) responses from a generic resource
7419 according to the rules in section 16.4. The partial entities in 206
7420 (Partial Content) responses from generic resources MAY also be used by
7423 When getting a request on a generic resource, a cache can only return a
7424 cached 200 (OK) response to one of its clients in two particular cases.
7426 First, if a cache gets a request on a generic resource for which it has
7427 cached one or more responses with Vary or Alternates headers, it can
7428 relay that request towards the origin server, adding an If-NoneMatch
7430 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 117]
7435 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7438 header listing the etag-info values in the ETag headers (section Error!
7439 Reference source not found.) of the cached responses which have
7441 IDs. If it then gets back a 304 (Not Modified) response with the etag-
7442 info of a cached 200 (OK) response in its ETag header, it can return
7443 this cached 200 (OK) response to its client, after merging in any of the
7444 304 response headers as specified in section 16.4.2.
7446 Second, if a cache gets a request on a generic resource, it can return
7447 to its client a cached, fresh 200 (OK) response which has Vary or
7448 Alternates headers, provided that
7451 . the Vary and Alternates headers of this fresh response specify that
7452 only request header fields are selecting parameters,
7454 . the specified selecting request header fields of the current
7455 request match the specified selecting request header fields of a
7456 previous request on the resource relayed towards the origin
7459 . this previous request got a 200 (OK) or 304 (Not Modified) response
7460 which had the same etag-info value in its ETag header as the
7461 cached, fresh 200 (OK) response.
7462 Two sequences of selecting request header fields match if and only if
7463 the first sequence can be transformed into the second sequence by only
7464 adding or removing whitespace at places in fields where this is allowed
7465 according to the syntax rules in this specification.
7467 If a cached 200 (OK) response MAY be returned to a request on a generic
7468 resource which includes a Range request header, then a cache MAY also
7469 use this 200 (OK) response to construct and return a 206 (Partial
7470 Content) response with the requested range.
7472 Note: Implementation of support for the second case above is mainly
7473 interesting in user agent caches, as a user agent cache will
7474 generally have an easy way of determining whether the sequence of
7475 request header fields of the current request equals the sequence
7476 sent in an earlier request on the same resource. Proxy caches
7477 supporting the second case would have to record diverse sequences
7478 of request header fields previously relayed; the implementation
7479 effort associated with this may not be balanced by a sufficient
7480 payoff in traffic savings. A planned specification of a content
7481 negotiation mechanism will define additional cases in which proxy
7482 caches can return a cached 200 (OK) response without contacting the
7483 origin server. The implementation effort associated with support
7484 for these additional cases is expected to have a much better
7489 The Via general-header field MUST be used by gateways and proxies to
7490 indicate the intermediate protocols and recipients between the user
7491 agent and the server on requests, and between the origin server and the
7492 client on responses. It is analogous to the "Received" field of RFC 822
7493 and is intended to be used for tracking message forwards, avoiding
7495 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 118]
7500 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7503 request loops, and identifying the protocol capabilities of all senders
7504 along the request/response chain.
7506 Via = "Via" ":" 1#( received-protocol received-by [ comment ]
7509 received-protocol = [ protocol-name "/" ] protocol-version
7510 protocol-name = token
7511 protocol-version = token
7512 received-by = ( host [ ":" port ] ) | pseudonym
7515 The received-protocol indicates the protocol version of the message
7516 received by the server or client along each segment of the
7517 request/response chain. The received-protocol version is appended to
7518 the Via field value when the message is forwarded so that information
7519 about the protocol capabilities of upstream applications remains visible
7522 The protocol-name is optional if and only if it would be "HTTP". The
7523 received-by field is normally the host and optional port number of a
7524 recipient server or client that subsequently forwarded the message.
7525 However, if the real host is considered to be sensitive information, it
7526 MAY be replaced by a pseudonym. If the port is not given, it MAY be
7527 assumed to be the default port of the received-protocol.
7529 Multiple Via field values represent each proxy or gateway that has
7530 forwarded the message. Each recipient MUST append its information such
7531 that the end result is ordered according to the sequence of forwarding
7534 Comments MAY be used in the Via header field to identify the software of
7535 the recipient proxy or gateway, analogous to the User-Agent and Server
7536 header fields. However, all comments in the Via field are optional and
7537 MAY be removed by any recipient prior to forwarding the message.
7539 For example, a request message could be sent from an HTTP/1.0 user agent
7540 to an internal proxy code-named "fred", which uses HTTP/1.1 to forward
7541 the request to a public proxy at nowhere.com, which completes the
7542 request by forwarding it to the origin server at www.ics.uci.edu. The
7543 request received by www.ics.uci.edu would then have the following Via
7546 Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
7548 Proxies and gateways used as a portal through a network firewall SHOULD
7549 NOT, by default, forward the names and ports of hosts within the
7550 firewall region. This information SHOULD only be propagated if
7551 explicitly enabled. If not enabled, the received-by host of any host
7552 behind the firewall SHOULD be replaced by an appropriate pseudonym for
7555 For organizations that have strong privacy requirements for hiding
7556 internal structures, a proxy MAY combine an ordered subsequence of Via
7558 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 119]
7563 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7566 header field entries with identical received-protocol values into a
7567 single such entry. For example,
7569 Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy
7571 could be collapsed to
7573 Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
7575 Applications SHOULD NOT combine multiple entries unless they are all
7576 under the same organizational control and the hosts have already been
7577 replaced by pseudonyms. Applications MUST NOT combine entries which
7578 have different received-protocol values.
7580 Note: The Via header field replaces the Forwarded header field
7581 which was present in earlier drafts of this specification.
7585 Warning headers are sent with responses using:
7587 Warning = "Warning" ":" warn-code SP warn-agent SP warn-text
7589 warn-agent = ( host [ ":" port ] ) | pseudonym
7590 ; the name or pseudonym of the server adding
7591 ; the Warning header, for use in debugging
7592 warn-text = quoted-string
7594 A response may carry more than one Warning header.
7596 The warn-text should be in a natural language and character set that is
7597 most likely to be intelligible to the human user receiving the
7599 This decision may be based on any available knowledge, such as the
7600 location of the cache or user, the Accept-Language field in a request,
7601 the Content-Language field in a response, etc. The default language is
7602 English and the default character set is ISO-8599-1.
7604 If a character set other than ISO-8599-1 is used, it must be encoded in
7605 the warn-text using the method described in RFC 1522 [14].
7607 Any server or cache may add Warning headers to a response. New Warning
7608 headers should be added after any existing Warning headers. A cache MUST
7609 NOT delete any Warning header that it received with a response.
7611 if a cache successfully validates a cache entry, it SHOULD remove any
7612 Warning headers previously attached to that entry. It MUST then add any
7613 Warning headers received in the validating response. In other words,
7614 Warning headers are those that would be attached to the most recent
7617 When multiple Warning headers are attached to a response, the user agent
7618 SHOULD display as many of them as possible, in the order that they
7619 appear in the response. If it is not possible to display all of the
7620 warnings, the user agent should follow these heuristics:
7623 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 120]
7628 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7631 . Warnings that appear early in the response take priority over those
7632 appearing later in the response.
7633 . Warnings in the user's preferred character set take priority over
7634 warnings in other character sets but with identical warn-codes and
7636 Systems that generate multiple Warning headers should order them with
7637 this user-agent behavior in mind.
7639 This is a list of the currently-defined warn-codes, each with a
7640 recommended warn-text in English, and a description of its meaning.
7643 10 Response is stale
7644 MUST be included whenever the returned response is stale. A cache may
7645 add this warning to any response, but may never remove it until the
7646 response is known to be fresh.
7648 11 Revalidation failed
7649 MUST be included if a cache returns a stale response because an
7650 attempt to revalidate the response failed, due to an inability to
7651 reach the server. A cache may add this warning to any response, but
7652 may never remove it until the response is successfully revalidated.
7654 12 Disconnected operation
7655 SHOULD be included if the cache is intentionally disconnected from
7656 the rest of the network for a period of time.
7658 99 Miscellaneous warning
7659 The warning text may include arbitrary information to be presented to
7660 a human user, or logged. A system receiving this warning MUST NOT
7661 take any automated action.
7665 18.49 WWW-Authenticate
7666 The WWW-Authenticate response-header field MUST be included in 401
7667 (Unauthorized) response messages. The field value consists of at least
7668 one challenge that indicates the authentication scheme(s) and parameters
7669 applicable to the Request-URI.
7671 WWW-Authenticate = "WWW-Authenticate" ":" 1#challenge
7673 The HTTP access authentication process is described in section 14. User
7674 agents MUST take special care in parsing the WWW-Authenticate field
7675 value if it contains more than one challenge, or if more than one WWW-
7676 Authenticate header field is provided, since the contents of a challenge
7677 may itself contain a comma-separated list of authentication parameters.
7680 19 Security Considerations
7681 This section is meant to inform application developers, information
7682 providers, and users of the security limitations in HTTP/1.1 as
7683 described by this document. The discussion does not include definitive
7686 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 121]
7691 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7694 solutions to the problems revealed, though it does make some suggestions
7695 for reducing security risks.
7698 19.1 Authentication of Clients
7699 As mentioned in section 14, the Basic authentication scheme is not a
7700 secure method of user authentication, nor does it in any way protect the
7701 Entity-Body, which is transmitted in clear text across the physical
7702 network used as the carrier. HTTP does not prevent additional
7703 authentication schemes and encryption mechanisms from being employed to
7704 increase security or the addition of enhancements (such as schemes to
7705 use one-time passwords) to Basic authentication.
7707 The most serious flaw in Basic authentication is that it results in the
7708 essentially clear text transmission of the user's password over the
7709 physical network. It is this problem which Digest Authentication
7710 attempts to address.
7712 Because Basic authentication involves the clear text transmission of
7713 passwords it SHOULD never be used (without enhancements) to protect
7714 sensitive or valuable information.
7716 A common use of Basic authentication is for identification purposes --
7717 requiring the user to provide a user name and password as a means of
7718 identification, for example, for purposes of gathering accurate usage
7719 statistics on a server. When used in this way it is tempting to think
7720 that there is no danger in its use if illicit access to the protected
7721 documents is not a major concern. This is only correct if the server
7722 issues both user name and password to the users and in particular does
7723 not allow the user to choose his or her own password. The danger arises
7724 because naive users frequently reuse a single password to avoid the task
7725 of maintaining multiple passwords.
7727 If a server permits users to select their own passwords, then the threat
7728 is not only illicit access to documents on the server but also illicit
7729 access to the accounts of all users who have chosen to use their account
7730 password. If users are allowed to choose their own password that also
7731 means the server must maintain files containing the (presumably
7732 encrypted) passwords. Many of these may be the account passwords of
7733 users perhaps at distant sites. The owner or administrator of such a
7734 system could conceivably incur liability if this information is not
7735 maintained in a secure fashion.
7737 Basic Authentication is also vulnerable to spoofing by counterfeit
7738 servers. If a user can be led to believe that he is connecting to a
7739 host containing information protected by basic authentication when in
7740 fact he is connecting to a hostile server or gateway then the attacker
7741 can request a password, store it for later use, and feign an error.
7742 This type of attack is not possible with Digest Authentication[26].
7743 Server implementers SHOULD guard against the possibility of this sort of
7744 counterfeiting by gateways or CGI scripts. In particular it is very
7745 dangerous for a server to simply turn over a connection to a gateway
7746 since that gateway can then use the persistent connection mechanism to
7749 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 122]
7754 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7757 engage in multiple transactions with the client while impersonating the
7758 original server in a way that is not detectable by the client.
7762 The writers of client software should be aware that the software
7763 represents the user in their interactions over the Internet, and should
7764 be careful to allow the user to be aware of any actions they may take
7765 which may have an unexpected significance to themselves or others.
7767 In particular, the convention has been established that the GET and HEAD
7768 methods should never have the significance of taking an action other
7769 than retrieval. These methods should be considered "safe. " This allows
7770 user agents to represent other methods, such as POST, PUT and DELETE, in
7771 a special way, so that the user is made aware of the fact that a
7772 possibly unsafe action is being requested.
7774 Naturally, it is not possible to ensure that the server does not
7775 generate side-effects as a result of performing a GET request; in fact,
7776 some dynamic resources consider that a feature. The important
7777 distinction here is that the user did not request the side-effects, so
7778 therefore cannot be held accountable for them.
7781 19.3 Abuse of Server Log Information
7782 A server is in the position to save personal data about a user's
7783 requests which may identify their reading patterns or subjects of
7784 interest. This information is clearly confidential in nature and its
7785 handling may be constrained by law in certain countries. People using
7786 the HTTP protocol to provide data are responsible for ensuring that such
7787 material is not distributed without the permission of any individuals
7788 that are identifiable by the published results.
7791 19.4 Transfer of Sensitive Information
7792 Like any generic data transfer protocol, HTTP cannot regulate the
7793 content of the data that is transferred, nor is there any a priori
7794 method of determining the sensitivity of any particular piece of
7795 information within the context of any given request. Therefore,
7796 applications SHOULD supply as much control over this information as
7797 possible to the provider of that information. Four header fields are
7798 worth special mention in this context: Server, Via, Referer and From.
7800 Revealing the specific software version of the server may allow the
7801 server machine to become more vulnerable to attacks against software
7802 that is known to contain security holes. Implementers SHOULD make the
7803 Server header field a configurable option.
7805 Proxies which serve as a portal through a network firewall SHOULD take
7806 special precautions regarding the transfer of header information that
7807 identifies the hosts behind the firewall. In particular, they SHOULD
7808 remove, or replace with sanitized versions, any Via fields generated
7809 behind the firewall.
7812 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 123]
7817 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7820 The Referer field allows reading patterns to be studied and reverse
7821 links drawn. Although it can be very useful, its power can be abused if
7822 user details are not separated from the information contained in the
7823 Referer. Even when the personal information has been removed, the
7824 Referer field may indicate a private document's URI whose publication
7825 would be inappropriate.
7827 The information sent in the From field might conflict with the user's
7828 privacy interests or their site's security policy, and hence it SHOULD
7829 NOT be transmitted without the user being able to disable, enable, and
7830 modify the contents of the field. The user MUST be able to set the
7831 contents of this field within a user preference or application defaults
7834 We suggest, though do not require, that a convenient toggle interface be
7835 provided for the user to enable or disable the sending of From and
7836 Referer information.
7839 19.5 Attacks Based On File and Path Names
7840 Implementations of HTTP origin servers SHOULD be careful to restrict the
7841 documents returned by HTTP requests to be only those that were intended
7842 by the server administrators. If an HTTP server translates HTTP URIs
7843 directly into file system calls, the server MUST take special care not
7844 to serve files that were not intended to be delivered to HTTP clients.
7845 For example, UNIX, Microsoft Windows, and other operating systems use
7846 ".." as a path component to indicate a directory level above the current
7847 one. On such a system, an HTTP server MUST disallow any such construct
7848 in the Request-URI if it would otherwise allow access to a resource
7849 outside those intended to be accessible via the HTTP server. Similarly,
7850 files intended for reference only internally to the server (such as
7851 access control files, configuration files, and script code) MUST be
7852 protected from inappropriate retrieval, since they might contain
7853 sensitive information. Experience has shown that minor bugs in such HTTP
7854 server implementations have turned into security risks.
7857 19.6 Personal Information
7858 HTTP clients are often privy to large amounts of personal information
7859 (e.g. the user's name, location, mail address, passwords, encryption
7860 keys, etc.), and SHOULD be very careful to prevent unintentional leakage
7861 of this information via the HTTP protocol to other sources. We very
7862 strongly recommend that a convenient interface be provided for the user
7863 to control dissemination of such information, and that designers and
7864 implementers be particularly careful in this area. History shows that
7865 errors in this area are often both serious security and/or privacy
7866 problems, and often generate very adverse publicity for the
7867 implementer's company.
7870 19.7 Privacy Issues Connected to Accept headers
7871 Accept request headers can reveal information about the user to all
7872 servers which are accessed. The Accept-Language header in particular
7873 can reveal information the user would consider to be of a private
7875 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 124]
7880 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7883 nature, because the understanding of particular languages is often
7884 strongly correlated to the membership of a particular ethnic group.
7885 User agents which offer the option to configure the contents of an
7886 Accept-Language header to be sent in every request are strongly
7887 encouraged to let the configuration process include a message which
7888 makes the user aware of the loss of privacy involved.
7890 An approach that limits the loss of privacy would be for a user agent to
7891 omit the sending of Accept-Language headers by default, and to ask the
7892 user whether it should start sending Accept-Language headers to a server
7893 if it detects, by looking for any Vary or Alternates response headers
7894 generated by the server, that such sending could improve the quality of
7897 Elaborate user-customized accept header fields sent in every request, in
7898 particular if these include quality values, can be used by servers as
7899 relatively reliable and long-lived user identifiers. Such user
7900 identifiers would allow content providers to do click-trail tracking,
7901 and would allow collaborating content providers to match cross-server
7902 click-trails or form submissions of individual users. Note that for
7903 many users not behind a proxy, the network address of the host running
7904 the user agent will also serve as a long-lived user identifier. In
7905 environments where proxies are used to enhance privacy, user agents
7906 should be conservative in offering accept header configuration options
7907 to end users. As an extreme privacy measure, proxies could filter the
7908 accept headers in relayed requests. General purpose user agents which
7909 provide a high degree of header configurability should warn users about
7910 the loss of privacy which can be involved.
7914 Clients using HTTP rely heavily on the Domain Name Service, and are thus
7915 generally prone to security attacks based on the deliberate miss-
7916 association of IP addresses and DNS names. The deployment of DNSSEC
7917 should help this situation. In advance of this deployment, however,
7918 clients need to be cautious in assuming the continuing validity of an IP
7919 number/DNS name association.
7921 In particular, HTTP clients SHOULD rely on their name resolver for
7922 confirmation of an IP number/DNS name association, rather than caching
7923 the result of previous host name lookups. Many platforms already can
7924 cache host name lookups locally when appropriate, and they SHOULD be
7925 configured to do so. These lookups should be cached, however, only when
7926 the TTL (Time To Live) information reported by the name server makes it
7927 likely that the cached information will remain useful.
7929 If HTTP clients cache the results of host name lookups in order to
7930 achieve a performance improvement, they MUST observe the TTL information
7933 If HTTP clients do not observe this rule, they could be spoofed when a
7934 previously-accessed server's IP address changes. As renumbering is
7935 expected to become increasingly common, the possibility of this form of
7938 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 125]
7943 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7946 attack will grow. Observing this requirement thus reduces this
7947 potential security vulnerability.
7949 This requirement also improves the load-balancing behavior of clients
7950 for replicated servers using the same DNS name and reduces the
7951 likelihood of a user's experiencing failure in accessing sites which use
7955 19.9 Location Headers and Spoofing
7956 If a single server supports multiple organizations that do not trust one
7957 another, then it must check the values of Location and Content-Location
7958 headers in responses that are generated under control of said
7959 organizations to make sure that they do not attempt to invalidate
7960 resources over which they have no authority.
7964 This specification makes heavy use of the augmented BNF and generic
7965 constructs defined by David H. Crocker for RFC 822 . Similarly, it
7966 reuses many of the definitions provided by Nathaniel Borenstein and Ned
7967 Freed for MIME . We hope that their inclusion in this specification will
7968 help reduce past confusion over the relationship between HTTP and
7969 Internet mail message formats.
7971 The HTTP protocol has evolved considerably over the past four years. It
7972 has benefited from a large and active developer community--the many
7973 people who have participated on the www-talk mailing list--and it is
7974 that community which has been most responsible for the success of HTTP
7975 and of the World-Wide Web in general. Marc Andreessen, Robert Cailliau,
7976 Daniel W. Connolly, Bob Denny, John Franks, Jean-Francois Groff, Phillip
7977 M. Hallam-Baker, Hakon W. Lie, Ari Luotonen, Rob McCool, Lou Montulli,
7978 Dave Raggett, Tony Sanders, and Marc VanHeyningen deserve special
7979 recognition for their efforts in defining early aspects of the
7982 This document has benefited greatly from the comments of all those
7983 participating in the HTTP-WG. In addition to those already mentioned,
7984 the following individuals have contributed to this specification:
7986 Gary Adams Harald Tveit Alvestrand
7987 Keith Ball Brian Behlendorf
7988 Paul Burchard Maurizio Codogno
7989 Mike Cowlishaw Roman Czyborra
7990 Michael A. Dolan Alan Freier
7991 Marc Hedlund Koen Holtman
7992 Alex Hopmann Bob Jernigan
7993 Shel Kaphan Rohit Khare
7994 Martijn Koster Alexei Kosut
7995 David M. Kristol Daniel LaLiberte
7996 Paul J. Leach Albert Lunde
7997 John C. Mallery Jean-Philippe Martin-Flatin
7998 Larry Masinter Mitra
7999 Gavin Nicol Scott Powers
8000 Bill Perry Jeffrey Perry
8002 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 126]
8007 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8010 Owen Rees Luigi Rizzo
8011 David Robinson Marc Salomon
8012 Rich Salz Jim Seidman
8013 Chuck Shotton Eric W. Sink
8014 Simon E. Spero Richard N. Taylor
8015 Robert S. Thau Francois Yergeau
8016 Mary Ellen Zurko David Morris
8017 Greg Herlihy Bill (BearHeart) Weinman
8021 Much of the content and presentation of the caching design is due to
8022 suggestions and comments from individuals including: Shel Kaphan, Paul
8023 Leach, Koen Holtman, David Morris, Larry Masinter, and Roy Fielding.
8025 Most of the specification of ranges is based on work originally done by
8026 Ari Luotonen and John Franks, with additional input from Steve Zilles
8029 XXX need acks for subgroup work.
8036 [1] H. Alvestrand. "Tags for the identification of languages." RFC
8038 1766, UNINETT, March 1995.
8040 [2] F. Anklesaria, M. McCahill, P. Lindner, D. Johnson, D. Torrey,
8041 B. Alberti. "The Internet Gopher Protocol: (a distributed document
8043 search and retrieval protocol)", RFC 1436, University of Minnesota,
8046 [3] T. Berners-Lee. "Universal Resource Identifiers in WWW" A
8048 Unifying Syntax for the Expression of Names and Addresses of Objects
8049 on the Network as used in the World-Wide Web." RFC 1630, CERN, June
8052 [4] T. Berners-Lee, L. Masinter, M. McCahill.
8053 "Uniform Resource Locators (URL)." RFC 1738, CERN, Xerox PARC,
8055 University of Minnesota, December 1994.
8057 [5] T. Berners-Lee, D. Connolly.
8058 "HyperText Markup Language Specification - 2.0." RFC 1866, MIT/LCS,
8065 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 127]
8070 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8073 [6] T. Berners-Lee, R. Fielding, H. Frystyk.
8074 "Hypertext Transfer Protocol - HTTP/1.0." Work in Progress (draft-
8076 ietf-http-v10-spec-04.txt), MIT/LCS, UC Irvine, September 1995.
8078 [7] N. Borenstein, N. Freed.
8079 "MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms
8081 for Specifying and Describing the Format of Internet Message Bodies."
8082 RFC 1521, Bellcore, Innosoft, September 1993.
8085 "Requirements for Internet hosts - application and support." STD 3,
8087 RFC 1123, IETF, October 1989.
8090 "Standard for the Format of ARPA Internet Text Messages." STD 11, RFC
8092 822, UDEL, August 1982.
8094 [10] F. Davis, B. Kahle, H. Morris, J. Salem, T. Shen, R. Wang, J.
8095 Sui, M. Grinbaum. "WAIS Interface Protocol Prototype Functional
8096 Specification." (v1.5), Thinking Machines Corporation, April 1990.
8098 [11] R. Fielding. "Relative Uniform Resource Locators." RFC 1808, UC
8102 [12] M. Horton, R. Adams.
8103 "Standard for interchange of USENET messages." RFC 1036 (Obsoletes
8105 RFC 850), AT&T Bell Laboratories, Center for Seismic Studies,
8108 [13] B. Kantor, P. Lapsley. "Network News Transfer Protocol A
8110 Proposed Standard for the Stream-Based Transmission of News." RFC
8111 977, UC San Diego, UC Berkeley, February 1986.
8113 [14] K. Moore. "MIME (Multipurpose Internet Mail Extensions) Part Two
8115 : Message Header Extensions for Non-ASCII Text." RFC 1522, University
8116 of Tennessee, September 1993.
8118 [15] E. Nebel, L. Masinter. "Form-based File Upload in HTML." RFC
8120 1867, Xerox Corporation, November 1995.
8122 [16] J. Postel. "Simple Mail Transfer Protocol." STD 10, RFC 821,
8124 USC/ISI, August 1982.
8128 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 128]
8133 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8136 [17] J. Postel. "Media Type Registration Procedure." RFC 1590,
8138 USC/ISI, March 1994.
8140 [18] J. Postel, J. K. Reynolds. "File Transfer Protocol (FTP)" STD
8143 RFC 959, USC/ISI, October 1985.
8145 [19] J. Reynolds, J. Postel. "Assigned Numbers." STD 2, RFC 1700,
8147 USC/ISI, October 1994.
8149 [20] K. Sollins, L. Masinter.
8150 "Functional Requirements for Uniform Resource Names." RFC 1737,
8152 MIT/LCS, Xerox Corporation, December 1994.
8154 [21] US-ASCII. Coded Character Set - 7-Bit American Standard Code for
8155 Information Interchange. Standard ANSI X3.4-1986, ANSI, 1986.
8157 [22] ISO-8859. International Standard -- Information Processing --
8158 8-bit Single-Byte Coded Graphic Character Sets --
8159 Part 1: Latin alphabet No. 1, ISO 8859-1:1987.
8160 Part 2: Latin alphabet No. 2, ISO 8859-2, 1987.
8161 Part 3: Latin alphabet No. 3, ISO 8859-3, 1988.
8162 Part 4: Latin alphabet No. 4, ISO 8859-4, 1988.
8163 Part 5: Latin/Cyrillic alphabet, ISO 8859-5, 1988.
8164 Part 6: Latin/Arabic alphabet, ISO 8859-6, 1987.
8165 Part 7: Latin/Greek alphabet, ISO 8859-7, 1987.
8166 Part 8: Latin/Hebrew alphabet, ISO 8859-8, 1988.
8167 Part 9: Latin alphabet No. 5, ISO 8859-9, 1990.
8169 [23] Meyers, M. Rose "The Content-MD5 Header Field." RFC 1864,
8171 Carnegie Mellon, Dover Beach Consulting, October, 1995.
8173 [24] B. Carpenter, Y. Rekhter, "Renumbering Needs Work". RFC 1900,
8177 [25] Gzip is available from the GNU project at
8178 <URL:ftp://prep.ai.mit.edu/pub/gnu/>. A more formal specification is
8180 currently a work in progress.
8182 [26] Work In Progress for Digest authentication of the IETF HTTP
8185 [27] TBS, Work in progress (XXX should put RFC in here_ )
8187 [28] Mills, D, "Network Time Protocol, Version 3", Specification,
8189 Implementation and Analysis RFC 1305, University of Delaware, March,
8192 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 129]
8197 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8200 [29] Work in progress of the HTTP working group (XXX is this correct
8201 reference for incomplete work?).
8203 [30] S. Spero. "Analysis of HTTP Performance Problems"
8204 <URL:http://sunsite.unc.edu/mdma-release/http-prob.html>
8206 [31] E. Rescorla, A. Schiffman "The Secure HyperText Transfer
8207 Protocol" Internet-Draft (work in progress).
8209 [32] A. Freier, P Karlton, P. Kocher. "SSL Version 3.0" Internet-
8210 Draft" (work in progress).
8212 [33] Jeffrey C. Mogul. "The Case for Persistent-Connection HTTP". In
8213 Proc.SIGCOMM '95 Symposium on Communications Architectures and
8214 Protocols, pages 299-313. Cambridge, MA, August, 1995.
8216 [34] Jeffrey C. Mogul. "The Case for Persistent-Connection HTTP".
8217 Research, Report 95/4, Digital Equipment Corporation Western Research
8218 Laboratory, May, 1995.,
8220 :http://www.research.digital.com/wrl/techreports/abstracts/95.4.html>
8223 [35] Work in progress of the HTTP working group on state management.
8225 22 Authors' Addresses
8229 Department of Information and Computer Science
8230 University of California
8231 Irvine, CA 92717-3425, USA
8232 Fax: +1 (714) 824-4056
8233 Email: fielding@ics.uci.edu
8235 Henrik Frystyk Nielsen
8238 MIT Laboratory for Computer Science
8239 545 Technology Square
8240 Cambridge, MA 02139, USA
8241 Fax: +1 (617) 258 8682
8242 Email: frystyk@w3.org
8246 Director, W3 Consortium
8247 MIT Laboratory for Computer Science
8248 545 Technology Square
8249 Cambridge, MA 02139, USA
8250 Fax: +1 (617) 258 8682
8255 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 130]
8260 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8265 MIT Laboratory for Computer Science
8266 545 Technology Square
8267 Cambridge, MA 02139, USA
8268 Fax: +1 (617) 258 8682
8273 Western Research Laboratory
8274 Digital Equipment Corporation
8275 250 University Avenue
8276 Palo Alto, California, 94305, U.S.A.
8277 Email: mogul@wrl.dec.com
8283 These appendices are provided for informational reasons only -- they do
8284 not form a part of the HTTP/1.1 specification.
8287 23.1 Internet Media Type message/http
8288 In addition to defining the HTTP/1.1 protocol, this document serves as
8289 the specification for the Internet media type "message/http". The
8290 following is to be registered with IANA .
8292 Media Type name: message
8293 Media subtype name: http
8294 Required parameters: none
8295 Optional parameters: version, msgtype
8297 version: The HTTP-Version number of the enclosed message
8298 (e.g., "1.1"). If not present, the version can be
8299 determined from the first line of the body.
8301 msgtype: The message type -- "request" or "response". If not
8302 present, the type can be determined from the first
8305 Encoding considerations: only "7bit", "8bit", or "binary" are
8308 Security considerations: none
8311 23.2 Tolerant Applications
8312 Although this document specifies the requirements for the generation of
8313 HTTP/1.1 messages, not all applications will be correct in their
8314 implementation. We therefore recommend that operational applications be
8316 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 131]
8321 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8324 tolerant of deviations whenever those deviations can be interpreted
8327 Clients SHOULD be tolerant in parsing the Status-Line and servers
8328 tolerant when parsing the Request-Line. In particular, they SHOULD
8329 accept any amount of SP or HT characters between fields, even though
8330 only a single SP is required.
8332 The line terminator for HTTP-header fields is the sequence CRLF.
8333 However, we recommend that applications, when parsing such headers,
8334 recognize a single LF as a line terminator and ignore the leading CR.
8337 23.3 Differences Between HTTP Bodies and RFC 1521 Internet Message Bodies
8338 HTTP/1.1 uses many of the constructs defined for Internet Mail (RFC 822
8339 ) and the Multipurpose Internet Mail Extensions (MIME ) to allow
8340 entities to be transmitted in an open variety of representations and
8341 with extensible mechanisms. However, RFC 1521 discusses mail, and HTTP
8342 has a few features that are different than those described in RFC 1521.
8343 These differences were carefully chosen to optimize performance over
8344 binary connections, to allow greater freedom in the use of new media
8345 types, to make date comparisons easier, and to acknowledge the practice
8346 of some early HTTP servers and clients.
8348 At the time of this writing, it is expected that RFC 1521 will be
8349 revised. The revisions may include some of the practices found in
8350 HTTP/1.1 but not in RFC 1521.
8352 This appendix describes specific areas where HTTP differs from RFC
8354 Proxies and gateways to strict MIME environments SHOULD be aware of
8355 these differences and provide the appropriate conversions where
8356 necessary. Proxies and gateways from MIME environments to HTTP also need
8357 to be aware of the differences because some conversions may be
8361 23.3.1 Conversion to Canonical Form
8362 RFC 1521 requires that an Internet mail entity be converted to canonical
8363 form prior to being transferred, as described in Appendix G of RFC 1521
8364 . Section 7.7.1 of this document describes the forms allowed for
8365 subtypes of the "text" media type when transmitted over HTTP. RFC 1521
8366 requires that content with a typeof "text" represent line breaks as
8367 CRLF and forbids the use of CR or LF outside of line break sequences.
8368 HTTP allows CRLF, bare CR, and bare LF to indicate a line break within
8369 text content when a message is transmitted over HTTP.
8371 Where it is possible, a proxy or gateway from HTTP to a strict RFC 1521
8372 environment SHOULD translate all line breaks within the text media types
8373 described in section 7.7.1 of this document to the RFC 1521 canonical
8374 form of CRLF. Note, however, that this may be complicated by the
8375 presence of a Content-Encoding and by the fact that HTTP allows the use
8376 of some character sets which do not use octets 13 and 10 to represent CR
8377 and LF, as is the case for some multi-byte character sets.
8380 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 132]
8385 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8388 23.3.2 Conversion of Date Formats
8389 HTTP/1.1 uses a restricted set of date formats (section 7.3.1) to
8390 simplify the process of date comparison. Proxies and gateways from other
8391 protocols SHOULD ensure that any Date header field present in a message
8392 conforms to one of the HTTP/1.1 formats and rewrite the date if
8396 23.3.3 Introduction of Content-Encoding
8397 RFC 1521 does not include any concept equivalent to HTTP/1.1's Content-
8398 Encoding header field. Since this acts as a modifier on the media type,
8399 proxies and gateways from HTTP to MIME-compliant protocols MUST either
8400 change the value of the Content-Type header field or decode the Entity-
8401 Body before forwarding the message. (Some experimental applications of
8402 Content-Type for Internet mail have used a media-type parameter of
8403 ";conversions=<content-coding>" to perform an equivalent function as
8404 Content-Encoding. However, this parameter is not part of RFC 1521.)
8407 23.3.4 No Content-Transfer-Encoding
8408 HTTP does not use the Content-Transfer-Encoding (CTE) field of RFC
8410 Proxies and gateways from MIME-compliant protocols to HTTP MUST remove
8411 any non-identity CTE ("quoted-printable" or "base64") encoding prior to
8412 delivering the response message to an HTTP client.
8414 Proxies and gateways from HTTP to MIME-compliant protocols are
8415 responsible for ensuring that the message is in the correct format and
8416 encoding for safe transport on that protocol, where "safe transport" is
8417 defined by the limitations of the protocol being used. Such a proxy or
8418 gateway SHOULD label the data with an appropriate Content-Transfer-
8419 Encoding if doing so will improve the likelihood of safe transport over
8420 the destination protocol.
8423 23.3.5 HTTP Header Fields in Multipart Body-Parts
8424 In RFC 1521, most header fields in multipart body-parts are generally
8425 ignored unless the field name begins with "Content-". In HTTP/1.1,
8426 multipart body-parts may contain any HTTP header fields which are
8427 significant to the meaning of that part.
8430 23.3.6 Introduction of Transfer-Encoding
8431 HTTP/1.1 introduces the Transfer-Encoding header field (section 18.43).
8432 Proxies/gateways MUST remove any transfer coding prior to forwarding a
8433 message via a MIME-compliant protocol. The process for decoding the
8434 "chunked" transfer coding (section 7.6) can be represented in pseudo-
8438 read chunk-size and CRLF
8439 while (chunk-size > 0) {
8440 read chunk-data and CRLF
8441 append chunk-data to Entity-Body
8442 length := length + chunk-size
8444 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 133]
8449 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8452 read chunk-size and CRLF
8455 while (entity-header not empty) {
8456 append entity-header to existing header fields
8459 Content-Length := length
8460 Remove "chunked" from Transfer-Encoding
8466 HTTP is not a MIME-compliant protocol (see Appendix 23.3). However,
8467 HTTP/1.1 messages may include a single MIME-Version general-header field
8468 to indicate what version of the MIME protocol was used to construct the
8469 message. Use of the MIME-Version header field indicates that the message
8470 is in full compliance with the MIME protocol (as defined in ).
8471 Proxies/gateways are responsible for ensuring full compliance (where
8472 possible) when exporting HTTP messages to strict MIME environments.
8474 MIME-Version = "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
8476 MIME version "1.0" is the default for use in HTTP/1.1. However,
8478 message parsing and semantics are defined by this document and not the
8482 23.4 Changes from HTTP/1.0
8483 This section will summarize major differences between versions HTTP/1.0
8487 23.4.1 Changes to Simplify Multi-homed Web Servers and Conserve IP Addresses
8488 The requirements that clients and servers support the Host request-
8489 header, report an error if the Host request-header (section 18.24) is
8490 missing from an HTTP/1.1 request, and accept absolute URIs (Section
8491 9.1.2) are among the most important changes from HTTP/1.0.
8493 In HTTP/1.0 there is a one-to-one relationship of IP addresses and
8494 servers. There is no other way to distinguish the intended server of a
8495 request than the IP address to which that request is directed. The
8496 HTTP/1.1 change will allow the Internet, once HTTP/1.0 clients and
8497 servers are no longer common, to support multiple Web sites from a
8498 single IP address, greatly simplifying large operational Web servers,
8499 where allocation of many IP addresses to a single host has created
8500 serious problems. The Internet will also be able to recover the IP
8501 addresses that have been used for the sole purpose of allowing root-
8502 level domain names to be used in HTTP URLs. Given the rate of growth of
8503 the Web, and the number of servers already deployed, it is extremely
8504 important that implementations of HTTP/1.1 correctly implement these new
8507 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 134]
8512 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8515 . both clients and servers MUST support the Host request-header
8517 . Host request-headers are required in HTTP/1.1 requests.
8519 . servers MUST report an error if an HTTP/1.1 request does not
8520 include a Host request-header
8522 . servers MUST accept absolute URIs
8524 23.5 Additional Features
8525 This appendix documents protocol elements used by some existing HTTP
8526 implementations, but not consistently and correctly across most
8528 applications. Implementers should be aware of these features, but cannot
8529 rely upon their presence in, or interoperability with, other HTTP/1.1
8530 applications. Some of these describe proposed experimental features,
8531 and some describe features that experimental deployment found lacking
8532 that are now addressed in the base HTTP/1.1 specification.
8535 23.5.1 Additional Request Methods
8538 The PATCH method is similar to PUT except that the entity contains a
8539 list of differences between the original version of the resource
8540 identified by the Request-URI and the desired content of the resource
8541 entity after the PATCH action has been applied. The list of differences
8542 is in a format defined by the media type of the entity (e.g.,
8543 "application/diff") and MUST include sufficient information to allow the
8544 server to recreate the changes necessary to convert the original version
8545 of the resource entity to the desired version.
8547 If the request passes through a cache and the Request-URI identifies a
8548 currently cached entity, that entity MUST be removed from the cache.
8549 Responses to this method are not cachable.
8551 For compatibility with HTTP/1.0 applications, all PATCH requests MUST
8552 include a valid Content-Length header field unless the server is known
8553 to be HTTP/1.1 compliant. When sending a PATCH request to an HTTP/1.1
8554 server, a client MUST use a valid Content-Length or the "chunked"
8555 Transfer-Encoding. The server SHOULD respond with a 400 (Bad Request)
8556 message if it cannot determine the length of the request message's
8557 content, or with 411 (Length Required) if it wishes to insist on
8558 receiving a valid Content-Length.
8560 The actual method for determining how the patched resource is placed,
8561 and what happens to its predecessor, is defined entirely by the origin
8562 server. If the original version of the resource being patched included a
8563 Content-Version header field, the request entity MUST include a
8565 From header field corresponding to the value of the original Content-
8566 Version header field. Applications are encouraged to use these fields
8567 for constructing versioning relationships and resolving version
8572 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 135]
8577 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8580 PATCH requests must obey the entity transmission requirements set out in
8583 Caches that implement PATCH should invalidate cached responses as
8584 defined in section 16.10 for PUT.
8588 The LINK method establishes one or more Link relationships between the
8589 existing resource identified by the Request-URI and other existing
8590 resources. The difference between LINK and other methods allowing links
8591 to be established between resources is that the LINK method does not
8592 allow any Entity-Body to be sent in the request and does not directly
8593 result in the creation of new resources.
8595 If the request passes through a cache and the Request-URI identifies a
8596 currently cached entity, that entity MUST be removed from the cache.
8597 Responses to this method are not cachable.
8599 Caches that implement LINK should invalidate cached responses as defined
8600 in section 16.10 for PUT.
8604 The UNLINK method removes one or more Link relationships from the
8605 existing resource identified by the Request-URI. These relationships may
8606 have been established using the LINK method or by any other method
8607 supporting the Link header. The removal of a link to a resource does not
8608 imply that the resource ceases to exist or becomes inaccessible for
8611 If the request passes through a cache and the Request-URI identifies a
8612 currently cached entity, that entity MUST be removed from the cache.
8613 Responses to this method are not cachable.
8615 Caches that implement UNLINK should invalidate cached responses as
8616 defined in section 16.10 for PUT.
8620 To support the PATCH method, if the entity being PUT was derived from an
8621 existing resource which included a Content-Version header field, the new
8622 entity MUST include a Derived-From header field corresponding to the
8623 value of the original Content-Version header field. Multiple Derived-
8624 From values may be included if the entity was derived from multiple
8625 resources with Content-Version information. Applications are encouraged
8626 to use these fields for constructing versioning relationships and
8627 resolving version conflicts.
8630 23.5.2 Additional Header Field Definitions
8632 23.5.2.1 Content-Version
8635 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 136]
8640 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8643 The Content-Version entity-header field defines the version tag
8644 associated with a rendition of an evolving entity. Together with the
8645 Derived-From field described in section 23.5.2.2, it allows a group of
8646 people to work simultaneously on the creation of a work as an iterative
8647 process. The field SHOULD be used to allow evolution of a particular
8648 work along a single path. It SHOULD NOT be used to indicate derived
8649 works or renditions in different representations. It MAY also me used as
8650 an opaque value for comparing a cached entity's version with that of the
8651 current resource entity.
8653 Content-Version = "Content-Version" ":" quoted-string
8655 Examples of the Content-Version field include:
8657 Content-Version: "2.1.2"
8658 Content-Version: "Fred 19950116-12:26:48"
8659 Content-Version: "2.5a4-omega7"
8661 The value of the Content-Version field SHOULD be considered opaque to
8662 all parties but the origin server. A user agent MAY suggest a value for
8663 the version of an entity transferred via a PUT request; however, only
8664 the origin server can reliably assign that value.
8667 23.5.2.2 Derived-From
8668 The Derived-From entity-header field can be used to indicate the version
8669 tag of the resource from which the enclosed entity was derived before
8670 modifications were made by the sender. This field is used to help manage
8671 the process of merging successive changes to a resource, particularly
8672 when such changes are being made in parallel and from multiple sources.
8674 Derived-From = "Derived-From" ":" quoted-string
8676 An example use of the field is:
8678 Derived-From: "2.1.1"
8680 The Derived-From field is required for PUT and PATCH requests if the
8681 entity being sent was previously retrieved from the same URI and a
8682 Content-Version header was included with the entity when it was last
8687 The Link entity-header field provides a means for describing a
8688 relationship between two resources, generally between the requested
8689 resource and some other resource. An entity MAY include multiple Link
8690 values. Links at the metainformation level typically indicate
8691 relationships like hierarchical structure and navigation paths. The Link
8692 field is semantically equivalent to the <LINK> element in HTML .
8694 Link = "Link" ":" #("<" URI ">" *( ";" link-param )
8698 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 137]
8703 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8706 link-param = ( ( "rel" "=" relationship )
8707 | ( "rev" "=" relationship )
8708 | ( "title" "=" quoted-string )
8709 | ( "anchor" "=" <"> URI <"> )
8710 | ( link-extension ) )
8712 link-extension = token [ "=" ( token | quoted-string ) ]
8714 relationship = sgml-name
8715 | ( <"> sgml-name *( SP sgml-name) <"> )
8717 sgml-name = ALPHA *( ALPHA | DIGIT | "." | "-" )
8719 Relationship values are case-insensitive and MAY be extended within the
8720 constraints of the sgml-name syntax. The title parameter MAY be used to
8721 label the destination of a link such that it can be used as
8722 identification within a human-readable menu. The anchor parameter MAY be
8723 used to indicate a source anchor other than the entire current
8725 such as a fragment of this resource or a third resource.
8727 Examples of usage include:
8729 Link: <http://www.cern.ch/TheBook/chapter2>; rel="Previous"
8731 Link: <mailto:timbl@w3.org>; rev="Made"; title="Tim Berners-Lee"
8733 The first example indicates that chapter2 is previous to this resource
8734 in a logical navigation path. The second indicates that the person
8735 responsible for making the resource available is identified by the given
8740 The URI header field has, in past versions of this specification, been
8741 used as a combination of the existing Location, Content-Location, and
8742 Alternates header fields. Its primary purpose has been to include a list
8743 of additional URIs for the resource, including names and mirror
8744 locations. However, it has become clear that the combination of many
8745 different functions within this single field has been a barrier to
8746 consistently and correctly implementing any of those functions.
8747 Furthermore, we believe that the identification of names and mirror
8748 locations would be better performed via the Link header field. The URI
8749 header field is therefore deprecated in favor of those other fields.
8751 URI-header = "URI" ":" 1#( "<" URI ">" )
8754 23.5.2.5 Compatibility with HTTP/1.0 Persistent Connections
8755 Some clients and servers may wish to be compatible with some previous
8756 implementations of persistent connections in HTTP/1.0 clients and
8757 servers. These implementations are faulty, and the new facilities in
8758 HTTP/1.1 are designed to rectify these problems. The fear was that
8759 some existing 1.0 clients may be sending Keep-Alive to a proxy server
8760 that doesn't understand Connection, which would then erroneously forward
8762 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 138]
8767 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8770 it to the next inbound server, which would establish the Keep-Alive
8771 connection and result in a dead 1.0 proxy waiting for the close on the
8772 response. The result is that 1.0 clients must be prevented from using
8773 Keep-Alive when talking to proxies.
8775 However, talking to proxies is the most important use of persistent
8776 connections, so that is clearly unacceptable. Therefore, we need some
8777 other mechanism for indicating a persistent connection is desired, which
8778 is safe to use even when talking to an old proxy that ignores
8779 Connection. As it turns out, there are two ways to accomplish that:
8782 Introduce a new keyword (persist) which is declared to be valid only
8783 when received from an HTTP/1.1 message.
8786 Declare persistence to be the default for HTTP/1.1 messages and
8787 introduce a new keyword (close) for declaring non-persistence.
8789 The following describes the original, buggy form of persistent
8792 When connecting to an origin server an HTTP client MAY send the Keep-
8793 Alive connection-token in addition to the Persist connection-token:
8795 Connection: Keep-Alive,Persist
8797 An HTTP/1.0 server would then respond with the Keep-Alive connection
8798 token and the client may proceed with an HTTP/1.0 (or Keep-Alive)
8799 persistent connection.
8801 An HTTP/1.1 server may also establish persistent connections with
8802 HTTP/1.0 clients upon receipt of a Keep-Alive connection token.
8803 However, a persistent connection with an HTTP/1.0 client cannot make use
8804 of the chunked transfer-coding, and therefore MUST use a Content-Length
8805 for marking the ending boundary of each Entity-Body.
8807 A client MUST NOT send the Keep-Alive connection token to a proxy server
8808 as HTTP/1.0 proxy servers do not obey the rules of HTTP/1.1 for parsing
8809 the Connection header field.
8812 23.5.2.5.1 The Keep-Alive Header
8813 When the Keep-Alive connection-token has been transmitted with a request
8814 or a response a Keep-Alive header field MAY also be included. The Keep-
8815 Alive header field takes the following form:
8817 Keep-Alive-header = "Keep-Alive" ":" 0# keepalive-param
8819 keepalive-param = param-name "=" value
8821 The Keep-Alive header itself is optional, and is used only if a
8822 parameter is being sent. HTTP/1.1 does not define any parameters.
8827 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 139]
8832 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8835 If the Keep-Alive header is sent, the corresponding connection token
8836 MUST be transmitted. The Keep-Alive header MUST be ignored if received
8837 without the connection token.
8840 23.5.3 Compatibility with Previous Versions
8841 It is beyond the scope of a protocol specification to mandate compliance
8842 with previous versions. HTTP/1.1 was deliberately designed, however, to
8843 make supporting previous versions easy. While we are contemplating a
8844 separate document containing advice to implementers, we feel it worth
8845 noting that at the time of composing this specification, we would expect
8846 commercial HTTP/1.1 servers to:
8849 . recognize the format of the Request-Line for HTTP/0.9, 1.0, and 1.1
8852 . understand any valid request in the format of HTTP/0.9, 1.0, or
8855 . respond appropriately with a message in the same major version used
8857 And we would expect HTTP/1.1 clients to:
8860 . recognize the format of the Status-Line for HTTP/1.0 and 1.1
8863 . understand any valid response in the format of HTTP/0.9, 1.0, or
8865 For most implementations of HTTP/1.0, each connection is established by
8866 the client prior to the request and closed by the server after sending
8867 the response. A few implementations implement the Keep-Alive version of
8868 persistent connections described in section 23.5.2.5.1.
8890 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 140]