/[suikacvs]/webroot/www/2004/id/draft-ietf-http-v11-spec-05.txt
Suika

Contents of /webroot/www/2004/id/draft-ietf-http-v11-spec-05.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Jun 15 08:04:05 2004 UTC (19 years, 11 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
New

1 HTTP Working Group R. Fielding, UC Irvine
2 INTERNET-DRAFT J. Gettys, DEC
3 <draft-ietf-http-v11-spec-05> J. C. Mogul, DEC
4 H. Frystyk, MIT/LCS
5 T. Berners-Lee, MIT/LCS
6 Expires December 7, 1996 June 7, 1996
7
8 Hypertext Transfer Protocol -- HTTP/1.1
9
10 Status of this Memo
11
12 This document is an Internet-Draft. Internet-Drafts are working
13 documents of the Internet Engineering Task Force (IETF), its areas, and
14 its working groups. Note that other groups may also distribute working
15 documents as Internet-Drafts.
16
17 Internet-Drafts are draft documents valid for a maximum of six months
18 and may be updated, replaced, or made obsolete by other documents at any
19 time. It is inappropriate to use Internet-Drafts as reference material
20 or to cite them other than as "work in progress".
21
22 To learn the current status of any Internet-Draft, please check the
23 "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow
24 Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
25 munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
26 ftp.isi.edu (US West Coast).
27
28 Distribution of this document is unlimited. Please send comments to the
29 HTTP working group at <http-wg@cuckoo.hpl.hp.com>. Discussions of the
30 working group are archived at
31 <URL:http://www.ics.uci.edu/pub/ietf/http/>. General discussions about
32 HTTP and the applications which use HTTP should take place on the <www-
33 talk@w3.org> mailing list.
34
35 Abstract
36
37 The Hypertext Transfer Protocol (HTTP) is an application-level protocol
38 for distributed, collaborative, hypermedia information systems. It is a
39 generic, stateless, object-oriented protocol which can be used for many
40 tasks, such as name servers and distributed object management systems,
41 through extension of its request methods. A feature of HTTP is the
42 typing and negotiation of data representation, allowing systems to be
43 built independently of the data being transferred.
44
45 HTTP has been in use by the World-Wide Web global information initiative
46 since 1990. This specification defines the protocol referred to as
47 "HTTP/1.1".
48
49
50
51
52
53 Fielding, et al [Page 1]
54
55
56
57
58
59 Table of Contents
60
61
62
63 HYPERTEXT TRANSFER PROTOCOL -- HTTP/1.1................................1
64
65 1 Introduction.........................................................7
66 1.1 Purpose ..........................................................7
67 1.2 Requirements .....................................................7
68 1.3 Terminology ......................................................8
69 1.4 Overall Operation ...............................................11
70
71 2 Notational Conventions and Generic Grammar..........................13
72 2.1 Augmented BNF ...................................................13
73 2.2 Basic Rules .....................................................15
74
75 3 Protocol Parameters.................................................16
76 3.1 HTTP Version ....................................................16
77 3.2 Uniform Resource Identifiers ....................................17
78 3.3 Date/Time Formats ...............................................19
79 3.4 Character Sets ..................................................21
80 3.5 Content Codings .................................................22
81 3.6 Transfer Codings ................................................23
82 3.7 Media Types .....................................................24
83 3.8 Product Tokens ..................................................26
84 3.9 Quality Values ..................................................26
85 3.10 Language Tags ..................................................27
86 3.11 Entity Tags ....................................................27
87 3.12 Range Units ....................................................28
88
89 4 HTTP Message........................................................28
90 4.1 Message Types ...................................................28
91 4.2 Message Headers .................................................29
92 4.3 Message Body ....................................................30
93 4.4 Message Length ..................................................30
94 4.5 General Header Fields ...........................................31
95
96 5 Request.............................................................32
97 5.1 Request-Line ....................................................32
98 5.2 The Resource Identified by a Request ............................34
99 5.3 Request Header Fields ...........................................35
100
101 6 Response............................................................35
102 6.1 Status-Line .....................................................36
103 6.2 Response Header Fields ..........................................38
104
105 7 Entity..............................................................38
106 7.1 Entity Header Fields ............................................38
107 7.2 Entity Body .....................................................39
108
109 8 Connections.........................................................40
110
111 Fielding, et al [Page 3]
112
113
114 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
115
116
117 8.1 Persistent Connections ..........................................40
118 8.2 Message Transmission Requirements ...............................43
119
120 9 Method Definitions..................................................44
121 9.1 Safe and Idempotent Methods .....................................45
122 9.2 OPTIONS .........................................................45
123 9.3 GET .............................................................46
124 9.4 HEAD ............................................................46
125 9.5 POST ............................................................47
126 9.6 PUT .............................................................48
127 9.7 DELETE ..........................................................49
128 9.8 TRACE ...........................................................49
129
130 10 Status Code Definitions............................................49
131 10.1 Informational 1xx ..............................................50
132 10.2 Successful 2xx .................................................50
133 10.3 Redirection 3xx ................................................52
134 10.4 Client Error 4xx ...............................................55
135 10.5 Server Error 5xx ...............................................59
136
137 11 Access Authentication..............................................60
138 11.1 Basic Authentication Scheme ....................................62
139 11.2 Digest Authentication Scheme ...................................62
140
141 12 Content Negotiation................................................63
142 12.1 Server-driven Negotiation ......................................63
143 12.2 Agent-driven Negotiation .......................................64
144 12.3 Transparent Negotiation ........................................65
145
146 13 Caching in HTTP....................................................65
147 13.2 Expiration Model ...............................................70
148 13.3 Validation Model ...............................................75
149 13.4 Response Cachability ...........................................80
150 13.5 Constructing Responses From Caches .............................81
151 13.6 Caching Negotiated Responses ...................................83
152 13.7 Shared and Non-Shared Caches ...................................84
153 13.8 Errors or Incomplete Response Cache Behavior ...................84
154 13.9 Side Effects of GET and HEAD ...................................85
155 13.10 Invalidation After Updates or Deletions .......................85
156 13.11 Write-Through Mandatory .......................................86
157 13.12 Cache Replacement .............................................86
158 13.13 History Lists .................................................86
159
160 14 Header Field Definitions...........................................87
161 14.1 Accept .........................................................87
162 14.2 Accept-Charset .................................................89
163 14.3 Accept-Encoding ................................................89
164 14.4 Accept-Language ................................................90
165 14.5 Accept-Ranges ..................................................91
166 14.6 Age ............................................................91
167 14.7 Allow ..........................................................92
168
169 Fielding, et al [Page 4]
170
171
172 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
173
174
175 14.8 Authorization ..................................................92
176 14.9 Cache-Control ..................................................93
177 14.10 Connection ...................................................100
178 14.11 Content-Base .................................................101
179 14.12 Content-Encoding .............................................101
180 14.13 Content-Language .............................................102
181 14.14 Content-Length ...............................................102
182 14.15 Content-Location .............................................103
183 14.16 Content-MD5 ..................................................104
184 14.17 Content-Range ................................................105
185 14.18 Content-Type .................................................107
186 14.19 Date .........................................................107
187 14.20 ETag .........................................................108
188 14.21 Expires ......................................................108
189 14.22 From .........................................................109
190 14.23 Host .........................................................109
191 14.24 If-Modified-Since ............................................110
192 14.25 If-Match .....................................................111
193 14.26 If-None-Match ................................................112
194 14.27 If-Range .....................................................113
195 14.28 If-Unmodified-Since ..........................................114
196 14.29 Last-Modified ................................................114
197 14.30 Location .....................................................115
198 14.31 Max-Forwards .................................................115
199 14.32 Pragma .......................................................116
200 14.33 Proxy-Authenticate ...........................................117
201 14.34 Proxy-Authorization ..........................................117
202 14.35 Public .......................................................117
203 14.36 Range ........................................................118
204 14.37 Referer ......................................................120
205 14.38 Retry-After ..................................................121
206 14.39 Server .......................................................121
207 14.40 Transfer-Encoding ............................................122
208 14.41 Upgrade ......................................................122
209 14.42 User-Agent ...................................................123
210 14.43 Vary .........................................................123
211 14.44 Via ..........................................................125
212 14.45 Warning ......................................................126
213 14.46 WWW-Authenticate .............................................128
214
215 15 Security Considerations...........................................128
216 15.1 Authentication of Clients .....................................128
217 15.2 Offering a Choice of Authentication Schemes ...................129
218 15.3 Abuse of Server Log Information ...............................130
219 15.4 Transfer of Sensitive Information .............................130
220 15.5 Attacks Based On File and Path Names ..........................131
221 15.6 Personal Information ..........................................131
222 15.7 Privacy Issues Connected to Accept Headers ....................132
223 15.8 DNS Spoofing ..................................................132
224 15.9 Location Headers and Spoofing .................................133
225
226
227 Fielding, et al [Page 5]
228
229
230 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
231
232
233 16 Acknowledgments...................................................133
234
235 17 References........................................................134
236
237 18 Authors' Addresses................................................138
238
239 19 Appendices........................................................139
240 19.1 Internet Media Type message/http ..............................139
241 19.2 Internet Media Type multipart/byteranges ......................140
242 19.3 Tolerant Applications .........................................140
243 19.4 Differences Between HTTP Entities and RFC 1521 Entities .......141
244 19.5 Changes from HTTP/1.0 .........................................144
245 19.6 Additional Features ...........................................145
246 19.7 Compatibility with Previous Versions ..........................149
247 19.8 Notes to the RFC Editor and IANA ..............................150
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285 Fielding, et al [Page 6]
286
287
288
289
290
291 1 Introduction
292
293 1.1 Purpose
294
295 The Hypertext Transfer Protocol (HTTP) is an application-level protocol
296 for distributed, collaborative, hypermedia information systems. HTTP has
297 been in use by the World-Wide Web global information initiative since
298 1990. The first version of HTTP, referred to as HTTP/0.9, was a simple
299 protocol for raw data transfer across the Internet. HTTP/1.0, as defined
300 by RFC 1945 [6], improved the protocol by allowing messages to be in the
301 format of MIME-like messages, containing metainformation about the data
302 transferred and modifiers on the request/response semantics. However,
303 HTTP/1.0 does not sufficiently take into consideration the effects of
304 hierarchical proxies, caching, the need for persistent connections, and
305 virtual hosts. In addition, the proliferation of incompletely-
306 implemented applications calling themselves "HTTP/1.0" has necessitated
307 a protocol version change in order for two communicating applications to
308 determine each other's true capabilities.
309
310 This specification defines the protocol referred to as "HTTP/1.1". This
311 protocol includes more stringent requirements than HTTP/1.0 in order to
312 ensure reliable implementation of its features.
313
314 Practical information systems require more functionality than simple
315 retrieval, including search, front-end update, and annotation. HTTP
316 allows an open-ended set of methods that indicate the purpose of a
317 request. It builds on the discipline of reference provided by the
318 Uniform Resource Identifier (URI) [3][20], as a location (URL) [4] or
319 name (URN) , for indicating the resource to which a method is to be
320 applied. Messages are passed in a format similar to that used by
321 Internet mail as defined by the Multipurpose Internet Mail Extensions
322 (MIME) .
323
324 HTTP is also used as a generic protocol for communication between user
325 agents and proxies/gateways to other Internet systems, including those
326 supported by the SMTP [16], NNTP [13], FTP [18], Gopher [2], and WAIS
327 [10] protocols. In this way, HTTP allows basic hypermedia access to
328 resources available from diverse applications.
329
330
331 1.2 Requirements
332
333 This specification uses the same words as RFC 1123 [8] for defining the
334 significance of each particular requirement. These words are:
335
336
337 MUST
338 This word or the adjective "required" means that the item is an
339 absolute requirement of the specification.
340
341
342
343 Fielding, et al [Page 7]
344
345
346 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
347
348
349 SHOULD
350 This word or the adjective "recommended" means that there may exist
351 valid reasons in particular circumstances to ignore this item, but
352 the full implications should be understood and the case carefully
353 weighed before choosing a different course.
354
355
356 MAY
357 This word or the adjective "optional" means that this item is truly
358 optional. One vendor may choose to include the item because a
359 particular marketplace requires it or because it enhances the
360 product, for example; another vendor may omit the same item.
361
362 An implementation is not compliant if it fails to satisfy one or more of
363 the MUST requirements for the protocols it implements. An implementation
364 that satisfies all the MUST and all the SHOULD requirements for its
365 protocols is said to be "unconditionally compliant"; one that satisfies
366 all the MUST requirements but not all the SHOULD requirements for its
367 protocols is said to be "conditionally compliant."
368
369
370 1.3 Terminology
371
372 This specification uses a number of terms to refer to the roles played
373 by participants in, and objects of, the HTTP communication.
374
375 connection
376 A transport layer virtual circuit established between two programs
377 for the purpose of communication.
378
379 message
380 The basic unit of HTTP communication, consisting of a structured
381 sequence of octets matching the syntax defined in section 4 and
382 transmitted via the connection.
383
384 request
385 An HTTP request message, as defined in section 5.
386
387 response
388 An HTTP response message, as defined in section 6.
389
390 resource
391 A network data object or service that can be identified by a URI, as
392 defined in section 3.2. Resources may be available in multiple
393 representations (e.g. multiple languages, data formats, size,
394 resolutions) or vary in other ways.
395
396 entity
397 The information transferred as the payload of a request or response.
398 An entity consists of metainformation in the form of entity-header
399
400
401 Fielding, et al [Page 8]
402
403
404 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
405
406
407 fields and content in the form of an entity-body, as described in
408 section 7.
409
410 representation
411 An entity included with a response that is subject to content
412 negotiation, as described in section 12. There may exist multiple
413 representations associated with a particular response status.
414
415 content negotiation
416 The mechanism for selecting the appropriate representation when
417 servicing a request, as described in section 12. The representation
418 of entities in any response can be negotiated (including error
419 responses).
420
421 variant
422 A resource may have one, or more than one, representation(s)
423 associated with it at any given instant. Each of these
424 representations is termed a `variant.' Use of the term `variant' does
425 not necessarily imply that the resource is subject to content
426 negotiation.
427
428 client
429 A program that establishes connections for the purpose of sending
430 requests.
431
432 user agent
433 The client which initiates a request. These are often browsers,
434 editors, spiders (web-traversing robots), or other end user tools.
435
436 server
437 An application program that accepts connections in order to service
438 requests by sending back responses. Any given program may be capable
439 of being both a client and a server; our use of these terms refers
440 only to the role being performed by the program for a particular
441 connection, rather than to the program's capabilities in general.
442 Likewise, any server may act as an origin server, proxy, gateway, or
443 tunnel, switching behavior based on the nature of each request.
444
445 origin server
446 The server on which a given resource resides or is to be created.
447
448 proxy
449 An intermediary program which acts as both a server and a client for
450 the purpose of making requests on behalf of other clients. Requests
451 are serviced internally or by passing them on, with possible
452 translation, to other servers. A proxy must implement both the client
453 and server requirements of this specification.
454
455 gateway
456 A server which acts as an intermediary for some other server. Unlike
457 a proxy, a gateway receives requests as if it were the origin server
458
459 Fielding, et al [Page 9]
460
461
462 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
463
464
465 for the requested resource; the requesting client may not be aware
466 that it is communicating with a gateway.
467
468 tunnel
469 An intermediary program which is acting as a blind relay between two
470 connections. Once active, a tunnel is not considered a party to the
471 HTTP communication, though the tunnel may have been initiated by an
472 HTTP request. The tunnel ceases to exist when both ends of the
473 relayed connections are closed.
474
475 cache
476 A program's local store of response messages and the subsystem that
477 controls its message storage, retrieval, and deletion. A cache stores
478 cachable responses in order to reduce the response time and network
479 bandwidth consumption on future, equivalent requests. Any client or
480 server may include a cache, though a cache cannot be used by a server
481 that is acting as a tunnel.
482
483 cachable
484 A response is cachable if a cache is allowed to store a copy of the
485 response message for use in answering subsequent requests. The rules
486 for determining the cachability of HTTP responses are defined in
487 section 13. Even if a resource is cachable, there may be additional
488 constraints on whether a cache can use the cached copy for a
489 particular request.
490
491 first-hand
492 A response is first-hand if it comes directly and without unnecessary
493 delay from the origin server, perhaps via one or more proxies. A
494 response is also first-hand if its validity has just been checked
495 directly with the origin server.
496
497 explicit expiration time
498 The time at which the origin server intends that an entity should no
499 longer be returned by a cache without further validation.
500
501 heuristic expiration time
502 An expiration time assigned by a cache when no explicit expiration
503 time is available.
504
505 age
506 The age of a response is the time since it was sent by, or
507 successfully validated with, the origin server.
508
509 freshness lifetime
510 The length of time between the generation of a response and its
511 expiration time.
512
513 fresh
514 A response is fresh if its age has not yet exceeded its freshness
515 lifetime.
516
517 Fielding, et al [Page 10]
518
519
520 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
521
522
523 stale
524 A response is stale if its age has passed its freshness lifetime.
525
526 semantically transparent
527 A cache behaves in a "semantically transparent" manner, with respect
528 to a particular response, when its use affects neither the requesting
529 client nor the origin server, except to improve performance. When a
530 cache is semantically transparent, the client receives exactly the
531 same response (except for hop-by-hop headers) that it would have
532 received had its request been handled directly by the origin server.
533
534 validator
535 A protocol element (e.g., an entity tag or a Last-Modified time) that
536 is used to find out whether a cache entry is an equivalent copy of an
537 entity.
538
539
540 1.4 Overall Operation
541
542 The HTTP protocol is a request/response protocol. A client sends a
543 request to the server in the form of a request method, URI, and protocol
544 version, followed by a MIME-like message containing request modifiers,
545 client information, and possible body content over a connection with a
546 server. The server responds with a status line, including the message's
547 protocol version and a success or error code, followed by a MIME-like
548 message containing server information, entity metainformation, and
549 possible entity-body content. The relationship between HTTP and MIME is
550 described in appendix 19.4.
551
552 Most HTTP communication is initiated by a user agent and consists of a
553 request to be applied to a resource on some origin server. In the
554 simplest case, this may be accomplished via a single connection (v)
555 between the user agent (UA) and the origin server (O).
556
557 request chain ------------------------>
558 UA -------------------v------------------- O
559 <----------------------- response chain
560
561 A more complicated situation occurs when one or more intermediaries are
562 present in the request/response chain. There are three common forms of
563 intermediary: proxy, gateway, and tunnel. A proxy is a forwarding agent,
564 receiving requests for a URI in its absolute form, rewriting all or part
565 of the message, and forwarding the reformatted request toward the server
566 identified by the URI. A gateway is a receiving agent, acting as a layer
567 above some other server(s) and, if necessary, translating the requests
568 to the underlying server's protocol. A tunnel acts as a relay point
569 between two connections without changing the messages; tunnels are used
570 when the communication needs to pass through an intermediary (such as a
571 firewall) even when the intermediary cannot understand the contents of
572 the messages.
573
574
575 Fielding, et al [Page 11]
576
577
578 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
579
580
581 request chain -------------------------------------->
582 UA -----v----- A -----v----- B -----v----- C -----v----- O
583 <------------------------------------- response chain
584
585 The figure above shows three intermediaries (A, B, and C) between the
586 user agent and origin server. A request or response message that travels
587 the whole chain will pass through four separate connections. This
588 distinction is important because some HTTP communication options may
589 apply only to the connection with the nearest, non-tunnel neighbor, only
590 to the end-points of the chain, or to all connections along the chain.
591 Although the diagram is linear, each participant may be engaged in
592 multiple, simultaneous communications. For example, B may be receiving
593 requests from many clients other than A, and/or forwarding requests to
594 servers other than C, at the same time that it is handling A's request.
595
596 Any party to the communication which is not acting as a tunnel may
597 employ an internal cache for handling requests. The effect of a cache is
598 that the request/response chain is shortened if one of the participants
599 along the chain has a cached response applicable to that request. The
600 following illustrates the resulting chain if B has a cached copy of an
601 earlier response from O (via C) for a request which has not been cached
602 by UA or A.
603
604 request chain ---------->
605 UA -----v----- A -----v----- B - - - - - - C - - - - - - O
606 <--------- response chain
607
608 Not all responses are usefully cachable, and some requests may contain
609 modifiers which place special requirements on cache behavior. HTTP
610 requirements for cache behavior and cachable responses are defined in
611 section 13.
612
613 In fact, there are a wide variety of architectures and configurations of
614 caches and proxies currently being experimented with or deployed across
615 the World Wide Web; these systems include national hierarchies of proxy
616 caches to save transoceanic bandwidth, systems that broadcast or
617 multicast cache entries, organizations that distribute subsets of cached
618 data via CD-ROM, and so on. HTTP systems are used in corporate intranets
619 over high-bandwidth links, and for access via PDAs with low-power radio
620 links and intermittent connectivity. The goal of HTTP/1.1 is to support
621 the wide diversity of configurations already deployed while introducing
622 protocol constructs that meet the needs of those who build web
623 applications that require high reliability and, failing that, at least
624 reliable indications of failure.
625
626 HTTP communication usually takes place over TCP/IP connections. The
627 default port is TCP 80, but other ports can be used. This does not
628 preclude HTTP from being implemented on top of any other protocol on the
629 Internet, or on other networks. HTTP only presumes a reliable transport;
630 any protocol that provides such guarantees can be used; the mapping of
631 the HTTP/1.1 request and response structures onto the transport data
632
633 Fielding, et al [Page 12]
634
635
636 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
637
638
639 units of the protocol in question is outside the scope of this
640 specification.
641
642 In HTTP/1.0, most implementations used a new connection for each
643 request/response exchange. In HTTP/1.1, a connection may be used for one
644 or more request/response exchanges, although connections may be closed
645 for a variety of reasons (see section 8.1).
646
647
648 2 Notational Conventions and Generic Grammar
649
650
651 2.1 Augmented BNF
652
653 All of the mechanisms specified in this document are described in both
654 prose and an augmented Backus-Naur Form (BNF) similar to that used by
655 RFC 822 [9]. Implementers will need to be familiar with the notation in
656 order to understand this specification. The augmented BNF includes the
657 following constructs:
658
659
660 name = definition
661 The name of a rule is simply the name itself (without any enclosing
662 "<" and ">") and is separated from its definition by the equal "="
663 character. Whitespace is only significant in that indentation of
664 continuation lines is used to indicate a rule definition that spans
665 more than one line. Certain basic rules are in uppercase, such as
666 SP, LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle brackets are used
667 within definitions whenever their presence will facilitate
668 discerning the use of rule names.
669
670
671 "literal"
672 Quotation marks surround literal text. Unless stated otherwise, the
673 text is case-insensitive.
674
675
676 rule1 | rule2
677 Elements separated by a bar ("|") are alternatives, e.g., "yes |
678 no" will accept yes or no.
679
680
681 (rule1 rule2)
682 Elements enclosed in parentheses are treated as a single element.
683 Thus, "(elem (foo | bar) elem)" allows the token sequences
684 "elem foo elem" and "elem bar elem".
685
686
687 *rule
688 The character "*" preceding an element indicates repetition. The
689 full form is "<n>*<m>element" indicating at least <n> and at most
690
691 Fielding, et al [Page 13]
692
693
694 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
695
696
697 <m> occurrences of element. Default values are 0 and infinity so
698 that "*(element)" allows any number, including zero; "1*element"
699 requires at least one; and "1*2element" allows one or two.
700
701
702 [rule]
703 Square brackets enclose optional elements; "[foo bar]" is
704 equivalent to "*1(foo bar)".
705
706
707 N rule
708 Specific repetition: "<n>(element)" is equivalent to
709 "<n>*<n>(element)"; that is, exactly <n> occurrences of (element).
710 Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three
711 alphabetic characters.
712
713
714 #rule
715 A construct "#" is defined, similar to "*", for defining lists of
716 elements. The full form is "<n>#<m>element " indicating at least
717 <n> and at most <m> elements, each separated by one or more commas
718 (",") and optional linear whitespace (LWS). This makes the usual
719 form of lists very easy; a rule such as
720 "( *LWS element *( *LWS "," *LWS element )) " can be shown as
721 "1#element". Wherever this construct is used, null elements are
722 allowed, but do not contribute to the count of elements present.
723 That is, "(element), , (element) " is permitted, but counts as only
724 two elements. Therefore, where at least one element is required, at
725 least one non-null element must be present. Default values are 0
726 and infinity so that "#element" allows any number, including zero;
727 "1#element" requires at least one; and "1#2element" allows one or
728 two.
729
730
731 ; comment
732 A semi-colon, set off some distance to the right of rule text,
733 starts a comment that continues to the end of line. This is a
734 simple way of including useful notes in parallel with the
735 specifications.
736
737
738 implied *LWS
739 The grammar described by this specification is word-based. Except
740 where noted otherwise, linear whitespace (LWS) can be included
741 between any two adjacent words (token or quoted-string), and
742 between adjacent tokens and delimiters (tspecials), without
743 changing the interpretation of a field. At least one delimiter
744 (tspecials) must exist between any two tokens, since they would
745 otherwise be interpreted as a single token.
746
747
748
749 Fielding, et al [Page 14]
750
751
752 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
753
754
755 2.2 Basic Rules
756
757 The following rules are used throughout this specification to describe
758 basic parsing constructs. The US-ASCII coded character set is defined by
759 ANSI X3.4-1986 [21].
760
761 OCTET = <any 8-bit sequence of data>
762 CHAR = <any US-ASCII character (octets 0 - 127)>
763 UPALPHA = <any US-ASCII uppercase letter "A".."Z">
764 LOALPHA = <any US-ASCII lowercase letter "a".."z">
765 ALPHA = UPALPHA | LOALPHA
766 DIGIT = <any US-ASCII digit "0".."9">
767 CTL = <any US-ASCII control character
768 (octets 0 - 31) and DEL (127)>
769 CR = <US-ASCII CR, carriage return (13)>
770 LF = <US-ASCII LF, linefeed (10)>
771 SP = <US-ASCII SP, space (32)>
772 HT = <US-ASCII HT, horizontal-tab (9)>
773 <"> = <US-ASCII double-quote mark (34)>
774
775 HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
776 protocol elements except the entity-body (see appendix 19.3 for tolerant
777 applications). The end-of-line marker within an entity-body is defined
778 by its associated media type, as described in section 3.7.
779
780 CRLF = CR LF
781
782 HTTP/1.1 headers can be folded onto multiple lines if the continuation
783 line begins with a space or horizontal tab. All linear white space,
784 including folding, has the same semantics as SP.
785
786 LWS = [CRLF] 1*( SP | HT )
787
788 The TEXT rule is only used for descriptive field contents and values
789 that are not intended to be interpreted by the message parser. Words of
790 *TEXT may contain characters from character sets other than ISO 8859-1
791 [22] only when encoded according to the rules of RFC 1522 [14].
792
793 TEXT = <any OCTET except CTLs,
794 but including LWS>
795
796 Hexadecimal numeric characters are used in several protocol elements.
797
798 HEX = "A" | "B" | "C" | "D" | "E" | "F"
799 | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT
800
801 Many HTTP/1.1 header field values consist of words separated by LWS or
802 special characters. These special characters MUST be in a quoted string
803 to be used within a parameter value.
804
805 token = 1*<any CHAR except CTLs or tspecials>
806
807 Fielding, et al [Page 15]
808
809
810 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
811
812
813 tspecials = "(" | ")" | "<" | ">" | "@"
814 | "," | ";" | ":" | "\" | <">
815 | "/" | "[" | "]" | "?" | "="
816 | "{" | "}" | SP | HT
817
818 Comments can be included in some HTTP header fields by surrounding the
819 comment text with parentheses. Comments are only allowed in fields
820 containing "comment" as part of their field value definition. In all
821 other fields, parentheses are considered part of the field value.
822
823 comment = "(" *( ctext | comment ) ")"
824 ctext = <any TEXT excluding "(" and ")">
825
826 A string of text is parsed as a single word if it is quoted using
827 double-quote marks.
828
829 quoted-string = ( <"> *(qdtext) <"> )
830
831 qdtext = <any TEXT except <">>
832
833 The backslash character ("\") may be used as a single-character quoting
834 mechanism only within quoted-string and comment constructs.
835
836 quoted-pair = "\" CHAR
837
838
839 3 Protocol Parameters
840
841
842 3.1 HTTP Version
843
844 HTTP uses a "<major>.<minor>" numbering scheme to indicate versions of
845 the protocol. The protocol versioning policy is intended to allow the
846 sender to indicate the format of a message and its capacity for
847 understanding further HTTP communication, rather than the features
848 obtained via that communication. No change is made to the version number
849 for the addition of message components which do not affect communication
850 behavior or which only add to extensible field values. The <minor>
851 number is incremented when the changes made to the protocol add features
852 which do not change the general message parsing algorithm, but which may
853 add to the message semantics and imply additional capabilities of the
854 sender. The <major> number is incremented when the format of a message
855 within the protocol is changed.
856
857 The version of an HTTP message is indicated by an HTTP-Version field in
858 the first line of the message.
859
860 HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
861
862 Note that the major and minor numbers MUST be treated as separate
863 integers and that each may be incremented higher than a single digit.
864
865 Fielding, et al [Page 16]
866
867
868 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
869
870
871 Thus, HTTP/2.4 is a lower version than HTTP/2.13, which in turn is lower
872 than HTTP/12.3. Leading zeros MUST be ignored by recipients and MUST NOT
873 be sent.
874
875 Applications sending Request or Response messages, as defined by this
876 specification, MUST include an HTTP-Version of "HTTP/1.1". Use of this
877 version number indicates that the sending application is at least
878 conditionally compliant with this specification.
879
880 The HTTP version of an application is the highest HTTP version for which
881 the application is at least conditionally compliant.
882
883 Proxy and gateway applications must be careful when forwarding messages
884 in protocol versions different from that of the application. Since the
885 protocol version indicates the protocol capability of the sender, a
886 proxy/gateway MUST never send a message with a version indicator which
887 is greater than its actual version; if a higher version request is
888 received, the proxy/gateway MUST either downgrade the request version,
889 respond with an error, or switch to tunnel behavior. Requests with a
890 version lower than that of the proxy/gateway's version MAY be upgraded
891 before being forwarded; the proxy/gateway's response to that request
892 MUST be in the same major version as the request.
893
894 Note: Converting between versions of HTTP may involve modification
895 of header fields required or forbidden by the versions involved.
896
897
898 3.2 Uniform Resource Identifiers
899
900 URIs have been known by many names: WWW addresses, Universal Document
901 Identifiers, Universal Resource Identifiers , and finally the
902 combination of Uniform Resource Locators (URL) and Names (URN) . As far
903 as HTTP is concerned, Uniform Resource Identifiers are simply formatted
904 strings which identify--via name, location, or any other characteristic-
905 -a resource.
906
907
908 3.2.1 General Syntax
909
910 URIs in HTTP can be represented in absolute form or relative to some
911 known base URI, depending upon the context of their use. The two forms
912 are differentiated by the fact that absolute URIs always begin with a
913 scheme name followed by a colon.
914
915 URI = ( absoluteURI | relativeURI ) [ "#" fragment ]
916
917 absoluteURI = scheme ":" *( uchar | reserved )
918
919 relativeURI = net_path | abs_path | rel_path
920
921
922
923 Fielding, et al [Page 17]
924
925
926 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
927
928
929 net_path = "//" net_loc [ abs_path ]
930 abs_path = "/" rel_path
931 rel_path = [ path ] [ ";" params ] [ "?" query ]
932
933 path = fsegment *( "/" segment )
934 fsegment = 1*pchar
935 segment = *pchar
936
937 params = param *( ";" param )
938 param = *( pchar | "/" )
939
940 scheme = 1*( ALPHA | DIGIT | "+" | "-" | "." )
941 net_loc = *( pchar | ";" | "?" )
942 query = *( uchar | reserved )
943 fragment = *( uchar | reserved )
944
945 pchar = uchar | ":" | "@" | "&" | "=" | "+"
946 uchar = unreserved | escape
947 unreserved = ALPHA | DIGIT | safe | extra | national
948
949 escape = "%" HEX HEX
950 reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+"
951 extra = "!" | "*" | "'" | "(" | ")" | ","
952 safe = "$" | "-" | "_" | "."
953 unsafe = CTL | SP | <"> | "#" | "%" | "<" | ">"
954 national = <any OCTET excluding ALPHA, DIGIT,
955 reserved, extra, safe, and unsafe>
956
957 For definitive information on URL syntax and semantics, see RFC 1738 [4]
958 and RFC 1808 [11]. The BNF above includes national characters not
959 allowed in valid URLs as specified by RFC 1738, since HTTP servers are
960 not restricted in the set of unreserved characters allowed to represent
961 the rel_path part of addresses, and HTTP proxies may receive requests
962 for URIs not defined by RFC 1738.
963
964 The HTTP protocol does not place any a priori limit on the length of a
965 URI. Servers MUST be able to handle the URI of any resource they serve,
966 and SHOULD be able to handle URIs of unbounded length if they provide
967 GET-based forms that could generate such URIs. A server SHOULD return
968 414 (Request-URI Too Long) status if a URI is longer than the server can
969 handle (see section 10.4.15).
970
971 Note: Servers should be cautious about depending on URI lengths
972 above 255 bytes, because some older client or proxy implementations
973 may not properly support these lengths.
974
975
976
977
978
979
980
981 Fielding, et al [Page 18]
982
983
984 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
985
986
987 3.2.2 http URL
988
989 The "http" scheme is used to locate network resources via the HTTP
990 protocol. This section defines the scheme-specific syntax and semantics
991 for http URLs.
992
993 http_URL = "http:" "//" host [ ":" port ] [ abs_path ]
994
995 host = <A legal Internet host domain name
996 or IP address (in dotted-decimal form),
997 as defined by Section 2.1 of RFC 1123>
998
999 port = *DIGIT
1000
1001 If the port is empty or not given, port 80 is assumed. The semantics are
1002 that the identified resource is located at the server listening for TCP
1003 connections on that port of that host, and the Request-URI for the
1004 resource is abs_path. The use of IP addresses in URL's SHOULD be avoided
1005 whenever possible (see RFC 1900 [24]). If the abs_path is not present in
1006 the URL, it MUST be given as "/" when used as a Request-URI for a
1007 resource (section 5.1.2).
1008
1009
1010 3.2.3 URI Comparison
1011
1012 When comparing two URIs to decide if they match or not, a client SHOULD
1013 use a case-sensitive octet-by-octet comparison of the entire URIs, with
1014 these exceptions:
1015
1016 . A port that is empty or not given is equivalent to the default port
1017 for that URI;
1018 . Comparisons of host names MUST be case-insensitive;
1019 . Comparisons of scheme names MUST be case-insensitive;
1020 . An empty abs_path is equivalent to an abs_path of "/".
1021 Characters other than those in the "reserved" and "unsafe" sets (see
1022 section 3.2) are equivalent to their ""%" HEX HEX" encodings.
1023
1024 For example, the following three URIs are equivalent:
1025
1026 http://abc.com:80/~smith/home.html
1027 http://ABC.com/%7Esmith/home.html
1028 http://ABC.com:/%7esmith/home.html
1029
1030
1031 3.3 Date/Time Formats
1032
1033
1034 3.3.1 Full Date
1035
1036 HTTP applications have historically allowed three different formats for
1037 the representation of date/time stamps:
1038
1039 Fielding, et al [Page 19]
1040
1041
1042 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1043
1044
1045 Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
1046 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
1047 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
1048
1049 The first format is preferred as an Internet standard and represents a
1050 fixed-length subset of that defined by RFC 1123 (an update to RFC 822
1051 ). The second format is in common use, but is based on the obsolete RFC
1052 850 date format and lacks a four-digit year. HTTP/1.1 clients and
1053 servers that parse the date value MUST accept all three formats (for
1054 compatibility with HTTP/1.0), though they MUST only generate the RFC
1055 1123 format for representing HTTP-date values in header fields.
1056
1057 Note: Recipients of date values are encouraged to be robust in
1058 accepting date values that may have been sent by non-HTTP
1059 applications, as is sometimes the case when retrieving or posting
1060 messages via proxies/gateways to SMTP or NNTP.
1061
1062 All HTTP date/time stamps MUST be represented in Greenwich Mean Time
1063 (GMT), without exception. This is indicated in the first two formats by
1064 the inclusion of "GMT" as the three-letter abbreviation for time zone,
1065 and MUST be assumed when reading the asctime format.
1066
1067 HTTP-date = rfc1123-date | rfc850-date | asctime-date
1068
1069 rfc1123-date = wkday "," SP date1 SP time SP "GMT"
1070 rfc850-date = weekday "," SP date2 SP time SP "GMT"
1071 asctime-date = wkday SP date3 SP time SP 4DIGIT
1072
1073 date1 = 2DIGIT SP month SP 4DIGIT
1074 ; day month year (e.g., 02 Jun 1982)
1075 date2 = 2DIGIT "-" month "-" 2DIGIT
1076 ; day-month-year (e.g., 02-Jun-82)
1077 date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
1078 ; month day (e.g., Jun 2)
1079
1080 time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
1081 ; 00:00:00 - 23:59:59
1082
1083 wkday = "Mon" | "Tue" | "Wed"
1084 | "Thu" | "Fri" | "Sat" | "Sun"
1085
1086 weekday = "Monday" | "Tuesday" | "Wednesday"
1087 | "Thursday" | "Friday" | "Saturday" | "Sunday"
1088
1089 month = "Jan" | "Feb" | "Mar" | "Apr"
1090 | "May" | "Jun" | "Jul" | "Aug"
1091 | "Sep" | "Oct" | "Nov" | "Dec"
1092
1093 Note: HTTP requirements for the date/time stamp format apply only
1094 to their usage within the protocol stream. Clients and servers are
1095
1096
1097 Fielding, et al [Page 20]
1098
1099
1100 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1101
1102
1103 not required to use these formats for user presentation, request
1104 logging, etc.
1105
1106
1107 3.3.2 Delta Seconds
1108
1109 Some HTTP header fields allow a time value to be specified as an integer
1110 number of seconds, represented in decimal, after the time that the
1111 message was received.
1112
1113 delta-seconds = 1*DIGIT
1114
1115
1116 3.4 Character Sets
1117
1118 HTTP uses the same definition of the term "character set" as that
1119 described for MIME:
1120
1121 The term "character set" is used in this document to refer to a
1122 method used with one or more tables to convert a sequence of octets
1123 into a sequence of characters. Note that unconditional conversion
1124 in the other direction is not required, in that not all characters
1125 may be available in a given character set and a character set may
1126 provide more than one sequence of octets to represent a particular
1127 character. This definition is intended to allow various kinds of
1128 character encodings, from simple single-table mappings such as US-
1129 ASCII to complex table switching methods such as those that use ISO
1130 2022's techniques. However, the definition associated with a MIME
1131 character set name MUST fully specify the mapping to be performed
1132 from octets to characters. In particular, use of external profiling
1133 information to determine the exact mapping is not permitted.
1134
1135 Note: This use of the term "character set" is more commonly
1136 referred to as a "character encoding." However, since HTTP and MIME
1137 share the same registry, it is important that the terminology also
1138 be shared.
1139
1140 HTTP character sets are identified by case-insensitive tokens. The
1141 complete set of tokens is defined by the IANA Character Set registry
1142 [19].
1143
1144 charset = token
1145
1146 Although HTTP allows an arbitrary token to be used as a charset value,
1147 any token that has a predefined value within the IANA Character Set
1148 registry MUST represent the character set defined by that registry.
1149 Applications SHOULD limit their use of character sets to those defined
1150 by the IANA registry.
1151
1152
1153
1154
1155 Fielding, et al [Page 21]
1156
1157
1158 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1159
1160
1161 3.5 Content Codings
1162
1163 Content coding values indicate an encoding transformation that has been
1164 or can be applied to an entity. Content codings are primarily used to
1165 allow a document to be compressed or otherwise usefully transformed
1166 without losing the identity of its underlying media type and without
1167 loss of information. Frequently, the entity is stored in coded form,
1168 transmitted directly, and only decoded by the recipient.
1169
1170 content-coding = token
1171
1172 All content-coding values are case-insensitive. HTTP/1.1 uses content-
1173 coding values in the Accept-Encoding (section 14.3) and Content-Encoding
1174 (section 14.12) header fields. Although the value describes the content-
1175 coding, what is more important is that it indicates what decoding
1176 mechanism will be required to remove the encoding.
1177
1178 The Internet Assigned Numbers Authority (IANA) acts as a registry for
1179 content-coding value tokens. Initially, the registry contains the
1180 following tokens:
1181
1182
1183 gzip An encoding format produced by the file compression program "gzip"
1184 (GNU zip) as described in RFC 1952 [25]. This format is a Lempel-
1185 Ziv coding (LZ77) with a 32 bit CRC.
1186
1187
1188 compress
1189 The encoding format produced by the common UNIX file compression
1190 program "compress". This format is an adaptive Lempel-Ziv-Welch
1191 coding (LZW).
1192
1193 Note: Use of program names for the identification of encoding
1194 formats is not desirable and should be discouraged for future
1195 encodings. Their use here is representative of historical practice,
1196 not good design. For compatibility with previous implementations of
1197 HTTP, applications should consider "x-gzip" and "x-compress" to be
1198 equivalent to "gzip" and "compress" respectively.
1199
1200 deflate The "zlib" format defined in RFC 1950[31] in combination with
1201 the "deflate" compression mechanism described in RFC 1951[29].
1202
1203 New content-coding value tokens should be registered; to allow
1204 interoperability between clients and servers, specifications of the
1205 content coding algorithms needed to implement a new value should be
1206 publicly available and adequate for independent implementation, and
1207 conform to the purpose of content coding defined in this section.
1208
1209
1210
1211
1212
1213 Fielding, et al [Page 22]
1214
1215
1216 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1217
1218
1219 3.6 Transfer Codings
1220
1221 Transfer coding values are used to indicate an encoding transformation
1222 that has been, can be, or may need to be applied to an entity-body in
1223 order to ensure "safe transport" through the network. This differs from
1224 a content coding in that the transfer coding is a property of the
1225 message, not of the original entity.
1226
1227 transfer-coding = "chunked" | transfer-extension
1228
1229 transfer-extension = token
1230
1231 All transfer-coding values are case-insensitive. HTTP/1.1 uses transfer
1232 coding values in the Transfer-Encoding header field (section 14.40).
1233
1234 Transfer codings are analogous to the Content-Transfer-Encoding values
1235 of MIME , which were designed to enable safe transport of binary data
1236 over a 7-bit transport service. However, safe transport has a different
1237 focus for an 8bit-clean transfer protocol. In HTTP, the only unsafe
1238 characteristic of message-bodies is the difficulty in determining the
1239 exact body length (section 7.2.2), or the desire to encrypt data over a
1240 shared transport.
1241
1242 The chunked encoding modifies the body of a message in order to transfer
1243 it as a series of chunks, each with its own size indicator, followed by
1244 an optional footer containing entity-header fields. This allows
1245 dynamically-produced content to be transferred along with the
1246 information necessary for the recipient to verify that it has received
1247 the full message.
1248
1249 Chunked-Body = *chunk
1250 "0" CRLF
1251 footer
1252 CRLF
1253
1254 chunk = chunk-size [ chunk-ext ] CRLF
1255 chunk-data CRLF
1256
1257 hex-no-zero = <HEX excluding "0">
1258
1259 chunk-size = hex-no-zero *HEX
1260 chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-value ] )
1261 chunk-ext-name = token
1262 chunk-ext-val = token | quoted-string
1263 chunk-data = chunk-size(OCTET)
1264
1265 footer = *entity-header
1266
1267 The chunked encoding is ended by a zero-sized chunk followed by the
1268 footer, which is terminated by an empty line. The purpose of the footer
1269 is to provide an efficient way to supply information about an entity
1270
1271 Fielding, et al [Page 23]
1272
1273
1274 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1275
1276
1277 that is generated dynamically; applications MUST NOT send header fields
1278 in the footer which are not explicitly defined as being appropriate for
1279 the footer, such as Content-MD5 or future extensions to HTTP for digital
1280 signatures or other facilities.
1281
1282 An example process for decoding a Chunked-Body is presented in appendix
1283 19.4.6.
1284
1285 All HTTP/1.1 applications MUST be able to receive and decode the
1286 "chunked" transfer coding, and MUST ignore transfer coding extensions
1287 they do not understand. A server which receives an entity-body with a
1288 transfer-coding it does not understand SHOULD return 501
1289 (Unimplemented), and close the connection. A server MUST NOT send
1290 transfer-codings to an HTTP/1.0 client.
1291
1292
1293 3.7 Media Types
1294
1295 HTTP uses Internet Media Types in the Content-Type (section 14.18) and
1296 Accept (section 14.1) header fields in order to provide open and
1297 extensible data typing and type negotiation.
1298
1299 media-type = type "/" subtype *( ";" parameter )
1300 type = token
1301 subtype = token
1302
1303 Parameters may follow the type/subtype in the form of attribute/value
1304 pairs.
1305
1306 parameter = attribute "=" value
1307 attribute = token
1308 value = token | quoted-string
1309
1310 The type, subtype, and parameter attribute names are case-insensitive.
1311 Parameter values may or may not be case-sensitive, depending on the
1312 semantics of the parameter name. Linear white space (LWS) MUST NOT be
1313 used between the type and subtype, nor between an attribute and its
1314 value. User agents that recognize the media-type MUST process (or
1315 arrange to be processed by any external applications used to process
1316 that type/subtype by the user agent) the parameters for that MIME type
1317 as described by that type/subtype definition to the and inform the user
1318 of any problems discovered.
1319
1320 Note: some older HTTP applications do not recognize media type
1321 parameters. When sending data to older HTTP applications,
1322 implementations should only use media type parameters when they are
1323 required by that type/subtype definition.
1324
1325 Media-type values are registered with the Internet Assigned Number
1326 Authority (IANA). The media type registration process is outlined in RFC
1327 1590 [17]. Use of non-registered media types is discouraged.
1328
1329 Fielding, et al [Page 24]
1330
1331
1332 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1333
1334
1335 3.7.1 Canonicalization and Text Defaults
1336
1337 Internet media types are registered with a canonical form. In general,
1338 an entity-body transferred via HTTP messages MUST be represented in the
1339 appropriate canonical form prior to its transmission; the exception is
1340 "text" types, as defined in the next paragraph.
1341
1342 When in canonical form, media subtypes of the "text" type use CRLF as
1343 the text line break. HTTP relaxes this requirement and allows the
1344 transport of text media with plain CR or LF alone representing a line
1345 break when it is done consistently for an entire entity-body. HTTP
1346 applications MUST accept CRLF, bare CR, and bare LF as being
1347 representative of a line break in text media received via HTTP. In
1348 addition, if the text is represented in a character set that does not
1349 use octets 13 and 10 for CR and LF respectively, as is the case for some
1350 multi-byte character sets, HTTP allows the use of whatever octet
1351 sequences are defined by that character set to represent the equivalent
1352 of CR and LF for line breaks. This flexibility regarding line breaks
1353 applies only to text media in the entity-body; a bare CR or LF MUST NOT
1354 be substituted for CRLF within any of the HTTP control structures (such
1355 as header fields and multipart boundaries).
1356
1357 If an entity-body is encoded with a Content-Encoding, the underlying
1358 data MUST be in a form defined above prior to being encoded.
1359
1360 The "charset" parameter is used with some media types to define the
1361 character set (section 3.4) of the data. When no explicit charset
1362 parameter is provided by the sender, media subtypes of the "text" type
1363 are defined to have a default charset value of "ISO-8859-1" when
1364 received via HTTP. Data in character sets other than "ISO-8859-1" or its
1365 subsets MUST be labeled with an appropriate charset value.
1366
1367
1368 3.7.2 Multipart Types
1369
1370 MIME provides for a number of "multipart" types -- encapsulations of one
1371 or more entities within a single message-body. All multipart types share
1372 a common syntax, as defined in section 7.2.1 of RFC 1521 [7], and MUST
1373 include a boundary parameter as part of the media type value. The
1374 message body is itself a protocol element and MUST therefore use only
1375 CRLF to represent line breaks between body-parts. Unlike in RFC 1521,
1376 the epilogue of any multipart message MUST be empty; HTTP applications
1377 MUST NOT transmit the epilogue (even if the original multipart contains
1378 an epilogue).
1379
1380 In HTTP, multipart body-parts MAY contain header fields which are
1381 significant to the meaning of that part. A Content-Location header field
1382 (section 14.15) SHOULD be included in the body-part of each enclosed
1383 entity that can be identified by a URL.
1384
1385
1386
1387 Fielding, et al [Page 25]
1388
1389
1390 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1391
1392
1393 In general, an HTTP user agent SHOULD follow the same or similar
1394 behavior as a MIME user agent would upon receipt of a multipart type. If
1395 an application receives an unrecognized multipart subtype, the
1396 application MUST treat it as being equivalent to "multipart/mixed".
1397
1398 Note: The "multipart/form-data" type has been specifically defined
1399 for carrying form data suitable for processing via the POST request
1400 method, as described in RFC 1867 [15].
1401
1402
1403 3.8 Product Tokens
1404
1405 Product tokens are used to allow communicating applications to identify
1406 themselves by software name and version. Most fields using product
1407 tokens also allow sub-products which form a significant part of the
1408 application to be listed, separated by whitespace. By convention, the
1409 products are listed in order of their significance for identifying the
1410 application.
1411
1412 product = token ["/" product-version]
1413 product-version = token
1414
1415 Examples:
1416
1417 User-Agent: CERN-LineMode/2.15 libwww/2.17b3
1418 Server: Apache/0.8.4
1419
1420 Product tokens should be short and to the point -- use of them for
1421 advertising or other non-essential information is explicitly forbidden.
1422 Although any token character may appear in a product-version, this token
1423 SHOULD only be used for a version identifier (i.e., successive versions
1424 of the same product SHOULD only differ in the product-version portion of
1425 the product value).
1426
1427
1428 3.9 Quality Values
1429
1430 HTTP content negotiation (section 12) uses short "floating point"
1431 numbers to indicate the relative importance ("weight") of various
1432 negotiable parameters. A weight is normalized to a real number in the
1433 range 0 through 1, where 0 is the minimum and 1 the maximum value.
1434 HTTP/1.1 applications MUST NOT generate more than three digits after the
1435 decimal point. User configuration of these values SHOULD also be limited
1436 in this fashion.
1437
1438 qvalue = ( "0" [ "." 0*3DIGIT ] )
1439 | ( "1" [ "." 0*3("0") ] )
1440
1441 "Quality values" is a misnomer, since these values merely represent
1442 relative degradation in desired quality.
1443
1444
1445 Fielding, et al [Page 26]
1446
1447
1448 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1449
1450
1451 3.10 Language Tags
1452
1453 A language tag identifies a natural language spoken, written, or
1454 otherwise conveyed by human beings for communication of information to
1455 other human beings. Computer languages are explicitly excluded. HTTP
1456 uses language tags within the Accept-Language and Content-Language
1457 fields.
1458
1459 The syntax and registry of HTTP language tags is the same as that
1460 defined by RFC 1766 [1]. In summary, a language tag is composed of 1 or
1461 more parts: A primary language tag and a possibly empty series of
1462 subtags:
1463
1464 language-tag = primary-tag *( "-" subtag )
1465
1466 primary-tag = 1*8ALPHA
1467 subtag = 1*8ALPHA
1468
1469 Whitespace is not allowed within the tag and all tags are case-
1470 insensitive. The name space of language tags is administered by the
1471 IANA. Example tags include:
1472
1473 en, en-US, en-cockney, i-cherokee, x-pig-latin
1474
1475 where any two-letter primary-tag is an ISO 639 language abbreviation and
1476 any two-letter initial subtag is an ISO 3166 country code. (The last
1477 three tags above are not registered tags; all but the last are examples
1478 of tags which could be registered in future.)
1479
1480
1481 3.11 Entity Tags
1482
1483 Entity tags are used for comparing two or more entities from the same
1484 requested resource. HTTP/1.1 uses entity tags in the ETag (section
1485 14.20), If-Match (section 14.25), If-None-Match (section 14.26), and If-
1486 Range (section 14.27) header fields. The definition of how they are used
1487 and compared as cache validators is in section 13.3.3. An entity tag
1488 consists of an opaque quoted string, possibly prefixed by a weakness
1489 indicator.
1490
1491 entity-tag = [ weak ] opaque-tag
1492
1493 weak = "W/"
1494 opaque-tag = quoted-string
1495
1496 A "strong entity tag" may be shared by two entities of a resource only
1497 if they are equivalent by octet equality.
1498
1499 A "weak entity tag," indicated by the "W/" prefix, may be shared by two
1500 entities of a resource only if the entities are equivalent and could be
1501
1502
1503 Fielding, et al [Page 27]
1504
1505
1506 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1507
1508
1509 substituted for each other with no significant change in semantics. A
1510 weak entity tag can only be used for weak comparison.
1511
1512 An entity tag MUST be unique across all versions of all entities
1513 associated with a particular resource. A given entity tag value may be
1514 used for entities obtained by requests on different URIs without
1515 implying anything about the equivalence of those entities.
1516
1517
1518 3.12 Range Units
1519
1520 HTTP/1.1 allows a client to request that only part (a range of) the
1521 response entity be included within the response. HTTP/1.1 uses range
1522 units in the Range (section 14.36), and Content-Range (section 14.17)
1523 header fields. An entity may be broken down into subranges according to
1524 various structural units.
1525
1526 range-unit = bytes-unit | other-range-unit
1527
1528 bytes-unit = "bytes"
1529 other-range-unit = token
1530
1531 The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
1532 implementations may ignore ranges specified using other units. HTTP/1.1
1533 has been designed to allow implementations of applications that do not
1534 depend on knowledge of ranges.
1535
1536
1537 4 HTTP Message
1538
1539
1540 4.1 Message Types
1541
1542 HTTP messages consist of requests from client to server and responses
1543 from server to client.
1544
1545 HTTP-message = Request | Response ; HTTP/1.1 messages
1546
1547 Request (section 5) and Response (section 6) messages use the generic
1548 message format of RFC 822 [9] for transferring entities (the payload of
1549 the message). Both types of message consist of a start-line, one or more
1550 header fields (also known as "headers"), an empty line (i.e., a line
1551 with nothing preceding the CRLF) indicating the end of the header
1552 fields, and an optional message-body.
1553
1554 generic-message = start-line
1555 *message-header
1556 CRLF
1557 [ message-body ]
1558
1559 start-line = Request-Line | Status-Line
1560
1561 Fielding, et al [Page 28]
1562
1563
1564 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1565
1566
1567 In the interest of robustness, servers SHOULD ignore any empty line(s)
1568 received where a Request-Line is expected. In other words, if the server
1569 is reading the protocol stream at the beginning of a message and
1570 receives a CRLF first, it should ignore the CRLF.
1571
1572 Note: certain buggy HTTP/1.0 client implementations generate an
1573 extra CRLF's after a POST request. To restate what is explicitly
1574 forbidden by the BNF, an HTTP/1.1 client must not preface or follow
1575 a request with an extra CRLF.
1576
1577
1578 4.2 Message Headers
1579
1580 HTTP header fields, which include general-header (section 4.5), request-
1581 header (section 5.3), response-header (section 6.2), and entity-header
1582 (section 7.1) fields, follow the same generic format as that given in
1583 Section 3.1 of RFC 822 [9]. Each header field consists of a name
1584 followed by a colon (":") and the field value. Field names are case-
1585 insensitive. The field value may be preceded by any amount of LWS,
1586 though a single SP is preferred. Header fields can be extended over
1587 multiple lines by preceding each extra line with at least one SP or HT.
1588 Applications SHOULD follow "common form" when generating HTTP
1589 constructs, since there might exist some implementations that fail to
1590 accept anything beyond the common forms.
1591
1592 message-header = field-name ":" [ field-value ] CRLF
1593
1594 field-name = token
1595 field-value = *( field-content | LWS )
1596
1597 field-content = <the OCTETs making up the field-value
1598 and consisting of either *TEXT or combinations
1599 of token, tspecials, and quoted-string>
1600
1601 The order in which header fields with differing field names are received
1602 is not significant. However, it is "good practice" to send general-
1603 header fields first, followed by request-header or response-header
1604 fields, and ending with the entity-header fields.
1605
1606 Multiple message-header fields with the same field-name may be present
1607 in a message if and only if the entire field-value for that header field
1608 is defined as a comma-separated list [i.e., #(values)]. It MUST be
1609 possible to combine the multiple header fields into one "field-name:
1610 field-value" pair, without changing the semantics of the message, by
1611 appending each subsequent field-value to the first, each separated by a
1612 comma. The order in which header fields with the same field-name are
1613 received is therefore significant to the interpretation of the combined
1614 field value, and thus a proxy MUST NOT change the order of these field
1615 values when a message is forwarded.
1616
1617
1618
1619 Fielding, et al [Page 29]
1620
1621
1622 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1623
1624
1625 4.3 Message Body
1626
1627 The message-body (if any) of an HTTP message is used to carry the
1628 entity-body associated with the request or response. The message-body
1629 differs from the entity-body only when a transfer coding has been
1630 applied, as indicated by the Transfer-Encoding header field (section
1631 14.40).
1632
1633 message-body = entity-body
1634 | <entity-body encoded as per Transfer-Encoding>
1635
1636 Transfer-Encoding MUST be used to indicate any transfer codings applied
1637 by an application to ensure safe and proper transfer of the message.
1638 Transfer-Encoding is a property of the message, not of the entity, and
1639 thus can be added or removed by any application along the
1640 request/response chain.
1641
1642 The rules for when a message-body is allowed in a message differ for
1643 requests and responses.
1644
1645 The presence of a message-body in a request is signaled by the inclusion
1646 of a Content-Length or Transfer-Encoding header field in the request's
1647 message-headers. A message-body MAY be included in a request only when
1648 the request method (section 5.1.1) allows an entity-body.
1649
1650 For response messages, whether or not a message-body is included with a
1651 message is dependent on both the request method and the response status
1652 code (section 6.1.1). All responses to the HEAD request method MUST NOT
1653 include a message-body, even though the presence of entity-header fields
1654 might lead one to believe they do. All 1xx (informational), 204 (no
1655 content), and 304 (not modified) responses MUST NOT include a message-
1656 body. All other responses do include a message-body, although it may be
1657 of zero length.
1658
1659
1660 4.4 Message Length
1661
1662 When a message-body is included with a message, the length of that body
1663 is determined by one of the following (in order of precedence):
1664
1665 1. Any response message which MUST NOT include a message-body (such as
1666 the 1xx, 204, and 304 responses and any response to a HEAD request)
1667 is always terminated by the first empty line after the header fields,
1668 regardless of the entity-header fields present in the message.
1669
1670 2. If a Transfer-Encoding header field (section 14.40) is present and
1671 indicates that the "chunked" transfer coding has been applied, then
1672 the length is defined by the chunked encoding (section 3.6).
1673
1674 3. If a Content-Length header field (section 14.14) is present, its
1675 value in bytes represents the length of the message-body.
1676
1677 Fielding, et al [Page 30]
1678
1679
1680 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1681
1682
1683 4. If the message uses the media type "multipart/byteranges", which is
1684 self-delimiting, then that defines the length. This Content-Type MUST
1685 NOT be used unless the sender knows that the recipient can parse it;
1686 the presence in a request of a Range header with multiple byte-range
1687 specifiers implies that the client can parse multipart/byteranges
1688 responses.
1689
1690 5. By the server closing the connection. (Closing the connection cannot
1691 be used to indicate the end of a request body, since that would leave
1692 no possibility for the server to send back a response.)
1693
1694 For compatibility with HTTP/1.0 applications, HTTP/1.1 requests
1695 containing a message-body MUST include a valid Content-Length header
1696 field unless the server is known to be HTTP/1.1 compliant. If a request
1697 contains a message-body and a Content-Length is not given, the server
1698 SHOULD respond with 400 (bad request) if it cannot determine the length
1699 of the message, or with 411 (length required) if it wishes to insist on
1700 receiving a valid Content-Length.
1701
1702 All HTTP/1.1 applications that receive entities MUST accept the
1703 "chunked" transfer coding (section 3.6), thus allowing this mechanism to
1704 be used for messages when the message length cannot be determined in
1705 advance.
1706
1707 Messages MUST NOT include both a Content-Length header field and the
1708 "chunked" transfer coding. If both are received, the Content-Length MUST
1709 be ignored.
1710
1711 When a Content-Length is given in a message where a message-body is
1712 allowed, its field value MUST exactly match the number of OCTETs in the
1713 message-body. HTTP/1.1 user agents MUST notify the user when an invalid
1714 length is received and detected.
1715
1716
1717 4.5 General Header Fields
1718
1719 There are a few header fields which have general applicability for both
1720 request and response messages, but which do not apply to the entity
1721 being transferred. These header fields apply only to the message being
1722 transmitted.
1723
1724 general-header = Cache-Control ; Section 14.9
1725 | Connection ; Section 14.10
1726 | Date ; Section 14.19
1727 | Pragma ; Section 14.32
1728 | Transfer-Encoding ; Section 14.40
1729 | Upgrade ; Section 14.41
1730 | Via ; Section 14.44
1731
1732 General-header field names can be extended reliably only in combination
1733 with a change in the protocol version. However, new or experimental
1734
1735 Fielding, et al [Page 31]
1736
1737
1738 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1739
1740
1741 header fields may be given the semantics of general header fields if all
1742 parties in the communication recognize them to be general-header fields.
1743 Unrecognized header fields are treated as entity-header fields.
1744
1745
1746 5 Request
1747
1748 A request message from a client to a server includes, within the first
1749 line of that message, the method to be applied to the resource, the
1750 identifier of the resource, and the protocol version in use.
1751
1752 Request = Request-Line ; Section 5.1
1753 *( general-header ; Section 4.5
1754 | request-header ; Section 5.3
1755 | entity-header ) ; Section 7.1
1756 CRLF
1757 [ message-body ] ; Section 7.2
1758
1759
1760 5.1 Request-Line
1761
1762 The Request-Line begins with a method token, followed by the Request-URI
1763 and the protocol version, and ending with CRLF. The elements are
1764 separated by SP characters. No CR or LF are allowed except in the final
1765 CRLF sequence.
1766
1767 Request-Line = Method SP Request-URI SP HTTP-Version CRLF
1768
1769
1770 5.1.1 Method
1771
1772 The Method token indicates the method to be performed on the resource
1773 identified by the Request-URI. The method is case-sensitive.
1774
1775 Method = "OPTIONS" ; Section 9.2
1776 | "GET" ; Section 9.3
1777 | "HEAD" ; Section 9.4
1778 | "POST" ; Section 9.5
1779 | "PUT" ; Section 9.6
1780 | "DELETE" ; Section 9.7
1781 | "TRACE" ; Section 9.8
1782 | extension-method
1783
1784 extension-method = token
1785
1786 The list of methods allowed by a resource can be specified in an Allow
1787 header field (section 14.7). The return code of the response always
1788 notifies the client whether a method is currently allowed on a resource,
1789 since the set of allowed methods can change dynamically. Servers SHOULD
1790 return the status code 405 (Method Not Allowed) if the method is known
1791 by the server but not allowed for the requested resource, and 501 (Not
1792
1793 Fielding, et al [Page 32]
1794
1795
1796 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1797
1798
1799 Implemented) if the method is unrecognized or not implemented by the
1800 server. The list of methods known by a server can be listed in a Public
1801 response-header field (section 14.35).
1802
1803 The methods GET and HEAD MUST be supported by all general-purpose
1804 servers. All other methods are optional; however, if the above methods
1805 are implemented, they MUST be implemented with the same semantics as
1806 those specified in section 9.
1807
1808
1809 5.1.2 Request-URI
1810
1811 The Request-URI is a Uniform Resource Identifier (section 3.2) and
1812 identifies the resource upon which to apply the request.
1813
1814 Request-URI = "*" | absoluteURI | abs_path
1815
1816 The three options for Request-URI are dependent on the nature of the
1817 request. The asterisk "*" means that the request does not apply to a
1818 particular resource, but to the server itself, and is only allowed when
1819 the method used does not necessarily apply to a resource. One example
1820 would be
1821
1822 OPTIONS * HTTP/1.1
1823
1824 The absoluteURI form is required when the request is being made to a
1825 proxy. The proxy is requested to forward the request or service it from
1826 a valid cache, and return the response. Note that the proxy MAY forward
1827 the request on to another proxy or directly to the server specified by
1828 the absoluteURI. In order to avoid request loops, a proxy MUST be able
1829 to recognize all of its server names, including any aliases, local
1830 variations, and the numeric IP address. An example Request-Line would
1831 be:
1832
1833 GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
1834
1835 To allow for transition to absoluteURIs in all requests in future
1836 versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI form
1837 in requests, even though HTTP/1.1 clients will only generate them in
1838 requests to proxies.
1839
1840 The most common form of Request-URI is that used to identify a resource
1841 on an origin server or gateway. In this case the absolute path of the
1842 URI MUST be transmitted (see section 3.2.1, abs_path) as the Request-
1843 URI, and the network location of the URI (net_loc) MUST be transmitted
1844 in a Host header field. For example, a client wishing to retrieve the
1845 resource above directly from the origin server would create a TCP
1846 connection to port 80 of the host "www.w3.org" and send the lines:
1847
1848 GET /pub/WWW/TheProject.html HTTP/1.1
1849 Host: www.w3.org
1850
1851 Fielding, et al [Page 33]
1852
1853
1854 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1855
1856
1857 followed by the remainder of the Request. Note that the absolute path
1858 cannot be empty; if none is present in the original URI, it MUST be
1859 given as "/" (the server root).
1860
1861 If a proxy receives a request without any path in the Request-URI and
1862 the method specified is capable of supporting the asterisk form of
1863 request, then the last proxy on the request chain MUST forward the
1864 request with "*" as the final Request-URI. For example, the request
1865
1866 OPTIONS http://www.ics.uci.edu:8001 HTTP/1.1
1867
1868 would be forwarded by the proxy as
1869
1870 OPTIONS * HTTP/1.1
1871 Host: www.ics.uci.edu:8001
1872
1873 after connecting to port 8001 of host "www.ics.uci.edu".
1874
1875 The Request-URI is transmitted in the format specified in section 3.2.1.
1876 The origin server MUST decode the Request-URI in order to properly
1877 interpret the request. Servers SHOULD respond to invalid Request-URIs
1878 with an appropriate status code.
1879
1880 In requests that they forward, proxies MUST NOT rewrite the "abs_path"
1881 part of a Request-URI in any way except as noted above to replace a null
1882 abs_path with "*", no matter what the proxy does in its internal
1883 implementation.
1884
1885 Note: The "no rewrite" rule prevents the proxy from changing the
1886 meaning of the request when the origin server is improperly using a
1887 non-reserved URL character for a reserved purpose, since it is not
1888 feasible to fix all CGI scripts (or script authors) use URI syntax
1889 correctly. Implementers should be aware that some pre-HTTP/1.1
1890 proxies have been known to rewrite the Request-URI.
1891
1892
1893 5.2 The Resource Identified by a Request
1894
1895 HTTP/1.1 origin servers SHOULD be aware that the exact resource
1896 identified by an Internet request is determined by examining both the
1897 Request-URI and the Host header field.
1898
1899 An origin server that does not allow resources to differ by the
1900 requested host MAY ignore the Host header field value. (But see section
1901 19.5.1 for other requirements on Host support in HTTP/1.1.)
1902
1903 An origin server that does differentiate resources based on the host
1904 requested (sometimes referred to as virtual hosts or vanity hostnames)
1905 MUST use the following rules for determining the requested resource on
1906 an HTTP/1.1 request:
1907
1908
1909 Fielding, et al [Page 34]
1910
1911
1912 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1913
1914
1915 1. If Request-URI is an absoluteURI, the host is part of the Request-
1916 URI. Any Host header field value in the request MUST be ignored.
1917 2. If the Request-URI is not an absoluteURI, and the request includes
1918 a Host header field, the host is determined by the Host header
1919 field value.
1920
1921 3. If the host as determined by rule 1 or 2 is not a valid host on the
1922 server, the response MUST be a 400 (Bad Request) error message.
1923
1924 Recipients of an HTTP/1.0 request that lacks a Host header field MAY
1925 attempt to use heuristics (e.g., examination of the URI path for
1926 something unique to a particular host) in order to determine what exact
1927 resource is being requested.
1928
1929
1930 5.3 Request Header Fields
1931
1932 The request-header fields allow the client to pass additional
1933 information about the request, and about the client itself, to the
1934 server. These fields act as request modifiers, with semantics equivalent
1935 to the parameters on a programming language method invocation.
1936
1937 request-header = Accept ; Section 14.1
1938 | Accept-Charset ; Section 14.2
1939 | Accept-Encoding ; Section 14.3
1940 | Accept-Language ; Section 14.4
1941 | Authorization ; Section 14.8
1942 | From ; Section 14.22
1943 | Host ; Section 14.23
1944 | If-Modified-Since ; Section 14.24
1945 | If-Match ; Section 14.25
1946 | If-None-Match ; Section 14.26
1947 | If-Range ; Section 14.27
1948 | If-Unmodified-Since ; Section 14.28
1949 | Max-Forwards ; Section 14.31
1950 | Proxy-Authorization ; Section 14.34
1951 | Range ; Section 14.36
1952 | Referer ; Section 14.37
1953 | User-Agent ; Section 14.42
1954
1955 Request-header field names can be extended reliably only in combination
1956 with a change in the protocol version. However, new or experimental
1957 header fields MAY be given the semantics of request-header fields if all
1958 parties in the communication recognize them to be request-header fields.
1959 Unrecognized header fields are treated as entity-header fields.
1960
1961
1962 6 Response
1963
1964 After receiving and interpreting a request message, a server responds
1965 with an HTTP response message.
1966
1967 Fielding, et al [Page 35]
1968
1969
1970 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
1971
1972
1973 Response = Status-Line ; Section 6.1
1974 *( general-header ; Section 4.5
1975 | response-header ; Section 6.2
1976 | entity-header ) ; Section 7.1
1977 CRLF
1978 [ message-body ] ; Section 7.2
1979
1980
1981 6.1 Status-Line
1982
1983 The first line of a Response message is the Status-Line, consisting of
1984 the protocol version followed by a numeric status code and its
1985 associated textual phrase, with each element separated by SP characters.
1986 No CR or LF is allowed except in the final CRLF sequence.
1987
1988 Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
1989
1990
1991 6.1.1 Status Code and Reason Phrase
1992
1993 The Status-Code element is a 3-digit integer result code of the attempt
1994 to understand and satisfy the request. These codes are fully defined in
1995 section 10. The Reason-Phrase is intended to give a short textual
1996 description of the Status-Code. The Status-Code is intended for use by
1997 automata and the Reason-Phrase is intended for the human user. The
1998 client is not required to examine or display the Reason-Phrase.
1999
2000 The first digit of the Status-Code defines the class of response. The
2001 last two digits do not have any categorization role. There are 5 values
2002 for the first digit:
2003
2004
2005 . 1xx: Informational - Request received, continuing process
2006
2007 . 2xx: Success - The action was successfully received, understood,
2008 and accepted
2009
2010 . 3xx: Redirection - Further action must be taken in order to
2011 complete the request
2012
2013 . 4xx: Client Error - The request contains bad syntax or cannot be
2014 fulfilled
2015
2016 . 5xx: Server Error - The server failed to fulfill an apparently
2017 valid request
2018 The individual values of the numeric status codes defined for HTTP/1.1,
2019 and an example set of corresponding Reason-Phrase's, are presented
2020 below. The reason phrases listed here are only recommended -- they may
2021 be replaced by local equivalents without affecting the protocol.
2022
2023
2024
2025 Fielding, et al [Page 36]
2026
2027
2028 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2029
2030
2031 Status-Code = "100" ; Continue
2032 | "101" ; Switching Protocols
2033 | "200" ; OK
2034 | "201" ; Created
2035 | "202" ; Accepted
2036 | "203" ; Non-Authoritative Information
2037 | "204" ; No Content
2038 | "205" ; Reset Content
2039 | "206" ; Partial Content
2040 | "300" ; Multiple Choices
2041 | "301" ; Moved Permanently
2042 | "302" ; Moved Temporarily
2043 | "303" ; See Other
2044 | "304" ; Not Modified
2045 | "305" ; Use Proxy
2046 | "400" ; Bad Request
2047 | "401" ; Unauthorized
2048 | "402" ; Payment Required
2049 | "403" ; Forbidden
2050 | "404" ; Not Found
2051 | "405" ; Method Not Allowed
2052 | "406" ; Not Acceptable
2053 | "407" ; Proxy Authentication Required
2054 | "408" ; Request Time-out
2055 | "409" ; Conflict
2056 | "410" ; Gone
2057 | "411" ; Length Required
2058 | "412" ; Precondition Failed
2059 | "413" ; Request Entity Too Large
2060 | "414" ; Request-URI Too Large
2061 | "415" ; Unsupported Media Type
2062 | "500" ; Internal Server Error
2063 | "501" ; Not Implemented
2064 | "502" ; Bad Gateway
2065 | "503" ; Service Unavailable
2066 | "504" ; Gateway Time-out
2067 | "505" ; HTTP Version not supported
2068 | extension-code
2069
2070 extension-code = 3DIGIT
2071
2072 Reason-Phrase = *<TEXT, excluding CR, LF>
2073
2074 HTTP status codes are extensible. HTTP applications are not required to
2075 understand the meaning of all registered status codes, though such
2076 understanding is obviously desirable. However, applications MUST
2077 understand the class of any status code, as indicated by the first
2078 digit, and treat any unrecognized response as being equivalent to the
2079 x00 status code of that class, with the exception that an unrecognized
2080 response MUST NOT be cached. For example, if an unrecognized status code
2081 of 431 is received by the client, it can safely assume that there was
2082
2083 Fielding, et al [Page 37]
2084
2085
2086 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2087
2088
2089 something wrong with its request and treat the response as if it had
2090 received a 400 status code. In such cases, user agents SHOULD present to
2091 the user the entity returned with the response, since that entity is
2092 likely to include human-readable information which will explain the
2093 unusual status.
2094
2095
2096 6.2 Response Header Fields
2097
2098 The response-header fields allow the server to pass additional
2099 information about the response which cannot be placed in the Status-
2100 Line. These header fields give information about the server and about
2101 further access to the resource identified by the Request-URI.
2102
2103 response-header = Age ; Section 14.6
2104 | Location ; Section 14.30
2105 | Proxy-Authenticate ; Section 14.33
2106 | Public ; Section 14.35
2107 | Retry-After ; Section 14.38
2108 | Server ; Section 14.39
2109 | Vary ; Section 14.43
2110 | Warning ; Section 14.45
2111 | WWW-Authenticate ; Section 14.46
2112
2113 Response-header field names can be extended reliably only in combination
2114 with a change in the protocol version. However, new or experimental
2115 header fields MAY be given the semantics of response-header fields if
2116 all parties in the communication recognize them to be response-header
2117 fields. Unrecognized header fields are treated as entity-header fields.
2118
2119
2120 7 Entity
2121
2122 Request and Response messages MAY transfer an entity if not otherwise
2123 restricted by the request method or response status code. An entity
2124 consists of entity-header fields and an entity-body, although some
2125 responses will only include the entity-headers.
2126
2127 In this section, both sender and recipient refer to either the client or
2128 the server, depending on who sends and who receives the entity.
2129
2130
2131 7.1 Entity Header Fields
2132
2133 Entity-header fields define optional metainformation about the entity-
2134 body or, if no body is present, about the resource identified by the
2135 request.
2136
2137 entity-header = Allow ; Section 14.7
2138 | Content-Base ; Section 14.11
2139 | Content-Encoding ; Section 14.12
2140
2141 Fielding, et al [Page 38]
2142
2143
2144 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2145
2146
2147 | Content-Language ; Section 14.13
2148 | Content-Length ; Section 14.14
2149 | Content-Location ; Section 14.15
2150 | Content-MD5 ; Section 14.16
2151 | Content-Range ; Section 14.17
2152 | Content-Type ; Section 14.18
2153 | ETag ; Section 14.20
2154 | Expires ; Section 14.21
2155 | Last-Modified ; Section 14.29
2156 | extension-header
2157
2158 extension-header = message-header
2159
2160 The extension-header mechanism allows additional entity-header fields to
2161 be defined without changing the protocol, but these fields cannot be
2162 assumed to be recognizable by the recipient. Unrecognized header fields
2163 SHOULD be ignored by the recipient and forwarded by proxies.
2164
2165
2166 7.2 Entity Body
2167
2168 The entity-body (if any) sent with an HTTP request or response is in a
2169 format and encoding defined by the entity-header fields.
2170
2171 entity-body = *OCTET
2172
2173 An entity-body is only present in a message when a message-body is
2174 present, as described in section 4.3. The entity-body is obtained from
2175 the message-body by decoding any Transfer-Encoding that may have been
2176 applied to ensure safe and proper transfer of the message.
2177
2178
2179 7.2.1 Type
2180
2181 When an entity-body is included with a message, the data type of that
2182 body is determined via the header fields Content-Type and Content-
2183 Encoding. These define a two-layer, ordered encoding model:
2184
2185 entity-body := Content-Encoding( Content-Type( data ) )
2186
2187 Content-Type specifies the media type of the underlying data. Content-
2188 Encoding may be used to indicate any additional content codings applied
2189 to the data, usually for the purpose of data compression, that are a
2190 property of the requested resource. There is no default encoding.
2191
2192 Any HTTP/1.1 message containing an entity-body SHOULD include a Content-
2193 Type header field defining the media type of that body. If and only if
2194 the media type is not given by a Content-Type field, the recipient MAY
2195 attempt to guess the media type via inspection of its content and/or the
2196 name extension(s) of the URL used to identify the resource. If the media
2197
2198
2199 Fielding, et al [Page 39]
2200
2201
2202 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2203
2204
2205 type remains unknown, the recipient SHOULD treat it as type
2206 "application/octet-stream".
2207
2208
2209 7.2.2 Length
2210
2211 The length of an entity-body is the length of the message-body after any
2212 transfer codings have been removed. Section 4.4 defines how the length
2213 of a message-body is determined.
2214
2215
2216 8 Connections
2217
2218
2219 8.1 Persistent Connections
2220
2221
2222 8.1.1 Purpose
2223
2224 Prior to persistent connections, a separate TCP connection was
2225 established to fetch each URL, increasing the load on HTTP servers and
2226 causing congestion on the Internet. The use of inline images and other
2227 associated data often requires a client to make multiple requests of the
2228 same server in a short amount of time. An excellent analysis of these
2229 performance problems is available [30]; analysis and results from a
2230 prototype implementation are in [26].
2231
2232 Persistent HTTP connections have a number of advantages:
2233
2234 . By opening and closing fewer TCP connections, CPU time is saved,
2235 and memory used for TCP protocol control blocks is also saved.
2236 . HTTP requests and responses can be pipelined on a connection.
2237 Pipelining allows a client to make multiple requests without
2238 waiting for each response, allowing a single TCP connection to be
2239 used much more efficiently, with much lower elapsed time.
2240 . Network congestion is reduced by reducing the number of packets
2241 caused by TCP opens, and by allowing TCP sufficient time to
2242 determine the congestion state of the network.
2243 . HTTP can evolve more gracefully; since errors can be reported
2244 without the penalty of closing the TCP connection. Clients using
2245 future versions of HTTP might optimistically try a new feature, but
2246 if communicating with an older server, retry with old semantics
2247 after an error is reported.
2248 HTTP implementations SHOULD implement persistent connections.
2249
2250
2251 8.1.2 Overall Operation
2252
2253 A significant difference between HTTP/1.1 and earlier versions of HTTP
2254 is that persistent connections are the default behavior of any HTTP
2255
2256
2257 Fielding, et al [Page 40]
2258
2259
2260 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2261
2262
2263 connection. That is, unless otherwise indicated, the client may assume
2264 that the server will maintain a persistent connection.
2265
2266 Persistent connections provide a mechanism by which a client and a
2267 server can signal the close of a TCP connection. This signaling takes
2268 place using the Connection header field. Once a close has been signaled,
2269 the client MUST not send any more requests on that connection.
2270
2271
2272 8.1.2.1 Negotiation
2273
2274 An HTTP/1.1 server MAY assume that a HTTP/1.1 client intends to maintain
2275 a persistent connection unless a Connection header including the
2276 connection-token "close" was sent in the request. If the server chooses
2277 to close the connection immediately after sending the response, it
2278 SHOULD send a Connection header including the connection-token close.
2279
2280 An HTTP/1.1 client MAY expect a connection to remain open, but would
2281 decide to keep it open based on whether the response from a server
2282 contains a Connection header with the connection-token close. In case
2283 the client does not want to maintain a connection for more than that
2284 request, it SHOULD send a Connection header including the connection-
2285 token close.
2286
2287 If either the client or the server sends the close token in the
2288 Connection header, that request becomes the last one for the connection.
2289
2290 Clients and servers SHOULD NOT assume that a persistent connection is
2291 maintained for HTTP versions less than 1.1 unless it is explicitly
2292 signaled. See section 19.7.1 for more information on backwards
2293 compatibility with HTTP/1.0 clients.
2294
2295 In order to remain persistent, all messages on the connection must have
2296 a self-defined message length (i.e., one not defined by closure of the
2297 connection), as described in section 4.4.
2298
2299
2300 8.1.2.2 Pipelining
2301
2302 A client that supports persistent connections MAY "pipeline" its
2303 requests (i.e., send multiple requests without waiting for each
2304 response). A server MUST send its responses to those requests in the
2305 same order that the requests were received.
2306
2307 Clients which assume persistent connections and pipeline immediately
2308 after connection establishment SHOULD be prepared to retry their
2309 connection if the first pipelined attempt fails. If a client does such a
2310 retry, it MUST NOT pipeline before it knows the connection is
2311 persistent. Clients MUST also be prepared to resend their requests if
2312 the server closes the connection before sending all of the corresponding
2313 responses.
2314
2315 Fielding, et al [Page 41]
2316
2317
2318 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2319
2320
2321 8.1.3 Proxy Servers
2322
2323 It is especially important that proxies correctly implement the
2324 properties of the Connection header field as specified in 14.2.1.
2325
2326 The proxy server MUST signal persistent connections separately with its
2327 clients and the origin servers (or other proxy servers) that it connects
2328 to. Each persistent connection applies to only one transport link.
2329
2330 A proxy server MUST NOT establish a persistent connection with an
2331 HTTP/1.0 client.
2332
2333
2334 8.1.4 Practical Considerations
2335
2336 Servers will usually have some time-out value beyond which they will no
2337 longer maintain an inactive connection. Proxy servers might make this a
2338 higher value since it is likely that the client will be making more
2339 connections through the same server. The use of persistent connections
2340 places no requirements on the length of this time-out for either the
2341 client or the server.
2342
2343 When a client or server wishes to time-out it SHOULD issue a graceful
2344 close on the transport connection. Clients and servers SHOULD both
2345 constantly watch for the other side of the transport close, and respond
2346 to it as appropriate. If a client or server does not detect the other
2347 side's close promptly it could cause unnecessary resource drain on the
2348 network.
2349
2350 A client, server, or proxy MAY close the transport connection at any
2351 time. For example, a client MAY have started to send a new request at
2352 the same time that the server has decided to close the "idle"
2353 connection. From the server's point of view, the connection is being
2354 closed while it was idle, but from the client's point of view, a request
2355 is in progress.
2356
2357 This means that clients, servers, and proxies MUST be able to recover
2358 from asynchronous close events. Client software SHOULD reopen the
2359 transport connection and retransmit the aborted request without user
2360 interaction so long as the request method is idempotent (see section
2361 9.1.2); other methods MUST NOT be automatically retried, although user
2362 agents MAY offer a human operator the choice of retrying the request.
2363 However, this automatic retry SHOULD NOT be repeated if the second
2364 request fails.
2365
2366 Servers SHOULD always respond to at least one request per connection, if
2367 at all possible. Servers SHOULD NOT close a connection in the middle of
2368 transmitting a response, unless a network or client failure is
2369 suspected.
2370
2371
2372
2373 Fielding, et al [Page 42]
2374
2375
2376 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2377
2378
2379 Clients that use persistent connections SHOULD limit the number of
2380 simultaneous connections that they maintain to a given server. A single-
2381 user client SHOULD maintain AT MOST 2 connections with any server or
2382 proxy. A proxy SHOULD use up to 2*N connections to another server or
2383 proxy, where N is the number of simultaneously active users. These
2384 guidelines are intended to improve HTTP response times and avoid
2385 congestion of the Internet or other networks.
2386
2387
2388 8.2 Message Transmission Requirements
2389
2390 General requirements:
2391
2392 . HTTP/1.1 servers SHOULD maintain persistent connections and use
2393 TCP's flow control mechanisms to resolve temporary overloads,
2394 rather than terminating connections with the expectation that
2395 clients will retry. The latter technique can exacerbate network
2396 congestion.
2397 . An HTTP/1.1 (or later) client sending a message-body SHOULD monitor
2398 the network connection for an error status while it is transmitting
2399 the request. If the client sees an error status, it SHOULD
2400 immediately cease transmitting the body. If the body is being sent
2401 using a "chunked" encoding (section 3.6), a zero length chunk and
2402 empty footer MAY be used to prematurely mark the end of the
2403 message. If the body was preceded by a Content-Length header, the
2404 client MUST close the connection.
2405 . An HTTP/1.1 (or later) client MUST be prepared to accept a 100
2406 (Continue) status followed by a regular response.
2407 . An HTTP/1.1 (or later) server that receives a request from a
2408 HTTP/1.0 (or earlier) client MUST NOT transmit the 100 (continue)
2409 response; it SHOULD either wait for the request to be completed
2410 normally (thus avoiding an interrupted request) or close the
2411 connection prematurely.
2412 Upon receiving a method subject to these requirements from an HTTP/1.1
2413 (or later) client, an HTTP/1.1 (or later) server MUST either respond
2414 with 100 (Continue) status and continue to read from the input stream,
2415 or respond with an error status. If it responds with an error status, it
2416 MAY close the transport (TCP) connection or it MAY continue to read and
2417 discard the rest of the request. It MUST NOT perform the requested
2418 method if it returns an error status.
2419
2420 Clients SHOULD remember the version number of at least the most recently
2421 used server; if an HTTP/1.1 client has seen an HTTP/1.1 or later
2422 response from the server, and it sees the connection close before
2423 receiving any status from the server, the client SHOULD retry the
2424 request without user interaction so long as the request method is
2425 idempotent (see section 9.1.2); other methods MUST NOT be automatically
2426 retried, although user agents MAY offer a human operator the choice of
2427 retrying the request.. If the client does retry the request, the client
2428
2429 . MUST first send the request header fields, and then
2430
2431 Fielding, et al [Page 43]
2432
2433
2434 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2435
2436
2437 . MUST wait for the server to respond with either a 100 (Continue)
2438 response, in which case the client should continue, or with an
2439 error status.
2440 If an HTTP/1.1 client has not seen an HTTP/1.1 or later response from
2441 the server, it should assume that the server implements HTTP/1.0 or
2442 older and will not use the 100 (Continue) response. If in this case the
2443 client sees the connection close before receiving any status from the
2444 server, the client SHOULD retry the request. If the client does retry
2445 the request, it should use the following "binary exponential backoff"
2446 algorithm to be assured of obtaining a reliable response:
2447
2448 1. Initiate a new connection to the server
2449 2. Transmit the request-headers
2450 3. Initialize a variable R to the estimated round-trip time to the
2451 server (e.g., based on the time it took to establish the
2452 connection), or to a constant value of 5 seconds if the round-trip
2453 time is not available.
2454 4. Compute T = R * (2**N), where N is the number of previous retries
2455 of this request.
2456 5. Wait either for an error response from the server, or for T seconds
2457 (whichever comes first)
2458 6. If no error response is received, after T seconds transmit the body
2459 of the request.
2460 7. If client sees that the connection is closed prematurely, repeat
2461 from step 1 until the request is accepted, an error response is
2462 received, or the user becomes impatient and terminates the retry
2463 process.
2464 No matter what the server version, if an error status is received, the
2465 client
2466
2467 . MUST NOT continue and
2468 . MUST close the connection if it has not completed sending the
2469 message.
2470 An HTTP/1.1 (or later) client that sees the connection close after
2471 receiving a 100 (Continue) but before receiving any other status SHOULD
2472 retry the request, and need not wait for 100 (Continue) response (but
2473 MAY do so if this simplifies the implementation).
2474
2475
2476 9 Method Definitions
2477
2478 The set of common methods for HTTP/1.1 is defined below. Although this
2479 set can be expanded, additional methods cannot be assumed to share the
2480 same semantics for separately extended clients and servers.
2481
2482 The Host request-header field (section 14.23) MUST accompany all
2483 HTTP/1.1 requests.
2484
2485
2486
2487
2488
2489 Fielding, et al [Page 44]
2490
2491
2492 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2493
2494
2495 9.1 Safe and Idempotent Methods
2496
2497
2498 9.1.1 Safe Methods
2499
2500 Implementers should be aware that the software represents the user in
2501 their interactions over the Internet, and should be careful to allow the
2502 user to be aware of any actions they may take which may have an
2503 unexpected significance to themselves or others.
2504
2505 In particular, the convention has been established that the GET and HEAD
2506 methods should never have the significance of taking an action other
2507 than retrieval. These methods should be considered "safe." This allows
2508 user agents to represent other methods, such as POST, PUT and DELETE, in
2509 a special way, so that the user is made aware of the fact that a
2510 possibly unsafe action is being requested.
2511
2512 Naturally, it is not possible to ensure that the server does not
2513 generate side-effects as a result of performing a GET request; in fact,
2514 some dynamic resources consider that a feature. The important
2515 distinction here is that the user did not request the side-effects, so
2516 therefore cannot be held accountable for them.
2517
2518
2519 9.1.2 Idempotent Methods
2520
2521 Methods may also have the property of "idempotence" in that (aside from
2522 error or expiration issues) the side-effects of N > 0 identical
2523 requests is the same as for a single request. The methods GET, HEAD, PUT
2524 and DELETE share this property.
2525
2526
2527 9.2 OPTIONS
2528
2529 The OPTIONS method represents a request for information about the
2530 communication options available on the request/response chain identified
2531 by the Request-URI. This method allows the client to determine the
2532 options and/or requirements associated with a resource, or the
2533 capabilities of a server, without implying a resource action or
2534 initiating a resource retrieval.
2535
2536 Unless the server's response is an error, the response MUST NOT include
2537 entity information other than what can be considered as communication
2538 options (e.g., Allow is appropriate, but Content-Type is not). Responses
2539 to this method are not cachable.
2540
2541 If the Request-URI is an asterisk ("*"), the OPTIONS request is intended
2542 to apply to the server as a whole. A 200 response SHOULD include any
2543 header fields which indicate optional features implemented by the server
2544 (e.g., Public), including any extensions not defined by this
2545 specification, in addition to any applicable general or response-header
2546
2547 Fielding, et al [Page 45]
2548
2549
2550 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2551
2552
2553 fields. As described in section 5.1.2, an "OPTIONS *" request can be
2554 applied through a proxy by specifying the destination server in the
2555 Request-URI without any path information.
2556
2557 If the Request-URI is not an asterisk, the OPTIONS request applies only
2558 to the options that are available when communicating with that resource.
2559 A 200 response SHOULD include any header fields which indicate optional
2560 features implemented by the server and applicable to that resource
2561 (e.g., Allow), including any extensions not defined by this
2562 specification, in addition to any applicable general or response-header
2563 fields. If the OPTIONS request passes through a proxy, the proxy MUST
2564 edit the response to exclude those options which apply to a proxy's
2565 capabilities and which are known to be unavailable through that proxy.
2566
2567
2568 9.3 GET
2569
2570 The GET method means retrieve whatever information (in the form of an
2571 entity) is identified by the Request-URI. If the Request-URI refers to a
2572 data-producing process, it is the produced data which shall be returned
2573 as the entity in the response and not the source text of the process,
2574 unless that text happens to be the output of the process.
2575
2576 The semantics of the GET method change to a "conditional GET" if the
2577 request message includes an If-Modified-Since, If-Unmodified-Since, If-
2578 Match, If-None-Match, or If-Range header field. A conditional GET method
2579 requests that the entity be transferred only under the circumstances
2580 described by the conditional header field(s). The conditional GET method
2581 is intended to reduce unnecessary network usage by allowing cached
2582 entities to be refreshed without requiring multiple requests or
2583 transferring data already held by the client.
2584
2585 The semantics of the GET method change to a "partial GET" if the request
2586 message includes a Range header field. A partial GET requests that only
2587 part of the entity be transferred, as described in section 14.36. The
2588 partial GET method is intended to reduce unnecessary network usage by
2589 allowing partially-retrieved entities to be completed without
2590 transferring data already held by the client.
2591
2592 The response to a GET request is cachable if and only if it meets the
2593 requirements for HTTP caching described in section 13.
2594
2595
2596 9.4 HEAD
2597
2598 The HEAD method is identical to GET except that the server MUST NOT
2599 return a message-body in the response. The metainformation contained in
2600 the HTTP headers in response to a HEAD request SHOULD be identical to
2601 the information sent in response to a GET request. This method can be
2602 used for obtaining metainformation about the entity implied by the
2603 request without transferring the entity-body itself. This method is
2604
2605 Fielding, et al [Page 46]
2606
2607
2608 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2609
2610
2611 often used for testing hypertext links for validity, accessibility, and
2612 recent modification.
2613
2614 The response to a HEAD request may be cachable in the sense that the
2615 information contained in the response may be used to update a previously
2616 cached entity from that resource. If the new field values indicate that
2617 the cached entity differs from the current entity (as would be indicated
2618 by a change in Content-Length, Content-MD5, ETag or Last-Modified), then
2619 the cache MUST treat the cache entry as stale.
2620
2621
2622 9.5 POST
2623
2624 The POST method is used to request that the destination server accept
2625 the entity enclosed in the request as a new subordinate of the resource
2626 identified by the Request-URI in the Request-Line. POST is designed to
2627 allow a uniform method to cover the following functions:
2628
2629
2630 . Annotation of existing resources;
2631
2632 . Posting a message to a bulletin board, newsgroup, mailing list, or
2633 similar group of articles;
2634
2635 . Providing a block of data, such as the result of submitting a form,
2636 to a data-handling process;
2637
2638 . Extending a database through an append operation.
2639 The actual function performed by the POST method is determined by the
2640 server and is usually dependent on the Request-URI. The posted entity is
2641 subordinate to that URI in the same way that a file is subordinate to a
2642 directory containing it, a news article is subordinate to a newsgroup to
2643 which it is posted, or a record is subordinate to a database.
2644
2645 The action performed by the POST method might not result in a resource
2646 that can be identified by a URI. In this case, either 200 (OK) or 204
2647 (No Content) is the appropriate response status, depending on whether or
2648 not the response includes an entity that describes the result.
2649
2650 If a resource has been created on the origin server, the response SHOULD
2651 be 201 (Created) and contain an entity which describes the status of the
2652 request and refers to the new resource, and a Location header (see
2653 section 14.30).
2654
2655 Responses to this method are not cachable, unless the response includes
2656 appropriate Cache-Control or Expires header fields. However, the 303
2657 (See Other) response can be used to direct the user agent to retrieve a
2658 cachable resource.
2659
2660 POST requests must obey the message transmission requirements set out in
2661 section 8.2.
2662
2663 Fielding, et al [Page 47]
2664
2665
2666 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2667
2668
2669 9.6 PUT
2670
2671 The PUT method requests that the enclosed entity be stored under the
2672 supplied Request-URI. If the Request-URI refers to an already existing
2673 resource, the enclosed entity SHOULD be considered as a modified version
2674 of the one residing on the origin server. If the Request-URI does not
2675 point to an existing resource, and that URI is capable of being defined
2676 as a new resource by the requesting user agent, the origin server can
2677 create the resource with that URI. If a new resource is created, the
2678 origin server MUST inform the user agent via the 201 (Created) response.
2679 If an existing resource is modified, either the 200 (OK) or 204 (No
2680 Content) response codes SHOULD be sent to indicate successful completion
2681 of the request. If the resource could not be created or modified with
2682 the Request-URI, an appropriate error response SHOULD be given that
2683 reflects the nature of the problem. The recipient of the entity MUST NOT
2684 ignore any Content-* (e.g. Content-Range) headers that it does not
2685 understand or implement and MUST return a 501 (Not Implemented) response
2686 in such cases.
2687
2688 If the request passes through a cache and the Request-URI identifies one
2689 or more currently cached entities, those entries should be treated as
2690 stale. Responses to this method are not cachable.
2691
2692 The fundamental difference between the POST and PUT requests is
2693 reflected in the different meaning of the Request-URI. The URI in a POST
2694 request identifies the resource that will handle the enclosed entity.
2695 That resource may be a data-accepting process, a gateway to some other
2696 protocol, or a separate entity that accepts annotations. In contrast,
2697 the URI in a PUT request identifies the entity enclosed with the request
2698 -- the user agent knows what URI is intended and the server MUST NOT
2699 attempt to apply the request to some other resource. If the server
2700 desires that the request be applied to a different URI, it MUST send a
2701 301 (Moved Permanently) response; the user agent MAY then make its own
2702 decision regarding whether or not to redirect the request.
2703
2704 A single resource MAY be identified by many different URIs. For example,
2705 an article may have a URI for identifying "the current version" which is
2706 separate from the URI identifying each particular version. In this case,
2707 a PUT request on a general URI may result in several other URIs being
2708 defined by the origin server.
2709
2710 HTTP/1.1 does not define how a PUT method affects the state of an origin
2711 server.
2712
2713 PUT requests must obey the message transmission requirements set out in
2714 section 8.2.
2715
2716
2717
2718
2719
2720
2721 Fielding, et al [Page 48]
2722
2723
2724 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2725
2726
2727 9.7 DELETE
2728
2729 The DELETE method requests that the origin server delete the resource
2730 identified by the Request-URI. This method MAY be overridden by human
2731 intervention (or other means) on the origin server. The client cannot be
2732 guaranteed that the operation has been carried out, even if the status
2733 code returned from the origin server indicates that the action has been
2734 completed successfully. However, the server SHOULD not indicate success
2735 unless, at the time the response is given, it intends to delete the
2736 resource or move it to an inaccessible location.
2737
2738 A successful response SHOULD be 200 (OK) if the response includes an
2739 entity describing the status, 202 (Accepted) if the action has not yet
2740 been enacted, or 204 (No Content) if the response is OK but does not
2741 include an entity.
2742
2743 If the request passes through a cache and the Request-URI identifies one
2744 or more currently cached entities, those entries should be treated as
2745 stale. Responses to this method are not cachable.
2746
2747
2748 9.8 TRACE
2749
2750 The TRACE method is used to invoke a remote, application-layer loop-back
2751 of the request message. The final recipient of the request SHOULD
2752 reflect the message received back to the client as the entity-body of a
2753 200 (OK) response. The final recipient is either the origin server or
2754 the first proxy or gateway to receive a Max-Forwards value of zero (0)
2755 in the request (see section 14.31). A TRACE request MUST NOT include an
2756 entity.
2757
2758 TRACE allows the client to see what is being received at the other end
2759 of the request chain and use that data for testing or diagnostic
2760 information. The value of the Via header field (section 14.44) is of
2761 particular interest, since it acts as a trace of the request chain. Use
2762 of the Max-Forwards header field allows the client to limit the length
2763 of the request chain, which is useful for testing a chain of proxies
2764 forwarding messages in an infinite loop.
2765
2766 If successful, the response SHOULD contain the entire request message in
2767 the entity-body, with a Content-Type of "message/http". Responses to
2768 this method MUST NOT be cached.
2769
2770
2771 10 Status Code Definitions
2772
2773 Each Status-Code is described below, including a description of which
2774 method(s) it can follow and any metainformation required in the
2775 response.
2776
2777
2778
2779 Fielding, et al [Page 49]
2780
2781
2782 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2783
2784
2785 10.1 Informational 1xx
2786
2787 This class of status code indicates a provisional response, consisting
2788 only of the Status-Line and optional headers, and is terminated by an
2789 empty line. Since HTTP/1.0 did not define any 1xx status codes, servers
2790 MUST NOT send a 1xx response to an HTTP/1.0 client except under
2791 experimental conditions.
2792
2793
2794 10.1.1 100 Continue
2795
2796 The client may continue with its request. This interim response is used
2797 to inform the client that the initial part of the request has been
2798 received and has not yet been rejected by the server. The client SHOULD
2799 continue by sending the remainder of the request or, if the request has
2800 already been completed, ignore this response. The server MUST send a
2801 final response after the request has been completed.
2802
2803
2804 10.1.2 101 Switching Protocols
2805
2806 The server understands and is willing to comply with the client's
2807 request, via the Upgrade message header field (section 14.41), for a
2808 change in the application protocol being used on this connection. The
2809 server will switch protocols to those defined by the response's Upgrade
2810 header field immediately after the empty line which terminates the 101
2811 response.
2812
2813 The protocol should only be switched when it is advantageous to do so.
2814 For example, switching to a newer version of HTTP is advantageous over
2815 older versions, and switching to a real-time, synchronous protocol may
2816 be advantageous when delivering resources that use such features.
2817
2818
2819 10.2 Successful 2xx
2820
2821 This class of status code indicates that the client's request was
2822 successfully received, understood, and accepted.
2823
2824
2825 10.2.1 200 OK
2826
2827 The request has succeeded. The information returned with the response is
2828 dependent on the method used in the request, for example:
2829
2830 GET an entity corresponding to the requested resource is sent in the
2831 response;
2832
2833 HEAD the entity-header fields corresponding to the requested resource
2834 are sent in the response without any message-body;
2835
2836
2837 Fielding, et al [Page 50]
2838
2839
2840 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2841
2842
2843 POST an entity describing or containing the result of the action;
2844
2845 TRACE an entity containing the request message as received by the end
2846 server.
2847
2848
2849 10.2.2 201 Created
2850
2851 The request has been fulfilled and resulted in a new resource being
2852 created. The newly created resource can be referenced by the URI(s)
2853 returned in the entity of the response, with the most specific URL for
2854 the resource given by a Location header field. The origin server MUST
2855 create the resource before returning the 201 status code. If the action
2856 cannot be carried out immediately, the server should respond with 202
2857 (Accepted) response instead.
2858
2859
2860 10.2.3 202 Accepted
2861
2862 The request has been accepted for processing, but the processing has not
2863 been completed. The request MAY or MAY NOT eventually be acted upon, as
2864 it MAY be disallowed when processing actually takes place. There is no
2865 facility for re-sending a status code from an asynchronous operation
2866 such as this.
2867
2868 The 202 response is intentionally non-committal. Its purpose is to allow
2869 a server to accept a request for some other process (perhaps a batch-
2870 oriented process that is only run once per day) without requiring that
2871 the user agent's connection to the server persist until the process is
2872 completed. The entity returned with this response SHOULD include an
2873 indication of the request's current status and either a pointer to a
2874 status monitor or some estimate of when the user can expect the request
2875 to be fulfilled.
2876
2877
2878 10.2.4 203 Non-Authoritative Information
2879
2880 The returned metainformation in the entity-header is not the definitive
2881 set as available from the origin server, but is gathered from a local or
2882 a third-party copy. The set presented MAY be a subset or superset of the
2883 original version. For example, including local annotation information
2884 about the resource MAY result in a superset of the metainformation known
2885 by the origin server. Use of this response code is not required and is
2886 only appropriate when the response would otherwise be 200 (OK).
2887
2888
2889 10.2.5 204 No Content
2890
2891 The server has fulfilled the request but there is no new information to
2892 send back. If the client is a user agent, it SHOULD NOT change its
2893 document view from that which caused the request to be sent. This
2894
2895 Fielding, et al [Page 51]
2896
2897
2898 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2899
2900
2901 response is primarily intended to allow input for actions to take place
2902 without causing a change to the user agent's active document view. The
2903 response MAY include new metainformation in the form of entity-headers,
2904 which SHOULD apply to the document currently in the user agent's active
2905 view.
2906
2907 The 204 response MUST NOT include a message-body, and thus is always
2908 terminated by the first empty line after the header fields.
2909
2910
2911 10.2.6 205 Reset Content
2912
2913 The server has fulfilled the request and the user agent SHOULD reset the
2914 document view which caused the request to be sent. This response is
2915 primarily intended to allow input for actions to take place via user
2916 input, followed by a clearing of the form in which the input is given so
2917 that the user can easily initiate another input action. The response
2918 MUST NOT include an entity.
2919
2920
2921 10.2.7 206 Partial Content
2922
2923 The server has fulfilled the partial GET request for the resource. The
2924 request must have included a Range header field (section 14.36)
2925 indicating the desired range. The response MUST include either a
2926 Content-Range header field (section 14.17) indicating the range included
2927 with this response, or a multipart/byteranges Content-Type including
2928 Content-Range fields for each part. If multipart/byteranges is not used,
2929 the Content-Length header field in the response MUST match the actual
2930 number of OCTETs transmitted in the message-body.
2931
2932 A cache that does not support the Range and Content-Range headers MUST
2933 NOT cache 206 (Partial) responses.
2934
2935
2936 10.3 Redirection 3xx
2937
2938 This class of status code indicates that further action needs to be
2939 taken by the user agent in order to fulfill the request. The action
2940 required MAY be carried out by the user agent without interaction with
2941 the user if and only if the method used in the second request is GET or
2942 HEAD. A user agent SHOULD NOT automatically redirect a request more than
2943 5 times, since such redirections usually indicate an infinite loop.
2944
2945
2946 10.3.1 300 Multiple Choices
2947
2948 The requested resource corresponds to any one of a set of
2949 representations, each with its own specific location, and agent-driven
2950 negotiation information (section 12) is being provided so that the user
2951
2952
2953 Fielding, et al [Page 52]
2954
2955
2956 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
2957
2958
2959 (or user agent) can select a preferred representation and redirect its
2960 request to that location.
2961
2962 Unless it was a HEAD request, the response SHOULD include an entity
2963 containing a list of resource characteristics and location(s) from which
2964 the user or user agent can choose the one most appropriate. The entity
2965 format is specified by the media type given in the Content-Type header
2966 field. Depending upon the format and the capabilities of the user agent,
2967 selection of the most appropriate choice may be performed automatically.
2968 However, this specification does not define any standard for such
2969 automatic selection.
2970
2971 If the server has a preferred choice of representation, it SHOULD
2972 include the specific URL for that representation in the Location field;
2973 user agents MAY use the Location field value for automatic redirection.
2974 This response is cachable unless indicated otherwise.
2975
2976
2977 10.3.2 301 Moved Permanently
2978
2979 The requested resource has been assigned a new permanent URI and any
2980 future references to this resource SHOULD be done using one of the
2981 returned URIs. Clients with link editing capabilities SHOULD
2982 automatically re-link references to the Request-URI to one or more of
2983 the new references returned by the server, where possible. This response
2984 is cachable unless indicated otherwise.
2985
2986 If the new URI is a location, its URL SHOULD be given by the Location
2987 field in the response. Unless the request method was HEAD, the entity of
2988 the response SHOULD contain a short hypertext note with a hyperlink to
2989 the new URI(s).
2990
2991 If the 301 status code is received in response to a request other than
2992 GET or HEAD, the user agent MUST NOT automatically redirect the request
2993 unless it can be confirmed by the user, since this might change the
2994 conditions under which the request was issued.
2995
2996 Note: When automatically redirecting a POST request after receiving
2997 a 301 status code, some existing HTTP/1.0 user agents will
2998 erroneously change it into a GET request.
2999
3000
3001 10.3.3 302 Moved Temporarily
3002
3003 The requested resource resides temporarily under a different URI. Since
3004 the redirection may be altered on occasion, the client SHOULD continue
3005 to use the Request-URI for future requests. This response is only
3006 cachable if indicated by a Cache-Control or Expires header field.
3007
3008 If the new URI is a location, its URL SHOULD be given by the Location
3009 field in the response. Unless the request method was HEAD, the entity of
3010
3011 Fielding, et al [Page 53]
3012
3013
3014 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3015
3016
3017 the response SHOULD contain a short hypertext note with a hyperlink to
3018 the new URI(s).
3019
3020 If the 302 status code is received in response to a request other than
3021 GET or HEAD, the user agent MUST NOT automatically redirect the request
3022 unless it can be confirmed by the user, since this might change the
3023 conditions under which the request was issued.
3024
3025 Note: When automatically redirecting a POST request after receiving
3026 a 302 status code, some existing HTTP/1.0 user agents will
3027 erroneously change it into a GET request.
3028
3029
3030 10.3.4 303 See Other
3031
3032 The response to the request can be found under a different URI and
3033 SHOULD be retrieved using a GET method on that resource. This method
3034 exists primarily to allow the output of a POST-activated script to
3035 redirect the user agent to a selected resource. The new URI is not a
3036 substitute reference for the originally requested resource. The 303
3037 response is not cachable, but the response to the second (redirected)
3038 request MAY be cachable.
3039
3040 If the new URI is a location, its URL SHOULD be given by the Location
3041 field in the response. Unless the request method was HEAD, the entity of
3042 the response SHOULD contain a short hypertext note with a hyperlink to
3043 the new URI(s).
3044
3045
3046 10.3.5 304 Not Modified
3047
3048 If the client has performed a conditional GET request and access is
3049 allowed, but the document has not been modified, the server SHOULD
3050 respond with this status code. The response MUST NOT contain a message-
3051 body.
3052
3053 The response MUST include the following header fields:
3054
3055 . Date
3056 . ETag and/or Content-Location, if the header would have been sent in
3057 a 200 response to the same request
3058 . Expires, Cache-Control, and/or Vary, if the field-value might
3059 differ from that sent in any previous response for the same variant
3060 If the conditional GET used a strong cache validator (see section
3061 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise
3062 (i.e., the conditional GET used a weak validator), the response MUST NOT
3063 include other entity-headers; this prevents inconsistencies between
3064 cached entity-bodies and updated headers.
3065
3066
3067
3068
3069 Fielding, et al [Page 54]
3070
3071
3072 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3073
3074
3075 If a 304 response indicates an entity not currently cached, then the
3076 cache MUST disregard the response and repeat the request without the
3077 conditional.
3078
3079 If a cache uses a received 304 response to update a cache entry, the
3080 cache MUST update the entry to reflect any new field values given in the
3081 response.
3082
3083 The 304 response MUST NOT include a message-body, and thus is always
3084 terminated by the first empty line after the header fields.
3085
3086
3087 10.3.6 305 Use Proxy
3088
3089 The requested resource MUST be accessed through the proxy given by the
3090 Location field. The Location field gives the URL of the proxy. The
3091 recipient is expected to repeat the request via the proxy.
3092
3093
3094 10.4 Client Error 4xx
3095
3096 The 4xx class of status code is intended for cases in which the client
3097 seems to have erred. Except when responding to a HEAD request, the
3098 server SHOULD include an entity containing an explanation of the error
3099 situation, and whether it is a temporary or permanent condition. These
3100 status codes are applicable to any request method. User agents SHOULD
3101 display any included entity to the user.
3102
3103 Note: If the client is sending data, a server implementation using
3104 TCP should be careful to ensure that the client acknowledges
3105 receipt of the packet(s) containing the response, before the server
3106 closes the input connection. If the client continues sending data
3107 to the server after the close, the server's TCP stack will send a
3108 reset packet to the client, which may erase the client's
3109 unacknowledged input buffers before they can be read and
3110 interpreted by the HTTP application.
3111
3112
3113 10.4.1 400 Bad Request
3114
3115 The request could not be understood by the server due to malformed
3116 syntax. The client SHOULD NOT repeat the request without modifications.
3117
3118
3119 10.4.2 401 Unauthorized
3120
3121 The request requires user authentication. The response MUST include a
3122 WWW-Authenticate header field (section 14.46) containing a challenge
3123 applicable to the requested resource. The client MAY repeat the request
3124 with a suitable Authorization header field (section 14.8). If the
3125 request already included Authorization credentials, then the 401
3126
3127 Fielding, et al [Page 55]
3128
3129
3130 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3131
3132
3133 response indicates that authorization has been refused for those
3134 credentials. If the 401 response contains the same challenge as the
3135 prior response, and the user agent has already attempted authentication
3136 at least once, then the user SHOULD be presented the entity that was
3137 given in the response, since that entity MAY include relevant diagnostic
3138 information. HTTP access authentication is explained in section 11.
3139
3140
3141 10.4.3 402 Payment Required
3142
3143 This code is reserved for future use.
3144
3145
3146 10.4.4 403 Forbidden
3147
3148 The server understood the request, but is refusing to fulfill it.
3149 Authorization will not help and the request SHOULD NOT be repeated. If
3150 the request method was not HEAD and the server wishes to make public why
3151 the request has not been fulfilled, it SHOULD describe the reason for
3152 the refusal in the entity. This status code is commonly used when the
3153 server does not wish to reveal exactly why the request has been refused,
3154 or when no other response is applicable.
3155
3156
3157 10.4.5 404 Not Found
3158
3159 The server has not found anything matching the Request-URI. No
3160 indication is given of whether the condition is temporary or permanent.
3161 If the server does not wish to make this information available to the
3162 client, the status code 403 (Forbidden) can be used instead. The 410
3163 (Gone) status code SHOULD be used if the server knows, through some
3164 internally configurable mechanism, that an old resource is permanently
3165 unavailable and has no forwarding address.
3166
3167
3168 10.4.6 405 Method Not Allowed
3169
3170 The method specified in the Request-Line is not allowed for the resource
3171 identified by the Request-URI. The response MUST include an Allow header
3172 containing a list of valid methods for the requested resource.
3173
3174
3175 10.4.7 406 Not Acceptable
3176
3177 The resource identified by the request is only capable of generating
3178 response entities which have content characteristics not acceptable
3179 according to the accept headers sent in the request.
3180
3181 Unless it was a HEAD request, the response SHOULD include an entity
3182 containing a list of available entity characteristics and location(s)
3183 from which the user or user agent can choose the one most appropriate.
3184
3185 Fielding, et al [Page 56]
3186
3187
3188 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3189
3190
3191 The entity format is specified by the media type given in the Content-
3192 Type header field. Depending upon the format and the capabilities of the
3193 user agent, selection of the most appropriate choice may be performed
3194 automatically. However, this specification does not define any standard
3195 for such automatic selection.
3196
3197 Note: HTTP/1.1 servers are allowed to return responses which are
3198 not acceptable according to the accept headers sent in the request.
3199 In some cases, this may even be preferable to sending a 406
3200 response. User agents are encouraged to inspect the headers of an
3201 incoming response to determine if it is acceptable. If the response
3202 could be unacceptable, a user agent SHOULD temporarily stop receipt
3203 of more data and query the user for a decision on further actions.
3204
3205
3206 10.4.8 407 Proxy Authentication Required
3207
3208 This code is similar to 401 (Unauthorized), but indicates that the
3209 client MUST first authenticate itself with the proxy. The proxy MUST
3210 return a Proxy-Authenticate header field (section 14.33) containing a
3211 challenge applicable to the proxy for the requested resource. The client
3212 MAY repeat the request with a suitable Proxy-Authorization header field
3213 (section 14.34). HTTP access authentication is explained in section 11.
3214
3215
3216 10.4.9 408 Request Timeout
3217
3218 The client did not produce a request within the time that the server was
3219 prepared to wait. The client MAY repeat the request without
3220 modifications at any later time.
3221
3222
3223 10.4.10 409 Conflict
3224
3225 The request could not be completed due to a conflict with the current
3226 state of the resource. This code is only allowed in situations where it
3227 is expected that the user might be able to resolve the conflict and
3228 resubmit the request. The response body SHOULD include enough
3229 information for the user to recognize the source of the conflict.
3230 Ideally, the response entity would include enough information for the
3231 user or user agent to fix the problem; however, that may not be possible
3232 and is not required.
3233
3234 Conflicts are most likely to occur in response to a PUT request. If
3235 versioning is being used and the entity being PUT includes changes to a
3236 resource which conflict with those made by an earlier (third-party)
3237 request, the server MAY use the 409 response to indicate that it can't
3238 complete the request. In this case, the response entity SHOULD contain a
3239 list of the differences between the two versions in a format defined by
3240 the response Content-Type.
3241
3242
3243 Fielding, et al [Page 57]
3244
3245
3246 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3247
3248
3249 10.4.11 410 Gone
3250
3251 The requested resource is no longer available at the server and no
3252 forwarding address is known. This condition SHOULD be considered
3253 permanent. Clients with link editing capabilities SHOULD delete
3254 references to the Request-URI after user approval. If the server does
3255 not know, or has no facility to determine, whether or not the condition
3256 is permanent, the status code 404 (Not Found) SHOULD be used instead.
3257 This response is cachable unless indicated otherwise.
3258
3259 The 410 response is primarily intended to assist the task of web
3260 maintenance by notifying the recipient that the resource is
3261 intentionally unavailable and that the server owners desire that remote
3262 links to that resource be removed. Such an event is common for limited-
3263 time, promotional services and for resources belonging to individuals no
3264 longer working at the server's site. It is not necessary to mark all
3265 permanently unavailable resources as "gone" or to keep the mark for any
3266 length of time -- that is left to the discretion of the server owner.
3267
3268
3269 10.4.12 411 Length Required
3270
3271 The server refuses to accept the request without a defined Content-
3272 Length. The client MAY repeat the request if it adds a valid Content-
3273 Length header field containing the length of the message-body in the
3274 request message.
3275
3276
3277 10.4.13 412 Precondition Failed
3278
3279 The precondition given in one or more of the request-header fields
3280 evaluated to false when it was tested on the server. This response code
3281 allows the client to place preconditions on the current resource
3282 metainformation (header field data) and thus prevent the requested
3283 method from being applied to a resource other than the one intended.
3284
3285
3286 10.4.14 413 Request Entity Too Large
3287
3288 The server is refusing to process a request because the request entity
3289 is larger than the server is willing or able to process. The server may
3290 close the connection to prevent the client from continuing the request.
3291
3292 If the condition is temporary, the server SHOULD include a Retry-After
3293 header field to indicate that it is temporary and after what time the
3294 client may try again.
3295
3296
3297
3298
3299
3300
3301 Fielding, et al [Page 58]
3302
3303
3304 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3305
3306
3307 10.4.15 414 Request-URI Too Long
3308
3309 The server is refusing to service the request because the Request-URI is
3310 longer than the server is willing to interpret. This rare condition is
3311 only likely to occur when a client has improperly converted a POST
3312 request to a GET request with long query information, when the client
3313 has descended into a URL "black hole" of redirection (e.g., a redirected
3314 URL prefix that points to a suffix of itself), or when the server is
3315 under attack by a client attempting to exploit security holes present in
3316 some servers using fixed-length buffers for reading or manipulating the
3317 Request-URI.
3318
3319
3320 10.4.16 415 Unsupported Media Type
3321
3322 The server is refusing to service the request because the entity of the
3323 request is in a format not supported by the requested resource for the
3324 requested method.
3325
3326
3327 10.5 Server Error 5xx
3328
3329 Response status codes beginning with the digit "5" indicate cases in
3330 which the server is aware that it has erred or is incapable of
3331 performing the request. Except when responding to a HEAD request, the
3332 server SHOULD include an entity containing an explanation of the error
3333 situation, and whether it is a temporary or permanent condition. User
3334 agents SHOULD display any included entity to the user. These response
3335 codes are applicable to any request method.
3336
3337
3338 10.5.1 500 Internal Server Error
3339
3340 The server encountered an unexpected condition which prevented it from
3341 fulfilling the request.
3342
3343
3344 10.5.2 501 Not Implemented
3345
3346 The server does not support the functionality required to fulfill the
3347 request. This is the appropriate response when the server does not
3348 recognize the request method and is not capable of supporting it for any
3349 resource.
3350
3351
3352 10.5.3 502 Bad Gateway
3353
3354 The server, while acting as a gateway or proxy, received an invalid
3355 response from the upstream server it accessed in attempting to fulfill
3356 the request.
3357
3358
3359 Fielding, et al [Page 59]
3360
3361
3362 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3363
3364
3365 10.5.4 503 Service Unavailable
3366
3367 The server is currently unable to handle the request due to a temporary
3368 overloading or maintenance of the server. The implication is that this
3369 is a temporary condition which will be alleviated after some delay. If
3370 known, the length of the delay may be indicated in a Retry-After header.
3371 If no Retry-After is given, the client SHOULD handle the response as it
3372 would for a 500 response.
3373
3374 Note: The existence of the 503 status code does not imply that a
3375 server must use it when becoming overloaded. Some servers may wish
3376 to simply refuse the connection.
3377
3378
3379 10.5.5 504 Gateway Timeout
3380
3381 The server, while acting as a gateway or proxy, did not receive a timely
3382 response from the upstream server it accessed in attempting to complete
3383 the request.
3384
3385
3386 10.5.6 505 HTTP Version Not Supported
3387
3388 The server does not support, or refuses to support, the HTTP protocol
3389 version that was used in the request message. The server is indicating
3390 that it is unable or unwilling to complete the request using the same
3391 major version as the client, as described in section 3.1, other than
3392 with this error message. The response SHOULD contain an entity
3393 describing why that version is not supported and what other protocols
3394 are supported by that server.
3395
3396
3397 11 Access Authentication
3398
3399 HTTP provides a simple challenge-response authentication mechanism which
3400 MAY be used by a server to challenge a client request and by a client to
3401 provide authentication information. It uses an extensible, case-
3402 insensitive token to identify the authentication scheme, followed by a
3403 comma-separated list of attribute-value pairs which carry the parameters
3404 necessary for achieving authentication via that scheme.
3405
3406 auth-scheme = token
3407
3408 auth-param = token "=" quoted-string
3409
3410 The 401 (Unauthorized) response message is used by an origin server to
3411 challenge the authorization of a user agent. This response MUST include
3412 a WWW-Authenticate header field containing at least one challenge
3413 applicable to the requested resource.
3414
3415 challenge = auth-scheme 1*SP realm *( "," auth-param )
3416
3417 Fielding, et al [Page 60]
3418
3419
3420 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3421
3422
3423 realm = "realm" "=" realm-value
3424 realm-value = quoted-string
3425
3426 The realm attribute (case-insensitive) is required for all
3427 authentication schemes which issue a challenge. The realm value (case-
3428 sensitive), in combination with the canonical root URL (see section
3429 5.1.2) of the server being accessed, defines the protection space. These
3430 realms allow the protected resources on a server to be partitioned into
3431 a set of protection spaces, each with its own authentication scheme
3432 and/or authorization database. The realm value is a string, generally
3433 assigned by the origin server, which may have additional semantics
3434 specific to the authentication scheme.
3435
3436 A user agent that wishes to authenticate itself with a server--usually,
3437 but not necessarily, after receiving a 401 or 411 response--MAY do so by
3438 including an Authorization header field with the request. The
3439 Authorization field value consists of credentials containing the
3440 authentication information of the user agent for the realm of the
3441 resource being requested.
3442
3443 credentials = basic-credentials
3444 | auth-scheme #auth-param
3445
3446 The domain over which credentials can be automatically applied by a user
3447 agent is determined by the protection space. If a prior request has been
3448 authorized, the same credentials MAY be reused for all other requests
3449 within that protection space for a period of time determined by the
3450 authentication scheme, parameters, and/or user preference. Unless
3451 otherwise defined by the authentication scheme, a single protection
3452 space cannot extend outside the scope of its server.
3453
3454 If the server does not wish to accept the credentials sent with a
3455 request, it SHOULD return a 401 (Unauthorized) response. The response
3456 MUST include a WWW-Authenticate header field containing the (possibly
3457 new) challenge applicable to the requested resource and an entity
3458 explaining the refusal.
3459
3460 The HTTP protocol does not restrict applications to this simple
3461 challenge-response mechanism for access authentication. Additional
3462 mechanisms MAY be used, such as encryption at the transport level or via
3463 message encapsulation, and with additional header fields specifying
3464 authentication information. However, these additional mechanisms are not
3465 defined by this specification.
3466
3467 Proxies MUST be completely transparent regarding user agent
3468 authentication. That is, they MUST forward the WWW-Authenticate and
3469 Authorization headers untouched, and follow the rules found in section
3470 14.8.
3471
3472 HTTP/1.1 allows a client to pass authentication information to and from
3473 a proxy via the Proxy-Authenticate and Proxy-Authorization headers.
3474
3475 Fielding, et al [Page 61]
3476
3477
3478 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3479
3480
3481 11.1 Basic Authentication Scheme
3482
3483 The "basic" authentication scheme is based on the model that the user
3484 agent must authenticate itself with a user-ID and a password for each
3485 realm. The realm value should be considered an opaque string which can
3486 only be compared for equality with other realms on that server. The
3487 server will service the request only if it can validate the user-ID and
3488 password for the protection space of the Request-URI. There are no
3489 optional authentication parameters.
3490
3491 Upon receipt of an unauthorized request for a URI within the protection
3492 space, the server MAY respond with a challenge like the following:
3493
3494 WWW-Authenticate: Basic realm="WallyWorld"
3495
3496 where "WallyWorld" is the string assigned by the server to identify the
3497 protection space of the Request-URI.
3498
3499 To receive authorization, the client sends the userid and password,
3500 separated by a single colon (":") character, within a base64 encoded
3501 string in the credentials.
3502
3503 basic-credentials = "Basic" SP basic-cookie
3504
3505 basic-cookie = <base64 [7] encoding of user-pass,
3506 except not limited to 76 char/line>
3507
3508 user-pass = userid ":" password
3509
3510 userid = *<TEXT excluding ":">
3511
3512 password = *TEXT
3513
3514 Userids might be case sensitive.
3515
3516 If the user agent wishes to send the userid "Aladdin" and password "open
3517 sesame", it would use the following header field:
3518
3519 Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
3520
3521 See section 15 for security considerations associated with Basic
3522 authentication.
3523
3524
3525 11.2 Digest Authentication Scheme
3526
3527 Note for the RFC editor: This section is reserved for including the
3528 Digest Authentication specification, or if the RFC editor chooses to
3529 issue a single RFC rather than two RFC's, this section should be
3530 deleted.
3531
3532
3533 Fielding, et al [Page 62]
3534
3535
3536 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3537
3538
3539 12 Content Negotiation
3540
3541 Most HTTP responses include an entity which contains information for
3542 interpretation by a human user. Naturally, it is desirable to supply the
3543 user with the "best available" entity corresponding to the request.
3544 Unfortunately for servers and caches, not all users have the same
3545 preferences for what is "best," and not all user agents are equally
3546 capable of rendering all entity types. For that reason, HTTP has
3547 provisions for several mechanisms for "content negotiation" -- the
3548 process of selecting the best representation for a given response when
3549 there are multiple representations available.
3550
3551 Note: This is not called "format negotiation" because the alternate
3552 representations may be of the same media type, but use different
3553 capabilities of that type, be in different languages, etc.
3554
3555 Any response containing an entity-body MAY be subject to negotiation,
3556 including error responses.
3557
3558 There are two kinds of content negotiation which are possible in HTTP:
3559 server-driven and agent-driven negotiation. These two kinds of
3560 negotiation are orthogonal and thus may be used separately or in
3561 combination. One method of combination, referred to as transparent
3562 negotiation, occurs when a cache uses the agent-driven negotiation
3563 information provided by the origin server in order to provide server-
3564 driven negotiation for subsequent requests.
3565
3566
3567 12.1 Server-driven Negotiation
3568
3569 If the selection of the best representation for a response is made by an
3570 algorithm located at the server, it is called server-driven negotiation.
3571 Selection is based on the available representations of the response (the
3572 dimensions over which it can vary; e.g. language, content-coding, etc.)
3573 and the contents of particular header fields in the request message or
3574 on other information pertaining to the request (such as the network
3575 address of the client).
3576
3577 Server-driven negotiation is advantageous when the algorithm for
3578 selecting from among the available representations is difficult to
3579 describe to the user agent, or when the server desires to send its "best
3580 guess" to the client along with the first response (hoping to avoid the
3581 round-trip delay of a subsequent request if the "best guess" is good
3582 enough for the user). In order to improve the server's guess, the user
3583 agent MAY include request header fields (Accept, Accept-Language,
3584 Accept-Encoding, etc.) which describe its preferences for such a
3585 response.
3586
3587 Server-driven negotiation has disadvantages:
3588
3589
3590
3591 Fielding, et al [Page 63]
3592
3593
3594 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3595
3596
3597 1. It is impossible for the server to accurately determine what might be
3598 "best" for any given user, since that would require complete
3599 knowledge of both the capabilities of the user agent and the intended
3600 use for the response (e.g., does the user want to view it on screen
3601 or print it on paper?).
3602
3603 2. Having the user agent describe its capabilities in every request can
3604 be both very inefficient (given that only a small percentage of
3605 responses have multiple representations) and a potential violation of
3606 the user's privacy.
3607
3608 3. It complicates the implementation of an origin server and the
3609 algorithms for generating responses to a request.
3610
3611 4. It may limit a public cache's ability to use the same response for
3612 multiple user's requests.
3613
3614 HTTP/1.1 includes the following request-header fields for enabling
3615 server-driven negotiation through description of user agent capabilities
3616 and user preferences: Accept (section 14.1), Accept-Charset (section
3617 14.2), Accept-Encoding (section 14.3), Accept-Language (section 14.4),
3618 and User-Agent (section 14.42). However, an origin server is not limited
3619 to these dimensions and MAY vary the response based on any aspect of the
3620 request, including information outside the request-header fields or
3621 within extension header fields not defined by this specification.
3622
3623 HTTP/1.1 origin servers MUST include an appropriate Vary header field
3624 (section 14.43) in any cachable response based on server-driven
3625 negotiation. The Vary header field describes the dimensions over which
3626 the response might vary (i.e. the dimensions over which the origin
3627 server picks its "best guess" response from multiple representations).
3628
3629 HTTP/1.1 public caches MUST recognize the Vary header field when it is
3630 included in a response and obey the requirements described in section
3631 13.6 that describes the interactions between caching and content
3632 negotiation.
3633
3634
3635 12.2 Agent-driven Negotiation
3636
3637 With agent-driven negotiation, selection of the best representation for
3638 a response is performed by the user agent after receiving an initial
3639 response from the origin server. Selection is based on a list of the
3640 available representations of the response included within the header
3641 fields (this specification reserves the keyword Alternates, as described
3642 in appendix 19.6.2.1) or entity-body of the initial response, with each
3643 representation identified by its own URI. Selection from among the
3644 representations may be performed automatically (if the user agent is
3645 capable of doing so) or manually by the user selecting from a generated
3646 (possibly hypertext) menu.
3647
3648
3649 Fielding, et al [Page 64]
3650
3651
3652 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3653
3654
3655 Agent-driven negotiation is advantageous when the response would vary
3656 over commonly-used dimensions (such as type, language, or encoding),
3657 when the origin server is unable to determine a user agent's
3658 capabilities from examining the request, and generally when public
3659 caches are used to distribute server load and reduce network usage.
3660
3661 Agent-driven negotiation suffers from the disadvantage of needing a
3662 second request to obtain the best alternate representation. This second
3663 request is only efficient when caching is used. In addition, this
3664 specification does not define any mechanism for supporting automatic
3665 selection, though it also does not prevent any such mechanism from being
3666 developed as an extension and used within HTTP/1.1.
3667
3668 HTTP/1.1 defines the 300 (Multiple Choices) and 406 (Not Acceptable)
3669 status codes for enabling agent-driven negotiation when the server is
3670 unwilling or unable to provide a varying response using server-driven
3671 negotiation.
3672
3673
3674 12.3 Transparent Negotiation
3675
3676 Transparent negotiation is a combination of both server-driven and
3677 agent-driven negotiation. When a cache is supplied with a form of the
3678 list of available representations of the response (as in agent-driven
3679 negotiation) and the dimensions of variance are completely understood by
3680 the cache, then the cache becomes capable of performing server-driven
3681 negotiation on behalf of the origin server for subsequent requests on
3682 that resource.
3683
3684 Transparent negotiation has the advantage of distributing the
3685 negotiation work that would otherwise be required of the origin server
3686 and also removing the second request delay of agent-driven negotiation
3687 when the cache is able to correctly guess the right response.
3688
3689 This specification does not define any mechanism for transparent
3690 negotiation, though it also does not prevent any such mechanism from
3691 being developed as an extension and used within HTTP/1.1. An HTTP/1.1
3692 cache performing transparent negotiation MUST include a Vary header
3693 field in the response (defining the dimensions of its variance) if it is
3694 cachable to ensure correct interoperation with all HTTP/1.1 clients. The
3695 agent-driven negotiation information supplied by the origin server
3696 SHOULD be included with the transparently negotiated response.
3697
3698
3699 13 Caching in HTTP
3700
3701 HTTP is typically used for distributed information systems, where
3702 performance can be improved by the use of response caches. The HTTP/1.1
3703 protocol includes a number of elements intended to make caching work as
3704 well as possible. Because these elements are inextricable from other
3705 aspects of the protocol, and because they interact with each other, it
3706
3707 Fielding, et al [Page 65]
3708
3709
3710 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3711
3712
3713 is useful to describe the basic caching design of HTTP separately from
3714 the detailed descriptions of methods, headers, response codes, etc.
3715
3716 Caching would be useless if it did not significantly improve
3717 performance. The goal of caching in HTTP/1.1 is to eliminate the need to
3718 send requests in many cases, and to eliminate the need to send full
3719 responses in many other cases. The former reduces the number of network
3720 round-trips required for many operations; we use an "expiration"
3721 mechanism for this purpose (see section 13.2). The latter reduces
3722 network bandwidth requirements; we use a "validation" mechanism for this
3723 purpose (see section 13.3).
3724
3725 Requirements for performance, availability, and disconnected operation
3726 require us to be able to relax the goal of semantic transparency. The
3727 HTTP/1.1 protocol allows origin servers, caches, and clients to
3728 explicitly reduce transparency when necessary. However, because non-
3729 transparent operation may confuse non-expert users, and may be
3730 incompatible with certain server applications (such as those for
3731 ordering merchandise), the protocol requires that transparency be
3732 relaxed
3733
3734 . only by an explicit protocol-level request when relaxed by client
3735 or origin server
3736 . only with an explicit warning to the end user when relaxed by cache
3737 or client
3738 Therefore, the HTTP/1.1 protocol provides these important elements:
3739
3740 1. Protocol features that provide full semantic transparency when this
3741 is required by all parties.
3742 2. Protocol features that allow an origin server or user agent to
3743 explicitly request and control non-transparent operation.
3744 3. Protocol features that allow a cache to attach warnings to
3745 responses that do not preserve the requested approximation of
3746 semantic transparency.
3747 A basic principle is that it must be possible for the clients to detect
3748 any potential relaxation of semantic transparency.
3749
3750 Note: The server, cache, or client implementer may be faced with
3751 design decisions not explicitly discussed in this specification. If
3752 a decision may affect semantic transparency, the implementer ought
3753 to err on the side of maintaining transparency unless a careful and
3754 complete analysis shows significant benefits in breaking
3755 transparency.
3756
3757
3758 13.1.1 Cache Correctness
3759
3760 A correct cache MUST respond to a request with the most up-to-date
3761 response held by the cache that is appropriate to the request (see
3762 sections 13.2.5, 13.2.6, and 13.12) which meets one of the following
3763 conditions:
3764
3765 Fielding, et al [Page 66]
3766
3767
3768 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3769
3770
3771 1. It has been checked for equivalence with what the origin server
3772 would have returned by revalidating the response with the origin
3773 server (section 13.3);
3774 2. It is "fresh enough" (see section 13.2). In the default case, this
3775 means it meets the least restrictive freshness requirement of the
3776 client, server, and cache (see section 14.9); if the origin server
3777 so specifies, it is the freshness requirement of the origin server
3778 alone.
3779 3. It includes a warning if the freshness demand of the client or the
3780 origin server is violated (see section 13.1.5 and 14.45).
3781 4. It is an appropriate 304 (Not Modified), 305 (Proxy Redirect), or
3782 error (4xx or 5xx) response message.
3783 and it is the most up-to-date response appropriate to the request the
3784 cache has (see section 13.2.5, 13.2.6, and 13.12).
3785
3786 If the cache can not communicate with the origin server, then a correct
3787 cache SHOULD respond as above if the response can be correctly served
3788 from the cache; if not it MUST return an error or warning indicating
3789 that there was a communication failure.
3790
3791 If a cache receives a response (either an entire response, or a 304 (Not
3792 Modified) response) that it would normally forward to the requesting
3793 client, and the received response is no longer fresh, the cache SHOULD
3794 forward it to the requesting client without adding a new Warning (but
3795 without removing any existing Warning headers). A cache SHOULD NOT
3796 attempt to revalidate a response simply because that response became
3797 stale in transit; this might lead to an infinite loop. An user agent
3798 that receives a stale response without a Warning MAY display a warning
3799 indication to the user.
3800
3801
3802 13.1.2 Warnings
3803
3804 Whenever a cache returns a response that is neither first-hand nor
3805 "fresh enough" (in the sense of condition 2 in section 13.1.1), it must
3806 attach a warning to that effect, using a Warning response-header. This
3807 warning allows clients to take appropriate action.
3808
3809 Warnings may be used for other purposes, both cache-related and
3810 otherwise. The use of a warning, rather than an error status code,
3811 distinguish these responses from true failures.
3812
3813 Warnings are always cachable, because they never weaken the transparency
3814 of a response. This means that warnings can be passed to HTTP/1.0 caches
3815 without danger; such caches will simply pass the warning along as an
3816 entity-header in the response.
3817
3818 Warnings are assigned numbers between 0 and 99. This specification
3819 defines the code numbers and meanings of each currently assigned
3820 warnings, allowing a client or cache to take automated action in some
3821 (but not all) cases.
3822
3823 Fielding, et al [Page 67]
3824
3825
3826 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3827
3828
3829 Warnings also carry a warning text. The text may be in any appropriate
3830 natural language (perhaps based on the client's Accept headers), and
3831 include an optional indication of what character set is used.
3832
3833 Multiple warnings may be attached to a response (either by the origin
3834 server or by a cache), including multiple warnings with the same code
3835 number. For example, a server may provide the same warning with texts in
3836 both English and Basque.
3837
3838 When multiple warnings are attached to a response, it may not be
3839 practical or reasonable to display all of them to the user. This version
3840 of HTTP does not specify strict priority rules for deciding which
3841 warnings to display and in what order, but does suggest some heuristics.
3842
3843 The Warning header and the currently defined warnings are described in
3844 section 14.45.
3845
3846
3847 13.1.3 Cache-control Mechanisms
3848
3849 The basic cache mechanisms in HTTP/1.1 (server-specified expiration
3850 times and validators) are implicit directives to caches. In some cases,
3851 a server or client may need to provide explicit directives to the HTTP
3852 caches. We use the Cache-Control header for this purpose.
3853
3854 The Cache-Control header allows a client or server to transmit a variety
3855 of directives in either requests or responses. These directives
3856 typically override the default caching algorithms. As a general rule, if
3857 there is any apparent conflict between header values, the most
3858 restrictive interpretation should be applied (that is, the one that is
3859 most likely to preserve semantic transparency). However, in some cases,
3860 Cache-Control directives are explicitly specified as weakening the
3861 approximation of semantic transparency (for example, "max-stale" or
3862 "public").
3863
3864 The Cache-Control directives are described in detail in section 14.9.
3865
3866
3867 13.1.4 Explicit User Agent Warnings
3868
3869 Many user agents make it possible for users to override the basic
3870 caching mechanisms. For example, the user agent may allow the user to
3871 specify that cached entities (even explicitly stale ones) are never
3872 validated. Or the user agent might habitually add "Cache-Control: max-
3873 stale=3600" or "Cache-Control: reload" to every request. The user should
3874 have to explicitly request either non-transparent behavior, or behavior
3875 that results in abnormally ineffective caching.
3876
3877 If the user has overridden the basic caching mechanisms, the user agent
3878 should explicitly indicate to the user whenever this results in the
3879 display of information that might not meet the server's transparency
3880
3881 Fielding, et al [Page 68]
3882
3883
3884 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3885
3886
3887 requirements (in particular, if the displayed entity is known to be
3888 stale). Since the protocol normally allows the user agent to determine
3889 if responses are stale or not, this indication need only be displayed
3890 when this actually happens. The indication need not be a dialog box; it
3891 could be an icon (for example, a picture of a rotting fish) or some
3892 other visual indicator.
3893
3894 If the user has overridden the caching mechanisms in a way that would
3895 abnormally reduce the effectiveness of caches, the user agent should
3896 continually display an indication (for example, a picture of currency in
3897 flames) so that the user does not inadvertently consume excess resources
3898 or suffer from excessive latency.
3899
3900
3901 13.1.5 Exceptions to the Rules and Warnings
3902
3903 In some cases, the operator of a cache may choose to configure it to
3904 return stale responses even when not requested by clients. This decision
3905 should not be made lightly, but may be necessary for reasons of
3906 availability or performance, especially when the cache is poorly
3907 connected to the origin server. Whenever a cache returns a stale
3908 response, it MUST mark it as such (using a Warning header). This allows
3909 the client software to alert the user that there may be a potential
3910 problem.
3911
3912 It also allows the user agent to take steps to obtain a first-hand or
3913 fresh response. For this reason, a cache SHOULD NOT return a stale
3914 response if the client explicitly requests a first-hand or fresh one,
3915 unless it is impossible to comply for technical or policy reasons.
3916
3917
3918 13.1.6 Client-controlled Behavior
3919
3920 While the origin server (and to a lesser extent, intermediate caches, by
3921 their contribution to the age of a response) are the primary source of
3922 expiration information, in some cases the client may need to control a
3923 cache's decision about whether to return a cached response without
3924 validating it. Clients do this using several directives of the Cache-
3925 Control header.
3926
3927 A client's request may specify the maximum age it is willing to accept
3928 of an unvalidated response; specifying a value of zero forces the
3929 cache(s) to revalidate all responses. A client may also specify the
3930 minimum time remaining before a response expires. Both of these options
3931 increase constraints on the behavior of caches, and so cannot further
3932 relax the cache's approximation of semantic transparency.
3933
3934 A client may also specify that it will accept stale responses, up to
3935 some maximum amount of staleness. This loosens the constraints on the
3936 caches, and so may violate the origin server's specified constraints on
3937
3938
3939 Fielding, et al [Page 69]
3940
3941
3942 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
3943
3944
3945 semantic transparency, but may be necessary to support disconnected
3946 operation, or high availability in the face of poor connectivity.
3947
3948
3949 13.2 Expiration Model
3950
3951
3952 13.2.1 Server-Specified Expiration
3953
3954 HTTP caching works best when caches can entirely avoid making requests
3955 to the origin server. The primary mechanism for avoiding requests is for
3956 an origin server to provide an explicit expiration time in the future,
3957 indicating that a response may be used to satisfy subsequent requests.
3958 In other words, a cache can return a fresh response without first
3959 contacting the server.
3960
3961 Our expectation is that servers will assign future explicit expiration
3962 times to responses in the belief that the entity is not likely to
3963 change, in a semantically significant way, before the expiration time is
3964 reached. This normally preserves semantic transparency, as long as the
3965 server's expiration times are carefully chosen.
3966
3967 The expiration mechanism applies only to responses taken from a cache
3968 and not to first-hand responses forwarded immediately to the requesting
3969 client.
3970
3971 If an origin server wishes to force a semantically transparent cache to
3972 validate every request, it may assign an explicit expiration time in the
3973 past. This means that the response is always stale, and so the cache
3974 SHOULD validate it before using it for subsequent requests. See section
3975 14.9.4 for a more restrictive way to force revalidation.
3976
3977 If an origin server wishes to force any HTTP/1.1 cache, no matter how it
3978 is configured, to validate every request, it should use the "must-
3979 revalidate" Cache-Control directive (see section 14.9).
3980
3981 Servers specify explicit expiration times using either the Expires
3982 header, or the max-age directive of the Cache-Control header.
3983
3984 An expiration time cannot be used to force a user agent to refresh its
3985 display or reload a resource; its semantics apply only to caching
3986 mechanisms, and such mechanisms need only check a resource's expiration
3987 status when a new request for that resource is initiated. See section
3988 13.13 for explanation of the difference between caches and history
3989 mechanisms.
3990
3991
3992 13.2.2 Heuristic Expiration
3993
3994 Since origin servers do not always provide explicit expiration times,
3995 HTTP caches typically assign heuristic expiration times, employing
3996
3997 Fielding, et al [Page 70]
3998
3999
4000 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4001
4002
4003 algorithms that use other header values (such as the Last-Modified time)
4004 to estimate a plausible expiration time. The HTTP/1.1 specification does
4005 not provide specific algorithms, but does impose worst-case constraints
4006 on their results. Since heuristic expiration times may compromise
4007 semantic transparency, they should be used cautiously, and we encourage
4008 origin servers to provide explicit expiration times as much as possible.
4009
4010
4011 13.2.3 Age Calculations
4012
4013 In order to know if a cached entry is fresh, a cache needs to know if
4014 its age exceeds its freshness lifetime. We discuss how to calculate the
4015 latter in section 13.2.4; this section describes how to calculate the
4016 age of a response or cache entry.
4017
4018 In this discussion, we use the term "now" to mean "the current value of
4019 the clock at the host performing the calculation." All HTTP
4020 implementations, but especially origin servers and caches, should use
4021 NTP [28] or some similar protocol to synchronize their clocks to a
4022 globally accurate time standard.
4023
4024 Also note that HTTP/1.1 requires origin servers to send a Date header
4025 with every response, giving the time at which the response was
4026 generated. We use the term "date_value" to denote the value of the Date
4027 header, in a form appropriate for arithmetic operations.
4028
4029 HTTP/1.1 uses the Age response-header to help convey age information
4030 between caches. The Age header value is the sender's estimate of the
4031 amount of time since the response was generated at the origin server. In
4032 the case of a cached response that has been revalidated with the origin
4033 server, the Age value is based on the time of revalidation, not of the
4034 original response.
4035
4036 In essence, the Age value is the sum of the time that the response has
4037 been resident in each of the caches along the path from the origin
4038 server, plus the amount of time it has been in transit along network
4039 paths.
4040
4041 We use the term "age_value" to denote the value of the Age header, in a
4042 form appropriate for arithmetic operations.
4043
4044 A response's age can be calculated in two entirely independent ways:
4045
4046 1. now minus date_value, if the local clock is reasonably well
4047 synchronized to the origin server's clock. If the result is
4048 negative, the result is replaced by zero.
4049 2. age_value, if all of the caches along the response path implement
4050 HTTP/1.1.
4051 Given that we have two independent ways to compute the age of a response
4052 when it is received, we can combine these as
4053
4054
4055 Fielding, et al [Page 71]
4056
4057
4058 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4059
4060
4061 corrected_received_age = max(now - date_value, age_value)
4062
4063 and as long as we have either nearly synchronized clocks or all-HTTP/1.1
4064 paths, one gets a reliable (conservative) result.
4065
4066 Note that this correction is applied at each HTTP/1.1 cache along the
4067 path, so that if there is an HTTP/1.0 cache in the path, the correct
4068 received age is computed as long as the receiving cache's clock is
4069 nearly in sync. We don't need end-to-end clock synchronization (although
4070 it is good to have), and there is no explicit clock synchronization
4071 step.
4072
4073 Because of network-imposed delays, some significant interval may pass
4074 from the time that a server generates a response and the time it is
4075 received at the next outbound cache or client. If uncorrected, this
4076 delay could result in improperly low ages.
4077
4078 Because the request that resulted in the returned Age value must have
4079 been initiated prior to that Age value's generation, we can correct for
4080 delays imposed by the network by recording the time at which the request
4081 was initiated. Then, when an Age value is received, it MUST be
4082 interpreted relative to the time the request was initiated, not the time
4083 that the response was received. This algorithm results in conservative
4084 behavior no matter how much delay is experienced. So, we compute:
4085
4086 corrected_initial_age = corrected_received_age
4087 + (now - request_time)
4088
4089 where "request_time" is the time (according to the local clock) when the
4090 request that elicited this response was sent.
4091
4092 Summary of age calculation algorithm, when a cache receives a response:
4093
4094 /*
4095 * age_value
4096 * is the value of Age: header received by the cache with
4097 * this response.
4098 * date_value
4099 * is the value of the origin server's Date: header
4100 * request_time
4101 * is the (local) time when the cache made the request
4102 * that resulted in this cached response
4103 * response_time
4104 * is the (local) time when the cache received the
4105 * response
4106 * now
4107 * is the current (local) time
4108 */
4109 apparent_age = max(0, response_time - date_value);
4110 corrected_received_age = max(apparent_age, age_value);
4111 response_delay = response_time - request_time;
4112
4113 Fielding, et al [Page 72]
4114
4115
4116 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4117
4118
4119 corrected_initial_age = corrected_received_age + response_delay;
4120 resident_time = now - response_time;
4121 current_age = corrected_initial_age + resident_time;
4122
4123 When a cache sends a response, it must add to the corrected_initial_age
4124 the amount of time that the response was resident locally. It must then
4125 transmit this total age, using the Age header, to the next recipient
4126 cache.
4127
4128 Note that a client cannot reliably tell that a response is first-
4129 hand, but the presence of an Age header indicates that a response
4130 is definitely not first-hand. Also, if the Date in a response is
4131 earlier than the client's local request time, the response is
4132 probably not first-hand (in the absence of serious clock skew).
4133
4134
4135 13.2.4 Expiration Calculations
4136
4137 In order to decide whether a response is fresh or stale, we need to
4138 compare its freshness lifetime to its age. The age is calculated as
4139 described in section 13.2.3; this section describes how to calculate the
4140 freshness lifetime, and to determine if a response has expired. In the
4141 discussion below, the values can be represented in any form appropriate
4142 for arithmetic operations.
4143
4144 We use the term "expires_value" to denote the value of the Expires
4145 header. We use the term "max_age_value" to denote an appropriate value
4146 of the number of seconds carried by the max-age directive of the Cache-
4147 Control header in a response (see section 14.10.
4148
4149 The max-age directive takes priority over Expires, so if max-age is
4150 present in a response, the calculation is simply:
4151
4152 freshness_lifetime = max_age_value
4153
4154 Otherwise, if Expires is present in the response, the calculation is:
4155
4156 freshness_lifetime = expires_value - date_value
4157
4158 Note that neither of these calculations is vulnerable to clock skew,
4159 since all of the information comes from the origin server.
4160
4161 If neither Expires nor Cache-Control: max-age appears in the response,
4162 and the response does not include other restrictions on caching, the
4163 cache MAY compute a freshness lifetime using a heuristic. If the value
4164 is greater than 24 hours, the cache must attach Warning 13 to any
4165 response whose age is more than 24 hours if such warning has not already
4166 been added.
4167
4168
4169
4170
4171 Fielding, et al [Page 73]
4172
4173
4174 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4175
4176
4177 Also, if the response does have a Last-Modified time, the heuristic
4178 expiration value SHOULD be no more than some fraction of the interval
4179 since that time. A typical setting of this fraction might be 10%.
4180
4181 The calculation to determine if a response has expired is quite simple:
4182
4183 response_is_fresh = (freshness_lifetime > current_age)
4184
4185
4186 13.2.5 Disambiguating Expiration Values
4187
4188 Because expiration values are assigned optimistically, it is possible
4189 for two caches to contain fresh values for the same resource that are
4190 different.
4191
4192 If a client performing a retrieval receives a non-first-hand response
4193 for a request that was already fresh in its own cache, and the Date
4194 header in its existing cache entry is newer than the Date on the new
4195 response, then the client MAY ignore the response. If so, it MAY retry
4196 the request with a "Cache-Control: max-age=0" directive (see section
4197 14.9), to force a check with the origin server.
4198
4199 If a cache has two fresh responses for the same representation with
4200 different validators, it MUST use the one with the more recent Date
4201 header. This situation may arise because the cache is pooling responses
4202 from other caches, or because a client has asked for a reload or a
4203 revalidation of an apparently fresh cache entry.
4204
4205
4206 13.2.6 Disambiguating Multiple Responses
4207
4208 Because a client may be receiving responses via multiple paths, so that
4209 some responses flow through one set of caches and other responses flow
4210 through a different set of caches, a client may receive responses in an
4211 order different from that in which the origin server sent them. We would
4212 like the client to use the most recently generated response, even if
4213 older responses are still apparently fresh.
4214
4215 Neither the entity tag nor the expiration value can impose an ordering
4216 on responses, since it is possible that a later response intentionally
4217 carries an earlier expiration time. However, the HTTP/1.1 specification
4218 requires the transmission of Date headers on every response, and the
4219 Date values are ordered to a granularity of one second.
4220
4221 When a client tries to revalidate a cache entry, and the response it
4222 receives contains a Date header that appears to be older than the one
4223 for the existing entry, then the client SHOULD repeat the request
4224 unconditionally, and include
4225
4226 Cache-Control: max-age=0
4227
4228
4229 Fielding, et al [Page 74]
4230
4231
4232 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4233
4234
4235 to force any intermediate caches to validate their copies directly with
4236 the origin server, or
4237
4238 Cache-Control: no-cache
4239
4240 to force any intermediate caches to obtain a new copy from the origin
4241 server.
4242
4243 If the Date values are equal, then the client may use either response
4244 (or may, if it is being extremely prudent, request a new response).
4245 Servers MUST NOT depend on clients being able to choose
4246 deterministically between responses generated during the same second, if
4247 their expiration times overlap.
4248
4249
4250 13.3 Validation Model
4251
4252 When a cache has a stale entry that it would like to use as a response
4253 to a client's request, it first has to check with the origin server (or
4254 possibly an intermediate cache with a fresh response) to see if its
4255 cached entry is still usable. We call this "validating" the cache entry.
4256 Since we do not want to have to pay the overhead of retransmitting the
4257 full response if the cached entry is good, and we do not want to pay the
4258 overhead of an extra round trip if the cached entry is invalid, the
4259 HTTP/1.1 protocol supports the use of conditional methods.
4260
4261 The key protocol features for supporting conditional methods are those
4262 concerned with "cache validators." When an origin server generates a
4263 full response, it attaches some sort of validator to it, which is kept
4264 with the cache entry. When a client (user agent or proxy cache) makes a
4265 conditional request for a resource for which it has a cache entry, it
4266 includes the associated validator in the request.
4267
4268 The server then checks that validator against the current validator for
4269 the entity, and, if they match, it responds with a special status code
4270 (usually, 304 (Not Modified)) and no entity-body. Otherwise, it returns
4271 a full response (including entity-body). Thus, we avoid transmitting the
4272 full response if the validator matches, and we avoid an extra round trip
4273 if it does not match.
4274
4275 Note: the comparison functions used to decide if validators match
4276 are defined in section 13.3.3.
4277
4278 In HTTP/1.1, a conditional request looks exactly the same as a normal
4279 request for the same resource, except that it carries a special header
4280 (which includes the validator) that implicitly turns the method
4281 (usually, GET) into a conditional.
4282
4283 The protocol includes both positive and negative senses of cache-
4284 validating conditions. That is, it is possible to request either that a
4285
4286
4287 Fielding, et al [Page 75]
4288
4289
4290 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4291
4292
4293 method be performed if and only if a validator matches or if and only if
4294 no validators match.
4295
4296 Note: a response that lacks a validator may still be cached, and
4297 served from cache until it expires, unless this is explicitly
4298 prohibited by a Cache-Control directive. However, a cache cannot do
4299 a conditional retrieval if it does not have a validator for the
4300 entity, which means it will not be refreshable after it expires.
4301
4302
4303 13.3.1 Last-modified Dates
4304
4305 The Last-Modified entity-header field value is often used as a cache
4306 validator. In simple terms, a cache entry is considered to be valid if
4307 the entity has not been modified since the Last-Modified value.
4308
4309
4310 13.3.2 Entity Tag Cache Validators
4311
4312 The ETag entity-header field value, an entity tag, provides for an
4313 "opaque" cache validator. This may allow more reliable validation in
4314 situations where it is inconvenient to store modification dates, where
4315 the one-second resolution of HTTP date values is not sufficient, or
4316 where the origin server wishes to avoid certain paradoxes that may arise
4317 from the use of modification dates.
4318
4319 Entity Tags are described in section 3.11. The headers used with entity
4320 tags are described in sections 14.20, 14.25, 14.26 and 14.43.
4321
4322
4323 13.3.3 Weak and Strong Validators
4324
4325 Since both origin servers and caches will compare two validators to
4326 decide if they represent the same or different entities, one normally
4327 would expect that if the entity (the entity-body or any entity-headers)
4328 changes in any way, then the associated validator would change as well.
4329 If this is true, then we call this validator a "strong validator."
4330
4331 However, there may be cases when a server prefers to change the
4332 validator only on semantically significant changes, and not when
4333 insignificant aspects of the entity change. A validator that does not
4334 always change when the resource changes is a "weak validator."
4335
4336 Entity tags are normally "strong validators," but the protocol provides
4337 a mechanism to tag an entity tag as "weak." One can think of a strong
4338 validator as one that changes whenever the bits of an entity changes,
4339 while a weak value changes whenever the meaning of an entity changes.
4340 Alternatively, one can think of a strong validator as part of an
4341 identifier for a specific entity, while a weak validator is part of an
4342 identifier for a set of semantically equivalent entities.
4343
4344
4345 Fielding, et al [Page 76]
4346
4347
4348 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4349
4350
4351 Note: One example of a strong validator is an integer that is
4352 incremented in stable storage every time an entity is changed.
4353
4354 An entity's modification time, if represented with one-second
4355 resolution, could be a weak validator, since it is possible that
4356 the resource may be modified twice during a single second.
4357
4358 Support for weak validators is optional; however, weak validators
4359 allow for more efficient caching of equivalent objects; for
4360 example, a hit counter on a site is probably good enough if it is
4361 updated every few days or weeks, and any value during that period
4362 is likely "good enough" to be equivalent.
4363
4364 A "use" of a validator is either when a client generates a request and
4365 includes the validator in a validating header field, or when a server
4366 compares two validators.
4367
4368 Strong validators are usable in any context. Weak validators are only
4369 usable in contexts that do not depend on exact equality of an entity.
4370 For example, either kind is usable for a conditional GET of a full
4371 entity. However, only a strong validator is usable for a sub-range
4372 retrieval, since otherwise the client may end up with an internally
4373 inconsistent entity.
4374
4375 The only function that the HTTP/1.1 protocol defines on validators is
4376 comparison. There are two validator comparison functions, depending on
4377 whether the comparison context allows the use of weak validators or not:
4378
4379 . The strong comparison function: in order to be considered equal,
4380 both validators must be identical in every way, and neither may be
4381 weak.
4382 . The weak comparison function: in order to be considered equal, both
4383 validators must be identical in every way, but either or both of
4384 them may be tagged as "weak" without affecting the result.
4385 The weak comparison function MAY be used for simple (non-subrange) GET
4386 requests. The strong comparison function MUST be used in all other
4387 cases.
4388
4389 An entity tag is strong unless it is explicitly tagged as weak. Section
4390 3.11 gives the syntax for entity tags.
4391
4392 A Last-Modified time, when used as a validator in a request, is
4393 implicitly weak unless it is possible to deduce that it is strong, using
4394 the following rules:
4395
4396 . The validator is being compared by an origin server to the actual
4397 current validator for the entity and,
4398 . That origin server reliably knows that the associated entity did
4399 not change twice during the second covered by the presented
4400 validator.
4401 or
4402
4403 Fielding, et al [Page 77]
4404
4405
4406 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4407
4408
4409 . The validator is about to be used by a client in an If-Modified-
4410 Since or If-Unmodified-Since header, because the client has a cache
4411 entry for the associated entity, and
4412 . That cache entry includes a Date value, which gives the time when
4413 the origin server sent the original response, and
4414 . The presented Last-Modified time is at least 60 seconds before the
4415 Date value.
4416 or
4417
4418 . The validator is being compared by an intermediate cache to the
4419 validator stored in its cache entry for the entity, and
4420 . That cache entry includes a Date value, which gives the time when
4421 the origin server sent the original response, and
4422 . The presented Last-Modified time is at least 60 seconds before the
4423 Date value.
4424 This method relies on the fact that if two different responses were sent
4425 by the origin server during the same second, but both had the same Last-
4426 Modified time, then at least one of those responses would have a Date
4427 value equal to its Last-Modified time. The arbitrary 60-second limit
4428 guards against the possibility that the Date and Last-Modified values
4429 are generated from different clocks, or at somewhat different times
4430 during the preparation of the response. An implementation may use a
4431 value larger than 60 seconds, if it is believed that 60 seconds is too
4432 short.
4433
4434 If a client wishes to perform a sub-range retrieval on a value for which
4435 it has only a Last-Modified time and no opaque validator, it may do this
4436 only if the Last-Modified time is strong in the sense described here.
4437
4438 A cache or origin server receiving a cache-conditional request, other
4439 than a full-body GET request, MUST use the strong comparison function to
4440 evaluate the condition.
4441
4442 These rules allow HTTP/1.1 caches and clients to safely perform sub-
4443 range retrievals on values that have been obtained from HTTP/1.0
4444 servers.
4445
4446
4447 13.3.4 Rules for When to Use Entity Tags and Last-modified Dates
4448
4449 We adopt a set of rules and recommendations for origin servers, clients,
4450 and caches regarding when various validator types should be used, and
4451 for what purposes.
4452
4453 HTTP/1.1 origin servers:
4454
4455 . SHOULD send an entity tag validator unless it is not feasible to
4456 generate one.
4457 . MAY send a weak entity tag instead of a strong entity tag, if
4458 performance considerations support the use of weak entity tags, or
4459 if it is unfeasible to send a strong entity tag.
4460
4461 Fielding, et al [Page 78]
4462
4463
4464 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4465
4466
4467 . SHOULD send a Last-Modified value if it is feasible to send one,
4468 unless the risk of a breakdown in semantic transparency that could
4469 result from using this date in an If-Modified-Since header would
4470 lead to serious problems.
4471 In other words, the preferred behavior for an HTTP/1.1 origin server is
4472 to send both a strong entity tag and a Last-Modified value.
4473
4474 In order to be legal, a strong entity tag MUST change whenever the
4475 associated entity value changes in any way. A weak entity tag SHOULD
4476 change whenever the associated entity changes in a semantically
4477 significant way.
4478
4479 Note: in order to provide semantically transparent caching, an
4480 origin server must avoid reusing a specific strong entity tag value
4481 for two different entities, or reusing a specific weak entity tag
4482 value for two semantically different entities. Cache entries may
4483 persist for arbitrarily long periods, regardless of expiration
4484 times, so it may be inappropriate to expect that a cache will never
4485 again attempt to validate an entry using a validator that it
4486 obtained at some point in the past.
4487
4488 HTTP/1.1 clients:
4489
4490 . If an entity tag has been provided by the origin server, MUST use
4491 that entity tag in any cache-conditional request (using If-Match or
4492 If-None-Match).
4493 . If only a Last-Modified value has been provided by the origin
4494 server, SHOULD use that value in non-subrange cache-conditional
4495 requests (using If-Modified-Since).
4496 . If only a Last-Modified value has been provided by an HTTP/1.0
4497 origin server, MAY use that value in subrange cache-conditional
4498 requests (using If-Unmodified-Since:). The user agent should
4499 provide a way to disable this, in case of difficulty.
4500 . If both an entity tag and a Last-Modified value have been provided
4501 by the origin server, SHOULD use both validators in cache-
4502 conditional requests. This allows both HTTP/1.0 and HTTP/1.1 caches
4503 to respond appropriately.
4504 An HTTP/1.1 cache, upon receiving a request, MUST use the most
4505 restrictive validator when deciding whether the client's cache entry
4506 matches the cache's own cache entry. This is only an issue when the
4507 request contains both an entity tag and a last-modified-date validator
4508 (If-Modified-Since or If-Unmodified-Since).
4509
4510 A note on rationale: The general principle behind these rules is
4511 that HTTP/1.1 servers and clients should transmit as much non-
4512 redundant information as is available in their responses and
4513 requests. HTTP/1.1 systems receiving this information will make the
4514 most conservative assumptions about the validators they receive.
4515
4516 HTTP/1.0 clients and caches will ignore entity tags. Generally,
4517 last-modified values received or used by these systems will support
4518
4519 Fielding, et al [Page 79]
4520
4521
4522 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4523
4524
4525 transparent and efficient caching, and so HTTP/1.1 origin servers
4526 should provide Last-Modified values. In those rare cases where the
4527 use of a Last-Modified value as a validator by an HTTP/1.0 system
4528 could result in a serious problem, then HTTP/1.1 origin servers
4529 should not provide one.
4530
4531
4532 13.3.5 Non-validating Conditionals
4533
4534 The principle behind entity tags is that only the service author knows
4535 the semantics of a resource well enough to select an appropriate cache
4536 validation mechanism, and the specification of any validator comparison
4537 function more complex than byte-equality would open up a can of worms.
4538 Thus, comparisons of any other headers (except Last-Modified, for
4539 compatibility with HTTP/1.0) are never used for purposes of validating a
4540 cache entry.
4541
4542
4543 13.4 Response Cachability
4544
4545 Unless specifically constrained by a Cache-Control (section 14.9)
4546 directive, a caching system may always store a successful response (see
4547 section 13.8) as a cache entry, may return it without validation if it
4548 is fresh, and may return it after successful validation. If there is
4549 neither a cache validator nor an explicit expiration time associated
4550 with a response, we do not expect it to be cached, but certain caches
4551 may violate this expectation (for example, when little or no network
4552 connectivity is available). A client can usually detect that such a
4553 response was taken from a cache by comparing the Date header to the
4554 current time.
4555
4556 Note that some HTTP/1.0 caches are known to violate this
4557 expectation without providing any Warning.
4558
4559 However, in some cases it may be inappropriate for a cache to retain an
4560 entity, or to return it in response to a subsequent request. This may be
4561 because absolute semantic transparency is deemed necessary by the
4562 service author, or because of security or privacy considerations.
4563 Certain Cache-Control directives are therefore provided so that the
4564 server can indicate that certain resource entities, or portions thereof,
4565 may not be cached regardless of other considerations.
4566
4567 Note that section 14.8 normally prevents a shared cache from saving and
4568 returning a response to a previous request if that request included an
4569 Authorization header.
4570
4571 A response received with a status code of 200, 203, 206, 300, 301 or 410
4572 may be stored by a cache and used in reply to a subsequent request,
4573 subject to the expiration mechanism, unless a Cache-Control directive
4574 prohibits caching. However, a cache that does not support the Range and
4575 Content-Range headers MUST NOT cache 206 (Partial Content) responses.
4576
4577 Fielding, et al [Page 80]
4578
4579
4580 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4581
4582
4583 A response received with any other status code MUST NOT be returned in a
4584 reply to a subsequent request unless there are Cache-Control directives
4585 or another header(s) that explicitly allow it. For example, these
4586 include the following: an Expires header (section 14.21); a "max-age",
4587 "must-revalidate", "proxy-revalidate", "public" or "private" Cache-
4588 Control directive (section 14.9).
4589
4590
4591 13.5 Constructing Responses From Caches
4592
4593 The purpose of an HTTP cache is to store information received in
4594 response to requests, for use in responding to future requests. In many
4595 cases, a cache simply returns the appropriate parts of a response to the
4596 requester. However, if the cache holds a cache entry based on a previous
4597 response, it may have to combine parts of a new response with what is
4598 held in the cache entry.
4599
4600
4601 13.5.1 End-to-end and Hop-by-hop Headers
4602
4603 For the purpose of defining the behavior of caches and non-caching
4604 proxies, we divide HTTP headers into two categories:
4605
4606 . End-to-end headers, which must be transmitted to the ultimate
4607 recipient of a request or response. End-to-end headers in responses
4608 must be stored as part of a cache entry and transmitted in any
4609 response formed from a cache entry.
4610 . Hop-by-hop headers, which are meaningful only for a single
4611 transport-level connection, and are not stored by caches or
4612 forwarded by proxies.
4613 The following HTTP/1.1 headers are hop-by-hop headers:
4614
4615 . Connection
4616 . Keep-Alive
4617 . Public
4618 . Proxy-Authenticate
4619 . Transfer-Encoding
4620 . Upgrade
4621 All other headers defined by HTTP/1.1 are end-to-end headers.
4622
4623 Hop-by-hop headers introduced in future versions of HTTP MUST be listed
4624 in a Connection header, as described in section 14.10.
4625
4626
4627 13.5.2 Non-modifiable Headers
4628
4629 Some features of the HTTP/1.1 protocol, such as Digest Authentication,
4630 depend on the value of certain end-to-end headers. A cache or non-
4631 caching proxy SHOULD NOT modify an end-to-end header unless the
4632 definition of that header requires or specifically allows that.
4633
4634
4635 Fielding, et al [Page 81]
4636
4637
4638 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4639
4640
4641 A cache or non-caching proxy MUST NOT modify any of the following fields
4642 in a request or response, nor may it add any of these fields if not
4643 already present:
4644
4645 . Content-Location
4646 . ETag
4647 . Expires
4648 . Last-Modified
4649 A cache or non-caching proxy MUST NOT modify or add any of the following
4650 fields in a response that contains the no-transform Cache-Control
4651 directive, or in any request:
4652
4653 . Content-Encoding
4654 . Content-Length
4655 . Content-Range
4656 . Content-Type
4657 A cache or non-caching proxy MAY modify or add these fields in a
4658 response that does not include no-transform, but if it does so, it MUST
4659 add a Warning 14 (Transformation applied) if one does not already appear
4660 in the response.
4661
4662 Warning: unnecessary modification of end-to-end headers may cause
4663 authentication failures if stronger authentication mechanisms are
4664 introduced in later versions of HTTP. Such authentication
4665 mechanisms may rely on the values of header fields not listed here.
4666
4667
4668 13.5.3 Combining Headers
4669
4670 When a cache makes a validating request to a server, and the server
4671 provides a 304 (Not Modified) response, the cache must construct a
4672 response to send to the requesting client. The cache uses the entity-
4673 body stored in the cache entry as the entity-body of this outgoing
4674 response. The end-to-end headers stored in the cache entry are used for
4675 the constructed response, except that any end-to-end headers provided in
4676 the 304 response MUST replace the corresponding headers from the cache
4677 entry. Unless the cache decides to remove the cache entry, it MUST also
4678 replace the end-to-end headers stored with the cache entry with
4679 corresponding headers received in the incoming response.
4680
4681 In other words, the set of end-to-end headers received in the incoming
4682 response overrides all corresponding end-to-end headers stored with the
4683 cache entry. The cache may add Warning headers (see section 14.45) to
4684 this set.
4685
4686 If a header field-name in the incoming response matches more than one
4687 header in the cache entry, all such old headers are replaced.
4688
4689 Note: this rule allows an origin server to use a 304 (Not Modified)
4690 response to update any header associated with a previous response
4691 for the same entity, although it might not always be meaningful or
4692
4693 Fielding, et al [Page 82]
4694
4695
4696 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4697
4698
4699 correct to do so. This rule does not allow an origin server to use
4700 a 304 (not Modified) response to entirely delete a header that it
4701 had provided with a previous response.
4702
4703
4704 13.5.4 Combining Byte Ranges
4705
4706 A response may transfer only a subrange of the bytes of an entity-body,
4707 either because the request included one or more Range specifications, or
4708 because a connection was broken prematurely. After several such
4709 transfers, a cache may have received several ranges of the same entity-
4710 body.
4711
4712 If a cache has a stored non-empty set of subranges for an entity, and an
4713 incoming response transfers another subrange, the cache MAY combine the
4714 new subrange with the existing set if both the following conditions are
4715 met:
4716
4717 . Both the incoming response and the cache entry must have a cache
4718 validator.
4719 . The two cache validators must match using the strong comparison
4720 function (see section 13.3.3).
4721 If either requirement is not meant, the cache must use only the most
4722 recent partial response (based on the Date values transmitted with every
4723 response, and using the incoming response if these values are equal or
4724 missing), and must discard the other partial information.
4725
4726
4727 13.6 Caching Negotiated Responses
4728
4729 Use of server-driven content negotiation (section 12), as indicated by
4730 the presence of a Vary header field in a response, alters the conditions
4731 and procedure by which a cache can use the response for subsequent
4732 requests.
4733
4734 A server MUST use the Vary header field (section 14.43) to inform a
4735 cache of what header field dimensions are used to select among multiple
4736 representations of a cachable response. A cache may use the selected
4737 representation (the entity included with that particular response) for
4738 replying to subsequent requests on that resource only when the
4739 subsequent requests have the same or equivalent values for all header
4740 fields specified in the Vary response-header. Requests with a different
4741 value for one or more of those header fields would be forwarded toward
4742 the origin server.
4743
4744 If an entity tag was assigned to the representation, the forwarded
4745 request SHOULD be conditional and include the entity tags in an If-None-
4746 Match header field from all its cache entries for the Request-URI. This
4747 conveys to the server the set of entities currently held by the cache,
4748 so that if any one of these entities matches the requested entity, the
4749 server can use the ETag header in its 304 (Not Modified) response to
4750
4751 Fielding, et al [Page 83]
4752
4753
4754 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4755
4756
4757 tell the cache which entry is appropriate. If the entity-tag of the new
4758 response matches that of an existing entry, the new response SHOULD be
4759 used to update the header fields of the existing entry, and the result
4760 MUST be returned to the client.
4761
4762 The Vary header field may also inform the cache that the representation
4763 was selected using criteria not limited to the request-headers; in this
4764 case, a cache MUST NOT use the response in a reply to a subsequent
4765 request unless the cache relays the new request to the origin server in
4766 a conditional request and the server responds with 304 (Not Modified),
4767 including an entity tag or Content-Location that indicates which entity
4768 should be used.
4769
4770 If any of the existing cache entries contains only partial content for
4771 the associated entity, its entity-tag SHOULD NOT be included in the If-
4772 None-Match header unless the request is for a range that would be fully
4773 satisfied by that entry.
4774
4775 If a cache receives a successful response whose Content-Location field
4776 matches that of an existing cache entry for the same Request-URI, whose
4777 entity-tag differs from that of the existing entry, and whose Date is
4778 more recent than that of the existing entry, the existing entry SHOULD
4779 NOT be returned in response to future requests, and should be deleted
4780 from the cache.
4781
4782
4783 13.7 Shared and Non-Shared Caches
4784
4785 For reasons of security and privacy, it is necessary to make a
4786 distinction between "shared" and "non-shared" caches. A non-shared cache
4787 is one that is accessible only to a single user. Accessibility in this
4788 case SHOULD be enforced by appropriate security mechanisms. All other
4789 caches are considered to be "shared." Other sections of this
4790 specification place certain constraints on the operation of shared
4791 caches in order to prevent loss of privacy or failure of access
4792 controls.
4793
4794
4795 13.8 Errors or Incomplete Response Cache Behavior
4796
4797 A cache that receives an incomplete response (for example, with fewer
4798 bytes of data than specified in a Content-Length header) may store the
4799 response. However, the cache MUST treat this as a partial response.
4800 Partial responses may be combined as described in section 13.5.4; the
4801 result might be a full response or might still be partial. A cache MUST
4802 NOT return a partial response to a client without explicitly marking it
4803 as such, using the 206 (Partial Content) status code. A cache MUST NOT
4804 return a partial response using a status code of 200 (OK).
4805
4806 If a cache receives a 5xx response while attempting to revalidate an
4807 entry, it may either forward this response to the requesting client, or
4808
4809 Fielding, et al [Page 84]
4810
4811
4812 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4813
4814
4815 act as if the server failed to respond. In the latter case, it MAY
4816 return a previously received response unless the cached entry includes
4817 the "must-revalidate" Cache-Control directive (see section 14.9).
4818
4819
4820 13.9 Side Effects of GET and HEAD
4821
4822 Unless the origin server explicitly prohibits the caching of their
4823 responses, the application of GET and HEAD methods to any resources
4824 SHOULD NOT have side effects that would lead to erroneous behavior if
4825 these responses are taken from a cache. They may still have side
4826 effects, but a cache is not required to consider such side effects in
4827 its caching decisions. Caches are always expected to observe an origin
4828 server's explicit restrictions on caching.
4829
4830 We note one exception to this rule: since some applications have
4831 traditionally used GETs and HEADs with query URLs (those containing a
4832 "?" in the rel_path part) to perform operations with significant side
4833 effects, caches MUST NOT treat responses to such URLs as fresh unless
4834 the server provides an explicit expiration time. This specifically means
4835 that responses from HTTP/1.0 servers for such URIs should not be taken
4836 from a cache. See section 9.1.1 for related information.
4837
4838
4839 13.10 Invalidation After Updates or Deletions
4840
4841 The effect of certain methods at the origin server may cause one or more
4842 existing cache entries to become non-transparently invalid. That is,
4843 although they may continue to be "fresh," they do not accurately reflect
4844 what the origin server would return for a new request.
4845
4846 There is no way for the HTTP protocol to guarantee that all such cache
4847 entries are marked invalid. For example, the request that caused the
4848 change at the origin server may not have gone through the proxy where a
4849 cache entry is stored. However, several rules help reduce the likelihood
4850 of erroneous behavior.
4851
4852 In this section, the phrase "invalidate an entity" means that the cache
4853 should either remove all instances of that entity from its storage, or
4854 should mark these as "invalid" and in need of a mandatory revalidation
4855 before they can be returned in response to a subsequent request.
4856
4857 Some HTTP methods may invalidate an entity. This is either the entity
4858 referred to by the Request-URI, or by the Location or Content-Location
4859 response-headers (if present). These methods are:
4860
4861 . PUT
4862 . DELETE
4863 . POST
4864
4865
4866
4867 Fielding, et al [Page 85]
4868
4869
4870 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4871
4872
4873 In order to prevent denial of service attacks, an invalidation based on
4874 the URI in a Location or Content-Location header MUST only be performed
4875 if the host part is the same as in the Request-URI.
4876
4877
4878 13.11 Write-Through Mandatory
4879
4880 All methods that may be expected to cause modifications to the origin
4881 server's resources MUST be written through to the origin server. This
4882 currently includes all methods except for GET and HEAD. A cache MUST NOT
4883 reply to such a request from a client before having transmitted the
4884 request to the inbound server, and having received a corresponding
4885 response from the inbound server. This does not prevent a cache from
4886 sending a 100 (Continue) response before the inbound server has replied.
4887
4888 The alternative (known as "write-back" or "copy-back" caching) is not
4889 allowed in HTTP/1.1, due to the difficulty of providing consistent
4890 updates and the problems arising from server, cache, or network failure
4891 prior to write-back.
4892
4893
4894 13.12 Cache Replacement
4895
4896 If a new cachable (see sections 14.9.2, 13.2.5, 13.2.6 and 13.8)
4897 response is received from a resource while any existing responses for
4898 the same resource are cached, the cache SHOULD use the new response to
4899 reply to the current request. It may insert it into cache storage and
4900 may, if it meets all other requirements, use it to respond to any future
4901 requests that would previously have caused the old response to be
4902 returned. If it inserts the new response into cache storage it should
4903 follow the rules in section 13.5.3.
4904
4905 Note: a new response that has an older Date header value than
4906 existing cached responses is not cachable.
4907
4908
4909 13.13 History Lists
4910
4911 User agents often have history mechanisms, such as "Back" buttons and
4912 history lists, which can be used to redisplay an entity retrieved
4913 earlier in a session.
4914
4915 History mechanisms and caches are different. In particular history
4916 mechanisms SHOULD NOT try to show a semantically transparent view of the
4917 current state of a resource. Rather, a history mechanism is meant to
4918 show exactly what the user saw at the time when the resource was
4919 retrieved.
4920
4921 By default, an expiration time does not apply to history mechanisms. If
4922 the entity is still in storage, a history mechanism should display it
4923
4924
4925 Fielding, et al [Page 86]
4926
4927
4928 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4929
4930
4931 even if the entity has expired, unless the user has specifically
4932 configured the agent to refresh expired history documents.
4933
4934 This should not be construed to prohibit the history mechanism from
4935 telling the user that a view may be stale.
4936
4937 Note: if history list mechanisms unnecessarily prevent users from
4938 viewing stale resources, this will tend to force service authors to
4939 avoid using HTTP expiration controls and cache controls when they
4940 would otherwise like to. Service authors may consider it important
4941 that users not be presented with error messages or warning messages
4942 when they use navigation controls (such as BACK) to view previously
4943 fetched resources. Even though sometimes such resources ought not
4944 to cached, or ought to expire quickly, user interface
4945 considerations may force service authors to resort to other means
4946 of preventing caching (e.g. "once-only" URLs) in order not to
4947 suffer the effects of improperly functioning history mechanisms.
4948
4949
4950 14 Header Field Definitions
4951
4952 This section defines the syntax and semantics of all standard HTTP/1.1
4953 header fields. For entity-header fields, both sender and recipient refer
4954 to either the client or the server, depending on who sends and who
4955 receives the entity.
4956
4957
4958 14.1 Accept
4959
4960 The Accept request-header field can be used to specify certain media
4961 types which are acceptable for the response. Accept headers can be used
4962 to indicate that the request is specifically limited to a small set of
4963 desired types, as in the case of a request for an in-line image.
4964
4965 Accept = "Accept" ":" #(
4966 media-range
4967 [ ( ":" | ";" )
4968 range-parameter
4969 *( ";" range-parameter ) ]
4970 | extension-token )
4971
4972 media-range = ( "*/*"
4973 | ( type "/" "*" )
4974 | ( type "/" subtype )
4975 ) *( ";" parameter )
4976
4977 range-parameter = ( "q" "=" qvalue )
4978 | extension-range-parameter
4979
4980 extension-range-parameter = ( token "=" token )
4981
4982
4983 Fielding, et al [Page 87]
4984
4985
4986 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
4987
4988
4989 extension-token = token
4990
4991 The asterisk "*" character is used to group media types into ranges,
4992 with "*/*" indicating all media types and "type/*" indicating all
4993 subtypes of that type. The range-parameter q is used to indicate the
4994 media type quality factor for the range, which represents the user's
4995 preference for that range of media types. The default value is q=1. In
4996 Accept headers sent by HTTP/1.1 clients, the character separating media-
4997 ranges from range-parameters MUST be a ":". HTTP/1.1 servers SHOULD be
4998 tolerant of use of the ";" separator by HTTP/1.0 clients.
4999
5000 The example
5001
5002 Accept: audio/*: q=0.2, audio/basic
5003
5004 SHOULD be interpreted as "I prefer audio/basic, but send me any audio
5005 type if it is the best available after an 80% mark-down in quality."
5006
5007 If no Accept header is present, then it is assumed that the client
5008 accepts all media types. If Accept headers are present, and if the
5009 server cannot send a response which is acceptable according to the
5010 Accept headers, then the server SHOULD send an error response with the
5011 406 (not acceptable) status code, though the sending of an unacceptable
5012 response is also allowed.
5013
5014 A more elaborate example is
5015
5016 Accept: text/plain: q=0.5, text/html,
5017 text/x-dvi: q=0.8, text/x-c
5018
5019 Verbally, this would be interpreted as "text/html and text/x-c are the
5020 preferred media types, but if they do not exist, then send the text/x-
5021 dvi entity, and if that does not exist, send the text/plain entity."
5022
5023 Media ranges can be overridden by more specific media ranges or specific
5024 media types. If more than one media range applies to a given type, the
5025 most specific reference has precedence. For example,
5026
5027 Accept: text/*, text/html, text/html;level=1, */*
5028
5029 have the following precedence:
5030
5031 1) text/html;level=1
5032 2) text/html
5033 3) text/*
5034 4) */*
5035
5036 The media type quality factor associated with a given type is determined
5037 by finding the media range with the highest precedence which matches
5038 that type. For example,
5039
5040
5041 Fielding, et al [Page 88]
5042
5043
5044 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5045
5046
5047 Accept: text/*:q=0.3, text/html:q=0.7, text/html;level=1,
5048 text/html;level=2:q=0.4, */*:q=0.5
5049
5050 would cause the following values to be associated:
5051
5052 text/html;level=1 = 1
5053 text/html = 0.7
5054 text/plain = 0.3
5055 image/jpeg = 0.5
5056 text/html;level=2 = 0.4
5057 text/html;level=3 = 0.7
5058
5059 Note: A user agent may be provided with a default set of quality
5060 values for certain media ranges. However, unless the user agent is
5061 a closed system which cannot interact with other rendering agents,
5062 this default set should be configurable by the user.
5063
5064
5065 14.2 Accept-Charset
5066
5067 The Accept-Charset request-header field can be used to indicate what
5068 character sets are acceptable for the response. This field allows
5069 clients capable of understanding more comprehensive or special-purpose
5070 character sets to signal that capability to a server which is capable of
5071 representing documents in those character sets. The ISO-8859-1 character
5072 set can be assumed to be acceptable to all user agents.
5073
5074 Accept-Charset = "Accept-Charset" ":"
5075 1#( charset [ ";" "q" "=" qvalue ] )
5076
5077 Character set values are described in section 3.4. Each charset may be
5078 given an associated quality value which represents the user's preference
5079 for that charset. The default value is q=1. An example is
5080
5081 Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
5082
5083 If no Accept-Charset header is present, the default is that any
5084 character set is acceptable. If an Accept-Charset header is present, and
5085 if the server cannot send a response which is acceptable according to
5086 the Accept-Charset header, then the server SHOULD send an error response
5087 with the 406 (not acceptable) status code, though the sending of an
5088 unacceptable response is also allowed.
5089
5090
5091 14.3 Accept-Encoding
5092
5093 The Accept-Encoding request-header field is similar to Accept, but
5094 restricts the content-coding values (section 14.12) which are acceptable
5095 in the response.
5096
5097
5098
5099 Fielding, et al [Page 89]
5100
5101
5102 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5103
5104
5105 Accept-Encoding = "Accept-Encoding" ":"
5106 #( content-coding )
5107
5108 An example of its use is
5109
5110 Accept-Encoding: compress, gzip
5111
5112 If no Accept-Encoding header is present in a request, the server MAY
5113 assume that the client will accept any content coding. If an Accept-
5114 Encoding header is present, and if the server cannot send a response
5115 which is acceptable according to the Accept-Encoding header, then the
5116 server SHOULD send an error response with the 406 (Not Acceptable)
5117 status code.
5118
5119 An empty Accept-Encoding value indicates none are acceptable.
5120
5121
5122 14.4 Accept-Language
5123
5124 The Accept-Language request-header field is similar to Accept, but
5125 restricts the set of natural languages that are preferred as a response
5126 to the request.
5127
5128 Accept-Language = "Accept-Language" ":"
5129 1#( language-range [ ";" "q" "=" qvalue ] )
5130
5131 language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
5132
5133 Each language-range MAY be given an associated quality value which
5134 represents an estimate of the user's preference for the languages
5135 specified by that range. The quality value defaults to "q=1". For
5136 example,
5137
5138 Accept-Language: da, en-gb;q=0.8, en;q=0.7
5139
5140 would mean: "I prefer Danish, but will accept British English and other
5141 types of English." A language-range matches a language-tag if it exactly
5142 equals the tag, or if it exactly equals a prefix of the tag such that
5143 the first tag character following the prefix is "-". The special range
5144 "*", if present in the Accept-Language field, matches every tag not
5145 matched by any other range present in the Accept-Language field.
5146
5147 Note: This use of a prefix matching rule does not imply that
5148 language tags are assigned to languages in such a way that it is
5149 always true that if a user understands a language with a certain
5150 tag, then this user will also understand all languages with tags
5151 for which this tag is a prefix. The prefix rule simply allows the
5152 use of prefix tags if this is the case.
5153
5154 The language quality factor assigned to a language-tag by the Accept-
5155 Language field is the quality value of the longest language-range in the
5156
5157 Fielding, et al [Page 90]
5158
5159
5160 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5161
5162
5163 field that matches the language-tag. If no language-range in the field
5164 matches the tag, the language quality factor assigned is 0. If no
5165 Accept-Language header is present in the request, the server SHOULD
5166 assume that all languages are equally acceptable. If an Accept-Language
5167 header is present, then all languages which are assigned a quality
5168 factor greater than 0 are acceptable.
5169
5170 It may be contrary to the privacy expectations of the user to send an
5171 Accept-Language header with the complete linguistic preferences of the
5172 user in every request. For a discussion of this issue, see section 15.7.
5173
5174 Note: As intelligibility is highly dependent on the individual
5175 user, it is recommended that client applications make the choice of
5176 linguistic preference available to the user. If the choice is not
5177 made available, then the Accept-Language header field must not be
5178 given in the request.
5179
5180
5181 14.5 Accept-Ranges
5182
5183 The Accept-Ranges response header allows the server to indicate its
5184 acceptance of range requests for a resource:
5185
5186 Accept-Ranges = "Accept-Ranges" ":" acceptable-ranges
5187
5188 acceptable-ranges = 1#range-unit | "none"
5189
5190 Origin servers that accept byte-range requests MAY send
5191
5192 Accept-Ranges: bytes
5193
5194 but are not required to do so. Clients MAY generate byte-range requests
5195 without having received this header for the resource involved.
5196
5197 Servers that do not accept any kind of range request for a resource MAY
5198 send
5199
5200 Accept-Ranges: none
5201
5202 to advise the client not to attempt a range request.
5203
5204
5205 14.6 Age
5206
5207 The Age response-header field conveys the sender's estimate of the
5208 amount of time since the response (or its revalidation) was generated at
5209 the origin server. A cached response is "fresh" if its age does not
5210 exceed its freshness lifetime. Age values are calculated as specified in
5211 section 13.2.3.
5212
5213 Age = "Age" ":" age-value
5214
5215 Fielding, et al [Page 91]
5216
5217
5218 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5219
5220
5221 age-value = delta-seconds
5222
5223 Age values are non-negative decimal integers, representing time in
5224 seconds.
5225
5226 If a cache receives a value larger than the largest positive integer it
5227 can represent, or if any of its age calculations overflows, it MUST
5228 transmit an Age header with a value of 2147483648 (2^31). HTTP/1.1
5229 caches MUST send an Age header in every response. Caches SHOULD use an
5230 arithmetic type of at least 31 bits of range.
5231
5232
5233 14.7 Allow
5234
5235 The Allow entity-header field lists the set of methods supported by the
5236 resource identified by the Request-URI. The purpose of this field is
5237 strictly to inform the recipient of valid methods associated with the
5238 resource. An Allow header field MUST be present in a 405 (Method Not
5239 Allowed) response.
5240
5241 Allow = "Allow" ":" 1#method
5242
5243 Example of use:
5244
5245 Allow: GET, HEAD, PUT
5246
5247 This field cannot prevent a client from trying other methods. However,
5248 the indications given by the Allow header field value SHOULD be
5249 followed. The actual set of allowed methods is defined by the origin
5250 server at the time of each request.
5251
5252 The Allow header field MAY be provided with a PUT request to recommend
5253 the methods to be supported by the new or modified resource. The server
5254 is not required to support these methods and SHOULD include an Allow
5255 header in the response giving the actual supported methods.
5256
5257 A proxy MUST NOT modify the Allow header field even if it does not
5258 understand all the methods specified, since the user agent MAY have
5259 other means of communicating with the origin server.
5260
5261 The Allow header field does not indicate what methods are implemented at
5262 the server level. Servers MAY use the Public response-header field
5263 (section 14.35) to describe what methods are implemented on the server
5264 as a whole.
5265
5266
5267 14.8 Authorization
5268
5269 A user agent that wishes to authenticate itself with a server--usually,
5270 but not necessarily, after receiving a 401 response--MAY do so by
5271 including an Authorization request-header field with the request. The
5272
5273 Fielding, et al [Page 92]
5274
5275
5276 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5277
5278
5279 Authorization field value consists of credentials containing the
5280 authentication information of the user agent for the realm of the
5281 resource being requested.
5282
5283 Authorization = "Authorization" ":" credentials
5284
5285 HTTP access authentication is described in section 11. If a request is
5286 authenticated and a realm specified, the same credentials SHOULD be
5287 valid for all other requests within this realm.
5288
5289 When a shared cache (see section 13.7) receives a request containing an
5290 Authorization field, it MUST NOT return the corresponding response as a
5291 reply to any other request, unless one of the following specific
5292 exceptions holds:
5293
5294 1. If the response includes the "proxy-revalidate" Cache-Control
5295 directive, the cache MAY use that response in replying to a
5296 subsequent request, but a proxy cache MUST first revalidate it with
5297 the origin server, using the request-headers from the new request
5298 to allow the origin server to authenticate the new request.
5299 2. If the response includes the "must-revalidate" Cache-Control
5300 directive, the cache MAY use that response in replying to a
5301 subsequent request, but all caches MUST first revalidate it with
5302 the origin server, using the request-headers from the new request
5303 to allow the origin server to authenticate the new request.
5304 3. If the response includes the "public" Cache-Control directive, it
5305 may be returned in reply to any subsequent request.
5306
5307 14.9 Cache-Control
5308
5309 The Cache-Control general-header field is used to specify directives
5310 that MUST be obeyed by all caching mechanisms along the request/response
5311 chain. The directives specify behavior intended to prevent caches from
5312 adversely interfering with the request or response. These directives
5313 typically override the default caching algorithms. Cache directives are
5314 unidirectional in that the presence of a directive in a request does not
5315 imply that the same directive should be given in the response.
5316
5317 Note that HTTP/1.0 caches may not implement Cache-Control and may
5318 only implement Pragma: no-cache (see section 14.32).
5319
5320 Cache directives must be passed through by a proxy or gateway
5321 application, regardless of their significance to that application, since
5322 the directives may be applicable to all recipients along the
5323 request/response chain. It is not possible to specify a cache-directive
5324 for a specific cache.
5325
5326 Cache-Control = "Cache-Control" ":" 1#cache-directive
5327
5328 cache-directive = cache-request-directive
5329 | cache-response-directive
5330
5331 Fielding, et al [Page 93]
5332
5333
5334 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5335
5336
5337 cache-request-directive =
5338 | "no-cache" [ "=" <"> 1#field-name <"> ]
5339 | "no-store"
5340 | "max-age" "=" delta-seconds
5341 | "max-stale" "=" [ delta-seconds ]
5342 | "min-fresh" "=" delta-seconds
5343 | "only-if-cached"
5344 | cache-extension
5345
5346 cache-response-directive =
5347 "public"
5348 | "private" [ "=" <"> 1#field-name <"> ]
5349 | "no-cache" [ "=" <"> 1#field-name <"> ]
5350 | "no-store"
5351 | "no-transform"
5352 | "must-revalidate"
5353 | "proxy-revalidate"
5354 | "max-age" "=" delta-seconds
5355 | cache-extension
5356
5357 cache-extension = token [ "=" ( token | quoted-string ) ]
5358
5359 When a directive appears without any 1#field-name parameter, the
5360 directive applies to the entire request or response. When such a
5361 directive appears with a 1#field-name parameter, it applies only to the
5362 named field or fields, and not to the rest of the request or response.
5363 This mechanism supports extensibility; implementations of future
5364 versions of the HTTP protocol may apply these directives to header
5365 fields not defined in HTTP/1.1.
5366
5367 The cache-control directives can be broken down into these general
5368 categories:
5369
5370 . Restrictions on what is cachable; these may only be imposed by the
5371 origin server.
5372 . Restrictions on what may be stored by a cache; these may be imposed
5373 by either the origin server or the user agent.
5374 . Modifications of the basic expiration mechanism; these may be
5375 imposed by either the origin server or the user agent.
5376 . Controls over cache revalidation and reload; these may only be
5377 imposed by an user agent.
5378 . Control over transformation of entities.
5379 . Extensions to the caching system.
5380
5381 14.9.1 What is Cachable
5382
5383 By default, a response is cachable if the requirements of the request
5384 method, request header fields, and the response status indicate that it
5385 is cachable. Section 13.4 summarizes these defaults for cachability. The
5386 following Cache-Control response directives allow an origin server to
5387 override the default cachability of a response:
5388
5389 Fielding, et al [Page 94]
5390
5391
5392 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5393
5394
5395 public
5396 Indicates that the response is cachable by any cache, even if it
5397 would normally be non-cachable or cachable only within a non-shared
5398 cache. (See also Authorization, section 14.8, for additional
5399 details.)
5400
5401 private
5402 Indicates that all or part of the response message is intended for a
5403 single user and MUST NOT be cached by a shared cache. This allows an
5404 origin server to state that the specified parts of the response are
5405 intended for only one user and are not a valid response for requests
5406 by other users. A private (non-shared) cache may cache the response.
5407
5408 Note: This usage of the word private only controls where the
5409 response may be cached, and cannot ensure the privacy of the
5410 message content.
5411
5412 no-cache
5413 Indicates that all or part of the response message MUST NOT be cached
5414 anywhere. This allows an origin server to prevent caching even by
5415 caches that have been configured to return stale responses to client
5416 requests.
5417
5418 Note: HTTP/1.0 caches will not recognize or obey this directive.
5419
5420
5421 14.9.2 What May be Stored by Caches
5422
5423 The purpose of the no-store directive is to prevent the inadvertent
5424 release or retention of sensitive information (for example, on backup
5425 tapes). The no-store directive applies to the entire message, and may be
5426 sent either in a response or in a request. If sent in a request, a cache
5427 MUST NOT store any part of either this request or any response to it. If
5428 sent in a response, a cache MUST NOT store any part of either this
5429 response or the request that elicited it. This directive applies to both
5430 non-shared and shared caches. "MUST NOT store" in this context means
5431 that the cache MUST NOT intentionally store the information in non-
5432 volatile storage, and MUST make a best-effort attempt to remove the
5433 information from volatile storage as promptly as possible after
5434 forwarding it.
5435
5436 Even when this directive is associated with a response, users may
5437 explicitly store such a response outside of the caching system (e.g.,
5438 with a "Save As" dialog). History buffers may store such responses as
5439 part of their normal operation.
5440
5441 The purpose of this directive is to meet the stated requirements of
5442 certain users and service authors who are concerned about accidental
5443 releases of information via unanticipated accesses to cache data
5444 structures. While the use of this directive may improve privacy in some
5445 cases, we caution that it is NOT in any way a reliable or sufficient
5446
5447 Fielding, et al [Page 95]
5448
5449
5450 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5451
5452
5453 mechanism for ensuring privacy. In particular, malicious or compromised
5454 caches may not recognize or obey this directive; and communications
5455 networks may be vulnerable to eavesdropping.
5456
5457
5458 14.9.3 Modifications of the Basic Expiration Mechanism
5459
5460 The expiration time of an entity may be specified by the origin server
5461 using the Expires header (see section 14.21). Alternatively, it may be
5462 specified using the max-age directive in a response.
5463
5464 If a response includes both an Expires header and a max-age directive,
5465 the max-age directive overrides the Expires header, even if the Expires
5466 header is more restrictive. This rule allows an origin server to
5467 provide, for a given response, a longer expiration time to an HTTP/1.1
5468 (or later) cache than to an HTTP/1.0 cache. This may be useful if
5469 certain HTTP/1.0 caches improperly calculate ages or expiration times,
5470 perhaps due to synchronized clocks.
5471
5472 Note: most older caches, not compliant with this specification, do
5473 not implement any Cache-Control directives. An origin server
5474 wishing to use a Cache-Control directive that restricts, but does
5475 not prevent, caching by an HTTP/1.1-compliant cache may exploit the
5476 requirement that the max-age directive overrides the Expires
5477 header, and the fact that non-HTTP/1.1-compliant caches do not
5478 observe the max-age directive.
5479
5480 Other directives allow an user agent to modify the basic expiration
5481 mechanism. These directives may be specified on a request:
5482
5483 max-age
5484 Indicates that the client is willing to accept a response whose age
5485 is no greater than the specified time in seconds. Unless max-stale
5486 directive is also included, the client is not willing to accept a
5487 stale response.
5488
5489 min-fresh
5490 Indicates that the client is willing to accept a response whose
5491 freshness lifetime is no less than its current age plus the specified
5492 time in seconds. That is, the client wants a response that will still
5493 be fresh for at least the specified number of seconds.
5494
5495 max-stale
5496 Indicates that the client is willing to accept a response that has
5497 exceeded its expiration time. If max-stale is assigned a value, then
5498 the client is willing to accept a response that has exceeded its
5499 expiration time by no more than the specified number of seconds. If
5500 no value is assigned to max-stale, then the client is willing to
5501 accept a stale response of any age.
5502
5503
5504
5505 Fielding, et al [Page 96]
5506
5507
5508 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5509
5510
5511 If a cache returns a stale response, either because of a max-stale
5512 directive on a request, or because the cache is configured to override
5513 the expiration time of a response, the cache MUST attach a Warning
5514 header to the stale response, using Warning 10 (Response is stale).
5515
5516
5517 14.9.4 Cache Revalidation and Reload Controls
5518
5519 Sometimes an user agent may want or need to insist that a cache
5520 revalidate its cache entry with the origin server (and not just with the
5521 next cache along the path to the origin server), or to reload its cache
5522 entry from the origin server. End-to-end revalidation may be necessary
5523 if either the cache or the origin server has overestimated the
5524 expiration time of the cached response. End-to-end reload may be
5525 necessary if the cache entry has become corrupted for some reason.
5526
5527 End-to-end revalidation may be requested either when the client does not
5528 have its own local cached copy, in which case we call it "unspecified
5529 end-to-end revalidation", or when the client does have a local cached
5530 copy, in which case we call it "specific end-to-end revalidation."
5531
5532 The client can specify these three kinds of action using Cache-Control
5533 request directives:
5534
5535 End-to-end reload
5536 The request includes a "no-cache" Cache-Control directive or, for
5537 compatibility with HTTP/1.0 clients, "Pragma: no-cache". No field
5538 names may be included with the no-cache directive in a request. The
5539 server MUST NOT use a cached copy when responding to such a request.
5540
5541 Specific end-to-end revalidation
5542 The request includes a "max-age=0" Cache-Control directive, which
5543 forces each cache along the path to the origin server to revalidate
5544 its own entry, if any, with the next cache or server. The initial
5545 request includes a cache-validating conditional with the client's
5546 current validator.
5547
5548 Unspecified end-to-end revalidation
5549 The request includes "max-age=0" Cache-Control directive, which
5550 forces each cache along the path to the origin server to revalidate
5551 its own entry, if any, with the next cache or server. The initial
5552 request does not include a cache-validating conditional; the first
5553 cache along the path (if any) that holds a cache entry for this
5554 resource includes a cache-validating conditional with its current
5555 validator.
5556
5557 When an intermediate cache is forced, by means of a max-age=0 directive,
5558 to revalidate its own cache entry, and the client has supplied its own
5559 validator in the request, the supplied validator may differ from the
5560 validator currently stored with the cache entry. In this case, the cache
5561
5562
5563 Fielding, et al [Page 97]
5564
5565
5566 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5567
5568
5569 may use either validator in making its own request without affecting
5570 semantic transparency.
5571
5572 However, the choice of validator may affect performance. The best
5573 approach is for the intermediate cache to use its own validator when
5574 making its request. If the server replies with 304 (Not Modified), then
5575 the cache should return its now validated copy to the client with a 200
5576 (OK) response. If the server replies with a new entity and cache
5577 validator, however, the intermediate cache should compare the returned
5578 validator with the one provided in the client's request, using the
5579 strong comparison function. If the client's validator is equal to the
5580 origin server's, then the intermediate cache simply returns 304 (Not
5581 Modified). Otherwise, it returns the new entity with a 200 (OK)
5582 response.
5583
5584 If a request includes the no-cache directive, it should not include min-
5585 fresh, max-stale, or max-age.
5586
5587 In some cases, such as times of extremely poor network connectivity, a
5588 client may want a cache to return only those responses that it currently
5589 has stored, and not to reload or revalidate with the origin server. To
5590 do this, the client may include the only-if-cached directive in a
5591 request. If it receives this directive, a cache SHOULD either respond
5592 using a cached entry that is consistent with the other constraints of
5593 the request, or respond with a 504 (Gateway Timeout) status. However, if
5594 a group of caches is being operated as a unified system with good
5595 internal connectivity, such a request MAY be forwarded within that group
5596 of caches.
5597
5598 Because a cache may be configured to ignore a server's specified
5599 expiration time, and because a client request may include a max-stale
5600 directive (which has a similar effect), the protocol also includes a
5601 mechanism for the origin server to require revalidation of a cache entry
5602 on any subsequent use. When the must-revalidate directive is present in
5603 a response received by a cache, that cache MUST NOT use the entry after
5604 it becomes stale to respond to a subsequent request without first
5605 revalidating it with the origin server. (I.e., the cache must do an end-
5606 to-end revalidation every time, if, based solely on the origin server's
5607 Expires or max-age value, the cached response is stale.)
5608
5609 The must-revalidate directive is necessary to support reliable operation
5610 for certain protocol features. In all circumstances an HTTP/1.1 cache
5611 MUST obey the must-revalidate directive; in particular, if the cache
5612 cannot reach the origin server for any reason, it MUST generate a 504
5613 (Gateway Timeout) response.
5614
5615 Servers should send the must-revalidate directive if and only if failure
5616 to revalidate a request on the entity could result in incorrect
5617 operation, such as a silently unexecuted financial transaction.
5618 Recipients MUST NOT take any automated action that violates this
5619
5620
5621 Fielding, et al [Page 98]
5622
5623
5624 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5625
5626
5627 directive, and MUST NOT automatically provide an unvalidated copy of the
5628 entity if revalidation fails.
5629
5630 Although this is not recommended, user agents operating under severe
5631 connectivity constraints may violate this directive but, if so, MUST
5632 explicitly warn the user that an unvalidated response has been provided.
5633 The warning MUST be provided on each unvalidated access, and SHOULD
5634 require explicit user confirmation.
5635
5636 The proxy-revalidate directive has the same meaning as the must-
5637 revalidate directive, except that it does not apply to non-shared user
5638 agent caches. It can be used on a response to an authenticated request
5639 to permit the user's cache to store and later return the response
5640 without needing to revalidate it (since it has already been
5641 authenticated once by that user), while still requiring proxies that
5642 service many users to revalidate each time (in order to make sure that
5643 each user has been authenticated). Note that such authenticated
5644 responses also need the public cache control directive in order to allow
5645 them to be cached at all.
5646
5647
5648 14.9.5 No-Transform Directive
5649
5650 Implementers of intermediate caches (proxies) have found it useful to
5651 convert the media type of certain entity bodies. A proxy might, for
5652 example, convert between image formats in order to save cache space or
5653 to reduce the amount of traffic on a slow link. HTTP has to date been
5654 silent on these transformations.
5655
5656 Serious operational problems have already occurred, however, when these
5657 transformations have been applied to entity bodies intended for certain
5658 kinds of applications. For example, applications for medical imaging,
5659 scientific data analysis and those using end-to-end authentication, all
5660 depend on receiving an entity body that is bit for bit identical to the
5661 original entity-body.
5662
5663 Therefore, if a response includes the no-transform directive, an
5664 intermediate cache or proxy MUST NOT change those headers that are
5665 listed in section 13.5.2as being subject to the no-transform directive.
5666 This implies that the cache or proxy must not change any aspect of the
5667 entity-body that is specified by these headers.
5668
5669
5670 14.9.6 Cache Control Extensions
5671
5672 The Cache-Control header field can be extended through the use of one or
5673 more cache-extension tokens, each with an optional assigned value.
5674 Informational extensions (those which do not require a change in cache
5675 behavior) may be added without changing the semantics of other
5676 directives. Behavioral extensions are designed to work by acting as
5677 modifiers to the existing base of cache directives. Both the new
5678
5679 Fielding, et al [Page 99]
5680
5681
5682 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5683
5684
5685 directive and the standard directive are supplied, such that
5686 applications which do not understand the new directive will default to
5687 the behavior specified by the standard directive, and those that
5688 understand the new directive will recognize it as modifying the
5689 requirements associated with the standard directive. In this way,
5690 extensions to the Cache-Control directives can be made without requiring
5691 changes to the base protocol.
5692
5693 This extension mechanism depends on a HTTP cache obeying all of the
5694 cache-control directives defined for its native HTTP-version, obeying
5695 certain extensions, and ignoring all directives that it does not
5696 understand.
5697
5698 For example, consider a hypothetical new response directive called
5699 "community" which acts as a modifier to the "private" directive. We
5700 define this new directive to mean that, in addition to any non-shared
5701 cache, any cache which is shared only by members of the community named
5702 within its value may cache the response. An origin server wishing to
5703 allow the "UCI" community to use an otherwise private response in their
5704 shared cache(s) may do so by including
5705
5706 Cache-Control: private, community="UCI"
5707
5708 A cache seeing this header field will act correctly even if the cache
5709 does not understand the "community" cache-extension, since it will also
5710 see and understand the "private" directive and thus default to the safe
5711 behavior.
5712
5713 Unrecognized cache-directives MUST be ignored; it is assumed that any
5714 cache-directive likely to be unrecognized by an HTTP/1.1 cache will be
5715 combined with standard directives (or the response's default
5716 cachability) such that the cache behavior will remain minimally correct
5717 even if the cache does not understand the extension(s).
5718
5719
5720 14.10 Connection
5721
5722 The Connection general-header field allows the sender to specify options
5723 that are desired for that particular connection and MUST NOT be
5724 communicated by proxies over further connections.
5725
5726 The Connection header has the following grammar:
5727
5728 Connection-header = "Connection" ":" 1#(connection-token)
5729 connection-token = token
5730
5731 HTTP/1.1 proxies MUST parse the Connection header field before a message
5732 is forwarded and, for each connection-token in this field, remove any
5733 header field(s) from the message with the same name as the connection-
5734 token. Connection options are signaled by the presence of a connection-
5735 token in the Connection header field, not by any corresponding
5736
5737 Fielding, et al [Page 100]
5738
5739
5740 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5741
5742
5743 additional header field(s), since the additional header field may not be
5744 sent if there are no parameters associated with that connection option.
5745
5746 HTTP/1.1 defines the "close" connection option for the sender to signal
5747 that the connection will be closed after completion of the response. For
5748 example,
5749
5750 Connection: close
5751
5752 in either the request or the response header fields indicates that the
5753 connection should not be considered `persistent' (section 8.1) after the
5754 current request/response is complete.
5755
5756 HTTP/1.1 applications that do not support persistent connections MUST
5757 include the "close" connection option in every message.
5758
5759
5760 14.11 Content-Base
5761
5762 The Content-Base entity-header field may be used to specify the base URI
5763 for resolving relative URLs within the entity. This header field is
5764 described as Base in RFC 1808, which is expected to be revised soon.
5765
5766 Content-Base = "Content-Base" ":" absoluteURI
5767
5768 If no Content-Base field is present, the base URI of an entity is
5769 defined either by its Content-Location (if that Content-Location URI is
5770 an absolute URI) or the URI used to initiate the request, in that order
5771 of precedence. Note, however, that the base URI of the contents within
5772 the entity-body may be redefined within that entity-body.
5773
5774
5775 14.12 Content-Encoding
5776
5777 The Content-Encoding entity-header field is used as a modifier to the
5778 media-type. When present, its value indicates what additional content
5779 codings have been applied to the entity-body, and thus what decoding
5780 mechanisms MUST be applied in order to obtain the media-type referenced
5781 by the Content-Type header field. Content-Encoding is primarily used to
5782 allow a document to be compressed without losing the identity of its
5783 underlying media type.
5784
5785 Content-Encoding = "Content-Encoding" ":" 1#content-coding
5786
5787 Content codings are defined in section 3.5. An example of its use is
5788
5789 Content-Encoding: gzip
5790
5791 The Content-Encoding is a characteristic of the entity identified by the
5792 Request-URI. Typically, the entity-body is stored with this encoding and
5793 is only decoded before rendering or analogous usage.
5794
5795 Fielding, et al [Page 101]
5796
5797
5798 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5799
5800
5801 If multiple encodings have been applied to an entity, the content
5802 codings MUST be listed in the order in which they were applied.
5803 Additional information about the encoding parameters MAY be provided by
5804 other entity-header fields not defined by this specification.
5805
5806
5807 14.13 Content-Language
5808
5809 The Content-Language entity-header field describes the natural
5810 language(s) of the intended audience for the enclosed entity. Note that
5811 this may not be equivalent to all the languages used within the entity-
5812 body.
5813
5814 Content-Language = "Content-Language" ":" 1#language-tag
5815
5816 Language tags are defined in section 3.10. The primary purpose of
5817 Content-Language is to allow a user to identify and differentiate
5818 entities according to the user's own preferred language. Thus, if the
5819 body content is intended only for a Danish-literate audience, the
5820 appropriate field is
5821
5822 Content-Language: da
5823
5824 If no Content-Language is specified, the default is that the content is
5825 intended for all language audiences. This may mean that the sender does
5826 not consider it to be specific to any natural language, or that the
5827 sender does not know for which language it is intended.
5828
5829 Multiple languages MAY be listed for content that is intended for
5830 multiple audiences. For example, a rendition of the "Treaty of
5831 Waitangi," presented simultaneously in the original Maori and English
5832 versions, would call for
5833
5834 Content-Language: mi, en
5835
5836 However, just because multiple languages are present within an entity
5837 does not mean that it is intended for multiple linguistic audiences. An
5838 example would be a beginner's language primer, such as "A First Lesson
5839 in Latin," which is clearly intended to be used by an English-literate
5840 audience. In this case, the Content-Language should only include "en".
5841
5842 Content-Language may be applied to any media type -- it is not limited
5843 to textual documents.
5844
5845
5846 14.14 Content-Length
5847
5848 The Content-Length entity-header field indicates the size of the
5849 message-body, in decimal number of octets, sent to the recipient or, in
5850 the case of the HEAD method, the size of the entity-body that would have
5851 been sent had the request been a GET.
5852
5853 Fielding, et al [Page 102]
5854
5855
5856 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5857
5858
5859 Content-Length = "Content-Length" ":" 1*DIGIT
5860
5861 An example is
5862
5863 Content-Length: 3495
5864
5865 Applications SHOULD use this field to indicate the size of the message-
5866 body to be transferred, regardless of the media type of the entity. It
5867 must be possible for the recipient to reliably determine the end of
5868 HTTP/1.1 requests containing an entity-body, e.g., because the request
5869 has a valid Content-Length field, uses Transfer-Encoding: chunked or a
5870 multipart body.
5871
5872 Any Content-Length greater than or equal to zero is a valid value.
5873 Section 4.4 describes how to determine the length of a message-body if a
5874 Content-Length is not given.
5875
5876 Note: The meaning of this field is significantly different from the
5877 corresponding definition in MIME, where it is an optional field
5878 used within the "message/external-body" content-type. In HTTP, it
5879 SHOULD be sent whenever the message's length can be determined
5880 prior to being transferred.
5881
5882
5883 14.15 Content-Location
5884
5885 The Content-Location entity-header field may be used to supply the
5886 resource location for the entity enclosed in the message. In the case
5887 where a resource has multiple entities associated with it, and those
5888 entities actually have separate locations by which they might be
5889 individually accessed, the server should provide a Content-Location for
5890 the particular variant which is returned. In addition, a server SHOULD
5891 provide a Content-Location for the resource corresponding to the
5892 response entity.
5893
5894 Content-Location = "Content-Location" ":"
5895 ( absoluteURI | relativeURI )
5896
5897 If no Content-Base header field is present, the value of Content-
5898 Location also defines the base URL for the entity (see section 14.11).
5899
5900 The Content-Location value is not a replacement for the original
5901 requested URI; it is only a statement. of the location of the resource
5902 corresponding to this particular entity at the time of the request.
5903 Future requests MAY use the Content-Location URI if the desire is to
5904 identify the source of that particular entity.
5905
5906 A cache cannot assume that an entity with a Content-Location different
5907 from the URI used to retrieve it can be used to respond to later
5908 requests on that Content-Location URI. However, the Content-Location can
5909
5910
5911 Fielding, et al [Page 103]
5912
5913
5914 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5915
5916
5917 be used to differentiate between multiple entities retrieved from a
5918 single requested resource, as described in section 13.6.
5919
5920 If the Content-Location is a relative URI, the URI is interpreted
5921 relative to any Content-Base URI provided in the response. If no
5922 Content-Base is provided, the relative URI is interpreted relative to
5923 the Request-URI.
5924
5925
5926 14.16 Content-MD5
5927
5928 The Content-MD5 entity-header field, as defined in RFC 1864 [23] is a
5929 MD5 digest of the entity-body, for the purpose of providing an end-to-
5930 end message integrity check (MIC) of the entity-body. (Note: a MIC is
5931 good for detecting accidental modification of the entity-body in
5932 transit, but is not proof against malicious attacks.)
5933
5934 ContentMD5 = "Content-MD5" ":" md5-digest
5935
5936 md5-digest = <base64 of 128 bit MD5 digest as per RFC 1864>
5937
5938 The Content-MD5 header field may be generated by an origin server to
5939 function as an integrity check of the entity-body. Only origin servers
5940 may generate the Content-MD5 header field; proxies and gateways MUST NOT
5941 generate it, as this would defeat its value as an end-to-end integrity
5942 check. Any recipient of the entity-body, including gateways and proxies,
5943 MAY check that the digest value in this header field matches that of the
5944 entity-body as received.
5945
5946 The MD5 digest is computed based on the content of the entity-body,
5947 including any Content-Encoding that has been applied, but not including
5948 any Transfer-Encoding that may have been applied to the message-body. If
5949 the message is received with a Transfer-Encoding, that encoding must be
5950 removed prior to checking the Content-MD5 value against the received
5951 entity.
5952
5953 This has the result that the digest is computed on the octets of the
5954 entity-body exactly as, and in the order that, they would be sent if no
5955 Transfer-Encoding were being applied.
5956
5957 HTTP extends RFC 1864 to permit the digest to be computed for MIME
5958 composite media-types (e.g., multipart/* and message/rfc822), but this
5959 does not change how the digest is computed as defined in the preceding
5960 paragraph.
5961
5962 Note: There are several consequences of this. The entity-body for
5963 composite types may contain many body-parts, each with its own MIME
5964 and HTTP headers (including Content-MD5, Content-Transfer-Encoding,
5965 and Content-Encoding headers). If a body-part has a Content-
5966 Transfer-Encoding or Content-Encoding header, it is assumed that
5967 the content of the body-part has had the encoding applied, and the
5968
5969 Fielding, et al [Page 104]
5970
5971
5972 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
5973
5974
5975 body-part is included in the Content-MD5 digest as is -- i.e.,
5976 after the application. The Transfer-Encoding header field is not
5977 allowed within body-parts.
5978
5979 Note: while the definition of Content-MD5 is exactly the same for
5980 HTTP as in RFC 1864 for MIME entity-bodies, there are several ways
5981 in which the application of Content-MD5 to HTTP entity-bodies
5982 differs from its application to MIME entity-bodies. One is that
5983 HTTP, unlike MIME, does not use Content-Transfer-Encoding, and does
5984 use Transfer-Encoding and Content-Encoding. Another is that HTTP
5985 more frequently uses binary content types than MIME, so it is worth
5986 noting that, in such cases, the byte order used to compute the
5987 digest is the transmission byte order defined for the type. Lastly,
5988 HTTP allows transmission of text types with any of several line
5989 break conventions and not just the canonical form using CRLF.
5990 Conversion of all line breaks to CRLF should not be done before
5991 computing or checking the digest: the line break convention used in
5992 the text actually transmitted should be left unaltered when
5993 computing the digest.
5994
5995
5996 14.17 Content-Range
5997
5998 When a server returns a partial response to a client, it must describe
5999 both the extent of the range covered by the response, and the length of
6000 the entire entity-body.
6001
6002 The Content-Range header is sent with a partial entity-body to specify
6003 where in the full entity-body the partial body should be inserted. It
6004 also indicates the total size of the full entity-body.
6005
6006 Content-Range = "Content-Range" ":" content-range-spec
6007
6008 content-range-spec = byte-content-range-spec
6009
6010 byte-content-range-spec = bytes-unit SP first-byte-pos "-"
6011 last-byte-pos "/" entity-length
6012
6013 entity-length = 1*DIGIT
6014
6015 Unlike byte-ranges-specifier values, a byte-content-range-spec may only
6016 specify one range, and must contain absolute byte positions for both the
6017 first and last byte of the range.
6018
6019 A byte-content-range-spec whose last-byte-pos value is less than its
6020 first-byte-pos value, or whose entity-length value is less than or equal
6021 to its last-byte-pos value, is invalid. The recipient of an invalid
6022 byte-content-range-spec MUST ignore it and any content transferred along
6023 with it.
6024
6025
6026
6027 Fielding, et al [Page 105]
6028
6029
6030 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6031
6032
6033 Examples of byte-content-range-spec values, assuming that the entity
6034 contains a total of 1234 bytes:
6035
6036 . The first 500 bytes:
6037 bytes 0-499/1234
6038
6039 . The second 500 bytes:
6040 bytes 500-999/1234
6041
6042 . All except for the first 500 bytes:
6043 bytes 500-1233/1234
6044
6045 . The last 500 bytes:
6046 bytes 734-1233/1234
6047
6048 When an HTTP message includes the content of a single range (for
6049 example, a response to a request for a single range, or to a request for
6050 a set of ranges that overlap without any holes), this content is
6051 transmitted with a Content-Range header, and a Content-Length header
6052 showing the number of bytes actually transferred. For example,
6053
6054 HTTP/1.1 206 Partial content
6055 Date: Wed, 15 Nov 1995 06:25:24 GMT
6056 Last-modified: Wed, 15 Nov 1995 04:58:08 GMT
6057 Content-Range: 21010-47021/47022
6058 Content-Length: 26012
6059 Content-Type: image/gif
6060
6061 When an HTTP message includes the content of multiple ranges (for
6062 example, a response to a request for multiple non-overlapping ranges),
6063 these are transmitted as a multipart MIME message. The multipart MIME
6064 content-type used for this purpose is defined in this specification to
6065 be "multipart/byteranges". See appendix 19.2 for its definition.
6066
6067 A client that cannot decode a MIME multipart/byteranges message should
6068 not ask for multiple byte-ranges in a single request.
6069
6070 When a client requests multiple byte-ranges in one request, the server
6071 SHOULD return them in the order that they appeared in the request.
6072
6073 If the server ignores a byte-range-spec because it is invalid, the
6074 server should treat the request as if the invalid Range header field did
6075 not exist. (Normally, this means return a 200 response containing the
6076 full entity). The reason is that the only time a client will make such
6077 an invalid request is when the entity is smaller than the entity
6078 retrieved by a prior request.
6079
6080
6081
6082
6083
6084
6085 Fielding, et al [Page 106]
6086
6087
6088 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6089
6090
6091 14.18 Content-Type
6092
6093 The Content-Type entity-header field indicates the media type of the
6094 entity-body sent to the recipient or, in the case of the HEAD method,
6095 the media type that would have been sent had the request been a GET.
6096
6097 Content-Type = "Content-Type" ":" media-type
6098
6099 Media types are defined in section 3.7. An example of the field is
6100
6101 Content-Type: text/html; charset=ISO-8859-4
6102
6103 Further discussion of methods for identifying the media type of an
6104 entity is provided in section 7.2.1.
6105
6106
6107 14.19 Date
6108
6109 The Date general-header field represents the date and time at which the
6110 message was originated, having the same semantics as orig-date in RFC
6111 822. The field value is an HTTP-date, as described in section 3.3.1.
6112
6113 Date = "Date" ":" HTTP-date
6114
6115 An example is
6116
6117 Date: Tue, 15 Nov 1994 08:12:31 GMT
6118
6119 If a message is received via direct connection with the user agent (in
6120 the case of requests) or the origin server (in the case of responses),
6121 then the date can be assumed to be the current date at the receiving
6122 end. However, since the date--as it is believed by the origin--is
6123 important for evaluating cached responses, origin servers MUST include a
6124 Date header field in all responses. Clients SHOULD only send a Date
6125 header field in messages that include an entity-body, as in the case of
6126 the PUT and POST requests, and even then it is optional. A received
6127 message which does not have a Date header field SHOULD be assigned one
6128 by the recipient if the message will be cached by that recipient or
6129 gatewayed via a protocol which requires a Date.
6130
6131 In theory, the date SHOULD represent the moment just before the entity
6132 is generated. In practice, the date can be generated at any time during
6133 the message origination without affecting its semantic value.
6134
6135 The format of the Date is an absolute date and time as defined by HTTP-
6136 date in section 3.3; it MUST be sent in RFC1123 [8]-date format.
6137
6138
6139
6140
6141
6142
6143 Fielding, et al [Page 107]
6144
6145
6146 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6147
6148
6149 14.20 ETag
6150
6151 The ETag entity-header field defines the entity tag for the associated
6152 entity. The headers used with entity tags are described in sections
6153 14.20, 14.25, 14.26 and 14.43. The entity tag may be used for comparison
6154 with other entities from the same resource (see section 13.3.2).
6155
6156 ETag = "ETag" ":" entity-tag
6157
6158 Examples:
6159
6160 ETag: "xyzzy"
6161 ETag: W/"xyzzy"
6162 ETag: ""
6163
6164
6165 14.21 Expires
6166
6167 The Expires entity-header field gives the date/time after which the
6168 response should be considered stale. A stale cache entry may not
6169 normally be returned by a cache (either a proxy cache or an user agent
6170 cache) unless it is first validated with the origin server (or with an
6171 intermediate cache that has a fresh copy of the entity). See section
6172 13.2 for further discussion of the expiration model.
6173
6174 The presence of an Expires field does not imply that the original
6175 resource will change or cease to exist at, before, or after that time.
6176
6177 The format is an absolute date and time as defined by HTTP-date in
6178 section 3.3; it MUST be in RFC1123-date format:
6179
6180 Expires = "Expires" ":" HTTP-date
6181
6182 An example of its use is
6183
6184 Expires: Thu, 01 Dec 1994 16:00:00 GMT
6185
6186 Note: if a response includes a Cache-Control field with the max-age
6187 directive, that directive overrides the Expires field.
6188
6189 HTTP/1.1 clients and caches MUST treat other invalid date formats,
6190 especially including the value "0", as in the past (i.e., "already
6191 expired").
6192
6193 To mark a response as "already expired," an origin server should use an
6194 Expires date that is equal to the Date header value. (See the rules for
6195 expiration calculations in section 13.2.4.)
6196
6197 To mark a response as "never expires," an origin server should use an
6198 Expires date approximately one year from the time the response is sent.
6199
6200
6201 Fielding, et al [Page 108]
6202
6203
6204 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6205
6206
6207 HTTP/1.1 servers should not send Expires dates more than one year in the
6208 future.
6209
6210 The presence of an Expires header field with a date value of some time
6211 in the future on an response that otherwise would by default be non-
6212 cacheable indicates that the response is cachable, unless indicated
6213 otherwise by a Cache-Control header field (section 14.9).
6214
6215
6216 14.22 From
6217
6218 The From request-header field, if given, SHOULD contain an Internet e-
6219 mail address for the human user who controls the requesting user agent.
6220 The address SHOULD be machine-usable, as defined by mailbox in RFC 822
6221 (as updated by RFC 1123 ):
6222
6223 From = "From" ":" mailbox
6224
6225 An example is:
6226
6227 From: webmaster@w3.org
6228
6229 This header field MAY be used for logging purposes and as a means for
6230 identifying the source of invalid or unwanted requests. It SHOULD NOT be
6231 used as an insecure form of access protection. The interpretation of
6232 this field is that the request is being performed on behalf of the
6233 person given, who accepts responsibility for the method performed. In
6234 particular, robot agents SHOULD include this header so that the person
6235 responsible for running the robot can be contacted if problems occur on
6236 the receiving end.
6237
6238 The Internet e-mail address in this field MAY be separate from the
6239 Internet host which issued the request. For example, when a request is
6240 passed through a proxy the original issuer's address SHOULD be used.
6241
6242 Note: The client SHOULD not send the From header field without the
6243 user's approval, as it may conflict with the user's privacy
6244 interests or their site's security policy. It is strongly
6245 recommended that the user be able to disable, enable, and modify
6246 the value of this field at any time prior to a request.
6247
6248
6249 14.23 Host
6250
6251 The Host request-header field specifies the Internet host and port
6252 number of the resource being requested, as obtained from the original
6253 URL given by the user or referring resource (generally an HTTP URL, as
6254 described in section 3.2.2). The Host field value MUST represent the
6255 network location of the origin server or gateway given by the original
6256 URL. This allows the origin server or gateway to differentiate between
6257
6258
6259 Fielding, et al [Page 109]
6260
6261
6262 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6263
6264
6265 internally-ambiguous URLs, such as the root "/" URL of a server for
6266 multiple host names on a single IP address.
6267
6268 Host = "Host" ":" host [ ":" port ] ; Section 3.2.2
6269
6270 A "host" without any trailing port information implies the default port
6271 for the service requested (e.g., "80" for an HTTP URL). For example, a
6272 request on the origin server for <http://www.w3.org/pub/WWW/> MUST
6273 include:
6274
6275 GET /pub/WWW/ HTTP/1.1
6276 Host: www.w3.org
6277
6278 A client MUST include a Host header field in all HTTP/1.1 request
6279 messages on the Internet (i.e., on any message corresponding to a
6280 request for a URL which includes an Internet host address for the
6281 service being requested). If the Host field is not already present, an
6282 HTTP/1.1 proxy MUST add a Host field to the request message prior to
6283 forwarding it on the Internet. All Internet-based HTTP/1.1 servers MUST
6284 respond with a 400 status code to any HTTP/1.1 request message which
6285 lacks a Host header field.
6286
6287 See sections 5.2 and 19.5.1 for other requirements relating to Host.
6288
6289
6290 14.24 If-Modified-Since
6291
6292 The If-Modified-Since request-header field is used with the GET method
6293 to make it conditional: if the requested variant has not been modified
6294 since the time specified in this field, an entity will not be returned
6295 from the server; instead, a 304 (not modified) response will be returned
6296 without any message-body.
6297
6298 If-Modified-Since = "If-Modified-Since" ":" HTTP-date
6299
6300 An example of the field is:
6301
6302 If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
6303
6304 A GET method with an If-Modified-Since header and no Range header
6305 requests that the identified entity be transferred only if it has been
6306 modified since the date given by the If-Modified-Since header. The
6307 algorithm for determining this includes the following cases:
6308
6309
6310 a)If the request would normally result in anything other than a 200
6311 (OK) status, or if the passed If-Modified-Since date is invalid, the
6312 response is exactly the same as for a normal GET. A date which is
6313 later than the server's current time is invalid.
6314
6315
6316
6317 Fielding, et al [Page 110]
6318
6319
6320 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6321
6322
6323 b)If the variant has been modified since the If-Modified-Since date,
6324 the response is exactly the same as for a normal GET.
6325
6326
6327 c)If the variant has not been modified since a valid If-Modified-Since
6328 date, the server MUST return a 304 (Not Modified) response.
6329
6330 The purpose of this feature is to allow efficient updates of cached
6331 information with a minimum amount of transaction overhead.
6332
6333 Note that the Range request-header field modifies the meaning of
6334 If-Modified-Since; see section 14.36 for full details.
6335
6336 Note that If-Modified-Since times are interpreted by the server,
6337 whose clock may not be synchronized with the client.
6338
6339 Note that if a client uses an arbitrary date in the If-Modified-Since
6340 header instead of a date taken from the Last-Modified header for the
6341 same request, the client should be aware of the fact that this date is
6342 interpreted in the server's understanding of time. The client should
6343 consider unsynchronized clocks and rounding problems due to the
6344 different encodings of time between the client and server. This includes
6345 the possibility of race conditions if the document has changed between
6346 the time it was first requested and the If-Modified-Since date of a
6347 subsequent request, and the possibility of clock-skew-related problems
6348 if the If-Modified-Since date is derived from the client's clock without
6349 correction to the server's clock. Corrections for different time bases
6350 between client and server are at best approximate due to network
6351 latency.
6352
6353
6354 14.25 If-Match
6355
6356 The If-Match request-header field is used with a method to make it
6357 conditional. A client that has one or more entities previously obtained
6358 from the resource can verify that one of those entities is current by
6359 including a list of their associated entity tags in the If-Match header
6360 field. The purpose of this feature is to allow efficient updates of
6361 cached information with a minimum amount of transaction overhead. It is
6362 also used, on updating requests, to prevent inadvertent modification of
6363 the wrong version of a resource. As a special case, the value "*"
6364 matches any current entity of the resource.
6365
6366 If-Match = "If-Match" ":" ( "*" | 1#entity-tag )
6367
6368 If any of the entity tags match the entity tag of the entity that would
6369 have been returned in the response to a similar GET request (without the
6370 If-Match header) on that resource, or if "*" is given and any current
6371 entity exists for that resource, then the server MAY perform the
6372 requested method as if the If-Match header field did not exist.
6373
6374
6375 Fielding, et al [Page 111]
6376
6377
6378 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6379
6380
6381 A server MUST use the strong comparison function (see section 3.11) to
6382 compare the entity tags in If-Match.
6383
6384 If none of the entity tags match, or if "*" is given and no current
6385 entity exists, the server MUST NOT perform the requested method, and
6386 MUST return a 412 (Precondition Failed) response. This behavior is most
6387 useful when the client wants to prevent an updating method, such as PUT,
6388 from modifying a resource that has changed since the client last
6389 retrieved it.
6390
6391 If the request would, without the If-Match header field, result in
6392 anything other than a 2xx status, then the If-Match header MUST be
6393 ignored.
6394
6395 The meaning of "If-Match: *" is that the method SHOULD be performed if
6396 the representation selected by the origin server (or by a cache,
6397 possibly using the Vary mechanism, see section 14.43) exists, and MUST
6398 NOT be performed if the representation does not exist.
6399
6400 A request intended to update a resource (e.g., a PUT) MAY include an If-
6401 Match header field to signal that the request method MUST NOT be applied
6402 if the entity corresponding to the If-Match value (a single entity tag)
6403 is no longer a representation of that resource. This allows the user to
6404 indicate that they do not wish the request to be successful if the
6405 resource has been changed without their knowledge. Examples:
6406
6407 If-Match: "xyzzy"
6408 If-Match: W/"xyzzy"
6409 If-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
6410 If-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
6411 If-Match: *
6412
6413
6414 14.26 If-None-Match
6415
6416 The If-None-Match request-header field is used with a method to make it
6417 conditional. A client that has one or more entities previously obtained
6418 from the resource can verify that none of those entities is current by
6419 including a list of their associated entity tags in the If-None-Match
6420 header field. The purpose of this feature is to allow efficient updates
6421 of cached information with a minimum amount of transaction overhead. It
6422 is also used, on updating requests, to prevent inadvertent modification
6423 of a resource which was not known to exist.
6424
6425 As a special case, the value "*" matches any current entity of the
6426 resource.
6427
6428 If-None-Match = "If-None-Match" ":" ( "*" | 1#entity-tag )
6429
6430 If any of the entity tags match the entity tag of the entity that would
6431 have been returned in the response to a similar GET request (without the
6432
6433 Fielding, et al [Page 112]
6434
6435
6436 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6437
6438
6439 If-None-Match header) on that resource, or if "*" is given and any
6440 current entity exists for that resource, then the server MUST NOT
6441 perform the requested method. Instead, if the request method was GET or
6442 HEAD, the server SHOULD respond with a 304 (Not Modified) response,
6443 including the cache-related entity-header fields (particularly ETag) of
6444 one of the entities that matched. For all other request methods, the
6445 server MUST respond with a status of 412 (Precondition Failed).
6446
6447 See section 13.3.3 for rules on how to determine if two entity tags
6448 match. The weak comparison function can only be used with GET or HEAD
6449 requests.
6450
6451 If none of the entity tags match, or if "*" is given and no current
6452 entity exists, then the server MAY perform the requested method as if
6453 the If-None-Match header field did not exist.
6454
6455 If the request would, without the If-None-Match header field, result in
6456 anything other than a 2xx status, then the If-None-Match header MUST be
6457 ignored.
6458
6459 The meaning of "If-None-Match: *" is that the method MUST NOT be
6460 performed if the representation selected by the origin server (or by a
6461 cache, possibly using the Vary mechanism, see section 14.43) exists, and
6462 SHOULD be performed if the representation does not exist. This feature
6463 may be useful in preventing races between PUT operations.
6464
6465 Examples:
6466
6467 If-None-Match: "xyzzy"
6468 If-None-Match: W/"xyzzy"
6469 If-None-Match: "xyzzy", "r2d2xxxx", "c3piozzzz"
6470 If-None-Match: W/"xyzzy", W/"r2d2xxxx", W/"c3piozzzz"
6471 If-None-Match: *
6472
6473
6474 14.27 If-Range
6475
6476 If a client has a partial copy of an entity in its cache, and wishes to
6477 have an up-to-date copy of the entire entity in its cache, it could use
6478 the Range request-header with a conditional GET (using either or both of
6479 If-Unmodified-Since and If-Match.) However, if the condition fails
6480 because the entity has been modified, the client would then have to make
6481 a second request to obtain the entire current entity-body.
6482
6483 The If-Range header allows a client to "short-circuit" the second
6484 request. Informally, its meaning is `if the entity is unchanged, send me
6485 the part(s) that I am missing; otherwise, send me the entire new
6486 entity.'
6487
6488 If-Range = "If-Range" ":" ( entity-tag | HTTP-date )
6489
6490
6491 Fielding, et al [Page 113]
6492
6493
6494 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6495
6496
6497 If the client has no entity tag for an entity, but does have a Last-
6498 Modified date, it may use that date in a If-Range header. (The server
6499 can distinguish between a valid HTTP-date and any form of entity-tag by
6500 examining no more than two characters.) The If-Range header should only
6501 be used together with a Range header, and must be ignored if the request
6502 does not include a Range header, or if the server does not support the
6503 sub-range operation.
6504
6505 If the entity tag given in the If-Range header matches the current
6506 entity tag for the entity, then the server should provide the specified
6507 sub-range of the entity using a 206 (Partial content) response. If the
6508 entity tag does not match, then the server should return the entire
6509 entity using a 200 (OK) response.
6510
6511
6512 14.28 If-Unmodified-Since
6513
6514 The If-Unmodified-Since request-header field is used with a method to
6515 make it conditional. If the requested resource has not been modified
6516 since the time specified in this field, the server should perform the
6517 requested operation as if the If-Unmodified-Since header were not
6518 present.
6519
6520 If the requested variant has been modified since the specified time, the
6521 server MUST NOT perform the requested operation, and MUST return a 412
6522 (Precondition Failed).
6523
6524 If-Unmodified-Since = "If-Unmodified-Since" ":" HTTP-date
6525
6526 An example of the field is:
6527
6528 If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
6529
6530 If the request normally (i.e., without the If-Unmodified-Since header)
6531 would result in anything other than a 2xx status, the If-Unmodified-
6532 Since header should be ignored.
6533
6534 If the specified date is invalid, the header is ignored.
6535
6536
6537 14.29 Last-Modified
6538
6539 The Last-Modified entity-header field indicates the date and time at
6540 which the origin server believes the variant was last modified.
6541
6542 Last-Modified = "Last-Modified" ":" HTTP-date
6543
6544 An example of its use is
6545
6546 Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
6547
6548
6549 Fielding, et al [Page 114]
6550
6551
6552 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6553
6554
6555 The exact meaning of this header field depends on the implementation of
6556 the origin server and the nature of the original resource. For files, it
6557 may be just the file system last-modified time. For entities with
6558 dynamically included parts, it may be the most recent of the set of
6559 last-modify times for its component parts. For database gateways, it may
6560 be the last-update time stamp of the record. For virtual objects, it may
6561 be the last time the internal state changed.
6562
6563 An origin server MUST NOT send a Last-Modified date which is later than
6564 the server's time of message origination. In such cases, where the
6565 resource's last modification would indicate some time in the future, the
6566 server MUST replace that date with the message origination date.
6567
6568 An origin server should obtain the Last-Modified value of the entity as
6569 close as possible to the time that it generates the Date value of its
6570 response. This allows a recipient to make an accurate assessment of the
6571 entity's modification time, especially if the entity changes near the
6572 time that the response is generated.
6573
6574 HTTP/1.1 servers SHOULD send Last-Modified whenever feasible.
6575
6576
6577 14.30 Location
6578
6579 The Location response-header field is used to redirect the recipient to
6580 a location other than the Request-URI for completion of the request or
6581 identification of a new resource. For 201 (Created) responses, the
6582 Location is that of the new resource which was created by the request.
6583 For 3xx responses, the location SHOULD indicate the server's preferred
6584 URL for automatic redirection to the resource. The field value consists
6585 of a single absolute URL.
6586
6587 Location = "Location" ":" absoluteURI
6588
6589 An example is
6590
6591 Location: http://www.w3.org/pub/WWW/People.html
6592
6593 Note: The Content-Location header field (section 14.15) differs
6594 from Location in that the Content-Location identifies the original
6595 location of the entity enclosed in the request. It is therefore
6596 possible for a response to contain header fields for both Location
6597 and Content-Location. Also see section 13.10 for cache requirements
6598 of some methods.
6599
6600
6601 14.31 Max-Forwards
6602
6603 The Max-Forwards general-header field may be used with the TRACE method
6604 (section 14.31) to limit the number of proxies or gateways that can
6605 forward the request to the next inbound server. This can be useful when
6606
6607 Fielding, et al [Page 115]
6608
6609
6610 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6611
6612
6613 the client is attempting to trace a request chain which appears to be
6614 failing or looping in mid-chain.
6615
6616 Max-Forwards = "Max-Forwards" ":" 1*DIGIT
6617
6618 The Max-Forwards value is a decimal integer indicating the remaining
6619 number of times this request message may be forwarded.
6620
6621 Each proxy or gateway recipient of a TRACE request containing a Max-
6622 Forwards header field SHOULD check and update its value prior to
6623 forwarding the request. If the received value is zero (0), the recipient
6624 SHOULD NOT forward the request; instead, it SHOULD respond as the final
6625 recipient with a 200 (OK) response containing the received request
6626 message as the response entity-body (as described in section 9.8). If
6627 the received Max-Forwards value is greater than zero, then the forwarded
6628 message SHOULD contain an updated Max-Forwards field with a value
6629 decremented by one (1).
6630
6631 The Max-Forwards header field SHOULD be ignored for all other methods
6632 defined by this specification and for any extension methods for which it
6633 is not explicitly referred to as part of that method definition.
6634
6635
6636 14.32 Pragma
6637
6638 The Pragma general-header field is used to include implementation-
6639 specific directives that may apply to any recipient along the
6640 request/response chain. All pragma directives specify optional behavior
6641 from the viewpoint of the protocol; however, some systems MAY require
6642 that behavior be consistent with the directives.
6643
6644 Pragma = "Pragma" ":" 1#pragma-directive
6645
6646 pragma-directive = "no-cache" | extension-pragma
6647 extension-pragma = token [ "=" ( token | quoted-string ) ]
6648
6649 When the no-cache directive is present in a request message, an
6650 application SHOULD forward the request toward the origin server even if
6651 it has a cached copy of what is being requested. This pragma directive
6652 has the same semantics as the no-cache cache-directive (see section
6653 14.9) and is defined here for backwards compatibility with HTTP/1.0.
6654 Clients SHOULD include both header fields when a no-cache request is
6655 sent to a server not known to be HTTP/1.1 compliant.
6656
6657 Pragma directives MUST be passed through by a proxy or gateway
6658 application, regardless of their significance to that application, since
6659 the directives may be applicable to all recipients along the
6660 request/response chain. It is not possible to specify a pragma for a
6661 specific recipient; however, any pragma directive not relevant to a
6662 recipient SHOULD be ignored by that recipient.
6663
6664
6665 Fielding, et al [Page 116]
6666
6667
6668 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6669
6670
6671 HTTP/1.1 clients SHOULD NOT send the Pragma request-header. HTTP/1.1
6672 caches SHOULD treat "Pragma: no-cache" as if the client had sent "Cache-
6673 Control: no-cache". No new Pragma directives will be defined in HTTP.
6674
6675
6676 14.33 Proxy-Authenticate
6677
6678 The Proxy-Authenticate response-header field MUST be included as part of
6679 a 407 (Proxy Authentication Required) response. The field value consists
6680 of a challenge that indicates the authentication scheme and parameters
6681 applicable to the proxy for this Request-URI.
6682
6683 Proxy-Authentication = "Proxy-Authentication" ":" challenge
6684
6685 The HTTP access authentication process is described in section 11.
6686 Unlike WWW-Authenticate, the Proxy-Authenticate header field applies
6687 only to the current connection and SHOULD NOT be passed on to downstream
6688 clients. However, an intermediate proxy may need to obtain its own
6689 credentials by requesting them from the downstream client, which in some
6690 circumstances will appear as if the proxy is forwarding the Proxy-
6691 Authenticate header field.
6692
6693
6694 14.34 Proxy-Authorization
6695
6696 The Proxy-Authorization request-header field allows the client to
6697 identify itself (or its user) to a proxy which requires authentication.
6698 The Proxy-Authorization field value consists of credentials containing
6699 the authentication information of the user agent for the proxy and/or
6700 realm of the resource being requested.
6701
6702 Proxy-Authorization = "Proxy-Authorization" ":" credentials
6703
6704 The HTTP access authentication process is described in section 11.
6705 Unlike Authorization, the Proxy-Authorization header field applies only
6706 to the next outbound proxy that demanded authentication using the Proxy-
6707 Authenticate field. When multiple proxies are used in a chain, the
6708 Proxy-Authorization header field is consumed by the first outbound proxy
6709 that was expecting to receive credentials. A proxy MAY relay the
6710 credentials from the client request to the next proxy if that is the
6711 mechanism by which the proxies cooperatively authenticate a given
6712 request.
6713
6714
6715 14.35 Public
6716
6717 The Public response-header field lists the set of methods supported by
6718 the server. The purpose of this field is strictly to inform the
6719 recipient of the capabilities of the server regarding unusual methods.
6720 The methods listed may or may not be applicable to the Request-URI; the
6721
6722
6723 Fielding, et al [Page 117]
6724
6725
6726 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6727
6728
6729 Allow header field (section 14.7) MAY be used to indicate methods
6730 allowed for a particular URI.
6731
6732 Public = "Public" ":" 1#method
6733
6734 Example of use:
6735
6736 Public: OPTIONS, MGET, MHEAD, GET, HEAD
6737
6738 This header field applies only to the server directly connected to the
6739 client (i.e., the nearest neighbor in a chain of connections). If the
6740 response passes through a proxy, the proxy MUST either remove the Public
6741 header field or replace it with one applicable to its own capabilities.
6742
6743
6744 14.36 Range
6745
6746
6747 14.36.1 Byte Ranges
6748
6749 Since all HTTP entities are represented in HTTP messages as sequences of
6750 bytes, the concept of a byte range is meaningful for any HTTP entity.
6751 (However, not all clients and servers need to support byte-range
6752 operations.)
6753
6754 Byte range specifications in HTTP apply to the sequence of bytes in the
6755 entity-body (not necessarily the same as the message-body).
6756
6757 A byte range operation may specify a single range of bytes, or a set of
6758 ranges within a single entity.
6759
6760 ranges-specifier = byte-ranges-specifier
6761
6762 byte-ranges-specifier = bytes-unit "=" byte-range-set
6763
6764 byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec )
6765
6766 byte-range-spec = first-byte-pos "-" [last-byte-pos]
6767
6768 first-byte-pos = 1*DIGIT
6769
6770 last-byte-pos = 1*DIGIT
6771
6772 The first-byte-pos value in a byte-range-spec gives the byte-offset of
6773 the first byte in a range. The last-byte-pos value gives the byte-offset
6774 of the last byte in the range; that is, the byte positions specified are
6775 inclusive. Byte offsets start at zero.
6776
6777 If the last-byte-pos value is present, it must be greater than or equal
6778 to the first-byte-pos in that byte-range-spec, or the byte-range-spec is
6779 invalid. The recipient of an invalid byte-range-spec must ignore it.
6780
6781 Fielding, et al [Page 118]
6782
6783
6784 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6785
6786
6787 If the last-byte-pos value is absent, or if the value is greater than or
6788 equal to the current length of the entity-body, last-byte-pos is taken
6789 to be equal to one less than the current length of the entity-body in
6790 bytes.
6791
6792 By its choice of last-byte-pos, a client can limit the number of bytes
6793 retrieved without knowing the size of the entity.
6794
6795 suffix-byte-range-spec = "-" suffix-length
6796
6797 suffix-length = 1*DIGIT
6798
6799 A suffix-byte-range-spec is used to specify the suffix of the entity-
6800 body, of a length given by the suffix-length value. (That is, this form
6801 specifies the last N bytes of an entity-body.) If the entity is shorter
6802 than the specified suffix-length, the entire entity-body is used.
6803
6804 Examples of byte-ranges-specifier values (assuming an entity-body of
6805 length 10000):
6806
6807 . The first 500 bytes (byte offsets 0-499, inclusive):
6808 bytes=0-499
6809
6810 . The second 500 bytes (byte offsets 500-999, inclusive):
6811 bytes=500-999
6812
6813 . The final 500 bytes (byte offsets 9500-9999, inclusive):
6814 bytes=-500
6815
6816 . Or
6817 bytes=9500-
6818
6819 . The first and last bytes only (bytes 0 and 9999):
6820 bytes=0-0,-1
6821
6822 . Several legal but not canonical specifications of the second 500
6823 bytes (byte offsets 500-999, inclusive):
6824 bytes=500-600,601-999
6825
6826 bytes=500-700,601-999
6827
6828
6829 14.36.2 Range Retrieval Requests
6830
6831 HTTP retrieval requests using conditional or unconditional GET methods
6832 may request one or more sub-ranges of the entity, instead of the entire
6833 entity, using the Range request header, which applies to the entity
6834 returned as the result of the request:
6835
6836 Range = "Range" ":" ranges-specifier
6837
6838
6839 Fielding, et al [Page 119]
6840
6841
6842 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6843
6844
6845 A server MAY ignore the Range header. However, HTTP/1.1 origin servers
6846 and intermediate caches SHOULD support byte ranges when possible, since
6847 Range supports efficient recovery from partially failed transfers, and
6848 supports efficient partial retrieval of large entities.
6849
6850 If the server supports the Range header and the specified range or
6851 ranges are appropriate for the entity:
6852
6853 . The presence of a Range header in an unconditional GET modifies
6854 what is returned if the GET is otherwise successful. In other
6855 words, the response carries a status code of 206 (Partial Content)
6856 instead of 200 (OK).
6857 . The presence of a Range header in a conditional GET (a request
6858 using one or both of If-Modified-Since and If-None-Match, or one or
6859 both of If-Unmodified-Since and If-Match) modifies what is returned
6860 if the GET is otherwise successful and the condition is true. It
6861 does not affect the 304 (Not Modified) response returned if the
6862 conditional is false.
6863 In some cases, it may be more appropriate to use the If-Range header
6864 (see section 14.27) in addition to the Range header.
6865
6866 If a proxy that supports byte ranges receives a Range request, forwards
6867 the request to an inbound server, and receives an entire entity in
6868 reply, it SHOULD only return the requested range to its client. It
6869 SHOULD store the entire received response in its cache, if that is
6870 consistent with its cache allocation policies.
6871
6872
6873 14.37 Referer
6874
6875 The Referer[sic] request-header field allows the client to specify, for
6876 the server's benefit, the address (URI) of the resource from which the
6877 Request-URI was obtained (the "referrer", although the header field is
6878 misspelled.) The Referer request-header allows a server to generate
6879 lists of back-links to resources for interest, logging, optimized
6880 caching, etc. It also allows obsolete or mistyped links to be traced for
6881 maintenance. The Referer field MUST NOT be sent if the Request-URI was
6882 obtained from a source that does not have its own URI, such as input
6883 from the user keyboard.
6884
6885 Referer = "Referer" ":" ( absoluteURI | relativeURI )
6886
6887 Example:
6888
6889 Referer: http://www.w3.org/hypertext/DataSources/Overview.html
6890
6891 If the field value is a partial URI, it SHOULD be interpreted relative
6892 to the Request-URI. The URI MUST NOT include a fragment.
6893
6894 Note: Because the source of a link may be private information or
6895 may reveal an otherwise private information source, it is strongly
6896
6897 Fielding, et al [Page 120]
6898
6899
6900 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6901
6902
6903 recommended that the user be able to select whether or not the
6904 Referer field is sent. For example, a browser client could have a
6905 toggle switch for browsing openly/anonymously, which would
6906 respectively enable/disable the sending of Referer and From
6907 information.
6908
6909
6910 14.38 Retry-After
6911
6912 The Retry-After response-header field can be used with a 503 (Service
6913 Unavailable) response to indicate how long the service is expected to be
6914 unavailable to the requesting client. The value of this field can be
6915 either an HTTP-date or an integer number of seconds (in decimal) after
6916 the time of the response.
6917
6918 Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds )
6919
6920 Two examples of its use are
6921
6922 Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
6923 Retry-After: 120
6924
6925 In the latter example, the delay is 2 minutes.
6926
6927
6928 14.39 Server
6929
6930 The Server response-header field contains information about the software
6931 used by the origin server to handle the request. The field can contain
6932 multiple product tokens (section 3.8) and comments identifying the
6933 server and any significant subproducts. The product tokens are listed in
6934 order of their significance for identifying the application.
6935
6936 Server = "Server" ":" 1*( product | comment )
6937
6938 Example:
6939
6940 Server: CERN/3.0 libwww/2.17
6941
6942 If the response is being forwarded through a proxy, the proxy
6943 application MUST NOT modify the Server response-header. Instead, it
6944 SHOULD include a Via field (as described in section 14.44).
6945
6946 Note: Revealing the specific software version of the server may
6947 allow the server machine to become more vulnerable to attacks
6948 against software that is known to contain security holes. Server
6949 implementers are encouraged to make this field a configurable
6950 option.
6951
6952
6953
6954
6955 Fielding, et al [Page 121]
6956
6957
6958 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
6959
6960
6961 14.40 Transfer-Encoding
6962
6963 The Transfer-Encoding general-header field indicates what (if any) type
6964 of transformation has been applied to the message body in order to
6965 safely transfer it between the sender and the recipient. This differs
6966 from the Content-Encoding in that the transfer coding is a property of
6967 the message, not of the entity.
6968
6969 Transfer-Encoding = "Transfer-Encoding" ":" 1#transfer-
6970 coding
6971
6972 Transfer codings are defined in section 3.6. An example is:
6973
6974 Transfer-Encoding: chunked
6975
6976 Many older HTTP/1.0 applications do not understand the Transfer-Encoding
6977 header.
6978
6979
6980 14.41 Upgrade
6981
6982 The Upgrade general-header allows the client to specify what additional
6983 communication protocols it supports and would like to use if the server
6984 finds it appropriate to switch protocols. The server MUST use the
6985 Upgrade header field within a 101 (Switching Protocols) response to
6986 indicate which protocol(s) are being switched.
6987
6988 Upgrade = "Upgrade" ":" 1#product
6989
6990 For example,
6991
6992 Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
6993
6994 The Upgrade header field is intended to provide a simple mechanism for
6995 transition from HTTP/1.1 to some other, incompatible protocol. It does
6996 so by allowing the client to advertise its desire to use another
6997 protocol, such as a later version of HTTP with a higher major version
6998 number, even though the current request has been made using HTTP/1.1.
6999 This eases the difficult transition between incompatible protocols by
7000 allowing the client to initiate a request in the more commonly supported
7001 protocol while indicating to the server that it would like to use a
7002 "better" protocol if available (where "better" is determined by the
7003 server, possibly according to the nature of the method and/or resource
7004 being requested).
7005
7006 The Upgrade header field only applies to switching application-layer
7007 protocols upon the existing transport-layer connection. Upgrade cannot
7008 be used to insist on a protocol change; its acceptance and use by the
7009 server is optional. The capabilities and nature of the application-layer
7010 communication after the protocol change is entirely dependent upon the
7011 new protocol chosen, although the first action after changing the
7012
7013 Fielding, et al [Page 122]
7014
7015
7016 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7017
7018
7019 protocol MUST be a response to the initial HTTP request containing the
7020 Upgrade header field.
7021
7022 The Upgrade header field only applies to the immediate connection.
7023 Therefore, the upgrade keyword MUST be supplied within a Connection
7024 header field (section 14.10) whenever Upgrade is present in an HTTP/1.1
7025 message.
7026
7027 The Upgrade header field cannot be used to indicate a switch to a
7028 protocol on a different connection. For that purpose, it is more
7029 appropriate to use a 301, 302, 303, or 305 redirection response.
7030
7031 This specification only defines the protocol name "HTTP" for use by the
7032 family of Hypertext Transfer Protocols, as defined by the HTTP version
7033 rules of section 3.1 and future updates to this specification. Any token
7034 can be used as a protocol name; however, it will only be useful if both
7035 the client and server associate the name with the same protocol.
7036
7037
7038 14.42 User-Agent
7039
7040 The User-Agent request-header field contains information about the user
7041 agent originating the request. This is for statistical purposes, the
7042 tracing of protocol violations, and automated recognition of user agents
7043 for the sake of tailoring responses to avoid particular user agent
7044 limitations. User agents SHOULD include this field with requests. The
7045 field can contain multiple product tokens (section 3.8) and comments
7046 identifying the agent and any subproducts which form a significant part
7047 of the user agent. By convention, the product tokens are listed in order
7048 of their significance for identifying the application.
7049
7050 User-Agent = "User-Agent" ":" 1*( product | comment )
7051
7052 Example:
7053
7054 User-Agent: CERN-LineMode/2.15 libwww/2.17b3
7055
7056
7057 14.43 Vary
7058
7059 The Vary response-header field is used by a server to signal that the
7060 response entity was selected from the available representations of the
7061 response using server-driven negotiation (section 12). The Vary field
7062 value indicates either that the given set of header fields encompass the
7063 dimensions over which the representation might vary, or that the
7064 dimensions of variance are unspecified ("*") and thus may vary over any
7065 aspect of future requests.
7066
7067 Vary = "Vary" ":" ( "*" | 1#field-name )
7068
7069
7070
7071 Fielding, et al [Page 123]
7072
7073
7074 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7075
7076
7077 An HTTP/1.1 server MUST include an appropriate Vary header field with
7078 any cachable response that is subject to server-driven negotiation.
7079 Doing so allows a cache to properly interpret future requests on that
7080 resource and informs the user agent about the presence of negotiation on
7081 that resource. A server SHOULD include an appropriate Vary header field
7082 with a non-cachable response that is subject to server-driven
7083 negotiation, since this might provide the user agent with useful
7084 information about the dimensions over which the response might vary.
7085
7086 The set of header fields named by the Vary field value is known as the
7087 "selecting" request-headers.
7088
7089 When the cache receives a subsequent request whose Request-URI specifies
7090 one or more cache entries including a Vary header, the cache MUST NOT
7091 use such a cache entry to construct a response to the new request unless
7092 all of the headers named in the cached Vary header are present in the
7093 new request, and all of the stored selecting request-headers from the
7094 previous request match the corresponding headers in the new request.
7095
7096 The selecting request-headers from two requests are defined to match if
7097 and only if the selecting request-headers in the first request can be
7098 transformed to the selecting request-headers in the second request by
7099 adding or removing linear whitespace (LWS) at places where this is
7100 allowed by the corresponding BNF, and/or combining multiple message-
7101 header fields with the same field name following the rules about message
7102 headers in section 4.2.
7103
7104 A Vary field value of "*" signals that unspecified parameters, possibly
7105 other than the contents of request-header fields (e.g., the network
7106 address of the client), play a role in the selection of the response
7107 representation. Subsequent requests on that resource can only be
7108 properly interpreted by the origin server, and thus a cache MUST forward
7109 a (possibly conditional) request even when it has a fresh response
7110 cached for the resource. See section 13.6 for use of the Vary header by
7111 caches.
7112
7113 A Vary field value consisting of a list of field-names signals that the
7114 representation selected for the response is based on a selection
7115 algorithm which considers ONLY the listed request-header field values in
7116 selecting the most appropriate representation. A cache MAY assume that
7117 the same selection will be made for future requests with the same values
7118 for the listed field names, for the duration of time in which the
7119 response is fresh.
7120
7121 The field-names given are not limited to the set of standard request-
7122 header fields defined by this specification. Field names are case-
7123 insensitive.
7124
7125
7126
7127
7128
7129 Fielding, et al [Page 124]
7130
7131
7132 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7133
7134
7135 14.44 Via
7136
7137 The Via general-header field MUST be used by gateways and proxies to
7138 indicate the intermediate protocols and recipients between the user
7139 agent and the server on requests, and between the origin server and the
7140 client on responses. It is analogous to the "Received" field of RFC 822
7141 and is intended to be used for tracking message forwards, avoiding
7142 request loops, and identifying the protocol capabilities of all senders
7143 along the request/response chain.
7144
7145 Via = "Via" ":" 1#( received-protocol received-by [ comment ] )
7146
7147 received-protocol = [ protocol-name "/" ] protocol-version
7148 protocol-name = token
7149 protocol-version = token
7150 received-by = ( host [ ":" port ] ) | pseudonym
7151 pseudonym = token
7152
7153 The received-protocol indicates the protocol version of the message
7154 received by the server or client along each segment of the
7155 request/response chain. The received-protocol version is appended to the
7156 Via field value when the message is forwarded so that information about
7157 the protocol capabilities of upstream applications remains visible to
7158 all recipients.
7159
7160 The protocol-name is optional if and only if it would be "HTTP". The
7161 received-by field is normally the host and optional port number of a
7162 recipient server or client that subsequently forwarded the message.
7163 However, if the real host is considered to be sensitive information, it
7164 MAY be replaced by a pseudonym. If the port is not given, it MAY be
7165 assumed to be the default port of the received-protocol.
7166
7167 Multiple Via field values represent each proxy or gateway that has
7168 forwarded the message. Each recipient MUST append its information such
7169 that the end result is ordered according to the sequence of forwarding
7170 applications.
7171
7172 Comments MAY be used in the Via header field to identify the software of
7173 the recipient proxy or gateway, analogous to the User-Agent and Server
7174 header fields. However, all comments in the Via field are optional and
7175 MAY be removed by any recipient prior to forwarding the message.
7176
7177 For example, a request message could be sent from an HTTP/1.0 user agent
7178 to an internal proxy code-named "fred", which uses HTTP/1.1 to forward
7179 the request to a public proxy at nowhere.com, which completes the
7180 request by forwarding it to the origin server at www.ics.uci.edu. The
7181 request received by www.ics.uci.edu would then have the following Via
7182 header field:
7183
7184 Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
7185
7186
7187 Fielding, et al [Page 125]
7188
7189
7190 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7191
7192
7193 Proxies and gateways used as a portal through a network firewall SHOULD
7194 NOT, by default, forward the names and ports of hosts within the
7195 firewall region. This information SHOULD only be propagated if
7196 explicitly enabled. If not enabled, the received-by host of any host
7197 behind the firewall SHOULD be replaced by an appropriate pseudonym for
7198 that host.
7199
7200 For organizations that have strong privacy requirements for hiding
7201 internal structures, a proxy MAY combine an ordered subsequence of Via
7202 header field entries with identical received-protocol values into a
7203 single such entry. For example,
7204
7205 Via: 1.0 ricky, 1.1 ethel, 1.1 fred, 1.0 lucy
7206
7207 could be collapsed to
7208
7209 Via: 1.0 ricky, 1.1 mertz, 1.0 lucy
7210
7211 Applications SHOULD NOT combine multiple entries unless they are all
7212 under the same organizational control and the hosts have already been
7213 replaced by pseudonyms. Applications MUST NOT combine entries which have
7214 different received-protocol values.
7215
7216
7217 14.45 Warning
7218
7219 The Warning response-header field is used to carry additional
7220 information about the status of a response which may not be reflected by
7221 the response status code. This information is typically, though not
7222 exclusively, used to warn about a possible lack of semantic transparency
7223 from caching operations.
7224
7225 Warning headers are sent with responses using:
7226
7227 Warning = "Warning" ":" 1#warning-value
7228
7229 warning-value = warn-code SP warn-agent SP warn-text
7230 warn-code = 2DIGIT
7231 warn-agent = ( host [ ":" port ] ) | pseudonym
7232 ; the name or pseudonym of the server adding
7233 ; the Warning header, for use in debugging
7234 warn-text = quoted-string
7235
7236 A response may carry more than one Warning header.
7237
7238 The warn-text should be in a natural language and character set that is
7239 most likely to be intelligible to the human user receiving the response.
7240 This decision may be based on any available knowledge, such as the
7241 location of the cache or user, the Accept-Language field in a request,
7242 the Content-Language field in a response, etc. The default language is
7243 English and the default character set is ISO-8599-1.
7244
7245 Fielding, et al [Page 126]
7246
7247
7248 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7249
7250
7251 If a character set other than ISO-8599-1 is used, it MUST be encoded in
7252 the warn-text using the method described in RFC 1522 [14].
7253
7254 Any server or cache may add Warning headers to a response. New Warning
7255 headers should be added after any existing Warning headers. A cache MUST
7256 NOT delete any Warning header that it received with a response. However,
7257 if a cache successfully validates a cache entry, it SHOULD remove any
7258 Warning headers previously attached to that entry except as specified
7259 for specific Warning codes. It MUST then add any Warning headers
7260 received in the validating response. In other words, Warning headers are
7261 those that would be attached to the most recent relevant response.
7262
7263 When multiple Warning headers are attached to a response, the user agent
7264 SHOULD display as many of them as possible, in the order that they
7265 appear in the response. If it is not possible to display all of the
7266 warnings, the user agent should follow these heuristics:
7267
7268 . Warnings that appear early in the response take priority over those
7269 appearing later in the response.
7270 . Warnings in the user's preferred character set take priority over
7271 warnings in other character sets but with identical warn-codes and
7272 warn-agents.
7273 Systems that generate multiple Warning headers should order them with
7274 this user agent behavior in mind.
7275
7276 This is a list of the currently-defined warn-codes, each with a
7277 recommended warn-text in English, and a description of its meaning.
7278
7279 10 Response is stale
7280 MUST be included whenever the returned response is stale. A cache may
7281 add this warning to any response, but may never remove it until the
7282 response is known to be fresh.
7283
7284 11 Revalidation failed
7285 MUST be included if a cache returns a stale response because an
7286 attempt to revalidate the response failed, due to an inability to
7287 reach the server. A cache may add this warning to any response, but
7288 may never remove it until the response is successfully revalidated.
7289
7290 12 Disconnected operation
7291 SHOULD be included if the cache is intentionally disconnected from
7292 the rest of the network for a period of time.
7293
7294 13 Heuristic expiration
7295 MUST be included if the cache heuristically chose a freshness
7296 lifetime greater than 24 hours and the response's age is greater than
7297 24 hours.
7298
7299 14 Transformation applied
7300 MUST be added by an intermediate cache or proxy if it applies any
7301 transformation changing the content-coding (as specified in the
7302
7303 Fielding, et al [Page 127]
7304
7305
7306 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7307
7308
7309 Content-Encoding header) or media-type (as specified in the Content-
7310 Type header) of the response, unless this Warning code already
7311 appears in the response. MUST NOT be deleted from a response even
7312 after revalidation.
7313
7314 99 Miscellaneous warning
7315 The warning text may include arbitrary information to be presented to
7316 a human user, or logged. A system receiving this warning MUST NOT
7317 take any automated action.
7318
7319
7320 14.46 WWW-Authenticate
7321
7322 The WWW-Authenticate response-header field MUST be included in 401
7323 (Unauthorized) response messages. The field value consists of at least
7324 one challenge that indicates the authentication scheme(s) and parameters
7325 applicable to the Request-URI.
7326
7327 WWW-Authenticate = "WWW-Authenticate" ":" 1#challenge
7328
7329 The HTTP access authentication process is described in section 11. User
7330 agents MUST take special care in parsing the WWW-Authenticate field
7331 value if it contains more than one challenge, or if more than one WWW-
7332 Authenticate header field is provided, since the contents of a challenge
7333 may itself contain a comma-separated list of authentication parameters.
7334
7335
7336 15 Security Considerations
7337
7338 This section is meant to inform application developers, information
7339 providers, and users of the security limitations in HTTP/1.1 as
7340 described by this document. The discussion does not include definitive
7341 solutions to the problems revealed, though it does make some suggestions
7342 for reducing security risks.
7343
7344
7345 15.1 Authentication of Clients
7346
7347 The Basic authentication scheme is not a secure method of user
7348 authentication, nor does it in any way protect the entity, which is
7349 transmitted in clear text across the physical network used as the
7350 carrier. HTTP does not prevent additional authentication schemes and
7351 encryption mechanisms from being employed to increase security or the
7352 addition of enhancements (such as schemes to use one-time passwords) to
7353 Basic authentication.
7354
7355 The most serious flaw in Basic authentication is that it results in the
7356 essentially clear text transmission of the user's password over the
7357 physical network. It is this problem which Digest Authentication
7358 attempts to address.
7359
7360
7361 Fielding, et al [Page 128]
7362
7363
7364 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7365
7366
7367 Because Basic authentication involves the clear text transmission of
7368 passwords it SHOULD never be used (without enhancements) to protect
7369 sensitive or valuable information.
7370
7371 A common use of Basic authentication is for identification purposes --
7372 requiring the user to provide a user name and password as a means of
7373 identification, for example, for purposes of gathering accurate usage
7374 statistics on a server. When used in this way it is tempting to think
7375 that there is no danger in its use if illicit access to the protected
7376 documents is not a major concern. This is only correct if the server
7377 issues both user name and password to the users and in particular does
7378 not allow the user to choose his or her own password. The danger arises
7379 because naive users frequently reuse a single password to avoid the task
7380 of maintaining multiple passwords.
7381
7382 If a server permits users to select their own passwords, then the threat
7383 is not only illicit access to documents on the server but also illicit
7384 access to the accounts of all users who have chosen to use their account
7385 password. If users are allowed to choose their own password that also
7386 means the server must maintain files containing the (presumably
7387 encrypted) passwords. Many of these may be the account passwords of
7388 users perhaps at distant sites. The owner or administrator of such a
7389 system could conceivably incur liability if this information is not
7390 maintained in a secure fashion.
7391
7392 Basic Authentication is also vulnerable to spoofing by counterfeit
7393 servers. If a user can be led to believe that he is connecting to a host
7394 containing information protected by basic authentication when in fact he
7395 is connecting to a hostile server or gateway then the attacker can
7396 request a password, store it for later use, and feign an error. This
7397 type of attack is not possible with Digest Authentication [32]. Server
7398 implementers SHOULD guard against the possibility of this sort of
7399 counterfeiting by gateways or CGI scripts. In particular it is very
7400 dangerous for a server to simply turn over a connection to a gateway
7401 since that gateway can then use the persistent connection mechanism to
7402 engage in multiple transactions with the client while impersonating the
7403 original server in a way that is not detectable by the client.
7404
7405
7406 15.2 Offering a Choice of Authentication Schemes
7407
7408 An HTTP/1.1 server may return multiple challenges with a 401
7409 (Authenticate) response, and each challenge may use a different scheme.
7410 The order of the challenges returned to the user agent is in the order
7411 that the server would prefer they be chosen. The server should order its
7412 challenges with the "most secure" authentication scheme first. A user
7413 agent should choose as the challenge to be made to the user the first
7414 one that the user agent understands.
7415
7416 When the server offers choices of authentication schemes using the WWW-
7417 Authenticate header, the "security" of the authentication is only as
7418
7419 Fielding, et al [Page 129]
7420
7421
7422 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7423
7424
7425 good as the security of the weakest of the authentication schemes. A
7426 malicious user could capture the set of challenges and try to
7427 authenticate him/herself using the weakest of the authentication
7428 schemes. Thus, the ordering serves more to protect the user's
7429 credentials than the server's information.
7430
7431 A possible man-in-the-middle (MITM) attack would be to add a weak
7432 authentication scheme to the set of choices, hoping that the client will
7433 use one that exposes the user's credentials (e.g. password). For this
7434 reason, the client should always use the strongest scheme that it
7435 understands from the choices accepted.
7436
7437 An even better MITM attack would be to remove all offered choices, and
7438 to insert a challenge that requests Basic authentication. For this
7439 reason, user agents that are concerned about this kind of attack could
7440 remember the strongest authentication scheme ever requested by a server
7441 and produce a warning message that requires user confirmation before
7442 using a weaker one. A particularly insidious way to mount such a MITM
7443 attack would be to offer a "free" proxy caching service to gullible
7444 users.
7445
7446
7447 15.3 Abuse of Server Log Information
7448
7449 A server is in the position to save personal data about a user's
7450 requests which may identify their reading patterns or subjects of
7451 interest. This information is clearly confidential in nature and its
7452 handling may be constrained by law in certain countries. People using
7453 the HTTP protocol to provide data are responsible for ensuring that such
7454 material is not distributed without the permission of any individuals
7455 that are identifiable by the published results.
7456
7457
7458 15.4 Transfer of Sensitive Information
7459
7460 Like any generic data transfer protocol, HTTP cannot regulate the
7461 content of the data that is transferred, nor is there any a priori
7462 method of determining the sensitivity of any particular piece of
7463 information within the context of any given request. Therefore,
7464 applications SHOULD supply as much control over this information as
7465 possible to the provider of that information. Four header fields are
7466 worth special mention in this context: Server, Via, Referer and From.
7467
7468 Revealing the specific software version of the server may allow the
7469 server machine to become more vulnerable to attacks against software
7470 that is known to contain security holes. Implementers SHOULD make the
7471 Server header field a configurable option.
7472
7473 Proxies which serve as a portal through a network firewall SHOULD take
7474 special precautions regarding the transfer of header information that
7475 identifies the hosts behind the firewall. In particular, they SHOULD
7476
7477 Fielding, et al [Page 130]
7478
7479
7480 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7481
7482
7483 remove, or replace with sanitized versions, any Via fields generated
7484 behind the firewall.
7485
7486 The Referer field allows reading patterns to be studied and reverse
7487 links drawn. Although it can be very useful, its power can be abused if
7488 user details are not separated from the information contained in the
7489 Referer. Even when the personal information has been removed, the
7490 Referer field may indicate a private document's URI whose publication
7491 would be inappropriate.
7492
7493 The information sent in the From field might conflict with the user's
7494 privacy interests or their site's security policy, and hence it SHOULD
7495 NOT be transmitted without the user being able to disable, enable, and
7496 modify the contents of the field. The user MUST be able to set the
7497 contents of this field within a user preference or application defaults
7498 configuration.
7499
7500 We suggest, though do not require, that a convenient toggle interface be
7501 provided for the user to enable or disable the sending of From and
7502 Referer information.
7503
7504
7505 15.5 Attacks Based On File and Path Names
7506
7507 Implementations of HTTP origin servers SHOULD be careful to restrict the
7508 documents returned by HTTP requests to be only those that were intended
7509 by the server administrators. If an HTTP server translates HTTP URIs
7510 directly into file system calls, the server MUST take special care not
7511 to serve files that were not intended to be delivered to HTTP clients.
7512 For example, UNIX, Microsoft Windows, and other operating systems use
7513 ".." as a path component to indicate a directory level above the current
7514 one. On such a system, an HTTP server MUST disallow any such construct
7515 in the Request-URI if it would otherwise allow access to a resource
7516 outside those intended to be accessible via the HTTP server. Similarly,
7517 files intended for reference only internally to the server (such as
7518 access control files, configuration files, and script code) MUST be
7519 protected from inappropriate retrieval, since they might contain
7520 sensitive information. Experience has shown that minor bugs in such HTTP
7521 server implementations have turned into security risks.
7522
7523
7524 15.6 Personal Information
7525
7526 HTTP clients are often privy to large amounts of personal information
7527 (e.g. the user's name, location, mail address, passwords, encryption
7528 keys, etc.), and SHOULD be very careful to prevent unintentional leakage
7529 of this information via the HTTP protocol to other sources. We very
7530 strongly recommend that a convenient interface be provided for the user
7531 to control dissemination of such information, and that designers and
7532 implementers be particularly careful in this area. History shows that
7533 errors in this area are often both serious security and/or privacy
7534
7535 Fielding, et al [Page 131]
7536
7537
7538 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7539
7540
7541 problems, and often generate highly adverse publicity for the
7542 implementer's company.
7543
7544
7545 15.7 Privacy Issues Connected to Accept Headers
7546
7547 Accept request-headers can reveal information about the user to all
7548 servers which are accessed. The Accept-Language header in particular can
7549 reveal information the user would consider to be of a private nature,
7550 because the understanding of particular languages is often strongly
7551 correlated to the membership of a particular ethnic group. User agents
7552 which offer the option to configure the contents of an Accept-Language
7553 header to be sent in every request are strongly encouraged to let the
7554 configuration process include a message which makes the user aware of
7555 the loss of privacy involved.
7556
7557 An approach that limits the loss of privacy would be for a user agent to
7558 omit the sending of Accept-Language headers by default, and to ask the
7559 user whether it should start sending Accept-Language headers to a server
7560 if it detects, by looking for any Vary response-header fields generated
7561 by the server, that such sending could improve the quality of service.
7562
7563 Elaborate user-customized accept header fields sent in every request, in
7564 particular if these include quality values, can be used by servers as
7565 relatively reliable and long-lived user identifiers. Such user
7566 identifiers would allow content providers to do click-trail tracking,
7567 and would allow collaborating content providers to match cross-server
7568 click-trails or form submissions of individual users. Note that for many
7569 users not behind a proxy, the network address of the host running the
7570 user agent will also serve as a long-lived user identifier. In
7571 environments where proxies are used to enhance privacy, user agents
7572 should be conservative in offering accept header configuration options
7573 to end users. As an extreme privacy measure, proxies could filter the
7574 accept headers in relayed requests. General purpose user agents which
7575 provide a high degree of header configurability should warn users about
7576 the loss of privacy which can be involved.
7577
7578
7579 15.8 DNS Spoofing
7580
7581 Clients using HTTP rely heavily on the Domain Name Service, and are thus
7582 generally prone to security attacks based on the deliberate mis-
7583 association of IP addresses and DNS names. The deployment of DNSSEC
7584 should help this situation. In advance of this deployment, however,
7585 clients need to be cautious in assuming the continuing validity of an IP
7586 number/DNS name association.
7587
7588 In particular, HTTP clients SHOULD rely on their name resolver for
7589 confirmation of an IP number/DNS name association, rather than caching
7590 the result of previous host name lookups. Many platforms already can
7591 cache host name lookups locally when appropriate, and they SHOULD be
7592
7593 Fielding, et al [Page 132]
7594
7595
7596 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7597
7598
7599 configured to do so. These lookups should be cached, however, only when
7600 the TTL (Time To Live) information reported by the name server makes it
7601 likely that the cached information will remain useful.
7602
7603 If HTTP clients cache the results of host name lookups in order to
7604 achieve a performance improvement, they MUST observe the TTL information
7605 reported by DNS.
7606
7607 If HTTP clients do not observe this rule, they could be spoofed when a
7608 previously-accessed server's IP address changes. As network renumbering
7609 is expected to become increasingly common, the possibility of this form
7610 of attack will grow. Observing this requirement thus reduces this
7611 potential security vulnerability.
7612
7613 This requirement also improves the load-balancing behavior of clients
7614 for replicated servers using the same DNS name and reduces the
7615 likelihood of a user's experiencing failure in accessing sites which use
7616 that strategy.
7617
7618
7619 15.9 Location Headers and Spoofing
7620
7621 If a single server supports multiple organizations that do not trust one
7622 another, then it must check the values of Location and Content-Location
7623 headers in responses that are generated under control of said
7624 organizations to make sure that they do not attempt to invalidate
7625 resources over which they have no authority.
7626
7627
7628 16 Acknowledgments
7629
7630 This specification makes heavy use of the augmented BNF and generic
7631 constructs defined by David H. Crocker for RFC 822 . Similarly, it
7632 reuses many of the definitions provided by Nathaniel Borenstein and Ned
7633 Freed for MIME . We hope that their inclusion in this specification will
7634 help reduce past confusion over the relationship between HTTP and
7635 Internet mail message formats.
7636
7637 The HTTP protocol has evolved considerably over the past four years. It
7638 has benefited from a large and active developer community--the many
7639 people who have participated on the www-talk mailing list--and it is
7640 that community which has been most responsible for the success of HTTP
7641 and of the World-Wide Web in general. Marc Andreessen, Robert Cailliau,
7642 Daniel W. Connolly, Bob Denny, John Franks, Jean-Francois Groff, Phillip
7643 M. Hallam-Baker, Hakon W. Lie, Ari Luotonen, Rob McCool, Lou Montulli,
7644 Dave Raggett, Tony Sanders, and Marc VanHeyningen deserve special
7645 recognition for their efforts in defining early aspects of the protocol.
7646
7647 This document has benefited greatly from the comments of all those
7648 participating in the HTTP-WG. In addition to those already mentioned,
7649 the following individuals have contributed to this specification:
7650
7651 Fielding, et al [Page 133]
7652
7653
7654 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7655
7656
7657 Gary Adams Albert Lunde
7658 Harald Tveit Alvestrand John C. Mallery
7659 Keith Ball Jean-Philippe Martin-Flatin
7660 Brian Behlendorf Larry Masinter
7661 Paul Burchard Mitra
7662 Maurizio Codogno David Morris
7663 Mike Cowlishaw Gavin Nicol
7664 Roman Czyborra Bill Perry
7665 Michael A. Dolan Jeffrey Perry
7666 David J. Fiander Scott Powers
7667 Alan Freier Owen Rees
7668 Marc Hedlund Luigi Rizzo
7669 Greg Herlihy David Robinson
7670 Koen Holtman Marc Salomon
7671 Alex Hopmann Rich Salz
7672 Bob Jernigan Allan M. Schiffman
7673 Shel Kaphan Jim Seidman
7674 Rohit Khare Chuck Shotton
7675 John Klensin Eric W. Sink
7676 Martijn Koster Simon E. Spero
7677 Alexei Kosut Richard N. Taylor
7678 David M. Kristol Robert S. Thau
7679 Daniel LaLiberte Bill (BearHeart) Weinman
7680 Ben Laurie Francois Yergeau
7681 Paul J. Leach Mary Ellen Zurko
7682
7683 Much of the content and presentation of the caching design is due to
7684 suggestions and comments from individuals including: Shel Kaphan, Paul
7685 Leach, Koen Holtman, David Morris, and Larry Masinter.
7686
7687 Most of the specification of ranges is based on work originally done by
7688 Ari Luotonen and John Franks, with additional input from Steve Zilles.
7689
7690 Thanks to the "cave men" of Palo Alto. You know who you are.
7691
7692 Jim Gettys (the current editor of this document) wishes particularly to
7693 thank Roy Fielding, the previous editor of this document, along with
7694 John Klensin, Jeff Mogul, Paul Leach, Dave Kristol, Koen Holtman, John
7695 Franks, Alex Hopmann, and Larry Masinter for their help.
7696
7697
7698 17 References
7699
7700
7701 [1] H. Alvestrand. "Tags for the identification of languages." RFC
7702
7703 1766, UNINETT, March 1995.
7704
7705
7706
7707
7708
7709 Fielding, et al [Page 134]
7710
7711
7712 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7713
7714
7715 [2] F. Anklesaria, M. McCahill, P. Lindner, D. Johnson, D. Torrey,
7716 B. Alberti. "The Internet Gopher Protocol: (a distributed document
7717
7718 search and retrieval protocol)", RFC 1436, University of Minnesota,
7719 March 1993.
7720
7721
7722 [3] T. Berners-Lee. "Universal Resource Identifiers in WWW." A
7723
7724 Unifying Syntax for the Expression of Names and Addresses of Objects
7725 on the Network as used in the World-Wide Web." RFC 1630, CERN, June
7726 1994.
7727
7728
7729 [4] T. Berners-Lee, L. Masinter, M. McCahill.
7730 "Uniform Resource Locators (URL)." RFC 1738, CERN, Xerox PARC,
7731
7732 University of Minnesota, December 1994.
7733
7734
7735 [5] T. Berners-Lee, D. Connolly.
7736 "HyperText Markup Language Specification - 2.0." RFC 1866, MIT/LCS,
7737
7738 November 1995.
7739
7740
7741 [6] T. Berners-Lee, R. Fielding, H. Frystyk.
7742 "Hypertext Transfer Protocol -- HTTP/1.0." RFC 1945." MIT/LCS, UC
7743
7744 Irvine, May 1996.
7745
7746
7747 [7] N. Borenstein, N. Freed.
7748 "MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms
7749
7750 for Specifying and Describing the Format of Internet Message Bodies."
7751 RFC 1521, Bellcore, Innosoft, September 1993.
7752
7753
7754 [8] R. Braden.
7755 "Requirements for Internet hosts - application and support." STD 3,
7756
7757 RFC 1123, IETF, October 1989.
7758
7759
7760 [9] D. H. Crocker.
7761 "Standard for the Format of ARPA Internet Text Messages." STD 11, RFC
7762
7763 822, UDEL, August 1982.
7764
7765
7766
7767 Fielding, et al [Page 135]
7768
7769
7770 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7771
7772
7773 [10] F. Davis, B. Kahle, H. Morris, J. Salem, T. Shen, R. Wang, J.
7774 Sui, M. Grinbaum. "WAIS Interface Protocol Prototype Functional
7775 Specification." (v1.5), Thinking Machines Corporation, April 1990.
7776
7777
7778 [11] R. Fielding. "Relative Uniform Resource Locators." RFC 1808, UC
7779
7780 Irvine, June 1995.
7781
7782
7783 [12] M. Horton, R. Adams.
7784 "Standard for interchange of USENET messages." RFC 1036 (Obsoletes
7785
7786 RFC 850), AT&T Bell Laboratories, Center for Seismic Studies,
7787 December 1987.
7788
7789
7790 [13] B. Kantor, P. Lapsley. "Network News Transfer Protocol." A
7791
7792 Proposed Standard for the Stream-Based Transmission of News." RFC
7793 977, UC San Diego, UC Berkeley, February 1986.
7794
7795
7796 [14] K. Moore. "MIME (Multipurpose Internet Mail Extensions) Part Two
7797
7798 : Message Header Extensions for Non-ASCII Text." RFC 1522, University
7799 of Tennessee, September 1993.
7800
7801
7802 [15] E. Nebel, L. Masinter. "Form-based File Upload in HTML." RFC
7803
7804 1867, Xerox Corporation, November 1995.
7805
7806
7807 [16] J. Postel. "Simple Mail Transfer Protocol." STD 10, RFC 821,
7808
7809 USC/ISI, August 1982.
7810
7811
7812 [17] J. Postel. "Media Type Registration Procedure." RFC 1590,
7813
7814 USC/ISI, March 1994.
7815
7816
7817 [18] J. Postel, J. K. Reynolds. "File Transfer Protocol (FTP)." STD
7818
7819 9, RFC 959, USC/ISI, October 1985.
7820
7821
7822
7823
7824
7825 Fielding, et al [Page 136]
7826
7827
7828 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7829
7830
7831 [19] J. Reynolds, J. Postel. "Assigned Numbers." STD 2, RFC 1700,
7832
7833 USC/ISI, October 1994.
7834
7835
7836 [20] K. Sollins, L. Masinter.
7837 "Functional Requirements for Uniform Resource Names." RFC 1737,
7838
7839 MIT/LCS, Xerox Corporation, December 1994.
7840
7841
7842 [21] US-ASCII. Coded Character Set - 7-Bit American Standard Code for
7843 Information Interchange. Standard ANSI X3.4-1986, ANSI, 1986.
7844
7845
7846 [22] ISO-8859. International Standard -- Information Processing --
7847 8-bit Single-Byte Coded Graphic Character Sets --
7848 Part 1: Latin alphabet No. 1, ISO 8859-1:1987.
7849 Part 2: Latin alphabet No. 2, ISO 8859-2, 1987.
7850 Part 3: Latin alphabet No. 3, ISO 8859-3, 1988.
7851 Part 4: Latin alphabet No. 4, ISO 8859-4, 1988.
7852 Part 5: Latin/Cyrillic alphabet, ISO 8859-5, 1988.
7853 Part 6: Latin/Arabic alphabet, ISO 8859-6, 1987.
7854 Part 7: Latin/Greek alphabet, ISO 8859-7, 1987.
7855 Part 8: Latin/Hebrew alphabet, ISO 8859-8, 1988.
7856 Part 9: Latin alphabet No. 5, ISO 8859-9, 1990.
7857
7858
7859 [23] Meyers, M. Rose "The Content-MD5 Header Field." RFC 1864,
7860
7861 Carnegie Mellon, Dover Beach Consulting, October, 1995.
7862
7863
7864 [24] B. Carpenter, Y. Rekhter, "Renumbering Needs Work." RFC 1900,
7865
7866 IAB, February 1996.
7867
7868
7869 [25] P. Deutsch, "GZIP file format specification version 4.3." RFC
7870
7871 1952, Aladdin Enterprises, May, 1996.
7872
7873
7874 [26] Jeffrey C. Mogul. "The Case for Persistent-Connection HTTP". In
7875 Proc. SIGCOMM '95 Symposium on Communications Architectures and
7876 Protocols, pages 299-313. Cambridge, MA, August, 1995. A longer, more
7877 comprehensive version of this paper is available on line at
7878 <URL
7879 :http://www.research.digital.com/wrl/techreports/abstracts/95.4.html
7880
7881
7882
7883 Fielding, et al [Page 137]
7884
7885
7886 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7887
7888
7889 >, Digital Equipment Corporation Western Research Laboratory Research
7890 Report 95/4, May, 1995.,
7891
7892
7893 [27] Work in progress on content negotiation of the HTTP working
7894 group.
7895
7896
7897 [28] Mills, D, "Network Time Protocol, Version 3.", Specification,
7898
7899 Implementation and Analysis RFC 1305, University of Delaware, March,
7900 1992.
7901
7902
7903 [29] P. Deutsch,
7904 "DEFLATE Compressed Data Format Specification version 1.3." RFC 1951,
7905
7906 Aladdin Enterprises, May 1996.
7907
7908
7909 [30] S. Spero. "Analysis of HTTP Performance Problems"
7910 <URL:http://sunsite.unc.edu/mdma-release/http-prob.html>
7911
7912
7913 [31] P. Deutsch, J-L. Gailly,
7914 "ZLIB Compressed Data Format Specification version 3.3." RFC 1950,
7915
7916 Aladdin Enterprises, Info-ZIP, May 1996.
7917
7918
7919 [32] Work In Progress for Digest authentication of the IETF HTTP
7920 working group.
7921
7922
7923 18 Authors' Addresses
7924
7925 Roy T. Fielding
7926
7927 Department of Information and Computer Science
7928 University of California
7929 Irvine, CA 92717-3425, USA
7930 Fax: +1 (714) 824-4056
7931 Email: fielding@ics.uci.edu
7932
7933 Jim Gettys
7934
7935 MIT Laboratory for Computer Science
7936 545 Technology Square
7937 Cambridge, MA 02139, USA
7938 Fax: +1 (617) 258 8682
7939 Email: jg@w3.org
7940
7941 Fielding, et al [Page 138]
7942
7943
7944 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
7945
7946
7947 Jeffrey C. Mogul
7948
7949 Western Research Laboratory
7950 Digital Equipment Corporation
7951 250 University Avenue
7952 Palo Alto, California, 94305, USA
7953 Email: mogul@wrl.dec.com
7954
7955 Henrik Frystyk Nielsen
7956
7957 W3 Consortium
7958 MIT Laboratory for Computer Science
7959 545 Technology Square
7960 Cambridge, MA 02139, USA
7961 Fax: +1 (617) 258 8682
7962 Email: frystyk@w3.org
7963
7964 Tim Berners-Lee
7965
7966 Director, W3 Consortium
7967 MIT Laboratory for Computer Science
7968 545 Technology Square
7969 Cambridge, MA 02139, USA
7970 Fax: +1 (617) 258 8682
7971 Email: timbl@w3.org
7972
7973
7974 19 Appendices
7975
7976
7977 19.1 Internet Media Type message/http
7978
7979 In addition to defining the HTTP/1.1 protocol, this document serves as
7980 the specification for the Internet media type "message/http". The
7981 following is to be registered with IANA .
7982
7983 Media Type name: message
7984 Media subtype name: http
7985 Required parameters: none
7986 Optional parameters: version, msgtype
7987
7988 version: The HTTP-Version number of the enclosed message
7989 (e.g., "1.1"). If not present, the version can be
7990 determined from the first line of the body.
7991
7992 msgtype: The message type -- "request" or "response". If not
7993 present, the type can be determined from the first
7994 line of the body.
7995
7996 Encoding considerations: only "7bit", "8bit", or "binary" are
7997 permitted
7998
7999 Fielding, et al [Page 139]
8000
8001
8002 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8003
8004
8005 Security considerations: none
8006
8007
8008 19.2 Internet Media Type multipart/byteranges
8009
8010 When an HTTP message includes the content of multiple ranges (for
8011 example, a response to a request for multiple non-overlapping ranges),
8012 these are transmitted as a multipart MIME message. The multipart media
8013 type for this purpose is called "multipart/byteranges".
8014
8015 The multipart/byteranges media type includes two or more parts, each
8016 with its own Content-Type and Content-Range fields. The parts are
8017 separated using a MIME boundary parameter.
8018
8019 Media Type name: multipart
8020 Media subtype name: byteranges
8021 Required parameters: boundary
8022 Optional parameters: none
8023
8024 Encoding considerations: only "7bit", "8bit", or "binary" are
8025 permitted
8026
8027 Security considerations: none
8028
8029 For example:
8030
8031 HTTP/1.1 206 Partial content
8032 Date: Wed, 15 Nov 1995 06:25:24 GMT
8033 Last-modified: Wed, 15 Nov 1995 04:58:08 GMT
8034 Content-type: multipart/byteranges; boundary=THIS_STRING_SEPARATES
8035
8036 --THIS_STRING_SEPARATES
8037 Content-type: application/pdf
8038 Content-range: bytes 500-999/8000
8039
8040 ...the first range...
8041 --THIS_STRING_SEPARATES
8042 Content-type: application/pdf
8043 Content-range: bytes 7000-7999/8000
8044
8045 ...the second range
8046 --THIS_STRING_SEPARATES--
8047
8048
8049 19.3 Tolerant Applications
8050
8051 Although this document specifies the requirements for the generation of
8052 HTTP/1.1 messages, not all applications will be correct in their
8053 implementation. We therefore recommend that operational applications be
8054 tolerant of deviations whenever those deviations can be interpreted
8055 unambiguously.
8056
8057 Fielding, et al [Page 140]
8058
8059
8060 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8061
8062
8063 Clients SHOULD be tolerant in parsing the Status-Line and servers
8064 tolerant when parsing the Request-Line. In particular, they SHOULD
8065 accept any amount of SP or HT characters between fields, even though
8066 only a single SP is required.
8067
8068 The line terminator for message-header fields is the sequence CRLF.
8069 However, we recommend that applications, when parsing such headers,
8070 recognize a single LF as a line terminator and ignore the leading CR.
8071
8072 The character set of an entity-body should be labeled as the lowest
8073 common denominator of the character codes used within that body, with
8074 the exception that no label is preferred over the labels US-ASCII or
8075 ISO-8859-1.
8076
8077 Additional rules for requirements on parsing and encoding of dates and
8078 other potential problems with date encodings include:
8079
8080 . HTTP/1.1 clients and caches should assume that an RFC-850 date
8081 which appears to be more than 50 years in the future is in fact in
8082 the past (this helps solve the "year 2000" problem).
8083 . An HTTP/1.1 implementation may internally represent a parsed
8084 Expires date as earlier than the proper value, but MUST NOT
8085 internally represent a parsed Expires date as later than the proper
8086 value.
8087 . All expiration-related calculations must be done in GMT. The local
8088 time zone MUST NOT influence the calculation or comparison of an
8089 age or expiration time.
8090 . If an HTTP header incorrectly carries a date value with a time zone
8091 other than GMT, it must be converted into GMT using the most
8092 conservative possible conversion.
8093
8094 19.4 Differences Between HTTP Entities and RFC 1521 Entities
8095
8096 HTTP/1.1 uses many of the constructs defined for Internet Mail (RFC 822
8097 ) and the Multipurpose Internet Mail Extensions (MIME ) to allow
8098 entities to be transmitted in an open variety of representations and
8099 with extensible mechanisms. However, RFC 1521 discusses mail, and HTTP
8100 has a few features that are different from those described in RFC 1521.
8101 These differences were carefully chosen to optimize performance over
8102 binary connections, to allow greater freedom in the use of new media
8103 types, to make date comparisons easier, and to acknowledge the practice
8104 of some early HTTP servers and clients.
8105
8106 At the time of this writing, it is expected that RFC 1521 will be
8107 revised. The revisions may include some of the practices found in
8108 HTTP/1.1 but not in RFC 1521.
8109
8110 This appendix describes specific areas where HTTP differs from RFC 1521.
8111 Proxies and gateways to strict MIME environments SHOULD be aware of
8112 these differences and provide the appropriate conversions where
8113
8114
8115 Fielding, et al [Page 141]
8116
8117
8118 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8119
8120
8121 necessary. Proxies and gateways from MIME environments to HTTP also need
8122 to be aware of the differences because some conversions may be required.
8123
8124
8125 19.4.1 Conversion to Canonical Form
8126
8127 RFC 1521 requires that an Internet mail entity be converted to canonical
8128 form prior to being transferred, as described in Appendix G of RFC 1521
8129 . Section 3.7.1 of this document describes the forms allowed for
8130 subtypes of the "text" media type when transmitted over HTTP. RFC 1521
8131 requires that content with a type of "text" represent line breaks as
8132 CRLF and forbids the use of CR or LF outside of line break sequences.
8133 HTTP allows CRLF, bare CR, and bare LF to indicate a line break within
8134 text content when a message is transmitted over HTTP.
8135
8136 Where it is possible, a proxy or gateway from HTTP to a strict RFC 1521
8137 environment SHOULD translate all line breaks within the text media types
8138 described in section 3.7.1 of this document to the RFC 1521 canonical
8139 form of CRLF. Note, however, that this may be complicated by the
8140 presence of a Content-Encoding and by the fact that HTTP allows the use
8141 of some character sets which do not use octets 13 and 10 to represent CR
8142 and LF, as is the case for some multi-byte character sets.
8143
8144
8145 19.4.2 Conversion of Date Formats
8146
8147 HTTP/1.1 uses a restricted set of date formats (section 3.3.1) to
8148 simplify the process of date comparison. Proxies and gateways from other
8149 protocols SHOULD ensure that any Date header field present in a message
8150 conforms to one of the HTTP/1.1 formats and rewrite the date if
8151 necessary.
8152
8153
8154 19.4.3 Introduction of Content-Encoding
8155
8156 RFC 1521 does not include any concept equivalent to HTTP/1.1's Content-
8157 Encoding header field. Since this acts as a modifier on the media type,
8158 proxies and gateways from HTTP to MIME-compliant protocols MUST either
8159 change the value of the Content-Type header field or decode the entity-
8160 body before forwarding the message. (Some experimental applications of
8161 Content-Type for Internet mail have used a media-type parameter of
8162 ";conversions=<content-coding>" to perform an equivalent function as
8163 Content-Encoding. However, this parameter is not part of RFC 1521.)
8164
8165
8166 19.4.4 No Content-Transfer-Encoding
8167
8168 HTTP does not use the Content-Transfer-Encoding (CTE) field of RFC 1521.
8169 Proxies and gateways from MIME-compliant protocols to HTTP MUST remove
8170 any non-identity CTE ("quoted-printable" or "base64") encoding prior to
8171 delivering the response message to an HTTP client.
8172
8173 Fielding, et al [Page 142]
8174
8175
8176 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8177
8178
8179 Proxies and gateways from HTTP to MIME-compliant protocols are
8180 responsible for ensuring that the message is in the correct format and
8181 encoding for safe transport on that protocol, where "safe transport" is
8182 defined by the limitations of the protocol being used. Such a proxy or
8183 gateway SHOULD label the data with an appropriate Content-Transfer-
8184 Encoding if doing so will improve the likelihood of safe transport over
8185 the destination protocol.
8186
8187
8188 19.4.5 HTTP Header Fields in Multipart Body-Parts
8189
8190 In RFC 1521, most header fields in multipart body-parts are generally
8191 ignored unless the field name begins with "Content-". In HTTP/1.1,
8192 multipart body-parts may contain any HTTP header fields which are
8193 significant to the meaning of that part.
8194
8195
8196 19.4.6 Introduction of Transfer-Encoding
8197
8198 HTTP/1.1 introduces the Transfer-Encoding header field (section 14.40).
8199 Proxies/gateways MUST remove any transfer coding prior to forwarding a
8200 message via a MIME-compliant protocol.
8201
8202 A process for decoding the "chunked" transfer coding (section 3.6) can
8203 be represented in pseudo-code as:
8204
8205 length := 0
8206 read chunk-size, chunk-ext (if any) and CRLF
8207 while (chunk-size > 0) {
8208 read chunk-data and CRLF
8209 append chunk-data to entity-body
8210 length := length + chunk-size
8211 read chunk-size and CRLF
8212 }
8213 read entity-header
8214 while (entity-header not empty) {
8215 append entity-header to existing header fields
8216 read entity-header
8217 }
8218 Content-Length := length
8219 Remove "chunked" from Transfer-Encoding
8220
8221
8222 19.4.7 MIME-Version
8223
8224 HTTP is not a MIME-compliant protocol (see appendix 19.4). However,
8225 HTTP/1.1 messages may include a single MIME-Version general-header field
8226 to indicate what version of the MIME protocol was used to construct the
8227 message. Use of the MIME-Version header field indicates that the message
8228 is in full compliance with the MIME protocol (as defined in RFC 1521).
8229
8230
8231 Fielding, et al [Page 143]
8232
8233
8234 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8235
8236
8237 Proxies/gateways are responsible for ensuring full compliance (where
8238 possible) when exporting HTTP messages to strict MIME environments.
8239
8240 MIME-Version = "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
8241
8242 MIME version "1.0" is the default for use in HTTP/1.1. However, HTTP/1.1
8243 message parsing and semantics are defined by this document and not the
8244 MIME specification.
8245
8246
8247 19.5 Changes from HTTP/1.0
8248
8249 This section summarizes major differences between versions HTTP/1.0 and
8250 HTTP/1.1.
8251
8252
8253 19.5.1 Changes to Simplify Multi-homed Web Servers and Conserve IP
8254 Addresses
8255
8256 The requirements that clients and servers support the Host request-
8257 header, report an error if the Host request-header (section 14.23) is
8258 missing from an HTTP/1.1 request, and accept absolute URIs (section
8259 5.1.2) are among the most important changes defined by this
8260 specification.
8261
8262 Older HTTP/1.0 clients assumed a one-to-one relationship of IP addresses
8263 and servers; there was no other established mechanism for distinguishing
8264 the intended server of a request than the IP address to which that
8265 request was directed. The changes outlined above will allow the
8266 Internet, once older HTTP clients are no longer common, to support
8267 multiple Web sites from a single IP address, greatly simplifying large
8268 operational Web servers, where allocation of many IP addresses to a
8269 single host has created serious problems. The Internet will also be able
8270 to recover the IP addresses that have been allocated for the sole
8271 purpose of allowing special-purpose domain names to be used in root-
8272 level HTTP URLs. Given the rate of growth of the Web, and the number of
8273 servers already deployed, it is extremely important that all
8274 implementations of HTTP (including updates to existing HTTP/1.0
8275 applications) correctly implement these requirements:
8276
8277
8278 . Both clients and servers MUST support the Host request-header.
8279
8280 . Host request-headers are required in HTTP/1.1 requests.
8281
8282 . Servers MUST report a 400 (Bad Request) error if an HTTP/1.1
8283 request does not include a Host request-header.
8284
8285 . Servers MUST accept absolute URIs.
8286
8287
8288
8289 Fielding, et al [Page 144]
8290
8291
8292 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8293
8294
8295 19.6 Additional Features
8296
8297 This appendix documents protocol elements used by some existing HTTP
8298 implementations, but not consistently and correctly across most HTTP/1.1
8299 applications. Implementers should be aware of these features, but cannot
8300 rely upon their presence in, or interoperability with, other HTTP/1.1
8301 applications. Some of these describe proposed experimental features, and
8302 some describe features that experimental deployment found lacking that
8303 are now addressed in the base HTTP/1.1 specification.
8304
8305
8306 19.6.1 Additional Request Methods
8307
8308
8309 19.6.1.1 PATCH
8310
8311 The PATCH method is similar to PUT except that the entity contains a
8312 list of differences between the original version of the resource
8313 identified by the Request-URI and the desired content of the resource
8314 after the PATCH action has been applied. The list of differences is in a
8315 format defined by the media type of the entity (e.g.,
8316 "application/diff") and MUST include sufficient information to allow the
8317 server to recreate the changes necessary to convert the original version
8318 of the resource to the desired version.
8319
8320 If the request passes through a cache and the Request-URI identifies a
8321 currently cached entity, that entity MUST be removed from the cache.
8322 Responses to this method are not cachable.
8323
8324 The actual method for determining how the patched resource is placed,
8325 and what happens to its predecessor, is defined entirely by the origin
8326 server. If the original version of the resource being patched included a
8327 Content-Version header field, the request entity MUST include a Derived-
8328 From header field corresponding to the value of the original Content-
8329 Version header field. Applications are encouraged to use these fields
8330 for constructing versioning relationships and resolving version
8331 conflicts.
8332
8333 PATCH requests must obey the message transmission requirements set out
8334 in section 8.2.
8335
8336 Caches that implement PATCH should invalidate cached responses as
8337 defined in section 13.10 for PUT.
8338
8339
8340 19.6.1.2 LINK
8341
8342 The LINK method establishes one or more Link relationships between the
8343 existing resource identified by the Request-URI and other existing
8344 resources. The difference between LINK and other methods allowing links
8345 to be established between resources is that the LINK method does not
8346
8347 Fielding, et al [Page 145]
8348
8349
8350 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8351
8352
8353 allow any message-body to be sent in the request and does not directly
8354 result in the creation of new resources.
8355
8356 If the request passes through a cache and the Request-URI identifies a
8357 currently cached entity, that entity MUST be removed from the cache.
8358 Responses to this method are not cachable.
8359
8360 Caches that implement LINK should invalidate cached responses as defined
8361 in section 13.10 for PUT.
8362
8363
8364 19.6.1.3 UNLINK
8365
8366 The UNLINK method removes one or more Link relationships from the
8367 existing resource identified by the Request-URI. These relationships may
8368 have been established using the LINK method or by any other method
8369 supporting the Link header. The removal of a link to a resource does not
8370 imply that the resource ceases to exist or becomes inaccessible for
8371 future references.
8372
8373 If the request passes through a cache and the Request-URI identifies a
8374 currently cached entity, that entity MUST be removed from the cache.
8375 Responses to this method are not cachable.
8376
8377 Caches that implement UNLINK should invalidate cached responses as
8378 defined in section 13.10 for PUT.
8379
8380
8381 19.6.2 Additional Header Field Definitions
8382
8383
8384 19.6.2.1 Alternates
8385
8386 The Alternates response-header field has been proposed as a means for
8387 the origin server to inform the client about other available
8388 representations of the requested resource, along with their
8389 distinguishing attributes, and thus providing a more reliable means for
8390 a user agent to perform subsequent selection of another representation
8391 which better fits the desires of its user (described as agent-driven
8392 negotiation in section 12).
8393
8394 The Alternates header field is orthogonal to the Vary header field in
8395 that both may coexist in a message without affecting the interpretation
8396 of the response or the available representations. It is expected that
8397 Alternates will provide a significant improvement over the server-driven
8398 negotiation provided by the Vary field for those resources that vary
8399 over common dimensions like type and language.
8400
8401 The Alternates header field will be defined in a future specification.
8402
8403
8404
8405 Fielding, et al [Page 146]
8406
8407
8408 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8409
8410
8411 19.6.2.2 Content-Version
8412
8413 The Content-Version entity-header field defines the version tag
8414 associated with a rendition of an evolving entity. Together with the
8415 Derived-From field described in section 19.6.2.3, it allows a group of
8416 people to work simultaneously on the creation of a work as an iterative
8417 process. The field should be used to allow evolution of a particular
8418 work along a single path rather than derived works or renditions in
8419 different representations.
8420
8421 Content-Version = "Content-Version" ":" quoted-string
8422
8423 Examples of the Content-Version field include:
8424
8425 Content-Version: "2.1.2"
8426 Content-Version: "Fred 19950116-12:26:48"
8427 Content-Version: "2.5a4-omega7"
8428
8429
8430 19.6.2.3 Derived-From
8431
8432 The Derived-From entity-header field can be used to indicate the version
8433 tag of the resource from which the enclosed entity was derived before
8434 modifications were made by the sender. This field is used to help manage
8435 the process of merging successive changes to a resource, particularly
8436 when such changes are being made in parallel and from multiple sources.
8437
8438 Derived-From = "Derived-From" ":" quoted-string
8439
8440 An example use of the field is:
8441
8442 Derived-From: "2.1.1"
8443
8444 The Derived-From field is required for PUT and PATCH requests if the
8445 entity being sent was previously retrieved from the same URI and a
8446 Content-Version header was included with the entity when it was last
8447 retrieved.
8448
8449
8450 19.6.2.4 Link
8451
8452 The Link entity-header field provides a means for describing a
8453 relationship between two resources, generally between the requested
8454 resource and some other resource. An entity MAY include multiple Link
8455 values. Links at the metainformation level typically indicate
8456 relationships like hierarchical structure and navigation paths. The Link
8457 field is semantically equivalent to the <LINK> element in HTML .
8458
8459 Link = "Link" ":" #("<" URI ">" *( ";" link-param )
8460
8461
8462
8463 Fielding, et al [Page 147]
8464
8465
8466 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8467
8468
8469 link-param = ( ( "rel" "=" relationship )
8470 | ( "rev" "=" relationship )
8471 | ( "title" "=" quoted-string )
8472 | ( "anchor" "=" <"> URI <"> )
8473 | ( link-extension ) )
8474
8475 link-extension = token [ "=" ( token | quoted-string ) ]
8476
8477 relationship = sgml-name
8478 | ( <"> sgml-name *( SP sgml-name) <"> )
8479
8480 sgml-name = ALPHA *( ALPHA | DIGIT | "." | "-" )
8481
8482 Relationship values are case-insensitive and MAY be extended within the
8483 constraints of the sgml-name syntax. The title parameter MAY be used to
8484 label the destination of a link such that it can be used as
8485 identification within a human-readable menu. The anchor parameter MAY be
8486 used to indicate a source anchor other than the entire current resource,
8487 such as a fragment of this resource or a third resource.
8488
8489 Examples of usage include:
8490
8491 Link: <http://www.cern.ch/TheBook/chapter2>; rel="Previous"
8492
8493 Link: <mailto:timbl@w3.org>; rev="Made"; title="Tim Berners-Lee"
8494
8495 The first example indicates that chapter2 is previous to this resource
8496 in a logical navigation path. The second indicates that the person
8497 responsible for making the resource available is identified by the given
8498 e-mail address.
8499
8500
8501 19.6.2.5 URI
8502
8503 The URI header field has, in past versions of this specification, been
8504 used as a combination of the existing Location, Content-Location, and
8505 Vary header fields as well as the future Alternates field (above). Its
8506 primary purpose has been to include a list of additional URIs for the
8507 resource, including names and mirror locations. However, it has become
8508 clear that the combination of many different functions within this
8509 single field has been a barrier to consistently and correctly
8510 implementing any of those functions. Furthermore, we believe that the
8511 identification of names and mirror locations would be better performed
8512 via the Link header field. The URI header field is therefore deprecated
8513 in favor of those other fields.
8514
8515 URI-header = "URI" ":" 1#( "<" URI ">" )
8516
8517
8518
8519
8520
8521 Fielding, et al [Page 148]
8522
8523
8524 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8525
8526
8527 19.7 Compatibility with Previous Versions
8528
8529 It is beyond the scope of a protocol specification to mandate compliance
8530 with previous versions. HTTP/1.1 was deliberately designed, however, to
8531 make supporting previous versions easy. It is worth noting that at the
8532 time of composing this specification, we would expect commercial
8533 HTTP/1.1 servers to:
8534
8535
8536 . recognize the format of the Request-Line for HTTP/0.9, 1.0, and 1.1
8537 requests;
8538
8539 . understand any valid request in the format of HTTP/0.9, 1.0, or
8540 1.1;
8541
8542 . respond appropriately with a message in the same major version used
8543 by the client.
8544 And we would expect HTTP/1.1 clients to:
8545
8546
8547 . recognize the format of the Status-Line for HTTP/1.0 and 1.1
8548 responses;
8549
8550 . understand any valid response in the format of HTTP/0.9, 1.0, or
8551 1.1.
8552 For most implementations of HTTP/1.0, each connection is established by
8553 the client prior to the request and closed by the server after sending
8554 the response. A few implementations implement the Keep-Alive version of
8555 persistent connections described in section 19.7.1.1.
8556
8557
8558 19.7.1 Compatibility with HTTP/1.0 Persistent Connections
8559
8560 Some clients and servers may wish to be compatible with some previous
8561 implementations of persistent connections in HTTP/1.0 clients and
8562 servers. Persistent connections in HTTP/1.0 must be explicitly
8563 negotiated as they are not the default behavior. HTTP/1.0 experimental
8564
8565 implementations of persistent connections are faulty, and the new
8566 facilities in HTTP/1.1 are designed to rectify these problems. The
8567 problem was that some existing 1.0 clients may be sending Keep-Alive to
8568 a proxy server that doesn't understand Connection, which would then
8569 erroneously forward it to the next inbound server, which would establish
8570 the Keep-Alive connection and result in a hung HTTP/1.0 proxy waiting
8571 for the close on the response. The result is that HTTP/1.0 clients must
8572 be prevented from using Keep-Alive when talking to proxies.
8573
8574 However, talking to proxies is the most important use of persistent
8575 connections, so that prohibition is clearly unacceptable. Therefore, we
8576 need some other mechanism for indicating a persistent connection is
8577 desired, which is safe to use even when talking to an old proxy that
8578
8579 Fielding, et al [Page 149]
8580
8581
8582 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8583
8584
8585 ignores Connection. Persistent connections are the default for HTTP/1.1
8586 messages; we introduce a new keyword (Connection: close) for declaring
8587 non-persistence.
8588
8589 The following describes the original HTTP/1.0 form of persistent
8590 connections.
8591
8592 When it connects to an origin server, an HTTP client MAY send the Keep-
8593 Alive connection-token in addition to the Persist connection-token:
8594
8595 Connection: Keep-Alive
8596
8597 An HTTP/1.0 server would then respond with the Keep-Alive connection
8598 token and the client may proceed with an HTTP/1.0 (or Keep-Alive)
8599 persistent connection.
8600
8601 An HTTP/1.1 server may also establish persistent connections with
8602 HTTP/1.0 clients upon receipt of a Keep-Alive connection token. However,
8603 a persistent connection with an HTTP/1.0 client cannot make use of the
8604 chunked transfer-coding, and therefore MUST use a Content-Length for
8605 marking the ending boundary of each message.
8606
8607 A client MUST NOT send the Keep-Alive connection token to a proxy server
8608 as HTTP/1.0 proxy servers do not obey the rules of HTTP/1.1 for parsing
8609 the Connection header field.
8610
8611
8612 19.7.1.1 The Keep-Alive Header
8613
8614 When the Keep-Alive connection-token has been transmitted with a request
8615 or a response, a Keep-Alive header field MAY also be included. The Keep-
8616 Alive header field takes the following form:
8617
8618 Keep-Alive-header = "Keep-Alive" ":" 0# keepalive-param
8619
8620 keepalive-param = param-name "=" value
8621
8622 The Keep-Alive header itself is optional, and is used only if a
8623 parameter is being sent. HTTP/1.1 does not define any parameters.
8624
8625 If the Keep-Alive header is sent, the corresponding connection token
8626 MUST be transmitted. The Keep-Alive header MUST be ignored if received
8627 without the connection token.
8628
8629
8630 19.8 Notes to the RFC Editor and IANA
8631
8632 This section of the document should be DELETED! It calls for the RFC
8633 editor and IANA to take some actions before the draft becomes a Proposed
8634 Standard. After those actions are taken, please delete this section of
8635 the specification.
8636
8637 Fielding, et al [Page 150]
8638
8639
8640 INTERNET-DRAFT HTTP/1.1 Sunday, June 09, 1996
8641
8642
8643 19.8.1 Charset Registry
8644
8645 The following names should be added to the IANA character set registry
8646 under the category "Preferred MIME name" and this section deleted.
8647
8648 "US-ASCII"
8649 | "ISO-8859-1" | "ISO-8859-2" | "ISO-8859-3"
8650 | "ISO-8859-4" | "ISO-8859-5" | "ISO-8859-6"
8651 | "ISO-8859-7" | "ISO-8859-8" | "ISO-8859-9"
8652 | "ISO-2022-JP" | "ISO-2022-JP-2" | "ISO-2022-KR"
8653 | "SHIFT_JIS" | "EUC-KR" | "GB2312" | "BIG5" | "KOI8-R"
8654
8655 Please also add the following new alias as the "preferred MIME name":
8656
8657 "EUC-JP" for "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE"
8658
8659
8660 19.8.2 Content-coding Values
8661
8662 HTTP also defines a new class of registry for its content-coding values.
8663 The initial set of values defined in this document are deflate, gzip and
8664 compress. IANA should create a registry with those entries. The registry
8665 should note that "x-gzip" and "x-compress" are used as content-codings
8666 in HTTP but that their use is deprecated. The registry should note that
8667 "specifications of the content coding algorithms needed to implement a
8668 new value should be publicly available and adequate for independent
8669 implementation, and conform to the purpose of content coding defined RFC
8670 XXX." where RFC XXX is the number assigned to this document.
8671
8672
8673 19.8.3 New Media Types Registered
8674
8675 This document defines two new media types which should be registered.
8676 Specifically appendix 19.1 defines the Internet media type message/http
8677 and appendix 19.2 defines multipart/byteranges.
8678
8679
8680 19.8.4 Possible Merge With Digest Authentication Draft
8681
8682 Note that the working group draft for Digest Authentication may be
8683 processed by the IESG at the same time as this document; we leave it to
8684 the RFC editor to decide whether to issue a single RFC containing both
8685 drafts (see section 11.2 for where it would be put); in any case, the
8686 reference in the reference list will need to be either deleted, or made
8687 to the appropriate RFC (and section 11.2 deleted).
8688
8689
8690
8691
8692
8693
8694
8695 Fielding, et al [Page 151]

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24