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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24