]> pere.pagekite.me Git - homepage.git/blob - reports/rfc/draft-ietf-http-v11-spec-03.txt
Nytt bokforslag.
[homepage.git] / reports / rfc / draft-ietf-http-v11-spec-03.txt
1
2
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
6 J. Gettys, DEC
7 J. C. Mogul, DEC
8 Expires October 2, 1996 May 2, 1996
9
10 Hypertext Transfer Protocol -- HTTP/1.1
11
12
13 1 Status of this Memo
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.
18
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".
23
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).
29
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.
36
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.
44
45
46 2 Abstract
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.
54
55
56 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 1]
57
58
59
60
61 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
62
63
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
66 "HTTP/1.1".
67
68 3 Note to Readers of This Document
69
70
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.
77
78 This draft has undergone extensive reorganization to improve
79 presentation. Let us know if there are remaining problems.
80
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.
87
88 There are a very few remaining issues indicated by Editor's Note: in
89 bold font.
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 2]
119
120
121
122
123
124
125
126
127 4 Table of Contents
128
129
130 HYPERTEXT TRANSFER PROTOCOL -- HTTP/1.1
131
132 1 Status of this Memo
133
134 2 Abstract
135
136 3 Note to Readers of This Document
137
138 4 Table of Contents
139
140 5 Introduction
141 5.1 Purpose
142 5.2 Requirements
143 5.3 Terminology
144 5.4 Overall Operation
145 5.5 HTTP and MIME
146
147 6 Notational Conventions and Generic Grammar
148 6.1 Augmented BNF
149 6.2 Basic Rules
150
151 7 Protocol Parameters
152 7.1 HTTP Version
153 7.2 Uniform Resource Identifiers
154 7.3 Date/Time Formats
155 7.4 Character Sets
156 7.5 Content Codings
157 7.6 Transfer Codings
158 7.7 Media Types
159 7.8 Product Tokens
160 7.9 Quality Values
161 7.10 Language Tags
162 7.11 Entity Tags
163 7.12 Variant IDs
164 7.13 Variant Sets
165 7.14 Range Protocol Parameters
166
167 8 HTTP Message
168 8.1 Message Types
169 8.2 Message Headers
170 8.3 General Header Fields
171
172 9 Request
173 9.1 Request-Line
174 9.2 The Resource Identified by a Request
175 9.3 Request Header Fields
176
177 10 Response
178 10.1 Status-Line
179 10.2 Response Header Fields
180
181 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 3]
182
183
184
185
186 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
187
188
189 11 Entity
190 11.1 Entity Header Fields
191 11.2 Entity Body
192
193 12 Status Code Definitions
194 12.1 Informational 1xx
195 12.2 Successful 2xx
196 12.3 Redirection 3xx
197 12.4 Client Error 4xx
198 12.5 Server Error 5xx
199
200 13 Method Definitions
201 13.1 OPTIONS
202 13.2 GET
203 13.3 HEAD
204 13.4 POST
205 13.5 PUT
206 13.6 DELETE
207 13.7 TRACE
208
209 14 Access Authentication
210 14.1 Basic Authentication Scheme
211 14.2 Digest Authentication Scheme
212
213 15 Content Negotiation
214 15.1 Negotiation Facilities Defined in this Specification
215
216 16 Caching in HTTP
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
231 16.15 History Lists
232
233 17 Persistent Connections
234 17.1 Purpose
235 17.2 Overall Operation
236 17.3 Proxy Servers
237 17.4 Interaction with Security Protocols
238 17.5 Practical Considerations
239
240 18 Header Field Definitions
241 18.1 Accept
242 18.2 Accept-Charset
243
244 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 4]
245
246
247
248
249 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
250
251
252 18.3 Accept-Encoding
253 18.4 Accept-Language
254 18.5 Accept-Ranges
255 18.6 Age
256 18.7 Allow
257 18.8 Alternates
258 18.9 Authorization
259 18.10 Cache-Control
260 18.11 Connection
261 18.12 Content-Base
262 18.13 Content-Encoding
263 18.14 Content-Language
264 18.15 Content-Length
265 18.16 Content-Location
266 18.17 Content-MD5
267 18.18 Content-Range
268 18.19 Content-Type
269 18.20 Date
270 18.21 ETag
271 18.22 Expires
272 18.23 From
273 18.24 Host
274 18.25 If-Modified-Since
275 18.26 If-Match
276 18.27 If-NoneMatch
277 18.28 If-Range
278 18.29 If-Unmodified-Since
279 18.30 Last-Modified
280 18.31 Location
281 18.32 Max-Forwards
282 18.33 Persist
283 18.34 Pragma
284 18.35 Proxy-Authenticate
285 18.36 Proxy-Authorization
286 18.37 Public
287 18.38 Range
288 18.39 Referer
289 18.40 Retry-After
290 18.41 Server
291 18.42 Title
292 18.43 Transfer Encoding
293 18.44 Upgrade
294 18.45 User-Agent
295 18.46 Vary
296 18.47 Via
297 18.48 Warning
298 18.49 WWW-Authenticate
299
300 19 Security Considerations
301 19.1 Authentication of Clients
302 19.2 Safe Methods
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
306
307 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 5]
308
309
310
311
312 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
313
314
315 19.6 Personal Information
316 19.7 Privacy Issues Connected to Accept headers
317 19.8 DNS Spoofing
318 19.9 Location Headers and Spoofing
319
320 20 Acknowledgments
321
322 21 References
323
324 22 Authors' Addresses
325
326 23 Appendices
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
330 Bodies
331 23.4 Changes from HTTP/1.0
332 23.5 Additional Features
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 6]
371
372
373
374
375
376
377
378 5 Introduction
379 5.1 Purpose
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.
394
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
398 features.
399
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)
405 ,
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) .
409
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.
415
416
417 5.2 Requirements
418 This specification uses the same words as RFC 1123 for defining the
419 significance of each particular requirement. These words are:
420
421
422 MUST
423 This word or the adjective "required" means that the item is an
424 absolute requirement of the specification.
425
426 SHOULD
427 This word or the adjective "recommended" means that there may
428 exist
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.
432
433
434
435 Fielding, Frystyk, Berners-Lee, Gettys and Mogul [Page 7]
436
437
438
439
440 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
441
442
443 MAY
444 This word or the adjective "optional" means that this item is
445 truly
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".
455
456
457 5.3 Terminology
458 This specification uses a number of terms to refer to the roles played
459 by participants in, and objects of, the HTTP communication.
460
461
462 connection
463 A transport layer virtual circuit established between two programs
464 for the purpose of communication.
465
466 message
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.
470
471 request
472 An HTTP request message as defined in section 9.
473
474 response
475 An HTTP response message as defined in section 10.
476
477 resource
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.
482
483 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
491 specifically.
492
493 plain resource
494 A resource that is not a generic resource. A plain resource is
495 always identified by a URI.
496
497
498
499 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 8]
500
501
502
503
504 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
505
506
507 entity
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.
512
513 resource entity
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.
520
521 variant
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.
525
526 content negotiation
527 The mechanism for selecting the appropriate variant of a generic
528 resource when servicing a request, as described in section 15.
529
530 entity tag
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.
540
541 client
542 An application program that establishes connections for the purpose
543 of sending requests.
544
545 user agent
546 The client which initiates a request. These are often browsers,
547 editors, spiders (web-traversing robots), or other end user tools.
548
549 server
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.
557
558 origin server
559 The server on which a given resource resides or is to be created.
560
561
562 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 9]
563
564
565
566
567 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
568
569
570 proxy
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.
579
580 gateway
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.
587
588 tunnel
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.
596
597 cache
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.
604
605 cachable
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
611 particular request.
612
613 firsthand
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.
618
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.
622
623
624
625 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 10]
626
627
628
629
630 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
631
632
633 heuristic expiration time
634 An expiration time assigned by a cache when no explicit expiration
635 time is available.
636
637 age
638 The age of a response is the time since it was generated by, or
639 successfully validated with, the origin server.
640
641 freshness lifetime
642 The length of time between the generation of a response and its
643 expiration time.
644
645 fresh
646 A response is fresh if its age has not yet exceeded its freshness
647 lifetime.
648
649 stale
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.
657
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.
665
666 validator
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.
672
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.
682
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).
687
688 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 11]
689
690
691
692
693 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
694
695
696 request chain ------------------------>
697 UA -------------------v------------------- O
698 <----------------------- response chain
699
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
703 agent,
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
712 the messages.
713
714 request chain -------------------------------------->
715 UA -----v----- A -----v----- B -----v----- C -----v----- O
716 <------------------------------------- response chain
717
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.
728
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
735 by UA or A.
736
737 request chain ---------->
738 UA -----v----- A -----v----- B - - - - - - C - - - - - - O
739 <--------- response chain
740
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.
744
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
749 transport;
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
752
753 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 12]
754
755
756
757
758 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
759
760
761 units of the protocol in question is outside the scope of this
762 specification.
763
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
768 case,
769 the closing of the connection by either or both parties always
770 terminates the current request, regardless of its status.
771
772
773 5.5 HTTP and MIME
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.
778
779
780 6 Notational Conventions and Generic Grammar
781
782 6.1 Augmented BNF
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:
788
789
790 name = definition
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.
799
800 "literal"
801 Quotation marks surround literal text. Unless stated otherwise, the
802 text is case-insensitive.
803
804 rule1 | rule2
805 Elements separated by a bar ("I") are alternatives, e.g., "yes |
806 no" will accept yes or no.
807
808 (rule1 rule2)
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".
812
813 *rule
814 The character "*" preceding an element indicates repetition. The
815 full form is "<n>*<m>element" indicating at least <n> and at most
816
817 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 13]
818
819
820
821
822 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
823
824
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.
828
829 [rule]
830 Square brackets enclose optional elements; "[foo bar]" is
831 equivalent to "*1(foo bar)".
832
833 N rule
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.
838
839 #rule
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
845 ","
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.
854
855 ; comment
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
859 specifications.
860
861 implied *LWS
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.
872
873 6.2 Basic Rules
874 The following rules are used throughout this specification to describe
875 basic parsing constructs. The US-ASCII coded character set is defined by.
876
877 OCTET = <any 8-bit sequence of data>
878 CHAR = <any US-ASCII character (octets 0 - 127)>
879
880 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 14]
881
882
883
884
885 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
886
887
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)>
899
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.
904
905 CRLF = CR LF
906
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.
910
911 LWS = [CRLF] 1*( SP | HT )
912
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 .
917
918 TEXT = <any OCTET except CTLs,
919 but including LWS>
920
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.
924
925 Hexadecimal numeric characters are used in several protocol elements.
926
927 HEX = "A" | "B" | "C" | "D" | "E" | "F"
928 | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT
929
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.
933
934 word = token | quoted-string
935
936 token = 1*<any CHAR except CTLs or tspecials>
937
938 tspecials = "(" | ")" | "<" | ">" | "@"
939 | "," | ";" | ":" | "\" | <">
940 | "/" | "[" | "]" | "?" | "="
941 | "{" | "}" | SP | HT
942
943 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 15]
944
945
946
947
948 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
949
950
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.
955
956 comment = "(" *( ctext | comment ) ")"
957 ctext = <any TEXT excluding "(" and ")">
958
959 A string of text is parsed as a single word if it is quoted using
960 double-quote marks.
961
962 quoted-string = ( <"> *(qdtext) <"> )
963
964
965 qdtext = <any CHAR except <"> and CTLs,
966 but including LWS>
967
968 The backslash character ("\") may be used as a single-character quoting
969 mechanism only within quoted-string and comment constructs.
970
971 quoted-pair = "\" CHAR
972
973
974 7 Protocol Parameters
975
976 7.1 HTTP Version
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.
989
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
993 format .
994
995 HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
996
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.
1002
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
1005
1006 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 16]
1007
1008
1009
1010
1011 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1012
1013
1014 of this version number indicates that the sending application is at
1015 least conditionally compliant with this specification.
1016
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.
1028
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
1032 indicator.
1033
1034
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--
1041 a network resource.
1042
1043
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.
1049
1050 URI = ( absoluteURI | relativeURI ) [ "#" fragment ]
1051
1052 absoluteURI = scheme ":" *( uchar | reserved )
1053
1054 relativeURI = net_path | abs_path | rel_path
1055
1056 net_path = "//" net_loc [ abs_path ] abs_path
1057 = "/" rel_path
1058 rel_path = [ path ] [ ";" params ] [ "?" query ]
1059
1060 path = fsegment *( "/" segment )
1061 fsegment = 1*pchar
1062 segment = *pchar
1063
1064 params = param *( ";" param )
1065 param = *( pchar | "/" )
1066
1067
1068
1069 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 17]
1070
1071
1072
1073
1074 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1075
1076
1077 scheme = 1*( ALPHA | DIGIT | "+" | "-" | "." )
1078 net_loc = *( pchar | ";" | "?" )
1079 query = *( uchar | reserved )
1080 fragment = *( uchar | reserved )
1081
1082 pchar = uchar | ":" | "@" | "&amp;" | "=" | "+"
1083 uchar = unreserved | escape
1084 unreserved = ALPHA | DIGIT | safe | extra | national
1085
1086 escape = "%" HEX HEX
1087 reserved = ";" | "/" | "?" | ":" | "@" | "&amp;" | "=" | "+"
1088 extra = "!" | "*" | "'" | "(" | ")" | ","
1089 safe = "$" | "-" | "_" | "."
1090 unsafe = CTL | SP | <"> | "#" | "%" | "<" | ">"
1091 national = <any OCTET excluding ALPHA, DIGIT,
1092 reserved, extra, safe, and unsafe>
1093
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.
1100
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
1106
1107 414 Request-URI Too Large
1108
1109 if a URI is longer than the server can handle. See section 12.4.1.15.
1110
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.
1114
1115 All client and proxy implementations MUST be able to handle a URI of
1116 any finite length.
1117
1118
1119 7.2.2 http URL
1120 The "http" scheme is used to locate network resources via the HTTP
1121 protocol. This section defines the scheme-specific syntax and semantics
1122 for http URLs.
1123
1124 http_URL = "http:" "//" host [ ":" port ] [ abs_path ]
1125
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>
1129
1130 port = *DIGIT
1131
1132 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 18]
1133
1134
1135
1136
1137 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1138
1139
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).
1147
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
1151 other URI scheme.
1152
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 "/".
1157
1158
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:
1163
1164 Following the rules from section 7.2.2:
1165
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.
1172
1173 For example, the following three URIs are equivalent:
1174
1175 http://abc.com:80/~smith/home.html
1176 http://ABC.com/%7Esmith/home.html
1177 http://ABC.com:/%7esmith/home.html
1178
1179
1180
1181
1182 7.3 Date/Time Formats
1183
1184 7.3.1 Full Date
1185 HTTP applications have historically allowed three different formats for
1186 the representation of date/time stamps:
1187
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
1191
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).
1194
1195 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 19]
1196
1197
1198
1199
1200 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1201
1202
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.
1208
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.
1213
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.
1219
1220 HTTP-date = rfc1123-date | rfc850-date | asctime-date
1221
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
1225
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)
1232
1233 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
1234 ; 00:00:00 - 23:59:59
1235
1236 wkday = "Mon" | "Tue" | "Wed"
1237 | "Thu" | "Fri" | "Sat" | "Sun"
1238
1239 weekday = "Monday" | "Tuesday" | "Wednesday"
1240 | "Thursday" | "Friday" | "Saturday" | "Sunday"
1241
1242 month = "Jan" | "Feb" | "Mar" | "Apr"
1243 | "May" | "Jun" | "Jul" | "Aug"
1244 | "Sep" | "Oct" | "Nov" | "Dec"
1245
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
1249 logging, etc.
1250
1251 Additional rules for requirements on parsing and representation of dates
1252 and other potential problems with date representations include:
1253
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).
1257
1258 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 20]
1259
1260
1261
1262
1263 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1264
1265
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
1269 value.
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.
1276
1277
1278
1279
1280 7.3.2 Delta Seconds
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.
1285
1286 delta-seconds = 1*DIGIT
1287
1288
1289 7.4 Character Sets
1290 HTTP uses the same definition of the term "character set" as that
1291 described for MIME:
1292
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.
1306
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
1310 be shared.
1311
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.
1320
1321 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 21]
1322
1323
1324
1325
1326 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1327
1328
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
1336
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.
1342
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
1346 ISO-8859-1.
1347
1348
1349 7.5 Content Codings
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
1355 analogous usage.
1356
1357 content-coding = "gzip" | "x-gzip"
1358 | "compress" | "x-compress" | token
1359
1360 Note: For historical reasons, HTTP applications SHOULD consider "x-
1361 gzip" and "x-compress" to be equivalent to "gzip" and "compress",
1362 respectively.
1363
1364 All content-coding values are case-insensitive. HTTP/1.1 uses content-
1365 coding values in the Accept-Encoding (section 18.3) and
1366 Content-Encoding
1367 (section 18.13) header fields. Although the value describes the
1368 content-
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:
1373
1374
1375 gzip
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.
1379
1380 compress
1381 The encoding format produced by the file compression program
1382 "compress". This format is an adaptive Lempel-Ziv-Welch coding
1383 (LZW).
1384
1385
1386 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 22]
1387
1388
1389
1390
1391 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1392
1393
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,
1397 not good design.
1398
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.
1408
1409
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
1415 message,
1416 not of the original resource entity.
1417
1418 transfer-coding = "chunked" | transfer-extension
1419
1420 transfer-extension = token
1421
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).
1424
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.
1432
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
1437 501(Unimplemented),
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.
1448
1449
1450
1451 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 23]
1452
1453
1454
1455
1456 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1457
1458
1459 Chunked-Body = *chunk
1460 "0" CRLF
1461 footer
1462 CRLF
1463
1464 chunk = chunk-size [ chunk-ext ] CRLF
1465 chunk-data CRLF
1466
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)
1472
1473 footer = *<<Content-MD5 and future headers that specify
1474 they are allowed in footer>>
1475
1476 hex-no-zero = <HEX excluding "0">
1477
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.
1481
1482
1483 7.7 Media Types
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.
1487
1488 media-type = type "/" subtype *( ";" parameter )
1489 type = token
1490 subtype = token
1491
1492 Parameters may follow the type/subtype in the form of attribute/value
1493 pairs.
1494
1495 parameter = attribute "=" value
1496 attribute = token
1497 value = token | quoted-string
1498
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
1505 not present.
1506
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.
1510
1511
1512
1513
1514 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 24]
1515
1516
1517
1518
1519 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1520
1521
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.
1525
1526
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..
1532
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
1546 boundaries).
1547
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.
1550
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.
1558
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.
1565
1566
1567
1568
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
1576
1577 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 25]
1578
1579
1580
1581
1582 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1583
1584
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.
1588
1589 In HTTP, multipart body-parts MAY contain header fields which are
1590 significant to the meaning of that part.
1591
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".
1596
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 .
1600
1601
1602
1603
1604 7.8 Product Tokens
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.
1611
1612 product = token ["/" product-version]
1613 product-version = token
1614
1615 Examples:
1616
1617 User-Agent: CERN-LineMode/2.15 libwww/2.17b3
1618 Server: Apache/0.8.4
1619
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
1625 the product value).
1626
1627
1628 7.9 Quality Values
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.
1636
1637 qvalue = ( "0" [ "." 0*3DIGIT ] )
1638 | ( "1" [ "." 0*3("0") ] )
1639
1640 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 26]
1641
1642
1643
1644
1645 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1646
1647
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.
1652
1653
1654 7.10 Language Tags
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
1659 fields.
1660
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
1664 subtags:
1665
1666 language-tag = primary-tag *( "-" subtag )
1667
1668 primary-tag = 1*8ALPHA
1669 subtag = 1*8ALPHA
1670
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:
1674
1675 en, en-US, en-cockney, i-cherokee, x-pig-latin
1676
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.)
1681
1682
1683 7.11 Entity Tags
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
1686 HTTP/1.1.
1687
1688 entity-tag = strong-entity-tag | weak-entity-tag
1689 | null-entity-tag
1690 strong-entity-tag = quoted-string
1691 weak-entity-tag = quoted-string "/W"
1692 null-entity-tag = <"> <">
1693
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.
1696
1697 There are two comparison functions on validators:
1698
1699 . The strong comparison function: in order to be considered equal,
1700 both validators must be identical in every way, and neither may be
1701 weak.
1702
1703 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 27]
1704
1705
1706
1707
1708 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1709
1710
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
1716 cases.
1717
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.
1721
1722
1723 7.12 Variant IDs
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
1731 cache).
1732
1733 For these reasons, the HTTP protocol provides an optional mechanism for
1734 identifying a specific entity source of a generic resource, called a
1735 variant-ID.
1736
1737 Variant-IDs are used to identify specific variants of a generic
1738 resource; see section 16.5.3 for how they are used.
1739
1740 variant-id = quoted-string
1741
1742 Variant-IDs are compared using string octet-equality; case is
1743 significant.
1744
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.
1749
1750
1751
1752
1753 7.13 Variant Sets
1754 Validator sets are used for doing conditional retrievals on generic
1755 resources; see section 16.5.3.
1756
1757 variant-set = 1#variant-set-item
1758 variant-set-item = opaque-validator ";" variant-id
1759
1760
1761 7.14 Range Protocol Parameters
1762 This section defines certain HTTP protocol parameters used in range
1763 requests and related responses.
1764
1765
1766 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 28]
1767
1768
1769
1770
1771 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1772
1773
1774 7.14.1 Range Units
1775 A resource entity may be broken down into subranges according to various
1776 structural units.
1777
1778 range-unit = bytes-unit | other-range-unit
1779
1780 bytes-unit = "bytes"
1781 other-range-unit = token
1782
1783 The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
1784 implementations may ignore ranges specified using other units.
1785
1786
1787 7.14.2 Byte Ranges
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
1791 operations.)
1792
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
1795 applied.
1796
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.
1804
1805 A byte range operation may specify a single range of bytes, or a set of
1806 ranges within a single entity.
1807
1808 ranges-specifier = byte-ranges-specifier
1809
1810 byte-ranges-specifier = bytes-unit "=" byte-range-set
1811
1812 byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec )
1813
1814 byte-range-spec = first-byte-pos "-" [last-byte-pos]
1815
1816 first-byte-pos = 1*DIGIT
1817
1818 last-byte-pos = 1*DIGIT
1819
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.
1824
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.
1828
1829 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 29]
1830
1831
1832
1833
1834 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1835
1836
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.
1839
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.
1842
1843 suffix-byte-range-spec = "-" suffix-length
1844
1845 suffix-length = 1*DIGIT
1846
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.
1851
1852 Examples of byte-ranges-specifier values (assuming an entity of length
1853 10000):
1854
1855 . The first 500 bytes (byte offsets 0-499, inclusive):
1856 bytes=0-499
1857
1858 . The second 500 bytes (byte offsets 500-999, inclusive):
1859 bytes=500-999
1860
1861 . The final 500 bytes (byte offsets 9500-9999, inclusive):
1862 bytes=-500
1863
1864 . Or
1865 bytes=9500-
1866
1867 . The first and last bytes only (bytes 0 and 9999):
1868 bytes=0-0,-1
1869
1870 . Several legal but not canonical specifications of the second 500
1871 bytes (byte offsets 500-999, inclusive):
1872 bytes=500-600,601-999
1873
1874 bytes=500-700,601-999
1875
1876
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
1880 the entire entity.
1881
1882 content-range-spec = byte-content-range-spec
1883
1884 byte-content-range-spec = bytes-unit SP first-byte-pos "-"
1885 last-byte-pos "/" entity-length
1886
1887 entity-length = 1*DIGIT
1888
1889
1890
1891
1892 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 30]
1893
1894
1895
1896
1897 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1898
1899
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.
1903
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
1908 with it.
1909
1910 Examples of byte-content-range-spec values, assuming that the entity
1911 contains a total of 1234 bytes:
1912
1913 . The first 500 bytes:
1914 bytes 0-499/1234
1915
1916 . The second 500 bytes:
1917 bytes 500-999/1234
1918
1919 . All except for the first 500 bytes:
1920 bytes 500-1233/1234
1921
1922 . The last 500 bytes:
1923 bytes 734-1233/1234
1924
1925
1926 8 HTTP Message
1927
1928 8.1 Message Types
1929 HTTP messages consist of requests from client to server and responses
1930 from server to client.
1931
1932 HTTP-message = Full-Request ; HTTP/1.1 messages
1933 | Full-Response
1934
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).
1940
1941
1942 8.2 Message Headers
1943 HTTP header fields, which include General-Header (Section 8.3),
1944 Request-
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.
1952
1953 HTTP-header = field-name ":" [ field-value ] CRLF
1954
1955
1956 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 31]
1957
1958
1959
1960
1961 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
1962
1963
1964 field-name = token
1965 field-value = *( field-content | LWS )
1966
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>
1970
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.
1975
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:
1980 field-value"
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
1985 field-
1986 value.
1987
1988
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
1993 transmitted.
1994
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
2002
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
2007 fields.
2008 Unrecognized header fields are treated as Entity-Header fields.
2009
2010
2011 9 Request
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:
2017
2018 Request = Full-Request
2019
2020
2021
2022 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 32]
2023
2024
2025
2026
2027 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2028
2029
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
2034 CRLF
2035 [ Entity-Body ] ; Section 11.2
2036
2037
2038
2039
2040 9.1 Request-Line
2041 The Request-Line begins with a method token, followed by the
2042 Request-URI
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
2045 CRLF sequence.
2046
2047 Request-Line = CRLF | Method SP Request-URI SP HTTP-Version CRLF
2048
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.
2052
2053
2054 9.1.1 Method
2055 The Method token indicates the method to be performed on the resource
2056 identified by the Request-URI. The method is case-sensitive.
2057
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
2065 | extension-method
2066
2067 extension-method = token
2068
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).
2078
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
2082 optional;
2083 however, if the above methods are implemented, they MUST be implemented
2084 with the same semantics as those specified in section 13.
2085
2086 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 33]
2087
2088
2089
2090
2091 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2092
2093
2094 9.1.2 Request-URI
2095 The Request-URI is a Uniform Resource Identifier (section 7.2) and
2096 identifies the resource upon which to apply the request.
2097
2098 Request-URI = "*" | absoluteURI | abs_path
2099
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
2104 would be
2105
2106 OPTIONS * HTTP/1.1
2107
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
2115 be:
2116
2117 GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
2118
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.
2124
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:
2132
2133 GET /pub/WWW/TheProject.html HTTP/1.1
2134 Host:www.w3.org
2135
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).
2139
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
2144
2145 OPTIONS http://www.ics.uci.edu:8001 HTTP/1.1
2146
2147 would be forwarded by the proxy as
2148
2149 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 34]
2150
2151
2152
2153
2154 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2155
2156
2157 OPTIONS * HTTP/1.1
2158 Host: www.ics.uci.edu:8001
2159
2160 after connecting to port 8001 of host "www.ics.uci.edu".
2161
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
2168 Request-URIs
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.
2172
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.
2181
2182
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:.
2192
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
2195 ignored.
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
2198 field.
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.
2206
2207
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
2212 equivalent
2213
2214
2215 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 35]
2216
2217
2218
2219
2220 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2221
2222
2223 to the parameters on a programming language method (procedure)
2224 invocation.
2225
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
2240
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
2245 fields.
2246 Unrecognized header fields are treated as Entity-Header fields.
2247
2248
2249 10 Response
2250 After receiving and interpreting a request message, a server responds in
2251 the form of an HTTP response message.
2252
2253 Response = Full-Response
2254
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
2259 CRLF
2260 [ Entity-Body ] ; Section 11.2
2261
2262
2263 10.1 Status-Line
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
2267 characters.
2268 No CR or LF is allowed except in the final CRLF sequence.
2269
2270 Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
2271
2272
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
2278
2279
2280 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 36]
2281
2282
2283
2284
2285 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2286
2287
2288 human user. The client is not required to examine or display the
2289 Reason-
2290 Phrase.
2291
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:
2295
2296
2297 . 1xx: Informational - Request received, continuing process
2298
2299 . 2xx: Success - The action was successfully received, understood,
2300 and accepted
2301
2302 . 3xx: Redirection - Further action must be taken in order to
2303 complete the request
2304
2305 . 4xx: Client Error - The request contains bad syntax or cannot be
2306 fulfilled
2307
2308 . 5xx: Server Error - The server failed to fulfill an apparently
2309 valid request
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.
2315
2316 Status-Code = "100" ; Continue
2317 | "101" ; Switching Protocols
2318 | "200" ; OK
2319 | "201" ; Created
2320 | "202" ; Accepted
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
2328 | "303" ; See Other
2329 | "304" ; Not Modified
2330 | "305" ; Use Proxy
2331 | "400" ; Bad Request
2332 | "401" ; Unauthorized
2333 | "402" ; Payment Required
2334 | "403" ; Forbidden
2335 | "404" ; Not Found
2336 | "405" ; Method Not Allowed
2337 | "406" ; Not Acceptable
2338 | "407" ; Proxy Authentication Required
2339 | "408" ; Request Time-out
2340 | "409" ; Conflict
2341 | "410" ; Gone
2342 | "411" ; Length Required
2343
2344 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 37]
2345
2346
2347
2348
2349 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2350
2351
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
2362 | extension-code
2363
2364 extension-code = 3DIGIT
2365
2366 Reason-Phrase = *<TEXT, excluding CR, LF>
2367
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
2380 unusual status.
2381
2382
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.
2388
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
2395
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.
2401
2402
2403 11 Entity
2404 Full-Request and Full-Response messages MAY transfer an entity within
2405 some requests and responses. An entity consists of Entity-Header fields
2406
2407 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 38]
2408
2409
2410
2411
2412 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2413
2414
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.
2418
2419
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
2423 request.
2424
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
2438 | extension-header
2439
2440 extension-header = HTTP-header
2441
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.
2446
2447
2448 11.2 Entity Body
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.
2451
2452 Entity-Body = *OCTET
2453
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
2457 Content-
2458 Type header field in the request message headers.
2459
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
2467 zero (0).
2468
2469
2470
2471 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 39]
2472
2473
2474
2475
2476 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2477
2478
2479 11.2.1 Type
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,
2482 Content-Encoding,
2483 and Transfer-Encoding. These define a three-layer, ordered encoding
2484 model:
2485
2486 entity-body :=
2487 Transfer-Encoding( Content-Encoding( Content-Type( data ) ) )
2488
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
2497 entity.
2498
2499 Any HTTP/1.1 message containing an entity body SHOULD include a
2500 Content-
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".
2507
2508
2509 11.2.2 Length
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.
2516
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
2521 the message.
2522
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.
2531
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
2535
2536 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 40]
2537
2538
2539
2540
2541 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2542
2543
2544 (length required) if it wishes to insist on receiving a valid Content-
2545 Length.
2546
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
2549 be ignored.
2550
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.
2555
2556
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
2560 response.
2561
2562
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.
2569
2570
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.
2578
2579
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
2586 response.
2587
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.
2592
2593
2594 12.2 Successful 2xx
2595 This class of status code indicates that the client's request was
2596 successfully received, understood, and accepted.
2597
2598
2599 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 41]
2600
2601
2602
2603
2604 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2605
2606
2607 12.2.1.1 200 OK
2608 The request has succeeded. The information returned with the response is
2609 dependent on the method used in the request, as follows:
2610
2611
2612 GET
2613 an entity corresponding to the requested resource is sent in the
2614 response;
2615
2616 HEAD
2617 the response MUST only contain the header information and no Entity-
2618 Body;
2619
2620 POST
2621 an entity describing or containing the result of the action;
2622
2623 TRACE
2624 an entity containing the request message as received by the end
2625 server;
2626
2627 otherwise,
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.
2632
2633
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).
2643
2644
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
2650 such as this.
2651
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
2659 to be fulfilled.
2660
2661
2662 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 42]
2663
2664
2665
2666
2667 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2668
2669
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).
2678
2679
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
2688 view.
2689
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.
2692
2693
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
2701 body.
2702
2703
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.
2715
2716
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.
2724
2725 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 43]
2726
2727
2728
2729
2730 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2731
2732
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.
2740
2741
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.
2749
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
2753 the new URI(s).
2754
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.
2759
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.
2763
2764
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.
2770
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
2774 the new URI(s).
2775
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.
2780
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.
2784
2785
2786
2787
2788 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 44]
2789
2790
2791
2792
2793 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2794
2795
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.
2803
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
2807 the new URI(s).
2808
2809
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.
2820
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.
2827
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.
2830
2831
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
2835 redirect.
2836
2837
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.
2846
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
2850
2851 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 45]
2852
2853
2854
2855
2856 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2857
2858
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
2863 application.
2864
2865
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.
2869
2870
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.
2883
2884
2885 12.4.1.3 402 Payment Required
2886 This code is reserved for future use.
2887
2888
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.
2897
2898
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.
2907
2908
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.
2913
2914 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 46]
2915
2916
2917
2918
2919 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2920
2921
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.
2926
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.
2936
2937
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.
2945
2946
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.
2951
2952
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.
2962
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.
2970
2971
2972 12.4.1.11 410 Gone
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
2976
2977 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 47]
2978
2979
2980
2981
2982 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
2983
2984
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.
2989
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.
2998
2999
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
3004 request message.
3005
3006
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.
3013
3014
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.
3020
3021 If the client manages to read the 413 response, it MUST honor it and
3022 SHOULD reflect it to the user.
3023
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.
3027
3028
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
3038 Request-URI.
3039
3040 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 48]
3041
3042
3043
3044
3045 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3046
3047
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.
3052
3053
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
3063 fields.
3064
3065
3066 12.5.1.1 500 Internal Server Error
3067 The server encountered an unexpected condition which prevented it from
3068 fulfilling the request.
3069
3070
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
3075 resource.
3076
3077
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
3081 the request.
3082
3083
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
3089 header.
3090 If no Retry-After is given, the client SHOULD handle the response as it
3091 would for a 500 response.
3092
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.
3096
3097
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
3101 the request.
3102
3103
3104 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 49]
3105
3106
3107
3108
3109 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3110
3111
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.
3120
3121
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.
3126
3127 The Host request-header field (section 18.24) MUST accompany all
3128 HTTP/1.1 requests.
3129
3130
3131 13.1 OPTIONS
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.
3138
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.
3144
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.
3153
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
3156 resource.
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
3163 through that proxy.
3164
3165
3166
3167
3168 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 50]
3169
3170
3171
3172
3173 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3174
3175
3176 13.2 GET
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.
3182
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
3187 If-
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.
3192
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.
3199
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.
3202
3203
3204 13.3 HEAD
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.
3213
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.
3220
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
3224 ignored.
3225
3226
3227 13.4 POST
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
3230
3231
3232 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 51]
3233
3234
3235
3236
3237 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3238
3239
3240 identified by the Request-URI in the Request-Line. POST is designed to
3241 allow a uniform method to cover the following functions:
3242
3243
3244 . Annotation of existing resources;
3245
3246 . Posting a message to a bulletin board, newsgroup, mailing list, or
3247 similar group of articles;
3248
3249 . Providing a block of data, such as the result of submitting a form
3250 , to a data-handling process;
3251
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.
3258
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.
3267
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
3274 result.
3275
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
3279 resource.
3280
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
3283 resource.
3284
3285 POST requests must obey the entity transmission requirements set out in
3286 section 13.4.1.
3287
3288
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
3293
3294
3295 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 52]
3296
3297
3298
3299
3300 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3301
3302
3303 normal situation. We would like it if we can redraft this section to be
3304 simpler in the next draft
3305
3306 General requirements:
3307
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
3312 congestion.
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.
3334
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,
3340
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:
3352
3353 1.
3354 Initiate a new connection to the server
3355 2.
3356 Transmit the request headers
3357 3.
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
3360
3361 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 53]
3362
3363
3364
3365
3366 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3367
3368
3369 connection), or to a constant value of 5 seconds if the round-trip
3370 time is not available.
3371 4.
3372 Compute T = R * (2**N), where N is the number of previous retries
3373 of this request.
3374 5.
3375 Wait either for an error response from the server, or for T seconds
3376 (whichever comes first)
3377 6.
3378 If no error response is received, after T seconds transmit the body
3379 of the request.
3380 7.
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,
3385
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
3389 transmit the body.
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).
3394
3395
3396 13.5 PUT
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)
3405 response.
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.
3411
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.
3415
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.
3427
3428
3429 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 54]
3430
3431
3432
3433
3434 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3435
3436
3437 A single resource MAY be identified by many different URIs. For
3438 example,
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
3441 case,
3442 a PUT request on a general URI may result in several other URIs being
3443 defined by the origin server.
3444
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.
3453
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
3456 server.
3457
3458 PUT requests must obey the entity transmission requirements set out in
3459 section 13.4.1.
3460
3461
3462 13.6 DELETE
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.
3471
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
3475 include an entity.
3476
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.
3480
3481
3482 13.7 TRACE
3483 The TRACE method is used to invoke a remote, application-layer
3484 loop-back
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
3490 entity.
3491
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
3494
3495 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 55]
3496
3497
3498
3499
3500 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3501
3502
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.
3508
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
3512 be cached.
3513
3514
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.
3522
3523 auth-scheme = token
3524
3525 auth-param = token "=" quoted-string
3526
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.
3531
3532 challenge = auth-scheme 1*SP realm *( "," auth-param )
3533
3534 realm = "realm" "=" realm-value
3535 realm-value = quoted-string
3536
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.
3546
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.
3553
3554 credentials = basic-credentials
3555 | auth-scheme 0#auth-param
3556
3557
3558 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 56]
3559
3560
3561
3562
3563 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3564
3565
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.
3573
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.
3579
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.
3586
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.
3591
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.
3594
3595
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.
3604
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:
3607
3608 WWW-Authenticate: Basic realm="WallyWorld"
3609
3610 where "WallyWorld" is the string assigned by the server to identify the
3611 protection space of the Request-URI.
3612
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.
3616
3617 basic-credentials = "Basic" SP basic-cookie
3618
3619
3620
3621 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 57]
3622
3623
3624
3625
3626 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3627
3628
3629 basic-cookie = <base64 [7] encoding of user-pass,
3630 except not limited to 76 char/line>
3631
3632 user-pass = userid ":" password
3633
3634 userid = [ token ]
3635
3636 password = *TEXT
3637
3638 If the user agent wishes to send the user-ID "Aladdin" and password
3639 "open sesame", it would use the following header field:
3640
3641 Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
3642
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.
3650
3651
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].
3656
3657
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.
3665
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
3676
3677 Accept: text/*: q=0.3, text/html, */*: q=0.5
3678
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.
3683
3684 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 58]
3685
3686
3687
3688
3689 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3690
3691
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.
3700
3701
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].
3710
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.
3719
3720
3721 16 Caching in HTTP
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.
3730
3731
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
3740 be relaxed
3741
3742 . without an explicit protocol-level request (when relaxed by client
3743 or origin server)
3744 . without a means for warning the end user (when relaxed by cache or
3745 client)
3746
3747 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 59]
3748
3749
3750
3751
3752 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3753
3754
3755 Therefore, the HTTP/1.1 protocol provides these important elements:
3756
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.
3765
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).
3774
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.
3780
3781
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:
3786
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
3796 origin-
3797 server alone.
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.
3806
3807
3808
3809
3810
3811 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 60]
3812
3813
3814
3815
3816 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3817
3818
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.
3824
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").
3833
3834 The Cache-Control directives are described in detail in section 18.10.
3835
3836
3837 16.1.3 Warnings
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
3841 appropriate action.
3842
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.
3846
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.
3851
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.
3855
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.
3859
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.
3864
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
3869 heuristics.
3870
3871 The Warning header and the currently defined warnings are described in
3872 section 18.48.
3873
3874
3875 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 61]
3876
3877
3878
3879
3880 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3881
3882
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.
3894
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.
3904
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.
3910
3911
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.
3920
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.
3925
3926
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-
3933 Control header.
3934
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
3937
3938 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 62]
3939
3940
3941
3942
3943 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
3944
3945
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.
3950
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
3955 poor connectivity.
3956
3957
3958 16.2 Expiration Model
3959
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.
3967
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.
3973
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).
3979
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.
3983
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.
3987
3988 Servers specify explicit expiration times using either the Expires
3989 header, or the max-age directive of the Cache-Control header.
3990
3991
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.
3997
3998 User agents often have history mechanisms, such as "Back" buttons and
3999 history lists, which can be used to redisplay an entity retrieved
4000
4001 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 63]
4002
4003
4004
4005
4006 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4007
4008
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
4013 documents.
4014
4015
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
4020 time)
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
4026 possible.
4027
4028
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.
4034
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.
4040
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
4045 operations.
4046
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
4052 original response.
4053
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
4057 paths.
4058
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.
4061
4062 An response's age can be calculated in two entirely independent ways:
4063
4064
4065
4066 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 64]
4067
4068
4069
4070
4071 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4072
4073
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
4078 HTTP/1.1.
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
4081
4082 corrected_received_age = max(now - date_value, age_value)
4083
4084 and as long as we have either nearly synchronized clocks or
4085 all-HTTP/1.1
4086 paths, one gets a reliable (conservative) result.
4087
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
4092 (although
4093 it is good to have), and there is no explicit clock synchronization
4094 step.
4095
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.
4100
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:
4108
4109 corrected_initial_age = corrected_received_age
4110 + (now - request_time)
4111
4112 where "request_time" is the time (according to the local clock) when the
4113 request that elicited this response was sent.
4114
4115 Summary of age calculation algorithm, when a cache receives a response:
4116
4117 /*
4118 * age_value
4119 * is the value of Age: header received by the cache with
4120 * this response.
4121 * date_value
4122 * is the value of the origin server's Date: header
4123 * request_time
4124 * is the (local) time when the cache made the request
4125 * that resulted in this cached response
4126 * response_time
4127 * is the (local) time when the cache received the
4128 * response
4129 * now
4130
4131 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 65]
4132
4133
4134
4135
4136 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4137
4138
4139 * is the current (local) time
4140 */
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;
4147
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
4151 cache.
4152
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.
4156
4157
4158
4159
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.
4165
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).
4171
4172 The max-age directive takes priority over Expires, so if max-age is
4173 present in a response, the calculation is simply:
4174
4175 freshness_lifetime = max_age_value
4176
4177 Otherwise, if Expires is present in the response, the calculation is:
4178
4179 freshness_lifetime = expires_value - date_value
4180
4181 Note that neither of these calculations is vulnerable to clock skew,
4182 since all of the information comes from the origin server.
4183
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.
4189
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%.
4193
4194 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 66]
4195
4196
4197
4198
4199 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4200
4201
4202 The calculation to determine if a response has expired is quite simple:
4203
4204 response_is_fresh = (freshness_lifetime > current_age)
4205
4206
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.
4213
4214 Editor's note: This restriction may be dropped in the next draft; there
4215 are still discussions about whether this restriction is needed.
4216
4217
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
4221 different.
4222
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.
4229
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.
4233
4234
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.
4242
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.
4248
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
4253
4254 Cache-Control: max-age=0
4255
4256
4257 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 67]
4258
4259
4260
4261
4262 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4263
4264
4265 to force any intermediate caches to validate their copies directly with
4266 the origin server, or
4267
4268 Cache-Control: no-cache
4269
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
4272 caches.
4273
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.
4279
4280
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
4286 entry.
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.
4291
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.
4298
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.
4302 Otherwise,
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.
4306
4307 Note: the comparison functions used to decide if validators match
4308 are defined in section 16.3.3.
4309
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.
4314
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.
4319
4320
4321
4322 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 68]
4323
4324
4325
4326
4327 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4328
4329
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
4335 expires.
4336
4337
4338
4339
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
4345 was generated.
4346
4347
4348 16.3.2 Entity Tags
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
4355 modification dates.
4356
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
4361 entry,
4362 it may compare entity tags using strict octet-equality. Otherwise,
4363 entity tags have no semantic value to clients or caches.
4364
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
4368 feasible.
4369
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,
4372 and 18.46.
4373
4374
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
4381 "strong validator."
4382
4383 However, there may be cases when a server prefers to change the
4384 validator only on semantically significant changes, and not when
4385
4386 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 69]
4387
4388
4389
4390
4391 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4392
4393
4394 insignificant aspects of the resource entity change. A validator that
4395 does not always change when the resource changes is a "weak validator."
4396
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
4402 entities.
4403
4404 Note: One example of a strong validator is an integer that is
4405 incremented in stable storage every time an entity is changed.
4406
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.
4410
4411 Entity tags are normally "strong validators," but the protocol provides
4412 a mechanism to tag an entity tag as "weak."
4413
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.
4417
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.
4424
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
4428 not:
4429
4430 . The strong comparison function: in order to be considered equal,
4431 both validators must be identical in every way, and neither may be
4432 weak.
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
4438 cases.
4439
4440 An entity tag is strong unless it is explicitly tagged as weak. Section
4441 16.3 gives the syntax for entity tags.
4442
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:
4446
4447 . The validator is being compared by an origin server to the actual
4448 current validator for the entity and,
4449
4450 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 70]
4451
4452
4453
4454
4455 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4456
4457
4458 . That origin server reliably knows that the associated entity did
4459 not change twice during the second covered by the presented
4460 validator. or
4461
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
4468 Date value. or
4469
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
4475 Date value.
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
4484 short.
4485
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.
4489
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.
4493
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
4496 servers.
4497
4498
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,
4501 clients,
4502 and caches regarding when various validator types should be used, and
4503 for what purposes.
4504
4505 HTTP/1.1 origin servers:
4506
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.
4511
4512 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 71]
4513
4514
4515
4516
4517 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4518
4519
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.
4527
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
4531 significant way.
4532
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.
4541
4542 HTTP/1.1 clients:
4543
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
4546 If-NoneMatch).
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).
4563
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.
4569
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
4574
4575 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 72]
4576
4577
4578
4579
4580 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4581
4582
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.
4586
4587
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
4595 cache entry.
4596
4597
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.
4605
4606
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:
4610
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:
4619
4620 . Connection
4621 . Keep-Alive
4622 . Upgrade
4623 . Public
4624 . Proxy-Authenticate
4625 . Transfer-Encoding
4626 All other headers defined by HTTP/1.1 are end-to-end headers.
4627
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.
4630
4631
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.
4637
4638 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 73]
4639
4640
4641
4642
4643 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4644
4645
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
4648 already present:
4649
4650 . Content-Type
4651 . Content-Encoding
4652 . Content-Length
4653 . Expires
4654 . Last-Modified
4655 . Content-Range
4656 . Content-Location
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.
4661
4662
4663
4664
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.
4674
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
4678 set.
4679
4680 A cache MUST preserve the order of all headers as received in an
4681 incoming response.
4682
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.
4687
4688
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.
4694
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
4698 met:
4699
4700
4701 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 74]
4702
4703
4704
4705
4706 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4707
4708
4709 . Both the incoming response and the cache entry must have a cache
4710 validator.
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.
4717
4718
4719 16.5 Caching and Generic Resources
4720 Generic resources interacts with caching in several ways:
4721
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.
4726
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
4734 response-header.
4735
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).
4742
4743
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.
4752
4753
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.).
4761
4762
4763
4764 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 75]
4765
4766
4767
4768
4769 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4770
4771
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.
4784
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
4790 requester's cache.
4791
4792 The client MAY choose to transmit only a subset of the (cache-
4793 validator, variant-ID) tuples corresponding to its cache entries
4794 for this resource.
4795
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
4798 (either
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
4806 unconditional.
4807
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.
4814
4815
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
4824
4825
4826
4827
4828 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 76]
4829
4830
4831
4832
4833 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4834
4835
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
4846 used.
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.
4853
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
4862 them.)
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
4865 of request headers.
4866
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).
4876
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.
4882
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
4889 18.10).
4890
4891 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 77]
4892
4893
4894
4895
4896 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4897
4898
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
4903 caching.
4904
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
4907 following:
4908
4909 . an Expires header
4910 . a max-age Cache-control directive
4911 . a must-revalidate Cache-control directive
4912 . a public Cache-control directive
4913
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
4921 18.10).
4922
4923
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.
4932
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.
4938
4939 This specifically means that responses from HTTP/1.0 servers for such
4940 URIs should not be taken from a cache.
4941
4942 See section 19.2 for related information.
4943
4944
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.
4950
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
4953
4954 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 78]
4955
4956
4957
4958
4959 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
4960
4961
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.
4965
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.
4970
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:
4974
4975 . PUT
4976 . DELETE
4977 . POST
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.
4981
4982
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.
4990
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.
4995
4996
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:
5002
5003 Expires: Thu, 01 Jan 1980 00:00:00 GMT
5004
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
5007
5008 Cache-Control: max-age=604800
5009
5010 which overrides the freshness lifetime of zero seconds specified by the
5011 included Expires header.
5012
5013
5014
5015
5016 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 79]
5017
5018
5019
5020
5021 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5022
5023
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.
5029
5030 Note: a new response that has an older Date header value than
5031 existing cached responses is not cacheable.
5032
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.
5037
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
5043 deleted.
5044
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
5050 section 16.4.3.
5051
5052
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.
5057
5058
5059 16.15 History Lists
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
5063 entity.
5064 Rather, a history list is meant to show exactly what the user saw at the
5065 time when the resource was retrieved .
5066
5067 This should not be construed to prohibit the history mechanism from
5068 telling the user that a view may be stale.
5069
5070
5071 17 Persistent Connections
5072
5073 17.1 Purpose
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
5079
5080 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 80]
5081
5082
5083
5084
5085 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5086
5087
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].
5091
5092 Persistent HTTP connections have a number of advantages:
5093
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.
5109
5110
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.
5117
5118
5119 17.2.1 Negotiation
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
5127 connection.
5128
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.)
5134
5135
5136 17.2.2 Pipe-lining
5137 Clients and servers which support persistent connections MAY
5138 "pipe-line"
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
5142 made.
5143
5144 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 81]
5145
5146
5147
5148
5149 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5150
5151
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
5160 responses.
5161
5162
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:
5167
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
5179 are possible.
5180
5181 Clients and servers that support persistent connections MUST correctly
5182 support receiving via all three techniques.
5183
5184
5185 17.3 Proxy Servers
5186 It is especially important that proxies correctly implement the
5187 properties of the Connection header field as specified in 14.2.1.
5188
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
5192 link.
5193
5194 A proxy server MUST NOT establish a persistent connection with an
5195 HTTP/1.0 client.
5196
5197
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"
5203 method).
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
5206 connection header.
5207
5208 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 82]
5209
5210
5211
5212
5213 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5214
5215
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.
5223
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
5229 network.
5230
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
5236 is in progress.
5237
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.
5243
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
5247 suspected.
5248
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.
5256
5257
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.
5263
5264
5265 18.1 Accept
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.
5270
5271 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 83]
5272
5273
5274
5275
5276 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5277
5278
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.
5282
5283 Accept = "Accept" ":" #(
5284 media-range
5285 [ ( ":" | ";" )
5286
5287 range-parameter
5288
5289 *( ";" range-parameter ) ]
5290
5291 | extension-token )
5292
5293 media-range = ( "*/*"
5294 | ( type "/" "*" )
5295 | ( type "/" subtype )
5296 ) *( ";" parameter )
5297
5298 range-parameter = ( "q" "=" qvalue )
5299 | extension-range-parameter
5300
5301 extension-range-parameter = ( token "=" token )
5302
5303 extension-token = token
5304
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.
5313
5314 The example
5315
5316 Accept: audio/*: q=0.2, audio/basic
5317
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."
5320
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.
5327
5328 A more elaborate example is
5329
5330 Accept: text/plain: q=0.5, text/html,
5331 text/x-dvi: q=0.8, text/x-c
5332
5333
5334 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 84]
5335
5336
5337
5338
5339 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5340
5341
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."
5345
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,
5349
5350 Accept: text/*, text/html, text/html;level=1, */*
5351
5352 have the following precedence:
5353
5354 1) text/html;level=1
5355 2) text/html
5356 3) text/*
5357 4) */*
5358
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,
5362
5363 Accept: text/*:q=0.3, text/html:q=0.7, text/html;level=1,
5364 */*:q=0.5
5365
5366 would cause the following values to be associated:
5367
5368 text/html;level=1 = 1
5369 text/html = 0.7
5370 text/plain = 0.3
5371 image/jpeg = 0.5
5372 text/html;level=3 = 0.7
5373
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.
5378
5379
5380
5381
5382 18.2 Accept-Charset
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.
5389
5390 Accept-Charset = "Accept-Charset" ":"
5391
5392 1#( charset [ ";" "q" "=" qvalue ] )
5393
5394
5395
5396
5397 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 85]
5398
5399
5400
5401
5402 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5403
5404
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
5408
5409 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
5410
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.
5417
5418
5419
5420
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
5424 response.
5425
5426 Accept-Encoding = "Accept-Encoding" ":"
5427 #( content-coding )
5428
5429 An example of its use is
5430
5431 Accept-Encoding: compress, gzip
5432
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)
5438 status code.
5439
5440
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
5444 to the request.
5445
5446 Accept-Language = "Accept-Language" ":"
5447 1#( language-range [ ";" "q" "=" qvalue ] )
5448
5449 language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) )
5450 | "*" )
5451
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,
5456
5457 Accept-Language: da, en-gb;q=0.8, en;q=0.7
5458
5459
5460 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 86]
5461
5462
5463
5464
5465 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5466
5467
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
5474 Accept-Language
5475 field, matches every tag not matched by any other ranges present in the
5476 Accept-Language field.
5477
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.
5484
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
5491 Accept-Language
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-
5496 accepted languages.
5497
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
5501 19.7.
5502
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.
5508
5509
5510
5511
5512 18.5 Accept-Ranges
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:
5517
5518 Accept-Ranges = "Accept-Ranges" ":" acceptable-ranges
5519
5520 acceptable-ranges = 1#range-unit | "none"
5521
5522 Origin servers that accept byte-range requests MAY send
5523
5524
5525 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 87]
5526
5527
5528
5529
5530 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5531
5532
5533 Accept-Ranges: bytes
5534
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.
5538
5539 Origin servers that do not accept any kind of range request for a plain
5540 resource MAY send
5541
5542 Accept-Ranges: none
5543
5544 to advise the client not to attempt a range request.
5545
5546
5547 18.6 Age
5548 Caches transmit age values using:
5549
5550 Age = "Age" ":" age-value
5551
5552 age-value = delta-seconds
5553
5554 Age values are non-negative decimal integers, representing time in
5555 seconds.
5556
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..
5562
5563
5564 18.7 Allow
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.
5572
5573 Allow = "Allow" ":" 1#method
5574
5575 Example of use:
5576
5577 Allow: GET, HEAD, PUT
5578
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.
5583
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
5586
5587
5588 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 88]
5589
5590
5591
5592
5593 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5594
5595
5596 is not required to support these methods and SHOULD include an Allow
5597 header in the response giving the actual supported methods.
5598
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.
5602
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
5606 as a whole.
5607
5608
5609 18.8 Alternates
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.
5616
5617 Alternates = "Alternates" ":" opaque-field
5618
5619 opaque-field = field-value
5620
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.
5626
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:
5630
5631 Vary: {accept-headers}
5632
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.
5636
5637
5638 18.9 Authorization
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.
5645
5646 Authorization = "Authorization" ":" credentials
5647
5648
5649
5650
5651 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 89]
5652
5653
5654
5655
5656 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5657
5658
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.
5662
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
5666 exceptions holds:
5667
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.
5680
5681 18.10 Cache-Control
5682 The Cache-Control general-header field is used to specify directives
5683 that MUST be obeyed by all caching mechanisms along the
5684 request/response
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.
5690
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.
5696
5697 Cache-Control = "Cache-Control" ":" 1#cache-directive
5698
5699 cache-directive = "public"
5700 | "private" [ "=" <"> 1#field-name <"> ]
5701 | "no-cache" [ "=" <"> 1#field-name <"> ]
5702 | "no-store"
5703 | "no-transform"
5704 | "must-revalidate"
5705 | "proxy-revalidate"
5706 | "only-if-cached"
5707 | "max-age" "=" delta-seconds
5708 | "max-stale" "=" delta-seconds
5709 | "min-fresh" "=" delta-seconds
5710 | "min-vers" "=" HTTP-Version
5711
5712 When a directive appears without any 1#field-name parameter, the
5713 directive applies to the entire request or response. When such a
5714
5715 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 90]
5716
5717
5718
5719
5720 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5721
5722
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.
5728
5729 The cache-control directives can be broken down into these general
5730 categories:
5731
5732 . Restrictions on what is cachable; these may only be imposed by the
5733 origin server.
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
5744 responses.
5745
5746 Check: is this true?
5747
5748
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.
5759
5760 Note that some HTTP/1.0 caches are known to violate this
5761 expectation without providing any Warning.
5762
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
5767 considerations.
5768 Certain Cache-Control directives are therefore provided so that the
5769 server can indicate that certain resource entities, or portions
5770 thereof,
5771 may not be cached regardless of other considerations.
5772
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.
5776
5777 The following Cache-Control response directives add or remove
5778 restrictions on what is cachable:
5779
5780 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 91]
5781
5782
5783
5784
5785 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5786
5787
5788 public
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.
5793 private
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
5799 directive.
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.
5804
5805
5806 no-cache
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
5810 requests.
5811 Note: HTTP/1.0 caches will not recognize or obey this directive.
5812
5813 TBS: precedence relations between public, private, and no-cache.
5814
5815
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.
5823
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.
5828
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.
5838
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
5841
5842 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 92]
5843
5844
5845
5846
5847 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5848
5849
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
5858 caching.
5859
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
5862 it.
5863
5864
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.
5869
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.
5877
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:
5881
5882
5883 max-age
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.
5888
5889 min-fresh
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.
5894
5895 max-stale
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.
5901
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
5904
5905 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 93]
5906
5907
5908
5909
5910 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5911
5912
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).
5915
5916
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.
5926
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."
5931
5932 The client can specify these three kinds of action using Cache-Control
5933 request directives:
5934
5935
5936 End-to-end reload
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.
5941
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
5947 validator.
5948
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".
5958
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.
5965
5966
5967
5968 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 94]
5969
5970
5971
5972
5973 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
5974
5975
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)
5986 response.
5987
5988 If a request includes the "no-cache" directive, it should not include
5989 "min-fresh", "max-stale", or "max-age".
5990
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
6000 of caches.
6001
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
6010 end-
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.)
6013
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
6017 particular,
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.
6021
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.
6028
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
6032 provided.
6033
6034 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 95]
6035
6036
6037
6038
6039 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6040
6041
6042 The warning MUST be provided on each unvalidated access, and SHOULD
6043 require explicit user confirmation.
6044
6045 The "proxy-revalidate" directive has the same meaning as the "must-
6046 revalidate" directive, except that it does not apply to user-agent
6047 caches.
6048
6049
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
6054 on a slow link.
6055
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.
6061
6062 Note: the use of hop-by-hop compression in conjunction with Range
6063 retrievals may require additional specification in a subsequent
6064 draft.
6065
6066
6067 18.11 Connection
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).
6074
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).
6081
6082 When a client wishes to establish a persistent connection it MUST send a
6083 "Persist" connection-token:
6084
6085 Connection: persist
6086
6087 The Connection header has the following grammar:
6088
6089 Connection-header = "Connection" ":" 1#(connection-token)
6090 connection-token = token
6091
6092
6093
6094
6095
6096
6097 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 96]
6098
6099
6100
6101
6102 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6103
6104
6105 18.12 Content-Base
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.
6109
6110 Content-Base = "Content-Base" ":" absoluteURI
6111
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
6116 entity body.
6117
6118
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.
6127
6128 Content-Encoding = "Content-Encoding" ":"
6129 1#content-coding
6130
6131 Content codings are defined in section 7.5. An example of its use is
6132
6133 Content-Encoding: gzip
6134
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
6138 usage.
6139
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.
6144
6145
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.
6150
6151 Content-Language = "Content-Language" ":" 1#language-tag
6152
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
6158
6159 Content-Language: dk
6160
6161 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 97]
6162
6163
6164
6165
6166 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6167
6168
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.
6173
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
6178
6179 Content-Language: mi, en
6180
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".
6186
6187 Content-Language MAY be applied to any media type -- it SHOULD not be
6188 limited to textual documents.
6189
6190
6191 18.15 Content-Length
6192 The Content-Length entity-header field indicates the size of the
6193 Entity-
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.
6197
6198 Content-Length = "Content-Length" ":" 1*DIGIT
6199
6200 An example is
6201
6202 Content-Length: 3495
6203
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.
6210
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.
6214
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.
6220
6221
6222
6223
6224
6225 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 98]
6226
6227
6228
6229
6230 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6231
6232
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
6240 Content-Location
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.
6245
6246 Content-Location = "Content-Location" ":" absoluteURI
6247
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).
6250
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.
6257
6258
6259 18.17 Content-MD5
6260 The Content-MD5 entity-header field is an MD5 digest of the
6261 entity-body,
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.)
6266
6267 ContentMD5 = "Content-MD5" ":" md5-digest
6268
6269 md5-digest = <base64 of 128 bit MD5 digest as per RFC
6270 1864>
6271
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
6277 proxies,
6278 MAY check that the digest value in this header field matches that of the
6279 entity-body as received.
6280
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.
6286
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.
6290
6291
6292 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 99]
6293
6294
6295
6296
6297 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6298
6299
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
6303 paragraph.
6304
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.
6315
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.
6331
6332
6333
6334
6335 18.18 Content-Range
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.
6339
6340 Content-Range = "Content-Range" ":" content-range-spec
6341
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,
6347
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
6354
6355 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 100]
6356
6357
6358
6359
6360 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6361
6362
6363 18.18.1 MIME multipart/byteranges Content-type
6364 When an HTTP message includes the content of multiple ranges (for
6365
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".
6370
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.
6374
6375 For example:
6376
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
6382
6383 --THIS_STRING_SEPARATES
6384 Content-type: application/pdf
6385 Content-range: bytes 500-999/8000
6386
6387 ...the first range...
6388 --THIS_STRING_SEPARATES
6389 Content-type: application/pdf
6390 Content-range: bytes 7000-7999/8000
6391
6392 ...the second range
6393 --THIS_STRING_SEPARATES_
6394
6395
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.
6399
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.
6402
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.
6409
6410
6411 18.19 Content-Type
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.
6415
6416 Content-Type = "Content-Type" ":" media-type
6417
6418
6419 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 101]
6420
6421
6422
6423
6424 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6425
6426
6427 Media types are defined in section 7.7. An example of the field is
6428
6429 Content-Type: text/html; charset=ISO-8859-4
6430
6431 Further discussion of methods for identifying the media type of an
6432 entity is provided in section 11.2.1.
6433
6434
6435 18.20 Date
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.
6439
6440 Date = "Date" ":" HTTP-date
6441
6442 An example is
6443
6444 Date: Tue, 15 Nov 1994 08:12:31 GMT
6445
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.
6457
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.
6461
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)
6465 usage.
6466
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.
6471
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.
6474
6475
6476
6477
6478 18.21 ETag
6479 The ETag header is used to transmit entity tags with variant id's in
6480 HTTP/1.1 responses.
6481
6482 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 102]
6483
6484
6485
6486
6487 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6488
6489
6490 ETag = "ETag" ":" etag-info
6491 etag-info = entity-tag [ ";" variant-id ]
6492
6493 Examples:
6494
6495 ETag: "xyzzy"
6496 ETag: "xyzzy"/W
6497 ETag: "xyzzy";"3"
6498 ETag: "xyzzy"/W;"3"
6499 ETag: ""
6500
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.
6504
6505
6506 18.22 Expires
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.
6513
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.
6516
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:
6519
6520 Expires = "Expires" ":" HTTP-date
6521
6522 An example of its use is
6523
6524 Expires: Thu, 01 Dec 1994 16:00:00 GMT
6525
6526 Note: if a response includes a Cache-Control field with the max-age
6527 directive, that directive overrides the Expires field.
6528
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
6531 expired").
6532
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.)
6536
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
6540 year in the future.
6541
6542
6543
6544
6545 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 103]
6546
6547
6548
6549
6550 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6551
6552
6553 18.23 From
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 ):
6558
6559 From = "From" ":" mailbox
6560
6561 An example is:
6562
6563 From: webmaster@w3.org
6564
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
6572 the receiving end.
6573
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.
6577
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.
6583
6584
6585 18.24 Host
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.
6594
6595 Host = "Host" ":" host [ ":" port ] ; Section 7.2.2
6596
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
6600 include:
6601
6602 GET /pub/WWW/ HTTP/1.1
6603 Host: www.w3.org
6604
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
6607
6608 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 104]
6609
6610
6611
6612
6613 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6614
6615
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
6621 header field.
6622
6623
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.
6630
6631 If-Modified-Since = "If-Modified-Since" ":" HTTP-date
6632
6633 An example of the field is:
6634
6635 If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
6636
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:
6641
6642
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.
6647
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.
6650
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)
6653 response.
6654 The purpose of this feature is to allow efficient updates of cached
6655 information with a minimum amount of transaction overhead.
6656
6657 Note that the Range request-header field modifies the meaning of
6658 If-Modified-Since; see section 18.38 for full details.
6659
6660 Note that If-Modified-Since is ignored for generic resources.
6661
6662 Note that If-Modified-Since times are interpreted by the server,
6663 whose clock may not be synchronized with the client.
6664
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
6670
6671 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 105]
6672
6673
6674
6675
6676 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6677
6678
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
6687 network latency.
6688
6689
6690
6691
6692 18.26 If-Match
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
6698 were not present.
6699
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
6705 checked it.
6706
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.
6709
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
6719 performed.
6720
6721 If-Match = "If-Match" ":" if-match-rhs
6722 if-match-rhs = opaque-validator | variant-set
6723
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.
6727
6728 Examples of plain resource form:
6729
6730 If-Match: "xyzzy"
6731 If-Match: "xyzzy"/W
6732
6733
6734 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 106]
6735
6736
6737
6738
6739 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6740
6741
6742 Examples of generic resource form:
6743
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"
6747
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.
6750
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.
6755
6756
6757 18.27 If-NoneMatch
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
6763 Entity-Body.
6764
6765 If the entity tags do not match, the server should treat the request as
6766 if the If-NoneMatch header was not present.
6767
6768 See section 18.26 for rules on how to determine if two entity tags
6769 match.
6770
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
6777 If-NoneMatch
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
6781 performed.
6782
6783 If-NoneMatch = "If-NoneMatch" ":" if-nonematch-rhs
6784 if-nonematch-rhs = opaque-validator | variant-set
6785
6786 Examples of plain resource form:
6787
6788 If-NoneMatch: "xyzzy"
6789 If-NoneMatch: "xyzzy"/W
6790
6791 Examples of generic resource form:
6792
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
6796
6797
6798 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 107]
6799
6800
6801
6802
6803 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6804
6805
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
6808 ignored.
6809
6810 The purpose of this feature is to allow efficient updates of cached
6811 information with a minimum amount of transaction overhead.
6812
6813
6814 18.28 If-Range
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.
6821
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
6825 entity.'"
6826
6827 Range-If = "Range-If" ":" (if-valid-rhs | HTTP-date)
6828
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.
6837
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.
6843
6844
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
6850 were not present.
6851
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.
6855
6856 If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
6857
6858 An example of the field is:
6859
6860
6861 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 108]
6862
6863
6864
6865
6866 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6867
6868
6869 If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
6870
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.
6874
6875 If the specified date is invalid, the header is ignored.
6876
6877
6878 18.30 Last-Modified
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.
6885
6886 Last-Modified = "Last-Modified" ":" HTTP-date
6887
6888 An example of its use is
6889
6890 Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
6891
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.
6899
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.
6904
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.
6910
6911
6912 18.31 Location
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.
6920
6921 Location = "Location" ":" absoluteURI
6922
6923
6924 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 109]
6925
6926
6927
6928
6929 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6930
6931
6932 An example is
6933
6934 Location: http://www.w3.org/pub/WWW/People.html
6935
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.
6941
6942
6943 18.32 Max-Forwards
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.
6949
6950 Max-Forwards = "Max-Forwards" ":" 1*DIGIT
6951
6952 The Max-Forwards value is a decimal integer indicating the remaining
6953 number of times this request message may be forwarded.
6954
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).
6964
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.
6968
6969
6970 18.33 Persist
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:
6974
6975 Persist-header = "Persist" ":" 0#pers-param
6976
6977 pers-param = param-name "=" word
6978 param-name = token
6979
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.
6982
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.
6986
6987 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 110]
6988
6989
6990
6991
6992 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
6993
6994
6995 18.34 Pragma
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.
7001
7002 Pragma = "Pragma" ":" 1#pragma-directive
7003
7004 pragma-directive = "no-cache" | extension-pragma
7005 extension-pragma = token [ "=" word ]
7006
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.
7014
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.
7021
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
7024 "Cache-
7025 control: no-cache". No new Pragma directives will be defined in HTTP.
7026
7027
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.
7033
7034 Proxy-Authentication = "Proxy-Authentication" ":" challenge
7035
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
7039 clients.
7040
7041
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.
7048
7049 Proxy-Authorization = "Proxy-Authorization" ":" credentials
7050
7051 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 111]
7052
7053
7054
7055
7056 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7057
7058
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.
7064
7065
7066 18.37 Public
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
7071 Request-
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.
7076
7077 Public = "Public" ":" 1#method
7078
7079 Example of use:
7080
7081 Public: OPTIONS, MGET, MHEAD
7082
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.
7087
7088
7089 18.38 Range
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:
7093
7094 Range = "Range" ":" ranges-specifier
7095
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.
7100
7101 If the server supports the Range header and the specified range or
7102 ranges are appropriate for the entity:
7103
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.
7114
7115 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 112]
7116
7117
7118
7119
7120 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7121
7122
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.
7125
7126
7127 18.39 Referer
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
7135 keyboard.
7136
7137 Referer = "Referer" ":" ( absoluteURI | relativeURI )
7138
7139 Example:
7140
7141 Referer: http://www.w3.org/hypertext/DataSources/Overview.html
7142
7143 If a partial URI is given, it SHOULD be interpreted relative to the
7144 Request-URI. The URI MUST NOT include a fragment.
7145
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
7152 information.
7153
7154
7155 18.40 Retry-After
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.
7161
7162 Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds )
7163
7164 Two examples of its use are
7165
7166 Retry-After: Wed, 14 Dec 1994 18:22:54 GMT
7167 Retry-After: 120
7168
7169 In the latter example, the delay is 2 minutes.
7170
7171
7172 18.41 Server
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
7177
7178 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 113]
7179
7180
7181
7182
7183 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7184
7185
7186 tokens are listed in order of their significance for identifying the
7187 application.
7188
7189 Server = "Server" ":" 1*( product | comment )
7190
7191 Example:
7192
7193 Server: CERN/3.0 libwww/2.17
7194
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).
7198
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
7203 option.
7204
7205
7206 18.42 Title
7207 The Title entity-header field indicates the title of the entity
7208
7209 Title = "Title" ":" *TEXT
7210
7211 An example of the field is
7212
7213 Title: Hypertext Transfer Protocol -- HTTP/1.1
7214
7215 This field is isomorphic with the <TITLE> element in HTML .
7216
7217
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.
7224
7225 Transfer-Encoding = "Transfer-Encoding" ":" 1#transfer- coding
7226
7227 Transfer codings are defined in section 7.6. An example is:
7228
7229 Transfer-Encoding: chunked
7230
7231 Many older HTTP/1.0 applications do not understand the
7232 Transfer-Encoding
7233 header.
7234
7235
7236 18.44 Upgrade
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
7240
7241 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 114]
7242
7243
7244
7245
7246 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7247
7248
7249 Upgrade header field within a 101 (Switching Protocols) response to
7250 indicate which protocol(s) are being switched.
7251
7252 Upgrade = "Upgrade" ":" 1#product
7253
7254 For example,
7255
7256 Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
7257
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
7268 being requested).
7269
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.
7278
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
7282 message.
7283
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.
7287
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.
7293
7294
7295 18.45 User-Agent
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
7303
7304 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 115]
7305
7306
7307
7308
7309 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7310
7311
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
7314 the application.
7315
7316 User-Agent = "User-Agent" ":" 1*( product | comment )
7317
7318 Example:
7319
7320 User-Agent: CERN-LineMode/2.15 libwww/2.17b3
7321
7322
7323 18.46 Vary
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
7333 client.
7334
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.
7340
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).
7346
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
7355 some requests.
7356
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.
7362
7363 Vary = "Vary" ":" 1#selection-parameter
7364
7365
7366
7367 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 116]
7368
7369
7370
7371
7372 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7373
7374
7375 selection-parameter = request-header-name
7376 | "{accept-headers}"
7377 | "{other}"
7378 | "{" extension-parameter "}"
7379
7380 request-header-name = field-name
7381
7382 extension-parameter = token
7383
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.
7390
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
7394 the response.
7395
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
7399 future extensions.
7400
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.
7405
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.
7410
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
7416 response.
7417
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
7421 the cache.
7422
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.
7425
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
7429
7430 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 117]
7431
7432
7433
7434
7435 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7436
7437
7438 header listing the etag-info values in the ETag headers (section Error!
7439 Reference source not found.) of the cached responses which have
7440 variant-
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.
7445
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
7449
7450
7451 . the Vary and Alternates headers of this fresh response specify that
7452 only request header fields are selecting parameters,
7453
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
7457 server,
7458
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.
7466
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.
7471
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
7485 cost/benefit ratio.
7486
7487
7488 18.47 Via
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
7494
7495 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 118]
7496
7497
7498
7499
7500 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7501
7502
7503 request loops, and identifying the protocol capabilities of all senders
7504 along the request/response chain.
7505
7506 Via = "Via" ":" 1#( received-protocol received-by [ comment ]
7507 )
7508
7509 received-protocol = [ protocol-name "/" ] protocol-version
7510 protocol-name = token
7511 protocol-version = token
7512 received-by = ( host [ ":" port ] ) | pseudonym
7513 pseudonym = token
7514
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
7520 to all recipients.
7521
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.
7528
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
7532 applications.
7533
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.
7538
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
7544 header field:
7545
7546 Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
7547
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
7553 that host.
7554
7555 For organizations that have strong privacy requirements for hiding
7556 internal structures, a proxy MAY combine an ordered subsequence of Via
7557
7558 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 119]
7559
7560
7561
7562
7563 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7564
7565
7566 header field entries with identical received-protocol values into a
7567 single such entry. For example,
7568
7569 Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy
7570
7571 could be collapsed to
7572
7573 Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
7574
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.
7579
7580 Note: The Via header field replaces the Forwarded header field
7581 which was present in earlier drafts of this specification.
7582
7583
7584 18.48 Warning
7585 Warning headers are sent with responses using:
7586
7587 Warning = "Warning" ":" warn-code SP warn-agent SP warn-text
7588 warn-code = 2DIGIT
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
7593
7594 A response may carry more than one Warning header.
7595
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
7598 response.
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.
7603
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].
7606
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.
7610 However,
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
7615 relevant response.
7616
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:
7621
7622
7623 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 120]
7624
7625
7626
7627
7628 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7629
7630
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
7635 warn-agents.
7636 Systems that generate multiple Warning headers should order them with
7637 this user-agent behavior in mind.
7638
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.
7641
7642
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.
7647
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.
7653
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.
7657
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.
7662
7663
7664
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.
7670
7671 WWW-Authenticate = "WWW-Authenticate" ":" 1#challenge
7672
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.
7678
7679
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
7684
7685
7686 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 121]
7687
7688
7689
7690
7691 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7692
7693
7694 solutions to the problems revealed, though it does make some suggestions
7695 for reducing security risks.
7696
7697
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.
7706
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.
7711
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.
7715
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.
7726
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.
7736
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
7747
7748
7749 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 122]
7750
7751
7752
7753
7754 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7755
7756
7757 engage in multiple transactions with the client while impersonating the
7758 original server in a way that is not detectable by the client.
7759
7760
7761 19.2 Safe Methods
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.
7766
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.
7773
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.
7779
7780
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.
7789
7790
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.
7799
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.
7804
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.
7810
7811
7812 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 123]
7813
7814
7815
7816
7817 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7818
7819
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.
7826
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
7832 configuration.
7833
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.
7837
7838
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.
7855
7856
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.
7868
7869
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
7874
7875 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 124]
7876
7877
7878
7879
7880 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7881
7882
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.
7889
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
7895 service.
7896
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.
7911
7912
7913 19.8 DNS Spoofing
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.
7920
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.
7928
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
7931 reported by DNS.
7932
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
7936
7937
7938 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 125]
7939
7940
7941
7942
7943 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
7944
7945
7946 attack will grow. Observing this requirement thus reduces this
7947 potential security vulnerability.
7948
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
7952 that strategy.
7953
7954
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.
7961
7962
7963 20 Acknowledgments
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.
7970
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
7980 protocol.
7981
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:
7985
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
8001
8002 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 126]
8003
8004
8005
8006
8007 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8008
8009
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
8018 Allan M. Schiffman
8019
8020
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.
8024
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
8027 and Roy Fielding.
8028
8029 XXX need acks for subgroup work.
8030
8031
8032
8033
8034 21 References
8035
8036 [1] H. Alvestrand. "Tags for the identification of languages." RFC
8037
8038 1766, UNINETT, March 1995.
8039
8040 [2] F. Anklesaria, M. McCahill, P. Lindner, D. Johnson, D. Torrey,
8041 B. Alberti. "The Internet Gopher Protocol: (a distributed document
8042
8043 search and retrieval protocol)", RFC 1436, University of Minnesota,
8044 March 1993.
8045
8046 [3] T. Berners-Lee. "Universal Resource Identifiers in WWW" A
8047
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
8050 1994.
8051
8052 [4] T. Berners-Lee, L. Masinter, M. McCahill.
8053 "Uniform Resource Locators (URL)." RFC 1738, CERN, Xerox PARC,
8054
8055 University of Minnesota, December 1994.
8056
8057 [5] T. Berners-Lee, D. Connolly.
8058 "HyperText Markup Language Specification - 2.0." RFC 1866, MIT/LCS,
8059
8060 November 1995.
8061
8062
8063
8064
8065 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 127]
8066
8067
8068
8069
8070 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8071
8072
8073 [6] T. Berners-Lee, R. Fielding, H. Frystyk.
8074 "Hypertext Transfer Protocol - HTTP/1.0." Work in Progress (draft-
8075
8076 ietf-http-v10-spec-04.txt), MIT/LCS, UC Irvine, September 1995.
8077
8078 [7] N. Borenstein, N. Freed.
8079 "MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms
8080
8081 for Specifying and Describing the Format of Internet Message Bodies."
8082 RFC 1521, Bellcore, Innosoft, September 1993.
8083
8084 [8] R. Braden.
8085 "Requirements for Internet hosts - application and support." STD 3,
8086
8087 RFC 1123, IETF, October 1989.
8088
8089 [9] D. H. Crocker.
8090 "Standard for the Format of ARPA Internet Text Messages." STD 11, RFC
8091
8092 822, UDEL, August 1982.
8093
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.
8097
8098 [11] R. Fielding. "Relative Uniform Resource Locators." RFC 1808, UC
8099
8100 Irvine, June 1995.
8101
8102 [12] M. Horton, R. Adams.
8103 "Standard for interchange of USENET messages." RFC 1036 (Obsoletes
8104
8105 RFC 850), AT&amp;T Bell Laboratories, Center for Seismic Studies,
8106 December 1987.
8107
8108 [13] B. Kantor, P. Lapsley. "Network News Transfer Protocol A
8109
8110 Proposed Standard for the Stream-Based Transmission of News." RFC
8111 977, UC San Diego, UC Berkeley, February 1986.
8112
8113 [14] K. Moore. "MIME (Multipurpose Internet Mail Extensions) Part Two
8114
8115 : Message Header Extensions for Non-ASCII Text." RFC 1522, University
8116 of Tennessee, September 1993.
8117
8118 [15] E. Nebel, L. Masinter. "Form-based File Upload in HTML." RFC
8119
8120 1867, Xerox Corporation, November 1995.
8121
8122 [16] J. Postel. "Simple Mail Transfer Protocol." STD 10, RFC 821,
8123
8124 USC/ISI, August 1982.
8125
8126
8127
8128 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 128]
8129
8130
8131
8132
8133 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8134
8135
8136 [17] J. Postel. "Media Type Registration Procedure." RFC 1590,
8137
8138 USC/ISI, March 1994.
8139
8140 [18] J. Postel, J. K. Reynolds. "File Transfer Protocol (FTP)" STD
8141 9,
8142
8143 RFC 959, USC/ISI, October 1985.
8144
8145 [19] J. Reynolds, J. Postel. "Assigned Numbers." STD 2, RFC 1700,
8146
8147 USC/ISI, October 1994.
8148
8149 [20] K. Sollins, L. Masinter.
8150 "Functional Requirements for Uniform Resource Names." RFC 1737,
8151
8152 MIT/LCS, Xerox Corporation, December 1994.
8153
8154 [21] US-ASCII. Coded Character Set - 7-Bit American Standard Code for
8155 Information Interchange. Standard ANSI X3.4-1986, ANSI, 1986.
8156
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.
8168
8169 [23] Meyers, M. Rose "The Content-MD5 Header Field." RFC 1864,
8170
8171 Carnegie Mellon, Dover Beach Consulting, October, 1995.
8172
8173 [24] B. Carpenter, Y. Rekhter, "Renumbering Needs Work". RFC 1900,
8174
8175 IAB, February 1996.
8176
8177 [25] Gzip is available from the GNU project at
8178 <URL:ftp://prep.ai.mit.edu/pub/gnu/>. A more formal specification is
8179
8180 currently a work in progress.
8181
8182 [26] Work In Progress for Digest authentication of the IETF HTTP
8183 working group.
8184
8185 [27] TBS, Work in progress (XXX should put RFC in here_ )
8186
8187 [28] Mills, D, "Network Time Protocol, Version 3", Specification,
8188
8189 Implementation and Analysis RFC 1305, University of Delaware, March,
8190 1992.
8191
8192 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 129]
8193
8194
8195
8196
8197 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8198
8199
8200 [29] Work in progress of the HTTP working group (XXX is this correct
8201 reference for incomplete work?).
8202
8203 [30] S. Spero. "Analysis of HTTP Performance Problems"
8204 <URL:http://sunsite.unc.edu/mdma-release/http-prob.html>
8205
8206 [31] E. Rescorla, A. Schiffman "The Secure HyperText Transfer
8207 Protocol" Internet-Draft (work in progress).
8208
8209 [32] A. Freier, P Karlton, P. Kocher. "SSL Version 3.0" Internet-
8210 Draft" (work in progress).
8211
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.
8215
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.,
8219 <URL
8220 :http://www.research.digital.com/wrl/techreports/abstracts/95.4.html>
8221
8222
8223 [35] Work in progress of the HTTP working group on state management.
8224
8225 22 Authors' Addresses
8226
8227 Roy T. Fielding
8228
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
8234
8235 Henrik Frystyk Nielsen
8236
8237 W3 Consortium
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
8243
8244 Tim Berners-Lee
8245
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
8251 Email: timbl@w3.org
8252
8253
8254
8255 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 130]
8256
8257
8258
8259
8260 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8261
8262
8263 Jim Gettys
8264
8265 MIT Laboratory for Computer Science
8266 545 Technology Square
8267 Cambridge, MA 02139, USA
8268 Fax: +1 (617) 258 8682
8269 Email: jg@w3.org
8270
8271 Jeffrey C. Mogul
8272
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
8278
8279
8280
8281
8282 23 Appendices
8283 These appendices are provided for informational reasons only -- they do
8284 not form a part of the HTTP/1.1 specification.
8285
8286
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 .
8291
8292 Media Type name: message
8293 Media subtype name: http
8294 Required parameters: none
8295 Optional parameters: version, msgtype
8296
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.
8300
8301 msgtype: The message type -- "request" or "response". If not
8302 present, the type can be determined from the first
8303 line of the body.
8304
8305 Encoding considerations: only "7bit", "8bit", or "binary" are
8306 permitted
8307
8308 Security considerations: none
8309
8310
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
8315
8316 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 131]
8317
8318
8319
8320
8321 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8322
8323
8324 tolerant of deviations whenever those deviations can be interpreted
8325 unambiguously.
8326
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.
8331
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.
8335
8336
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.
8347
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.
8351
8352 This appendix describes specific areas where HTTP differs from RFC
8353 1521.
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
8358 required.
8359
8360
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.
8370
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.
8378
8379
8380 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 132]
8381
8382
8383
8384
8385 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8386
8387
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
8393 necessary.
8394
8395
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.)
8405
8406
8407 23.3.4 No Content-Transfer-Encoding
8408 HTTP does not use the Content-Transfer-Encoding (CTE) field of RFC
8409 1521.
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.
8413
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.
8421
8422
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.
8428
8429
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-
8435 code as:
8436
8437 length := 0
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
8443
8444 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 133]
8445
8446
8447
8448
8449 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8450
8451
8452 read chunk-size and CRLF
8453 }
8454 read entity-header
8455 while (entity-header not empty) {
8456 append entity-header to existing header fields
8457 read entity-header
8458 }
8459 Content-Length := length
8460 Remove "chunked" from Transfer-Encoding
8461
8462
8463
8464
8465 23.3.7 MIME-Version
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.
8473
8474 MIME-Version = "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
8475
8476 MIME version "1.0" is the default for use in HTTP/1.1. However,
8477 HTTP/1.1
8478 message parsing and semantics are defined by this document and not the
8479 MIME specification.
8480
8481
8482 23.4 Changes from HTTP/1.0
8483 This section will summarize major differences between versions HTTP/1.0
8484 and HTTP/1.1.
8485
8486
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.
8492
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
8505 requirements:
8506
8507 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 134]
8508
8509
8510
8511
8512 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8513
8514
8515 . both clients and servers MUST support the Host request-header
8516
8517 . Host request-headers are required in HTTP/1.1 requests.
8518
8519 . servers MUST report an error if an HTTP/1.1 request does not
8520 include a Host request-header
8521
8522 . servers MUST accept absolute URIs
8523
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
8527 HTTP/1.1
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.
8533
8534
8535 23.5.1 Additional Request Methods
8536
8537 23.5.1.1 PATCH
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.
8546
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.
8550
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.
8559
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
8564 Derived-
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
8568 conflicts.
8569
8570
8571
8572 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 135]
8573
8574
8575
8576
8577 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8578
8579
8580 PATCH requests must obey the entity transmission requirements set out in
8581 section 13.4.1.
8582
8583 Caches that implement PATCH should invalidate cached responses as
8584 defined in section 16.10 for PUT.
8585
8586
8587 23.5.1.2 LINK
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.
8594
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.
8598
8599 Caches that implement LINK should invalidate cached responses as defined
8600 in section 16.10 for PUT.
8601
8602
8603 23.5.1.3 UNLINK
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
8609 future references.
8610
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.
8614
8615 Caches that implement UNLINK should invalidate cached responses as
8616 defined in section 16.10 for PUT.
8617
8618
8619 23.5.1.4 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.
8628
8629
8630 23.5.2 Additional Header Field Definitions
8631
8632 23.5.2.1 Content-Version
8633
8634
8635 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 136]
8636
8637
8638
8639
8640 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8641
8642
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.
8652
8653 Content-Version = "Content-Version" ":" quoted-string
8654
8655 Examples of the Content-Version field include:
8656
8657 Content-Version: "2.1.2"
8658 Content-Version: "Fred 19950116-12:26:48"
8659 Content-Version: "2.5a4-omega7"
8660
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.
8665
8666
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.
8673
8674 Derived-From = "Derived-From" ":" quoted-string
8675
8676 An example use of the field is:
8677
8678 Derived-From: "2.1.1"
8679
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
8683 retrieved.
8684
8685
8686 23.5.2.3 Link
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 .
8693
8694 Link = "Link" ":" #("<" URI ">" *( ";" link-param )
8695
8696
8697
8698 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 137]
8699
8700
8701
8702
8703 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8704
8705
8706 link-param = ( ( "rel" "=" relationship )
8707 | ( "rev" "=" relationship )
8708 | ( "title" "=" quoted-string )
8709 | ( "anchor" "=" <"> URI <"> )
8710 | ( link-extension ) )
8711
8712 link-extension = token [ "=" ( token | quoted-string ) ]
8713
8714 relationship = sgml-name
8715 | ( <"> sgml-name *( SP sgml-name) <"> )
8716
8717 sgml-name = ALPHA *( ALPHA | DIGIT | "." | "-" )
8718
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
8724 resource,
8725 such as a fragment of this resource or a third resource.
8726
8727 Examples of usage include:
8728
8729 Link: <http://www.cern.ch/TheBook/chapter2>; rel="Previous"
8730
8731 Link: <mailto:timbl@w3.org>; rev="Made"; title="Tim Berners-Lee"
8732
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
8736 e-mail address.
8737
8738
8739 23.5.2.4 URI
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.
8750
8751 URI-header = "URI" ":" 1#( "<" URI ">" )
8752
8753
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
8761
8762 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 138]
8763
8764
8765
8766
8767 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8768
8769
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.
8774
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:
8780
8781 1.
8782 Introduce a new keyword (persist) which is declared to be valid only
8783 when received from an HTTP/1.1 message.
8784
8785 2.
8786 Declare persistence to be the default for HTTP/1.1 messages and
8787 introduce a new keyword (close) for declaring non-persistence.
8788
8789 The following describes the original, buggy form of persistent
8790 connections.
8791
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:
8794
8795 Connection: Keep-Alive,Persist
8796
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.
8800
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.
8806
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.
8810
8811
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:
8816
8817 Keep-Alive-header = "Keep-Alive" ":" 0# keepalive-param
8818
8819 keepalive-param = param-name "=" value
8820
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.
8823
8824
8825
8826
8827 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 139]
8828
8829
8830
8831
8832 INTERNET-DRAFT HTTP/1.1 Friday, May 03, 1996
8833
8834
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.
8838
8839
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:
8847
8848
8849 . recognize the format of the Request-Line for HTTP/0.9, 1.0, and 1.1
8850 requests;
8851
8852 . understand any valid request in the format of HTTP/0.9, 1.0, or
8853 1.1;
8854
8855 . respond appropriately with a message in the same major version used
8856 by the client.
8857 And we would expect HTTP/1.1 clients to:
8858
8859
8860 . recognize the format of the Status-Line for HTTP/1.0 and 1.1
8861 responses;
8862
8863 . understand any valid response in the format of HTTP/0.9, 1.0, or
8864 1.1.
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.
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890 Fielding, Frystyk, Berners-Lee, Gettys, and Mogul [Page 140]
8891
8892
8893