-
Notifications
You must be signed in to change notification settings - Fork 0
/
draft-fielding-httpbis-http-conditional-latest.html
2079 lines (2045 loc) · 127 KB
/
draft-fielding-httpbis-http-conditional-latest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Hypertext Transfer Protocol (HTTP): Conditional Requests</title><script type="application/javascript">
var buttonsAdded = false;
function initFeedback() {
var fb = document.createElement("div");
fb.className = "feedback noprint";
fb.setAttribute("onclick", "feedback();");
fb.appendChild(document.createTextNode("feedback"));
document.body.appendChild(fb);
}
function feedback() {
toggleButtonsToElementsByName("h2");
toggleButtonsToElementsByName("h3");
toggleButtonsToElementsByName("h4");
toggleButtonsToElementsByName("h5");
buttonsAdded = !buttonsAdded;
}
function toggleButtonsToElementsByName(name) {
var list = document.getElementsByTagName(name);
for (var i = 0; i < list.length; i++) {
toggleButton(list.item(i));
}
}
function toggleButton(node) {
if (! buttonsAdded) {
// docname
var template = "mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&body=<{ref}>:";
var id = node.getAttribute("id");
// try also parent
if (id == null || id == "") {
var id = node.parentNode.getAttribute("id");
}
// better id available?
var titlelinks = node.getElementsByTagName("a");
for (var i = 0; i < titlelinks.length; i++) {
var tl = titlelinks.item(i);
if (tl.getAttribute("id")) {
id = tl.getAttribute("id");
}
}
// ref
var ref = window.location.toString();
var hash = ref.indexOf("#");
if (hash != -1) {
ref = ref.substring(0, hash);
}
if (id != null && id != "") {
ref += "#" + id;
}
// docname
var docname = "draft-fielding-httpbis-http-conditional-latest";
// section
var section = node.textContent;
section = section.replace("\u00a0", " ").trim();
// build URI from template
var uri = template.replace("{docname}", encodeURIComponent(docname));
uri = uri.replace("{section}", encodeURIComponent(section));
uri = uri.replace("{ref}", encodeURIComponent(ref));
var button = document.createElement("a");
button.className = "fbbutton noprint";
button.setAttribute("href", uri);
button.appendChild(document.createTextNode("send feedback"));
node.appendChild(button);
}
else {
var buttons = node.getElementsByTagName("a");
for (var i = 0; i < buttons.length; i++) {
var b = buttons.item(i);
if (b.className == "fbbutton noprint") {
node.removeChild(b);
}
}
}
}</script><script type="application/javascript">
function anchorRewrite() {
map = { "Last-Modified": "header.last-modified", "ETag": "header.etag", "entity-tag": "header.etag", "opaque-tag": "header.etag", "weak": "header.etag", "etagc": "header.etag", "validator.comparison": "entity.tag.comparison", "strong comparison": "entity.tag.comparison", "weak comparison": "entity.tag.comparison", "If-Match": "header.if-match", "If-None-Match": "header.if-none-match", "If-Modified-Since": "header.if-modified-since", "If-Unmodified-Since": "header.if-unmodified-since", "304": "status.304", "304 (Not Modified)": "status.304", "412 (Precondition Failed)": "status.412", "ALPHA": "imported.abnf", "CR": "imported.abnf", "DIGIT": "imported.abnf", "DQUOTE": "imported.abnf", "LF": "imported.abnf", "OCTET": "imported.abnf", "VCHAR": "imported.abnf", "core.rules": "imported.abnf", "obs-text": "imported.abnf", "OWS": "imported.abnf", "HTTP-date": "imported.abnf"};
if (window.location.hash.length >= 1) {
var fragid = window.location.hash.substr(1);
if (fragid) {
if (! document.getElementById(fragid)) {
var prefix = "rfc.";
var mapped = map[fragid];
if (mapped) {
window.location.hash = mapped;
} else if (fragid.indexOf("section-") == 0) {
window.location.hash = prefix + "section." + fragid.substring(8);
} else if (fragid.indexOf("appendix-") == 0) {
window.location.hash = prefix + "section." + fragid.substring(9);
} else if (fragid.indexOf("s-") == 0) {
var postfix = fragid.substring(2);
if (postfix.startsWith("abstract")) {
window.location.hash = prefix + postfix;
} else if (postfix.startsWith("note-")) {
window.location.hash = prefix + "note." + postfix.substring(5);
} else {
window.location.hash = prefix + "section." + postfix;
}
} else if (fragid.indexOf("p-") == 0) {
var r = fragid.substring(2);
var p = r.indexOf("-");
if (p >= 0) {
window.location.hash = prefix + "section." + r.substring(0, p) + ".p." + r.substring(p + 1);
}
}
}
}
}
}
window.addEventListener('hashchange', anchorRewrite);
window.addEventListener('DOMContentLoaded', anchorRewrite);
</script><style type="text/css" title="rfc2629.xslt">
a {
text-decoration: none;
}
a.smpl {
color: black;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
address {
margin-top: 1em;
margin-left: 2em;
font-style: normal;
}
body {
color: black;
font-family: cambria, georgia, serif;
font-size: 12pt;
margin: 10px 0px 10px 10px;
}
@media screen and (min-width: 1040px) {
body {
margin: 10px auto;
max-width: 1000px;
}
}
samp, span.tt, code, pre {
font-family: consolas, monaco, monospace;
}
cite {
font-style: normal;
}
aside {
margin-left: 2em;
}
dl {
margin-left: 2em;
}
dl > dt {
float: left;
margin-right: 1em;
}
dl.nohang > dt {
float: none;
}
dl > dd {
margin-bottom: .5em;
}
dl.compact > dd {
margin-bottom: .0em;
}
dl > dd > dl {
margin-top: 0.5em;
}
ul.empty {
list-style-type: none;
}
ul.empty li {
margin-top: .5em;
}
dl p {
margin-left: 0em;
}
dl.reference > dt {
font-weight: bold;
}
dl.reference > dd {
margin-left: 6em;
}
h1 {
color: green;
font-size: 150%;
line-height: 18pt;
font-weight: bold;
text-align: center;
margin-top: 36pt;
margin-bottom: 0pt;
}
h2 {
font-size: 130%;
line-height: 21pt;
page-break-after: avoid;
}
h2.np {
page-break-before: always;
}
h3 {
font-size: 120%;
line-height: 15pt;
page-break-after: avoid;
}
h4 {
font-size: 110%;
page-break-after: avoid;
}
h5, h6 {
page-break-after: avoid;
}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
color: black;
}
img {
margin-left: 3em;
}
li {
margin-left: 2em;
}
ol {
margin-left: 2em;
}
ol.la {
list-style-type: lower-alpha;
}
ol.ua {
list-style-type: upper-alpha;
}
ol p {
margin-left: 0em;
}
p {
margin-left: 2em;
}
pre {
font-size: 11pt;
margin-left: 3em;
background-color: lightyellow;
padding: .25em;
page-break-inside: avoid;
}
pre.text2 {
border-style: dotted;
border-width: 1px;
background-color: #f0f0f0;
}
pre.inline {
background-color: white;
padding: 0em;
page-break-inside: auto;
}
pre.text {
border-style: dotted;
border-width: 1px;
background-color: #f8f8f8;
}
pre.drawing {
border-style: solid;
border-width: 1px;
background-color: #f8f8f8;
padding: 2em;
}
table {
margin-left: 2em;
}
div.tt {
margin-left: 2em;
}
table.tt {
border-collapse: collapse;
border-color: gray;
border-spacing: 0;
vertical-align: top;
}
table.tt th {
border-color: gray;
padding: 3px;
}
table.tt td {
border-color: gray;
padding: 3px;
}
table.all {
border-style: solid;
border-width: 2px;
}
table.full {
border-style: solid;
border-width: 2px;
}
table.tt td {
vertical-align: top;
}
table.all td {
border-style: solid;
border-width: 1px;
}
table.full td {
border-style: none solid;
border-width: 1px;
}
table.tt th {
vertical-align: top;
}
table.all th {
border-style: solid;
border-width: 1px;
}
table.full th {
border-style: solid;
border-width: 1px 1px 2px 1px;
}
table.headers th {
border-style: none none solid none;
border-width: 2px;
}
table.tleft {
margin-right: auto;
}
table.tright {
margin-left: auto;
}
table.tcenter {
margin-left: auto;
margin-right: auto;
}
caption {
caption-side: bottom;
font-weight: bold;
font-size: 10pt;
margin-top: .5em;
}
table.header {
border-spacing: 1px;
width: 95%;
font-size: 11pt;
color: white;
}
td.top {
vertical-align: top;
}
td.topnowrap {
vertical-align: top;
white-space: nowrap;
}
table.header td {
background-color: gray;
width: 50%;
}
table.header a {
color: white;
}
ul.toc, ul.toc ul {
list-style: none;
margin-left: 1.5em;
padding-left: 0em;
}
ul.toc li {
line-height: 150%;
font-weight: bold;
margin-left: 0em;
}
ul.toc li li {
line-height: normal;
font-weight: normal;
font-size: 11pt;
margin-left: 0em;
}
li.excluded {
font-size: 0pt;
}
ul p {
margin-left: 0em;
}
.filename, h1, h2, h3, h4 {
font-family: candara, calibri, segoe, optima, arial, sans-serif;
}
ul.ind, ul.ind ul {
list-style: none;
margin-left: 1.5em;
padding-left: 0em;
page-break-before: avoid;
}
ul.ind li {
font-weight: bold;
line-height: 200%;
margin-left: 0em;
}
ul.ind li li {
font-weight: normal;
line-height: 150%;
margin-left: 0em;
}
.avoidbreakinside {
page-break-inside: avoid;
}
.avoidbreakafter {
page-break-after: avoid;
}
section.rfcEditorRemove > div:first-of-type {
font-style: italic;
}.bcp14 {
font-style: normal;
text-transform: lowercase;
font-variant: small-caps;
}
.comment {
background-color: yellow;
}
.center {
text-align: center;
}
.error {
color: red;
font-style: italic;
font-weight: bold;
}
.figure {
font-weight: bold;
text-align: center;
font-size: 10pt;
}
.filename {
color: #333333;
font-size: 112%;
font-weight: bold;
line-height: 21pt;
text-align: center;
margin-top: 0pt;
}
.fn {
font-weight: bold;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
.warning {
font-size: 130%;
background-color: yellow;
}.feedback {
position: fixed;
bottom: 1%;
right: 1%;
padding: 3px 5px;
color: white;
border-radius: 5px;
background: #006400;
border: 1px solid silver;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.fbbutton {
margin-left: 1em;
color: #303030;
font-size: small;
font-weight: normal;
background: #d0d000;
padding: 1px 4px;
border: 1px solid silver;
border-radius: 5px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
@media screen {
pre.text, pre.text2 {
width: 69em;
}
}
@media print {
.noprint {
display: none;
}
a {
color: black;
text-decoration: none;
}
table.header {
width: 90%;
}
td.header {
width: 50%;
color: black;
background-color: white;
vertical-align: top;
font-size: 110%;
}
ul.toc a:last-child::after {
content: leader('.') target-counter(attr(href), page);
}
ul.ind li li a {
content: target-counter(attr(href), page);
}
pre {
font-size: 10pt;
}
.print2col {
column-count: 2;
-moz-column-count: 2;
column-fill: auto;
}
}
@page {
font-family: cambria, georgia, serif;
@top-left {
content: "Internet-Draft";
}
@top-right {
content: "March 2018";
}
@top-center {
content: "HTTP Conditional Requests";
}
@bottom-left {
content: "Fielding & Reschke";
}
@bottom-center {
content: "Expires September 17, 2018";
}
@bottom-right {
content: "[Page " counter(page) "]";
}
}
@page:first {
@top-left {
content: normal;
}
@top-right {
content: normal;
}
@top-center {
content: normal;
}
}
</style><link rel="Contents" href="#rfc.toc">
<link rel="Author" href="#rfc.authors">
<link rel="Copyright" href="#rfc.copyrightnotice">
<link rel="Index" href="#rfc.index">
<link rel="Chapter" title="1 Introduction" href="#rfc.section.1">
<link rel="Chapter" title="2 Validators" href="#rfc.section.2">
<link rel="Chapter" title="3 Precondition Header Fields" href="#rfc.section.3">
<link rel="Chapter" title="4 Status Code Definitions" href="#rfc.section.4">
<link rel="Chapter" title="5 Evaluation" href="#rfc.section.5">
<link rel="Chapter" title="6 Precedence" href="#rfc.section.6">
<link rel="Chapter" title="7 IANA Considerations" href="#rfc.section.7">
<link rel="Chapter" title="8 Security Considerations" href="#rfc.section.8">
<link rel="Chapter" href="#rfc.section.9" title="9 References">
<link rel="Appendix" title="A Changes from RFC 7232" href="#rfc.section.A">
<link rel="Appendix" title="B Imported ABNF" href="#rfc.section.B">
<link rel="Appendix" title="C Collected ABNF" href="#rfc.section.C">
<link rel="Appendix" title="D Change Log" href="#rfc.section.D">
<link rel="Appendix" title="Acknowledgments" href="#rfc.section.unnumbered-1">
<meta name="generator" content="http://greenbytes.de/tech/webdav/rfc2629.xslt, Revision 1.1000, 2018/03/16 17:20:44, XSLT vendor: Saxonica http://www.saxonica.com/">
<meta name="keywords" content="Hypertext Transfer Protocol, HTTP, HTTP conditional requests">
<link rel="schema.dcterms" href="http://purl.org/dc/terms/">
<meta name="dcterms.creator" content="Fielding, R.">
<meta name="dcterms.creator" content="Reschke, J. F.">
<meta name="dcterms.identifier" content="urn:ietf:id:draft-fielding-httpbis-http-conditional-latest">
<meta name="dcterms.issued" content="2018-03-16">
<meta name="dct.replaces" content="urn:ietf:rfc:7232">
<meta name="dcterms.abstract" content="The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document defines HTTP/1.1 conditional requests, including metadata header fields for indicating state changes, request header fields for making preconditions on such state, and rules for constructing the responses to a conditional request when one or more preconditions evaluate to false. This document obsoletes RFC 7232.">
<meta name="description" content="The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document defines HTTP/1.1 conditional requests, including metadata header fields for indicating state changes, request header fields for making preconditions on such state, and rules for constructing the responses to a conditional request when one or more preconditions evaluate to false. This document obsoletes RFC 7232.">
</head>
<body onload="initFeedback();">
<header>
<table class="header" id="rfc.headerblock">
<tbody>
<tr>
<td class="left">Network Working Group</td>
<td class="right">R. Fielding, Editor</td>
</tr>
<tr>
<td class="left">Internet-Draft</td>
<td class="right">Adobe</td>
</tr>
<tr>
<td class="left">Obsoletes: <a href="https://tools.ietf.org/html/rfc7232">7232</a> (if approved)
</td>
<td class="right">J. Reschke, Editor</td>
</tr>
<tr>
<td class="left">Intended status: Standards Track</td>
<td class="right">greenbytes</td>
</tr>
<tr>
<td class="left">Expires: September 17, 2018</td>
<td class="right">March 16, 2018</td>
</tr>
</tbody>
</table>
<div id="rfc.title">
<h1>Hypertext Transfer Protocol (HTTP): Conditional Requests</h1>
<div class="filename">draft-fielding-httpbis-http-conditional-latest</div>
</div>
</header>
<section id="rfc.abstract">
<h2><a href="#rfc.abstract">Abstract</a></h2>
<div id="rfc.abstract.p.1">
<p>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for
distributed, collaborative, hypertext information systems. This document defines HTTP/1.1
conditional requests, including metadata header fields for indicating state changes,
request header fields for making preconditions on such state, and rules for constructing
the responses to a conditional request when one or more preconditions evaluate to
false.
</p>
</div>
<div id="rfc.abstract.p.2">
<p>This document obsoletes RFC 7232.</p>
</div>
</section>
<section id="rfc.note.1" class="note rfcEditorRemove">
<h2><a href="#rfc.note.1">Editorial Note</a></h2>
<div id="rfc.note.1.p.1">
<p>This note is to be removed before publishing as an RFC.</p>
</div>
<div id="rfc.note.1.p.2">
<p><em>This is a temporary document for the purpose of planning the revisions of RFCs 7230
to 7235. This is not yet an official work item of the HTTP Working Group.</em>
</p>
</div>
<div id="rfc.note.1.p.3">
<p>Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org),
which is archived at <<a href="http://lists.w3.org/Archives/Public/ietf-http-wg/">http://lists.w3.org/Archives/Public/ietf-http-wg/</a>>.
</p>
</div>
<div id="rfc.note.1.p.4">
<p>Errata for RFC 7232 have been collected at <<a href="https://www.rfc-editor.org/errata_search.php?rfc=7232">https://www.rfc-editor.org/errata_search.php?rfc=7232</a>>, and an additional issues list lives at <<a href="https://github.com/httpwg/http11bis/issues">https://github.com/httpwg/http11bis/issues</a>>.
</p>
</div>
<div id="rfc.note.1.p.5">
<p>The changes in this draft are summarized in <a href="#changes.since.00" title="Since draft-fielding-httpbis-conditional-00">Appendix D.2</a>.
</p>
</div>
</section>
<section id="rfc.status">
<h2><a href="#rfc.status">Status of This Memo</a></h2>
<div id="rfc.boilerplate.1.p.1">
<p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78
and BCP 79.
</p>
</div>
<div id="rfc.boilerplate.1.p.2">
<p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF).
Note that other groups may also distribute working documents as Internet-Drafts. The
list of current Internet-Drafts is at <a href="http://datatracker.ietf.org/drafts/current/">http://datatracker.ietf.org/drafts/current/</a>.
</p>
</div>
<div id="rfc.boilerplate.1.p.3">
<p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated,
replaced, or obsoleted by other documents at any time. It is inappropriate to use
Internet-Drafts as reference material or to cite them other than as “work in progress”.
</p>
</div>
<div id="rfc.boilerplate.1.p.4">
<p>This Internet-Draft will expire on September 17, 2018.</p>
</div>
</section>
<section id="rfc.copyrightnotice">
<h2><a href="#rfc.copyrightnotice">Copyright Notice</a></h2>
<div id="rfc.boilerplate.2.p.1">
<p>Copyright © 2018 IETF Trust and the persons identified as the document authors. All
rights reserved.
</p>
</div>
<div id="rfc.boilerplate.2.p.2">
<p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating
to IETF Documents (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect to this document.
Code Components extracted from this document must include Simplified BSD License text
as described in Section 4.e of the Trust Legal Provisions and are provided without
warranty as described in the Simplified BSD License.
</p>
</div>
<div id="rfc.boilerplate.2.p.3">
<p>This document may contain material from IETF Documents or IETF Contributions published
or made publicly available before November 10, 2008. The person(s) controlling the
copyright in some of this material may not have granted the IETF Trust the right to
allow modifications of such material outside the IETF Standards Process. Without obtaining
an adequate license from the person(s) controlling the copyright in such materials,
this document may not be modified outside the IETF Standards Process, and derivative
works of it may not be created outside the IETF Standards Process, except to format
it for publication as an RFC or to translate it into languages other than English.
</p>
</div>
</section>
<hr class="noprint">
<nav id="rfc.toc">
<h2 class="np"><a href="#rfc.toc">Table of Contents</a></h2>
<ul class="toc">
<li><a href="#rfc.section.1">1.</a> <a href="#introduction">Introduction</a><ul>
<li><a href="#rfc.section.1.1">1.1.</a> <a href="#conformance">Conformance and Error Handling</a></li>
<li><a href="#rfc.section.1.2">1.2.</a> <a href="#notation">Syntax Notation</a></li>
</ul>
</li>
<li><a href="#rfc.section.2">2.</a> <a href="#validators">Validators</a><ul>
<li><a href="#rfc.section.2.1">2.1.</a> <a href="#weak.and.strong.validators">Weak versus Strong</a></li>
<li><a href="#rfc.section.2.2">2.2.</a> <a href="#header.last-modified">Last-Modified</a><ul>
<li><a href="#rfc.section.2.2.1">2.2.1.</a> <a href="#lastmod.generation">Generation</a></li>
<li><a href="#rfc.section.2.2.2">2.2.2.</a> <a href="#lastmod.comparison">Comparison</a></li>
</ul>
</li>
<li><a href="#rfc.section.2.3">2.3.</a> <a href="#header.etag">ETag</a><ul>
<li><a href="#rfc.section.2.3.1">2.3.1.</a> <a href="#entity.tag.generation">Generation</a></li>
<li><a href="#rfc.section.2.3.2">2.3.2.</a> <a href="#entity.tag.comparison">Comparison</a></li>
<li><a href="#rfc.section.2.3.3">2.3.3.</a> <a href="#example.entity.tag.vs.conneg">Example: Entity-Tags Varying on Content-Negotiated Resources</a></li>
</ul>
</li>
<li><a href="#rfc.section.2.4">2.4.</a> <a href="#when.to.use.entity.tags.and.last-modified.dates">When to Use Entity-Tags and Last-Modified Dates</a></li>
</ul>
</li>
<li><a href="#rfc.section.3">3.</a> <a href="#preconditions">Precondition Header Fields</a><ul>
<li><a href="#rfc.section.3.1">3.1.</a> <a href="#header.if-match">If-Match</a></li>
<li><a href="#rfc.section.3.2">3.2.</a> <a href="#header.if-none-match">If-None-Match</a></li>
<li><a href="#rfc.section.3.3">3.3.</a> <a href="#header.if-modified-since">If-Modified-Since</a></li>
<li><a href="#rfc.section.3.4">3.4.</a> <a href="#header.if-unmodified-since">If-Unmodified-Since</a></li>
<li><a href="#rfc.section.3.5">3.5.</a> <a href="#header.if-range">If-Range</a></li>
</ul>
</li>
<li><a href="#rfc.section.4">4.</a> <a href="#status.code.definitions">Status Code Definitions</a><ul>
<li><a href="#rfc.section.4.1">4.1.</a> <a href="#status.304">304 Not Modified</a></li>
<li><a href="#rfc.section.4.2">4.2.</a> <a href="#status.412">412 Precondition Failed</a></li>
</ul>
</li>
<li><a href="#rfc.section.5">5.</a> <a href="#evaluation">Evaluation</a></li>
<li><a href="#rfc.section.6">6.</a> <a href="#precedence">Precedence</a></li>
<li><a href="#rfc.section.7">7.</a> <a href="#IANA.considerations">IANA Considerations</a><ul>
<li><a href="#rfc.section.7.1">7.1.</a> <a href="#status.code.registration">Status Code Registration</a></li>
<li><a href="#rfc.section.7.2">7.2.</a> <a href="#header.field.registration">Header Field Registration</a></li>
</ul>
</li>
<li><a href="#rfc.section.8">8.</a> <a href="#security.considerations">Security Considerations</a></li>
<li><a href="#rfc.section.9">9.</a> <a href="#rfc.references">References</a><ul>
<li><a href="#rfc.section.9.1">9.1.</a> <a href="#rfc.references.1">Normative References</a></li>
<li><a href="#rfc.section.9.2">9.2.</a> <a href="#rfc.references.2">Informative References</a></li>
</ul>
</li>
<li><a href="#rfc.section.A">A.</a> <a href="#changes.from.rfc.7232">Changes from RFC 7232</a></li>
<li><a href="#rfc.section.B">B.</a> <a href="#imported.abnf">Imported ABNF</a></li>
<li><a href="#rfc.section.C">C.</a> <a href="#collected.abnf">Collected ABNF</a></li>
<li><a href="#rfc.section.D">D.</a> <a href="#change.log">Change Log</a><ul>
<li><a href="#rfc.section.D.1">D.1.</a> <a href="#changes.since.publication.as.rfc">Since <span>RFC 7232</span></a></li>
<li><a href="#rfc.section.D.2">D.2.</a> <a href="#changes.since.00">Since draft-fielding-httpbis-conditional-00</a></li>
</ul>
</li>
<li><a href="#acks">Acknowledgments</a></li>
<li><a href="#rfc.index">Index</a></li>
<li><a href="#rfc.authors">Authors' Addresses</a></li>
</ul>
</nav>
<section id="introduction">
<h2 id="rfc.section.1" class="np"><a href="#rfc.section.1">1.</a> <a href="#introduction">Introduction</a></h2>
<div id="rfc.section.1.p.1">
<p>Conditional requests are HTTP requests <a href="#SEMNTCS" id="rfc.xref.SEMNTCS.1"><cite title="Hypertext Transfer Protocol (HTTP): Semantics and Content">[SEMNTCS]</cite></a> that include one or more header fields indicating a precondition to be tested before
applying the method semantics to the target resource. This document defines the HTTP/1.1
conditional request mechanisms in terms of the architecture, syntax notation, and
conformance criteria defined in <a href="#MESSGNG" id="rfc.xref.MESSGNG.1"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[MESSGNG]</cite></a>.
</p>
</div>
<div id="rfc.section.1.p.2">
<p>Conditional GET requests are the most efficient mechanism for HTTP cache updates <a href="#CACHING" id="rfc.xref.CACHING.1"><cite title="Hypertext Transfer Protocol (HTTP): Caching">[CACHING]</cite></a>. Conditionals can also be applied to state-changing methods, such as PUT and DELETE,
to prevent the "lost update" problem: one client accidentally overwriting the work
of another client that has been acting in parallel.
</p>
</div>
<div id="rfc.section.1.p.3">
<p><span id="rfc.iref.s.1"></span> Conditional request preconditions are based on the state of the target resource as
a whole (its current value set) or the state as observed in a previously obtained
representation (one value in that set). A resource might have multiple current representations,
each with its own observable state. The conditional request mechanisms assume that
the mapping of requests to a "selected representation" (<a href="draft-fielding-httpbis-http-semantics-latest.html#representations" title="Representations">Section 3</a> of <a href="#SEMNTCS" id="rfc.xref.SEMNTCS.2"><cite title="Hypertext Transfer Protocol (HTTP): Semantics and Content">[SEMNTCS]</cite></a>) will be consistent over time if the server intends to take advantage of conditionals.
Regardless, if the mapping is inconsistent and the server is unable to select the
appropriate representation, then no harm will result when the precondition evaluates
to false.
</p>
</div>
<div id="rfc.section.1.p.4">
<p>The conditional request preconditions defined by this specification (<a href="#preconditions" title="Precondition Header Fields">Section 3</a>) are evaluated when applicable to the recipient (<a href="#evaluation" title="Evaluation">Section 5</a>) according to their order of precedence (<a href="#precedence" title="Precedence">Section 6</a>).
</p>
</div>
<div id="rfc.section.1.p.5">
<p>This specification obsoletes <cite title="Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests" id="rfc.xref.RFC7232.1">RFC 7232</cite>, with the changes being summarized in <a href="#changes.from.rfc.7232" title="Changes from RFC 7232">Appendix A</a>.
</p>
</div>
<section id="conformance">
<h3 id="rfc.section.1.1"><a href="#rfc.section.1.1">1.1.</a> <a href="#conformance">Conformance and Error Handling</a></h3>
<div id="rfc.section.1.1.p.1">
<p>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD
NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted
as described in <a href="#RFC2119" id="rfc.xref.RFC2119.1"><cite title="Key words for use in RFCs to Indicate Requirement Levels">[RFC2119]</cite></a>.
</p>
</div>
<div id="rfc.section.1.1.p.2">
<p>Conformance criteria and considerations regarding error handling are defined in <a href="draft-fielding-httpbis-http-messaging-latest.html#conformance" title="Conformance and Error Handling">Section 2.5</a> of <a href="#MESSGNG" id="rfc.xref.MESSGNG.2"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[MESSGNG]</cite></a>.
</p>
</div>
</section>
<section id="notation">
<h3 id="rfc.section.1.2"><a href="#rfc.section.1.2">1.2.</a> <a href="#notation">Syntax Notation</a></h3>
<div id="rfc.section.1.2.p.1">
<p>This specification uses the Augmented Backus-Naur Form (ABNF) notation of <a href="#RFC5234" id="rfc.xref.RFC5234.1"><cite title="Augmented BNF for Syntax Specifications: ABNF">[RFC5234]</cite></a> with a list extension, defined in <a href="draft-fielding-httpbis-http-messaging-latest.html#abnf.extension" title="ABNF List Extension: #rule">Section 7</a> of <a href="#MESSGNG" id="rfc.xref.MESSGNG.3"><cite title="Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing">[MESSGNG]</cite></a>, that allows for compact definition of comma-separated lists using a '#' operator
(similar to how the '*' operator indicates repetition). <a href="#imported.abnf" title="Imported ABNF">Appendix B</a> describes rules imported from other documents. <a href="#collected.abnf" title="Collected ABNF">Appendix C</a> shows the collected grammar with all list operators expanded to standard ABNF notation.
</p>
</div>
</section>
</section>
<section id="validators">
<h2 id="rfc.section.2"><a href="#rfc.section.2">2.</a> <a href="#validators">Validators</a></h2>
<div id="rfc.section.2.p.1">
<p>This specification defines two forms of metadata that are commonly used to observe
resource state and test for preconditions: modification dates (<a href="#header.last-modified" id="rfc.xref.header.last-modified.1" title="Last-Modified">Section 2.2</a>) and opaque entity tags (<a href="#header.etag" id="rfc.xref.header.etag.1" title="ETag">Section 2.3</a>). Additional metadata that reflects resource state has been defined by various extensions
of HTTP, such as Web Distributed Authoring and Versioning (WebDAV, <a href="#RFC4918" id="rfc.xref.RFC4918.1"><cite title="HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)">[RFC4918]</cite></a>), that are beyond the scope of this specification. A resource metadata value is referred
to as a "<dfn>validator</dfn>" when it is used within a precondition.
</p>
</div>
<section id="weak.and.strong.validators">
<h3 id="rfc.section.2.1"><a href="#rfc.section.2.1">2.1.</a> <a href="#weak.and.strong.validators">Weak versus Strong</a></h3>
<div id="rfc.section.2.1.p.1">
<p>Validators come in two flavors: strong or weak. Weak validators are easy to generate
but are far less useful for comparisons. Strong validators are ideal for comparisons
but can be very difficult (and occasionally impossible) to generate efficiently. Rather
than impose that all forms of resource adhere to the same strength of validator, HTTP
exposes the type of validator in use and imposes restrictions on when weak validators
can be used as preconditions.
</p>
</div>
<div id="rfc.section.2.1.p.2">
<p>A "strong validator" is representation metadata that changes value whenever a change
occurs to the representation data that would be observable in the payload body of
a <a href="draft-fielding-httpbis-http-semantics-latest.html#status.200" class="smpl">200 (OK)</a> response to GET.
</p>
</div>
<div id="rfc.section.2.1.p.3">
<p>A strong validator might change for reasons other than a change to the representation
data, such as when a semantically significant part of the representation metadata
is changed (e.g., <a href="draft-fielding-httpbis-http-semantics-latest.html#header.content-type" class="smpl">Content-Type</a>), but it is in the best interests of the origin server to only change the value when
it is necessary to invalidate the stored responses held by remote caches and authoring
tools.
</p>
</div>
<div id="rfc.section.2.1.p.4">
<p>Cache entries might persist for arbitrarily long periods, regardless of expiration
times. Thus, a cache might attempt to validate an entry using a validator that it
obtained in the distant past. A strong validator is unique across all versions of
all representations associated with a particular resource over time. However, there
is no implication of uniqueness across representations of different resources (i.e.,
the same strong validator might be in use for representations of multiple resources
at the same time and does not imply that those representations are equivalent).
</p>
</div>
<div id="rfc.section.2.1.p.5">
<p>There are a variety of strong validators used in practice. The best are based on strict
revision control, wherein each change to a representation always results in a unique
node name and revision identifier being assigned before the representation is made
accessible to GET. A collision-resistant hash function applied to the representation
data is also sufficient if the data is available prior to the response header fields
being sent and the digest does not need to be recalculated every time a validation
request is received. However, if a resource has distinct representations that differ
only in their metadata, such as might occur with content negotiation over media types
that happen to share the same data format, then the origin server needs to incorporate
additional information in the validator to distinguish those representations.
</p>
</div>
<div id="rfc.section.2.1.p.6">
<p>In contrast, a "weak validator" is representation metadata that might not change for
every change to the representation data. This weakness might be due to limitations
in how the value is calculated, such as clock resolution, an inability to ensure uniqueness
for all possible representations of the resource, or a desire of the resource owner
to group representations by some self-determined set of equivalency rather than unique
sequences of data. An origin server <em class="bcp14">SHOULD</em> change a weak entity-tag whenever it considers prior representations to be unacceptable
as a substitute for the current representation. In other words, a weak entity-tag
ought to change whenever the origin server wants caches to invalidate old responses.
</p>
</div>
<div id="rfc.section.2.1.p.7">
<p>For example, the representation of a weather report that changes in content every
second, based on dynamic measurements, might be grouped into sets of equivalent representations
(from the origin server's perspective) with the same weak validator in order to allow
cached representations to be valid for a reasonable period of time (perhaps adjusted
dynamically based on server load or weather quality). Likewise, a representation's
modification time, if defined with only one-second resolution, might be a weak validator
if it is possible for the representation to be modified twice during a single second
and retrieved between those modifications.
</p>
</div>
<div id="rfc.section.2.1.p.8">
<p>Likewise, a validator is weak if it is shared by two or more representations of a
given resource at the same time, unless those representations have identical representation
data. For example, if the origin server sends the same validator for a representation
with a gzip content coding applied as it does for a representation with no content
coding, then that validator is weak. However, two simultaneous representations might
share the same strong validator if they differ only in the representation metadata,
such as when two different media types are available for the same representation data.
</p>
</div>
<div id="rfc.section.2.1.p.9">
<p>Strong validators are usable for all conditional requests, including cache validation,
partial content ranges, and "lost update" avoidance. Weak validators are only usable
when the client does not require exact equality with previously obtained representation
data, such as when validating a cache entry or limiting a web traversal to recent
changes.
</p>
</div>
</section>
<section id="header.last-modified">
<h3 id="rfc.section.2.2"><a href="#rfc.section.2.2">2.2.</a> <a href="#header.last-modified">Last-Modified</a></h3>
<div id="rfc.section.2.2.p.1">
<p>The "Last-Modified" header field in a response provides a timestamp indicating the
date and time at which the origin server believes the selected representation was
last modified, as determined at the conclusion of handling the request.
</p>
</div>
<div id="rfc.figure.u.1"><pre class="inline"><span id="rfc.iref.g.1"></span> <a href="#header.last-modified" class="smpl">Last-Modified</a> = <a href="#imported.abnf" class="smpl">HTTP-date</a>
</pre></div>
<div id="rfc.section.2.2.p.2">
<p>An example of its use is</p>
</div>
<div id="rfc.figure.u.2"><pre class="text"> Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
</pre></div>
<section id="lastmod.generation">
<h4 id="rfc.section.2.2.1"><a href="#rfc.section.2.2.1">2.2.1.</a> <a href="#lastmod.generation">Generation</a></h4>
<div id="rfc.section.2.2.1.p.1">
<p>An origin server <em class="bcp14">SHOULD</em> send Last-Modified for any selected representation for which a last modification date
can be reasonably and consistently determined, since its use in conditional requests
and evaluating cache freshness (<a href="#CACHING" id="rfc.xref.CACHING.2"><cite title="Hypertext Transfer Protocol (HTTP): Caching">[CACHING]</cite></a>) results in a substantial reduction of HTTP traffic on the Internet and can be a
significant factor in improving service scalability and reliability.
</p>
</div>
<div id="rfc.section.2.2.1.p.2">
<p>A representation is typically the sum of many parts behind the resource interface.
The last-modified time would usually be the most recent time that any of those parts
were changed. How that value is determined for any given resource is an implementation
detail beyond the scope of this specification. What matters to HTTP is how recipients
of the Last-Modified header field can use its value to make conditional requests and
test the validity of locally cached responses.
</p>
</div>
<div id="rfc.section.2.2.1.p.3">
<p>An origin server <em class="bcp14">SHOULD</em> obtain the Last-Modified value of the representation as close as possible to the time
that it generates the <a href="draft-fielding-httpbis-http-semantics-latest.html#header.date" class="smpl">Date</a> field value for its response. This allows a recipient to make an accurate assessment
of the representation's modification time, especially if the representation changes
near the time that the response is generated.
</p>
</div>
<div id="rfc.section.2.2.1.p.4">
<p>An origin server with a clock <em class="bcp14">MUST NOT</em> send a Last-Modified date that is later than the server's time of message origination
(<a href="draft-fielding-httpbis-http-semantics-latest.html#header.date" class="smpl">Date</a>). If the last modification time is derived from implementation-specific metadata
that evaluates to some time in the future, according to the origin server's clock,
then the origin server <em class="bcp14">MUST</em> replace that value with the message origination date. This prevents a future modification
date from having an adverse impact on cache validation.
</p>
</div>
<div id="rfc.section.2.2.1.p.5">
<p>An origin server without a clock <em class="bcp14">MUST NOT</em> assign Last-Modified values to a response unless these values were associated with
the resource by some other system or user with a reliable clock.
</p>
</div>
</section>
<section id="lastmod.comparison">
<h4 id="rfc.section.2.2.2"><a href="#rfc.section.2.2.2">2.2.2.</a> <a href="#lastmod.comparison">Comparison</a></h4>
<div id="rfc.section.2.2.2.p.1">
<p>A Last-Modified time, when used as a validator in a request, is implicitly weak unless
it is possible to deduce that it is strong, using the following rules:
</p>
<ul>
<li>The validator is being compared by an origin server to the actual current validator
for the representation and,
</li>
<li>That origin server reliably knows that the associated representation did not change