/
draft-ietf-quic-qpack.html
1989 lines (1908 loc) · 101 KB
/
draft-ietf-quic-qpack.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 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>QPACK: Header Compression for HTTP/3</title>
<style type="text/css">/*<![CDATA[*/
body {
font: 16px "Helvetica Neue","Open Sans",Helvetica,Calibri,sans-serif;
color: #333;
font-size-adjust: 0.5;
line-height: 24px;
margin: 75px auto;
max-width: 624px;
padding: 0 5px;
}
.title, .filename, h1, h2, h3, h4, h5 {
font: 16px "Roboto Condensed","Helvetica Neue","Open Sans",Helvetica,Calibri,sans-serif;
font-size-adjust: 0.5;
font-weight: bold;
color: #333;
line-height: 100%;
margin: 1.2em 0 0.3em;
}
.title, #rfc\.title h1 { font-size: 32px; }
h1, section h1, h2, section h2, section h3, nav h2 { font-size: 20px; }
h3, section h4, h4, section h5 { font-size: 16px; }
h1 a[href], h2 a[href], h3 a[href], h4 a[href] {
color: #333;
}
table {
margin-left: 0em;
border-collapse: collapse;
}
th {
text-align: left;
border-bottom: 2px solid #ddd;
}
td {
border-top: 1px solid #ddd;
vertical-align: top;
}
tr:nth-child(2n+1) > td,
tr:nth-child(2n+1) > th {
background-color: #f9f9f9;
}
td.reference {
max-width: 200px;
border-top: none;
padding-right: 1em;
}
.right {
text-align: right;
}
table.header, table#rfc\.headerblock {
width: 100%;
}
table.header td, table#rfc\.headerblock td {
border: none;
background-color: transparent;
color: black;
padding: 0;
}
.filename {
display: block;
color: rgb(119, 119, 119);
font-size: 20px;
font-weight: normal;
line-height: 100%;
margin: 10px 0 32px;
}
#rfc\.abstract+p, #rfc\.abstract+p code, #rfc\.abstract+p samp, #rfc\.abstract+p tt {
font-size: 20px;
line-height: 28px;
}
samp, tt, code, pre, span.tt {
font-size: 13.5px;
font-family: Consolas, monospace;
font-size-adjust: none;
}
pre {
background-color: #eee;
border: 1px solid #ddd;
overflow-x: auto;
padding: 5px;
margin: 5px;
}
.figure, caption {
font-style: italic;
margin: 0 1.5em;
text-align: left;
}
address {
margin: 16px 2px;
line-height: 20px;
}
.vcard {
font-style: normal;
}
.vcardline {
display: block;
}
.vcardline .fn, address b {
font-weight: normal;
}
.vcardline .hidden {
display: none;
}
dl {
margin-left: 1em;
}
dl.dl-horizontal: {
margin-left: 0;
}
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;
margin-bottom: 0em;
}
ul.empty {
list-style-type: none;
}
ul.empty li {
margin-top: .5em;
}
hr {
border: 0;
border-top: 1px solid #eee;
}
hr.noprint {
display: none;
}
a {
text-decoration: none;
}
a[href] {
color: #2a6496;
}
a[href]:hover {
background-color: #eee;
}
p, ol, ul, li {
padding: 0;
}
p {
margin: 0.5em 0;
}
ol, ul {
margin: 0.2em 0 0.2em 2em;
}
li {
margin: 0.2em 0;
}
address {
font-style: normal;
}
ul.toc ul {
margin: 0 0 0 2em;
}
ul.toc li {
list-style: none;
margin: 0;
}
@media screen and (min-width: 924px) {
body {
padding-right: 350px;
}
body>ul.toc, body>#rfc\.toc {
position: fixed;
bottom: 0;
right: 0;
right: calc(50vw - 500px);
width: 300px;
z-index: 1;
overflow: auto;
overscroll-behavior: contain;
}
body>#rfc\.toc {
top: 55px;
}
body>ul.toc {
top: 100px;
}
ul.toc {
margin: 0 0 0 4px;
font-size: 12px;
line-height: 20px;
}
ul.toc ul {
margin-left: 1.2em;
}
}
.github-fork-ribbon-wrapper {
display: none;
}
@media screen and (min-width: 800px) {
/* "Fork me on GitHub" CSS ribbon based on
* https://github.com/simonwhitaker/github-fork-ribbon-css
*/
.github-fork-ribbon {
position: absolute;
padding: 2px 0;
background-color: #a00;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
font: 700 12px "Helvetica Neue", Helvetica, Arial, sans-serif;
pointer-events: auto;
top: 38px;
right: -45px;
transform: rotate(45deg);
}
.github-fork-ribbon a[href],
.github-fork-ribbon a[href]:hover {
color: #fff;
background-color: transparent;
text-decoration: none;
text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
text-align: center;
width: 190px;
line-height: 18px;
display: inline-block;
padding: 2px 0;
border: 1.5px dotted #fff;
border-color: rgba(255, 255, 255, 0.6);
}
.github-fork-ribbon-wrapper {
display: block;
width: 130px;
height: 130px;
position: absolute;
overflow: hidden;
top: 0; right: 0;
z-index: 2;
pointer-events: none;
}
}
@media screen and (min-width: 1000px) {
.github-fork-ribbon-wrapper {
position: fixed;
}
/*]]>*/</style>
<meta name="viewport" content="initial-scale=1.0">
<link href="#rfc.toc" rel="Contents">
<link href="#rfc.section.1" rel="Chapter" title="1 Introduction">
<link href="#rfc.section.1.1" rel="Chapter" title="1.1 Conventions and Definitions">
<link href="#rfc.section.1.2" rel="Chapter" title="1.2 Notational Conventions">
<link href="#rfc.section.2" rel="Chapter" title="2 Compression Process Overview">
<link href="#rfc.section.2.1" rel="Chapter" title="2.1 Encoder">
<link href="#rfc.section.2.1.1" rel="Chapter" title="2.1.1 Reference Tracking">
<link href="#rfc.section.2.1.2" rel="Chapter" title="2.1.2 Blocked Dynamic Table Insertions">
<link href="#rfc.section.2.1.3" rel="Chapter" title="2.1.3 Avoiding Head-of-Line Blocking">
<link href="#rfc.section.2.1.4" rel="Chapter" title="2.1.4 Known Received Count">
<link href="#rfc.section.2.2" rel="Chapter" title="2.2 Decoder">
<link href="#rfc.section.2.2.1" rel="Chapter" title="2.2.1 State Synchronization">
<link href="#rfc.section.2.2.2" rel="Chapter" title="2.2.2 Blocked Decoding">
<link href="#rfc.section.3" rel="Chapter" title="3 Header Tables">
<link href="#rfc.section.3.1" rel="Chapter" title="3.1 Static Table">
<link href="#rfc.section.3.2" rel="Chapter" title="3.2 Dynamic Table">
<link href="#rfc.section.3.2.1" rel="Chapter" title="3.2.1 Dynamic Table Size">
<link href="#rfc.section.3.2.2" rel="Chapter" title="3.2.2 Dynamic Table Capacity and Eviction">
<link href="#rfc.section.3.2.3" rel="Chapter" title="3.2.3 Maximum Dynamic Table Capacity">
<link href="#rfc.section.3.2.4" rel="Chapter" title="3.2.4 Absolute Indexing">
<link href="#rfc.section.3.2.5" rel="Chapter" title="3.2.5 Relative Indexing">
<link href="#rfc.section.3.2.6" rel="Chapter" title="3.2.6 Post-Base Indexing">
<link href="#rfc.section.3.2.7" rel="Chapter" title="3.2.7 Invalid References">
<link href="#rfc.section.4" rel="Chapter" title="4 Wire Format">
<link href="#rfc.section.4.1" rel="Chapter" title="4.1 Primitives">
<link href="#rfc.section.4.1.1" rel="Chapter" title="4.1.1 Prefixed Integers">
<link href="#rfc.section.4.1.2" rel="Chapter" title="4.1.2 String Literals">
<link href="#rfc.section.4.2" rel="Chapter" title="4.2 Instructions">
<link href="#rfc.section.4.2.1" rel="Chapter" title="4.2.1 Encoder and Decoder Streams">
<link href="#rfc.section.4.3" rel="Chapter" title="4.3 Encoder Instructions">
<link href="#rfc.section.4.3.1" rel="Chapter" title="4.3.1 Insert With Name Reference">
<link href="#rfc.section.4.3.2" rel="Chapter" title="4.3.2 Insert Without Name Reference">
<link href="#rfc.section.4.3.3" rel="Chapter" title="4.3.3 Duplicate">
<link href="#rfc.section.4.3.4" rel="Chapter" title="4.3.4 Set Dynamic Table Capacity">
<link href="#rfc.section.4.4" rel="Chapter" title="4.4 Decoder Instructions">
<link href="#rfc.section.4.4.1" rel="Chapter" title="4.4.1 Insert Count Increment">
<link href="#rfc.section.4.4.2" rel="Chapter" title="4.4.2 Header Acknowledgement">
<link href="#rfc.section.4.4.3" rel="Chapter" title="4.4.3 Stream Cancellation">
<link href="#rfc.section.4.5" rel="Chapter" title="4.5 Header Block Instructions">
<link href="#rfc.section.4.5.1" rel="Chapter" title="4.5.1 Header Block Prefix">
<link href="#rfc.section.4.5.2" rel="Chapter" title="4.5.2 Indexed Header Field">
<link href="#rfc.section.4.5.3" rel="Chapter" title="4.5.3 Indexed Header Field With Post-Base Index">
<link href="#rfc.section.4.5.4" rel="Chapter" title="4.5.4 Literal Header Field With Name Reference">
<link href="#rfc.section.4.5.5" rel="Chapter" title="4.5.5 Literal Header Field With Post-Base Name Reference">
<link href="#rfc.section.4.5.6" rel="Chapter" title="4.5.6 Literal Header Field Without Name Reference">
<link href="#rfc.section.5" rel="Chapter" title="5 Configuration">
<link href="#rfc.section.6" rel="Chapter" title="6 Error Handling">
<link href="#rfc.section.7" rel="Chapter" title="7 Security Considerations">
<link href="#rfc.section.8" rel="Chapter" title="8 IANA Considerations">
<link href="#rfc.section.8.1" rel="Chapter" title="8.1 Settings Registration">
<link href="#rfc.section.8.2" rel="Chapter" title="8.2 Stream Type Registration">
<link href="#rfc.section.8.3" rel="Chapter" title="8.3 Error Code Registration">
<link href="#rfc.references" rel="Chapter" title="9 References">
<link href="#rfc.references.1" rel="Chapter" title="9.1 Normative References">
<link href="#rfc.references.2" rel="Chapter" title="9.2 Informative References">
<link href="#rfc.appendix.A" rel="Chapter" title="A Static Table">
<link href="#rfc.appendix.B" rel="Chapter" title="B Sample One Pass Encoding Algorithm">
<link href="#rfc.appendix.C" rel="Chapter" title="C Change Log">
<link href="#rfc.appendix.C.1" rel="Chapter" title="C.1 Since draft-ietf-quic-qpack-06">
<link href="#rfc.appendix.C.2" rel="Chapter" title="C.2 Since draft-ietf-quic-qpack-05">
<link href="#rfc.appendix.C.3" rel="Chapter" title="C.3 Since draft-ietf-quic-qpack-04">
<link href="#rfc.appendix.C.4" rel="Chapter" title="C.4 Since draft-ietf-quic-qpack-03">
<link href="#rfc.appendix.C.5" rel="Chapter" title="C.5 Since draft-ietf-quic-qpack-02">
<link href="#rfc.appendix.C.6" rel="Chapter" title="C.6 Since draft-ietf-quic-qpack-01">
<link href="#rfc.appendix.C.7" rel="Chapter" title="C.7 Since draft-ietf-quic-qpack-00">
<link href="#rfc.appendix.C.8" rel="Chapter" title="C.8 Since draft-ietf-quic-qcram-00">
<link href="#rfc.acknowledgments" rel="Chapter">
<link href="#rfc.authors" rel="Chapter">
<meta name="generator" content="xml2rfc version 2.22.2 - https://tools.ietf.org/tools/xml2rfc" />
<link rel="schema.dct" href="http://purl.org/dc/terms/" />
<meta name="dct.creator" content="Krasic, C., Bishop, M., and A. Frindell, Ed." />
<meta name="dct.identifier" content="urn:ietf:id:draft-ietf-quic-qpack-latest" />
<meta name="dct.issued" scheme="ISO8601" content="2019-06-21" />
<meta name="dct.abstract" content="This specification defines QPACK, a compression format for efficiently representing HTTP header fields, to be used in HTTP/3. This is a variation of HPACK header compression that seeks to reduce head-of-line blocking." />
<meta name="description" content="This specification defines QPACK, a compression format for efficiently representing HTTP header fields, to be used in HTTP/3. This is a variation of HPACK header compression that seeks to reduce head-of-line blocking." />
</head>
<body>
<table class="header">
<tbody>
<tr>
<td class="left">QUIC</td>
<td class="right">C. Krasic</td>
</tr>
<tr>
<td class="left">Internet-Draft</td>
<td class="right">Netflix</td>
</tr>
<tr>
<td class="left">Intended status: Standards Track</td>
<td class="right">M. Bishop</td>
</tr>
<tr>
<td class="left">Expires: December 23, 2019</td>
<td class="right">Akamai Technologies</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">A. Frindell, Ed.</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">Facebook</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">June 21, 2019</td>
</tr>
</tbody>
</table>
<p class="title">QPACK: Header Compression for HTTP/3<br />
<span class="filename">draft-ietf-quic-qpack-latest</span></p>
<h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1>
<p>This specification defines QPACK, a compression format for efficiently representing HTTP header fields, to be used in HTTP/3. This is a variation of HPACK header compression that seeks to reduce head-of-line blocking.</p>
<h1><a>Note to Readers</a></h1>
<p>Discussion of this draft takes place on the QUIC working group mailing list (quic@ietf.org), which is archived at <a href="https://mailarchive.ietf.org/arch/search/?email_list=quic">https://mailarchive.ietf.org/arch/search/?email_list=quic</a>.</p>
<p>Working Group information can be found at <a href="https://github.com/quicwg">https://github.com/quicwg</a>; source code and issues list for this draft can be found at <a href="https://github.com/quicwg/base-drafts/labels/-qpack">https://github.com/quicwg/base-drafts/labels/-qpack</a>.</p>
<h1 id="rfc.status"><a href="#rfc.status">Status of This Memo</a></h1>
<p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p>
<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 https://datatracker.ietf.org/drafts/current/.</p>
<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>
<p>This Internet-Draft will expire on December 23, 2019.</p>
<h1 id="rfc.copyrightnotice"><a href="#rfc.copyrightnotice">Copyright Notice</a></h1>
<p>Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.</p>
<p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) 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>
<hr class="noprint" />
<h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
<ul class="toc">
<li>1. <a href="#rfc.section.1">Introduction</a>
</li>
<ul><li>1.1. <a href="#rfc.section.1.1">Conventions and Definitions</a>
</li>
<li>1.2. <a href="#rfc.section.1.2">Notational Conventions</a>
</li>
</ul><li>2. <a href="#rfc.section.2">Compression Process Overview</a>
</li>
<ul><li>2.1. <a href="#rfc.section.2.1">Encoder</a>
</li>
<ul><li>2.1.1. <a href="#rfc.section.2.1.1">Reference Tracking</a>
</li>
<li>2.1.2. <a href="#rfc.section.2.1.2">Blocked Dynamic Table Insertions</a>
</li>
<li>2.1.3. <a href="#rfc.section.2.1.3">Avoiding Head-of-Line Blocking</a>
</li>
<li>2.1.4. <a href="#rfc.section.2.1.4">Known Received Count</a>
</li>
</ul><li>2.2. <a href="#rfc.section.2.2">Decoder</a>
</li>
<ul><li>2.2.1. <a href="#rfc.section.2.2.1">State Synchronization</a>
</li>
<li>2.2.2. <a href="#rfc.section.2.2.2">Blocked Decoding</a>
</li>
</ul></ul><li>3. <a href="#rfc.section.3">Header Tables</a>
</li>
<ul><li>3.1. <a href="#rfc.section.3.1">Static Table</a>
</li>
<li>3.2. <a href="#rfc.section.3.2">Dynamic Table</a>
</li>
<ul><li>3.2.1. <a href="#rfc.section.3.2.1">Dynamic Table Size</a>
</li>
<li>3.2.2. <a href="#rfc.section.3.2.2">Dynamic Table Capacity and Eviction</a>
</li>
<li>3.2.3. <a href="#rfc.section.3.2.3">Maximum Dynamic Table Capacity</a>
</li>
<li>3.2.4. <a href="#rfc.section.3.2.4">Absolute Indexing</a>
</li>
<li>3.2.5. <a href="#rfc.section.3.2.5">Relative Indexing</a>
</li>
<li>3.2.6. <a href="#rfc.section.3.2.6">Post-Base Indexing</a>
</li>
<li>3.2.7. <a href="#rfc.section.3.2.7">Invalid References</a>
</li>
</ul></ul><li>4. <a href="#rfc.section.4">Wire Format</a>
</li>
<ul><li>4.1. <a href="#rfc.section.4.1">Primitives</a>
</li>
<ul><li>4.1.1. <a href="#rfc.section.4.1.1">Prefixed Integers</a>
</li>
<li>4.1.2. <a href="#rfc.section.4.1.2">String Literals</a>
</li>
</ul><li>4.2. <a href="#rfc.section.4.2">Instructions</a>
</li>
<ul><li>4.2.1. <a href="#rfc.section.4.2.1">Encoder and Decoder Streams</a>
</li>
</ul><li>4.3. <a href="#rfc.section.4.3">Encoder Instructions</a>
</li>
<ul><li>4.3.1. <a href="#rfc.section.4.3.1">Insert With Name Reference</a>
</li>
<li>4.3.2. <a href="#rfc.section.4.3.2">Insert Without Name Reference</a>
</li>
<li>4.3.3. <a href="#rfc.section.4.3.3">Duplicate</a>
</li>
<li>4.3.4. <a href="#rfc.section.4.3.4">Set Dynamic Table Capacity</a>
</li>
</ul><li>4.4. <a href="#rfc.section.4.4">Decoder Instructions</a>
</li>
<ul><li>4.4.1. <a href="#rfc.section.4.4.1">Insert Count Increment</a>
</li>
<li>4.4.2. <a href="#rfc.section.4.4.2">Header Acknowledgement</a>
</li>
<li>4.4.3. <a href="#rfc.section.4.4.3">Stream Cancellation</a>
</li>
</ul><li>4.5. <a href="#rfc.section.4.5">Header Block Instructions</a>
</li>
<ul><li>4.5.1. <a href="#rfc.section.4.5.1">Header Block Prefix</a>
</li>
<li>4.5.2. <a href="#rfc.section.4.5.2">Indexed Header Field</a>
</li>
<li>4.5.3. <a href="#rfc.section.4.5.3">Indexed Header Field With Post-Base Index</a>
</li>
<li>4.5.4. <a href="#rfc.section.4.5.4">Literal Header Field With Name Reference</a>
</li>
<li>4.5.5. <a href="#rfc.section.4.5.5">Literal Header Field With Post-Base Name Reference</a>
</li>
<li>4.5.6. <a href="#rfc.section.4.5.6">Literal Header Field Without Name Reference</a>
</li>
</ul></ul><li>5. <a href="#rfc.section.5">Configuration</a>
</li>
<li>6. <a href="#rfc.section.6">Error Handling</a>
</li>
<li>7. <a href="#rfc.section.7">Security Considerations</a>
</li>
<li>8. <a href="#rfc.section.8">IANA Considerations</a>
</li>
<ul><li>8.1. <a href="#rfc.section.8.1">Settings Registration</a>
</li>
<li>8.2. <a href="#rfc.section.8.2">Stream Type Registration</a>
</li>
<li>8.3. <a href="#rfc.section.8.3">Error Code Registration</a>
</li>
</ul><li>9. <a href="#rfc.references">References</a>
</li>
<ul><li>9.1. <a href="#rfc.references.1">Normative References</a>
</li>
<li>9.2. <a href="#rfc.references.2">Informative References</a>
</li>
</ul><li>Appendix A. <a href="#rfc.appendix.A">Static Table</a>
</li>
<li>Appendix B. <a href="#rfc.appendix.B">Sample One Pass Encoding Algorithm</a>
</li>
<li>Appendix C. <a href="#rfc.appendix.C">Change Log</a>
</li>
<ul><li>C.1. <a href="#rfc.appendix.C.1">Since draft-ietf-quic-qpack-06</a>
</li>
<li>C.2. <a href="#rfc.appendix.C.2">Since draft-ietf-quic-qpack-05</a>
</li>
<li>C.3. <a href="#rfc.appendix.C.3">Since draft-ietf-quic-qpack-04</a>
</li>
<li>C.4. <a href="#rfc.appendix.C.4">Since draft-ietf-quic-qpack-03</a>
</li>
<li>C.5. <a href="#rfc.appendix.C.5">Since draft-ietf-quic-qpack-02</a>
</li>
<li>C.6. <a href="#rfc.appendix.C.6">Since draft-ietf-quic-qpack-01</a>
</li>
<li>C.7. <a href="#rfc.appendix.C.7">Since draft-ietf-quic-qpack-00</a>
</li>
<li>C.8. <a href="#rfc.appendix.C.8">Since draft-ietf-quic-qcram-00</a>
</li>
</ul><li><a href="#rfc.acknowledgments">Acknowledgments</a>
</li>
<li><a href="#rfc.authors">Authors' Addresses</a>
</li>
</ul>
<h1 id="rfc.section.1">
<a href="#rfc.section.1">1.</a> <a href="#introduction" id="introduction">Introduction</a>
</h1>
<p id="rfc.section.1.p.1">The QUIC transport protocol was designed from the outset to support HTTP semantics, and its design subsumes many of the features of HTTP/2. HTTP/2 uses HPACK (<a href="#RFC7541" class="xref">[RFC7541]</a>) for header compression, but QUIC’s stream multiplexing comes into some conflict with HPACK. A key goal of the design of QUIC is to improve stream multiplexing relative to HTTP/2 by reducing head-of-line blocking. If HPACK were used for HTTP/3, it would induce head-of-line blocking due to built-in assumptions of a total ordering across frames on all streams.</p>
<p id="rfc.section.1.p.2">QUIC is described in <a href="#QUIC-TRANSPORT" class="xref">[QUIC-TRANSPORT]</a>. The HTTP/3 mapping is described in <a href="#HTTP3" class="xref">[HTTP3]</a>. For a full description of HTTP/2, see <a href="#RFC7540" class="xref">[RFC7540]</a>. The description of HPACK is <a href="#RFC7541" class="xref">[RFC7541]</a>.</p>
<p id="rfc.section.1.p.3">QPACK reuses core concepts from HPACK, but is redesigned to allow correctness in the presence of out-of-order delivery, with flexibility for implementations to balance between resilience against head-of-line blocking and optimal compression ratio. The design goals are to closely approach the compression ratio of HPACK with substantially less head-of-line blocking under the same loss conditions.</p>
<h2 id="rfc.section.1.1">
<a href="#rfc.section.1.1">1.1.</a> <a href="#conventions-and-definitions" id="conventions-and-definitions">Conventions and Definitions</a>
</h2>
<p id="rfc.section.1.1.p.1">The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 <a href="#RFC2119" class="xref">[RFC2119]</a> <a href="#RFC8174" class="xref">[RFC8174]</a> when, and only when, they appear in all capitals, as shown here.</p>
<p id="rfc.section.1.1.p.2">Definitions of terms that are used in this document:</p>
<p></p>
<dl>
<dt>Header field:</dt>
<dd style="margin-left: 8">A name-value pair sent as part of an HTTP message.</dd>
<dt>Header list:</dt>
<dd style="margin-left: 8">An ordered collection of header fields associated with an HTTP message. A header list can contain multiple header fields with the same name. It can also contain duplicate header fields.</dd>
<dt>Header block:</dt>
<dd style="margin-left: 8">The compressed representation of a header list.</dd>
<dt>Encoder:</dt>
<dd style="margin-left: 8">An implementation which transforms a header list into a header block.</dd>
<dt>Decoder:</dt>
<dd style="margin-left: 8">An implementation which transforms a header block into a header list.</dd>
<dt>Absolute Index:</dt>
<dd style="margin-left: 8">A unique index for each entry in the dynamic table.</dd>
<dt>Base:</dt>
<dd style="margin-left: 8">A reference point for relative indices. Dynamic references are made relative to a Base in header blocks.</dd>
<dt>Insert Count:</dt>
<dd style="margin-left: 8">The total number of entries inserted in the dynamic table.</dd>
</dl>
<p id="rfc.section.1.1.p.4">QPACK is a name, not an acronym.</p>
<h2 id="rfc.section.1.2">
<a href="#rfc.section.1.2">1.2.</a> <a href="#notational-conventions" id="notational-conventions">Notational Conventions</a>
</h2>
<p id="rfc.section.1.2.p.1">Diagrams use the format described in Section 3.1 of <a href="#RFC2360" class="xref">[RFC2360]</a>, with the following additional conventions:</p>
<p></p>
<dl>
<dt>x (A)</dt>
<dd style="margin-left: 8">Indicates that x is A bits long</dd>
<dt>x (A+)</dt>
<dd style="margin-left: 8">Indicates that x uses the prefixed integer encoding defined in Section 5.1 of <a href="#RFC7541" class="xref">[RFC7541]</a>, beginning with an A-bit prefix.</dd>
<dt>x …</dt>
<dd style="margin-left: 8">Indicates that x is variable-length and extends to the end of the region.</dd>
</dl>
<h1 id="rfc.section.2">
<a href="#rfc.section.2">2.</a> <a href="#compression-process-overview" id="compression-process-overview">Compression Process Overview</a>
</h1>
<p id="rfc.section.2.p.1">Like HPACK, QPACK uses two tables for associating header fields to indices. The static table (see <a href="#table-static" class="xref">Section 3.1</a>) is predefined and contains common header fields (some of them with an empty value). The dynamic table (see <a href="#table-dynamic" class="xref">Section 3.2</a>) is built up over the course of the connection and can be used by the encoder to index header fields in the encoded header lists.</p>
<p id="rfc.section.2.p.2">QPACK instructions appear in three different types of streams:</p>
<p></p>
<ul>
<li>The encoder uses a unidirectional stream to modify the state of the dynamic table without emitting header fields associated with any particular request.</li>
<li>HEADERS and PUSH_PROMISE frames on request and push streams reference the table state without modifying it.</li>
<li>The decoder sends feedback to the encoder on a unidirectional stream. This feedback enables the encoder to manage dynamic table state.</li>
</ul>
<h2 id="rfc.section.2.1">
<a href="#rfc.section.2.1">2.1.</a> <a href="#encoder" id="encoder">Encoder</a>
</h2>
<p id="rfc.section.2.1.p.1">An encoder compresses a header list by emitting either an indexed or a literal representation for each header field in the list. References to the static table and literal representations do not require any dynamic state and never risk head-of-line blocking. References to the dynamic table risk head-of-line blocking if the encoder has not received an acknowledgement indicating the entry is available at the decoder.</p>
<p id="rfc.section.2.1.p.2">An encoder MAY insert any entry in the dynamic table it chooses; it is not limited to header fields it is compressing.</p>
<p id="rfc.section.2.1.p.3">QPACK preserves the ordering of header fields within each header list. An encoder MUST emit header field representations in the order they appear in the input header list.</p>
<p id="rfc.section.2.1.p.4">QPACK is designed to contain the more complex state tracking to the encoder, while the decoder is relatively simple.</p>
<h3 id="rfc.section.2.1.1">
<a href="#rfc.section.2.1.1">2.1.1.</a> <a href="#reference-tracking" id="reference-tracking">Reference Tracking</a>
</h3>
<p id="rfc.section.2.1.1.p.1">An encoder MUST ensure that a header block which references a dynamic table entry is not received by the decoder after the referenced entry has been evicted. Hence the encoder needs to track information about each compressed header block that references the dynamic table until that header block is acknowledged by the decoder.</p>
<h3 id="rfc.section.2.1.2">
<a href="#rfc.section.2.1.2">2.1.2.</a> <a href="#blocked-insertion" id="blocked-insertion">Blocked Dynamic Table Insertions</a>
</h3>
<p id="rfc.section.2.1.2.p.1">A dynamic table entry is considered blocking and cannot be evicted until its insertion has been acknowledged and there are no outstanding unacknowledged references to the entry. In particular, a dynamic table entry that has never been referenced can still be blocking.</p>
<p></p>
<dl>
<dt>Note:</dt>
<dd style="margin-left: 8">A blocking entry is unrelated to a blocked stream, which is a stream that a decoder cannot decode as a result of references to entries that are not yet available. Any encoder that uses the dynamic table has to keep track of blocked entries, whereas blocked streams are optional.</dd>
</dl>
<p id="rfc.section.2.1.2.p.3">An encoder MUST NOT insert an entry into the dynamic table (or duplicate an existing entry) if doing so would evict a blocking entry. In this case, the encoder can send literal representations of header fields.</p>
<p id="rfc.section.2.1.2.p.4">To ensure that the encoder is not prevented from adding new entries, the encoder can avoid referencing entries that are close to eviction. Rather than reference such an entry, the encoder can emit a Duplicate instruction (see <a href="#duplicate" class="xref">Section 4.3.3</a>), and reference the duplicate instead.</p>
<p id="rfc.section.2.1.2.p.5">Determining which entries are too close to eviction to reference is an encoder preference. One heuristic is to target a fixed amount of available space in the dynamic table: either unused space or space that can be reclaimed by evicting non-blocking entries. To achieve this, the encoder can maintain a draining index, which is the smallest absolute index in the dynamic table that it will emit a reference for. As new entries are inserted, the encoder increases the draining index to maintain the section of the table that it will not reference. If the encoder does not create new references to entries with an absolute index lower than the draining index, the number of unacknowledged references to those entries will eventually become zero, allowing them to be evicted.</p>
<div id="rfc.figure.1"></div>
<div id="fig-draining-index"></div>
<pre>
+----------+---------------------------------+--------+
| Draining | Referenceable | Unused |
| Entries | Entries | Space |
+----------+---------------------------------+--------+
^ ^ ^
| | |
Dropping Draining Index Insertion Point
Point
</pre>
<p class="figure">Figure 1: Draining Dynamic Table Entries</p>
<h3 id="rfc.section.2.1.3">
<a href="#rfc.section.2.1.3">2.1.3.</a> <a href="#overview-hol-avoidance" id="overview-hol-avoidance">Avoiding Head-of-Line Blocking</a>
</h3>
<p id="rfc.section.2.1.3.p.1">Because QUIC does not guarantee order between data on different streams, a header block might reference an entry in the dynamic table that has not yet been received.</p>
<p id="rfc.section.2.1.3.p.2">Each header block contains a Required Insert Count, the lowest possible value for the Insert Count with which the header block can be decoded. For a header block with references to the dynamic table, the Required Insert Count is one larger than the largest Absolute Index of all referenced dynamic table entries. For a header block with no references to the dynamic table, the Required Insert Count is zero.</p>
<p id="rfc.section.2.1.3.p.3">If the decoder encounters a header block with a Required Insert Count value larger than defined above, it MAY treat this as a connection error of type HTTP_QPACK_DECOMPRESSION_FAILED. If the decoder encounters a header block with a Required Insert Count value smaller than defined above, it MUST treat this as a connection error of type HTTP_QPACK_DECOMPRESSION_FAILED as prescribed in <a href="#invalid-references" class="xref">Section 3.2.7</a>.</p>
<p id="rfc.section.2.1.3.p.4">When the Required Insert Count is zero, the frame contains no references to the dynamic table and can always be processed immediately.</p>
<p id="rfc.section.2.1.3.p.5">If the Required Insert Count is greater than the number of dynamic table entries received, the stream is considered “blocked.” While blocked, header field data SHOULD remain in the blocked stream’s flow control window. A stream becomes unblocked when the Insert Count becomes greater than or equal to the Required Insert Count for all header blocks the decoder has started reading from the stream.</p>
<p id="rfc.section.2.1.3.p.6">The SETTINGS_QPACK_BLOCKED_STREAMS setting (see <a href="#configuration" class="xref">Section 5</a>) specifies an upper bound on the number of streams which can be blocked. An encoder MUST limit the number of streams which could become blocked to the value of SETTINGS_QPACK_BLOCKED_STREAMS at all times. Note that the decoder might not actually become blocked on every stream which risks becoming blocked. If the decoder encounters more blocked streams than it promised to support, it MUST treat this as a connection error of type HTTP_QPACK_DECOMPRESSION_FAILED.</p>
<p id="rfc.section.2.1.3.p.7">An encoder can decide whether to risk having a stream become blocked. If permitted by the value of SETTINGS_QPACK_BLOCKED_STREAMS, compression efficiency can often be improved by referencing dynamic table entries that are still in transit, but if there is loss or reordering the stream can become blocked at the decoder. An encoder avoids the risk of blocking by only referencing dynamic table entries which have been acknowledged, but this could mean using literals. Since literals make the header block larger, this can result in the encoder becoming blocked on congestion or flow control limits.</p>
<h3 id="rfc.section.2.1.4">
<a href="#rfc.section.2.1.4">2.1.4.</a> <a href="#known-received-count" id="known-received-count">Known Received Count</a>
</h3>
<p id="rfc.section.2.1.4.p.1">In order to identify which dynamic table entries can be safely used without a stream becoming blocked, the encoder tracks the number of entries received by the decoder. The Known Received Count tracks the total number of acknowledged insertions.</p>
<p id="rfc.section.2.1.4.p.2">When blocking references are permitted, the encoder uses header block acknowledgement to maintain the Known Received Count, as described in <a href="#header-acknowledgement" class="xref">Section 4.4.2</a>.</p>
<p id="rfc.section.2.1.4.p.3">To acknowledge dynamic table entries which are not referenced by header blocks, for example because the encoder or the decoder have chosen not to risk blocked streams, the decoder sends an Insert Count Increment instruction (see <a href="#insert-count-increment" class="xref">Section 4.4.1</a>).</p>
<h2 id="rfc.section.2.2">
<a href="#rfc.section.2.2">2.2.</a> <a href="#decoder" id="decoder">Decoder</a>
</h2>
<p id="rfc.section.2.2.p.1">As in HPACK, the decoder processes header blocks and emits the corresponding header lists. It also processes dynamic table modifications from encoder instructions received on the encoder stream.</p>
<p id="rfc.section.2.2.p.2">The decoder MUST emit header fields in the order their representations appear in the input header block.</p>
<h3 id="rfc.section.2.2.1">
<a href="#rfc.section.2.2.1">2.2.1.</a> <a href="#state-synchronization" id="state-synchronization">State Synchronization</a>
</h3>
<p id="rfc.section.2.2.1.p.1">The decoder instructions (<a href="#decoder-instructions" class="xref">Section 4.4</a>) signal key events at the decoder that permit the encoder to track the decoder’s state. These events are:</p>
<p></p>
<ul>
<li>Complete processing of a header block</li>
<li>Abandonment of a stream which might have remaining header blocks</li>
<li>Receipt of new dynamic table entries</li>
</ul>
<p id="rfc.section.2.2.1.p.3">Knowledge that a header block with references to the dynamic table has been processed permits the encoder to evict entries to which no unacknowledged references remain (see <a href="#blocked-insertion" class="xref">Section 2.1.2</a>). When a stream is reset or abandoned, the indication that these header blocks will never be processed serves a similar function (see <a href="#stream-cancellation" class="xref">Section 4.4.3</a>).</p>
<p id="rfc.section.2.2.1.p.4">The decoder chooses when to emit Insert Count Increment instructions (see <a href="#insert-count-increment" class="xref">Section 4.4.1</a>). Emitting an instruction after adding each new dynamic table entry will provide the most timely feedback to the encoder, but could be redundant with other decoder feedback. By delaying an Insert Count Increment instruction, the decoder might be able to coalesce multiple Insert Count Increment instructions, or replace them entirely with Header Acknowledgements (see <a href="#header-acknowledgement" class="xref">Section 4.4.2</a>). However, delaying too long may lead to compression inefficiencies if the encoder waits for an entry to be acknowledged before using it.</p>
<h3 id="rfc.section.2.2.2">
<a href="#rfc.section.2.2.2">2.2.2.</a> <a href="#blocked-decoding" id="blocked-decoding">Blocked Decoding</a>
</h3>
<p id="rfc.section.2.2.2.p.1">To track blocked streams, the Required Insert Count value for each stream can be used. Whenever the decoder processes a table update, it can begin decoding any blocked streams that now have their dependencies satisfied.</p>
<h1 id="rfc.section.3">
<a href="#rfc.section.3">3.</a> <a href="#header-tables" id="header-tables">Header Tables</a>
</h1>
<p id="rfc.section.3.p.1">Unlike in HPACK, entries in the QPACK static and dynamic tables are addressed separately. The following sections describe how entries in each table are addressed.</p>
<h2 id="rfc.section.3.1">
<a href="#rfc.section.3.1">3.1.</a> <a href="#table-static" id="table-static">Static Table</a>
</h2>
<p id="rfc.section.3.1.p.1">The static table consists of a predefined static list of header fields, each of which has a fixed index over time. Its entries are defined in <a href="#static-table" class="xref">Appendix A</a>.</p>
<p id="rfc.section.3.1.p.2">All entries in the static table have a name and a value. However, values can be empty (that is, have a length of 0).</p>
<p id="rfc.section.3.1.p.3">Note the QPACK static table is indexed from 0, whereas the HPACK static table is indexed from 1.</p>
<p id="rfc.section.3.1.p.4">When the decoder encounters an invalid static table index in a header block instruction it MUST treat this as a connection error of type <samp>HTTP_QPACK_DECOMPRESSION_FAILED</samp>. If this index is received on the encoder stream, this MUST be treated as a connection error of type <samp>HTTP_QPACK_ENCODER_STREAM_ERROR</samp>.</p>
<h2 id="rfc.section.3.2">
<a href="#rfc.section.3.2">3.2.</a> <a href="#table-dynamic" id="table-dynamic">Dynamic Table</a>
</h2>
<p id="rfc.section.3.2.p.1">The dynamic table consists of a list of header fields maintained in first-in, first-out order. Each HTTP/3 endpoint holds a dynamic table that is initially empty. Entries are added by encoder instructions received on the encoder stream (see <a href="#encoder-instructions" class="xref">Section 4.3</a>).</p>
<p id="rfc.section.3.2.p.2">The dynamic table can contain duplicate entries (i.e., entries with the same name and same value). Therefore, duplicate entries MUST NOT be treated as an error by the decoder.</p>
<h3 id="rfc.section.3.2.1">
<a href="#rfc.section.3.2.1">3.2.1.</a> <a href="#dynamic-table-size" id="dynamic-table-size">Dynamic Table Size</a>
</h3>
<p id="rfc.section.3.2.1.p.1">The size of the dynamic table is the sum of the size of its entries.</p>
<p id="rfc.section.3.2.1.p.2">The size of an entry is the sum of its name’s length in bytes (as defined in <a href="#string-literals" class="xref">Section 4.1.2</a>), its value’s length in bytes, and 32.</p>
<p id="rfc.section.3.2.1.p.3">The size of an entry is calculated using the length of its name and value without Huffman encoding applied.</p>
<h3 id="rfc.section.3.2.2">
<a href="#rfc.section.3.2.2">3.2.2.</a> <a href="#eviction" id="eviction">Dynamic Table Capacity and Eviction</a>
</h3>
<p id="rfc.section.3.2.2.p.1">The encoder sets the capacity of the dynamic table, which serves as the upper limit on its size. The initial capacity of the dynamic table is zero.</p>
<p id="rfc.section.3.2.2.p.2">Before a new entry is added to the dynamic table, entries are evicted from the end of the dynamic table until the size of the dynamic table is less than or equal to (table capacity - size of new entry) or until the table is empty. The encoder MUST NOT evict a blocking dynamic table entry (see <a href="#blocked-insertion" class="xref">Section 2.1.2</a>).</p>
<p id="rfc.section.3.2.2.p.3">If the size of the new entry is less than or equal to the dynamic table capacity, then that entry is added to the table. It is an error if the encoder attempts to add an entry that is larger than the dynamic table capacity; the decoder MUST treat this as a connection error of type <samp>HTTP_QPACK_ENCODER_STREAM_ERROR</samp>.</p>
<p id="rfc.section.3.2.2.p.4">A new entry can reference an entry in the dynamic table that will be evicted when adding this new entry into the dynamic table. Implementations are cautioned to avoid deleting the referenced name or value if the referenced entry is evicted from the dynamic table prior to inserting the new entry.</p>
<p id="rfc.section.3.2.2.p.5">Whenever the dynamic table capacity is reduced by the encoder, entries are evicted from the end of the dynamic table until the size of the dynamic table is less than or equal to the new table capacity. This mechanism can be used to completely clear entries from the dynamic table by setting a capacity of 0, which can subsequently be restored.</p>
<h3 id="rfc.section.3.2.3">
<a href="#rfc.section.3.2.3">3.2.3.</a> <a href="#maximum-dynamic-table-capacity" id="maximum-dynamic-table-capacity">Maximum Dynamic Table Capacity</a>
</h3>
<p id="rfc.section.3.2.3.p.1">To bound the memory requirements of the decoder, the decoder limits the maximum value the encoder is permitted to set for the dynamic table capacity. In HTTP/3, this limit is determined by the value of SETTINGS_QPACK_MAX_TABLE_CAPACITY sent by the decoder (see <a href="#configuration" class="xref">Section 5</a>). The encoder MUST not set a dynamic table capacity that exceeds this maximum, but it can choose to use a lower dynamic table capacity (see <a href="#set-dynamic-capacity" class="xref">Section 4.3.4</a>).</p>
<p id="rfc.section.3.2.3.p.2">For clients using 0-RTT data in HTTP/3, the server’s maximum table capacity is the remembered value of the setting, or zero if the value was not previously sent. When the client’s 0-RTT value of the SETTING is 0, the server MAY set it to a non-zero value in its SETTINGS frame. If the remembered value is non-zero, the server MUST send the same non-zero value in its SETTINGS frame. If it specifies any other value, or omits SETTINGS_QPACK_MAX_TABLE_CAPACITY from SETTINGS, the encoder must treat this as a connection error of type <samp>HTTP_QPACK_DECODER_STREAM_ERROR</samp>.</p>
<p id="rfc.section.3.2.3.p.3">For HTTP/3 servers and HTTP/3 clients when 0-RTT is not attempted or is rejected, the maximum table capacity is 0 until the encoder processes a SETTINGS frame with a non-zero value of SETTINGS_QPACK_MAX_TABLE_CAPACITY.</p>
<p id="rfc.section.3.2.3.p.4">When the maximum table capacity is 0, the encoder MUST NOT insert entries into the dynamic table, and MUST NOT send any encoder instructions on the encoder stream.</p>
<h3 id="rfc.section.3.2.4">
<a href="#rfc.section.3.2.4">3.2.4.</a> <a href="#indexing" id="indexing">Absolute Indexing</a>
</h3>
<p id="rfc.section.3.2.4.p.1">Each entry possesses both an absolute index which is fixed for the lifetime of that entry and a relative index which changes based on the context of the reference. The first entry inserted has an absolute index of “0”; indices increase by one with each insertion.</p>
<h3 id="rfc.section.3.2.5">
<a href="#rfc.section.3.2.5">3.2.5.</a> <a href="#relative-indexing" id="relative-indexing">Relative Indexing</a>
</h3>
<p id="rfc.section.3.2.5.p.1">The relative index begins at zero and increases in the opposite direction from the absolute index. Determining which entry has a relative index of “0” depends on the context of the reference.</p>
<p id="rfc.section.3.2.5.p.2">In encoder instructions, a relative index of “0” always refers to the most recently inserted value in the dynamic table. Note that this means the entry referenced by a given relative index will change while interpreting instructions on the encoder stream.</p>
<pre>
+-----+---------------+-------+
| n-1 | ... | d | Absolute Index
+ - - +---------------+ - - - +
| 0 | ... | n-d-1 | Relative Index
+-----+---------------+-------+
^ |
| V
Insertion Point Dropping Point
n = count of entries inserted
d = count of entries dropped
</pre>
<p class="figure">Example Dynamic Table Indexing - Control Stream</p>
<p id="rfc.section.3.2.5.p.3">Unlike encoder instructions, relative indices in header block instructions are relative to the Base at the beginning of the header block (see <a href="#header-prefix" class="xref">Section 4.5.1</a>). This ensures that references are stable even if the dynamic table is updated while decoding a header block.</p>
<p id="rfc.section.3.2.5.p.4">The Base is encoded as a value relative to the Required Insert Count. The Base identifies which dynamic table entries can be referenced using relative indexing, starting with 0 at the last entry added.</p>
<p id="rfc.section.3.2.5.p.5">Post-Base references are used for entries inserted after base, starting at 0 for the first entry added after the Base; see <a href="#post-base" class="xref">Section 3.2.6</a>.</p>
<pre>
Required
Insert
Count Base
| |
V V
+-----+-----+-----+-----+-------+
| n-1 | n-2 | n-3 | ... | d | Absolute Index
+-----+-----+ - +-----+ - +
| 0 | ... | n-d-3 | Relative Index
+-----+-----+-------+
n = count of entries inserted
d = count of entries dropped
</pre>
<p class="figure">Example Dynamic Table Indexing - Relative Index in Header Block</p>
<h3 id="rfc.section.3.2.6">
<a href="#rfc.section.3.2.6">3.2.6.</a> <a href="#post-base" id="post-base">Post-Base Indexing</a>
</h3>
<p id="rfc.section.3.2.6.p.1">A header block can reference entries added after the entry identified by the Base. This allows an encoder to process a header block in a single pass and include references to entries added while processing this (or other) header blocks. Newly added entries are referenced using Post-Base instructions. Indices for Post-Base instructions increase in the same direction as absolute indices, with the zero value being the first entry inserted after the Base.</p>
<pre>
Base
|
V
+-----+-----+-----+-----+-----+
| n-1 | n-2 | n-3 | ... | d | Absolute Index
+-----+-----+-----+-----+-----+
| 1 | 0 | Post-Base Index
+-----+-----+
n = count of entries inserted
d = count of entries dropped
</pre>
<p class="figure">Example Dynamic Table Indexing - Post-Base Index in Header Block</p>
<h3 id="rfc.section.3.2.7">
<a href="#rfc.section.3.2.7">3.2.7.</a> <a href="#invalid-references" id="invalid-references">Invalid References</a>
</h3>
<p id="rfc.section.3.2.7.p.1">If the decoder encounters a reference in a header block instruction to a dynamic table entry which has already been evicted or which has an absolute index greater than or equal to the declared Required Insert Count (see <a href="#header-prefix" class="xref">Section 4.5.1</a>), it MUST treat this as a connection error of type <samp>HTTP_QPACK_DECOMPRESSION_FAILED</samp>.</p>
<p id="rfc.section.3.2.7.p.2">If the decoder encounters a reference in an encoder instruction to a dynamic table entry which has already been dropped, it MUST treat this as a connection error of type <samp>HTTP_QPACK_ENCODER_STREAM_ERROR</samp>.</p>
<h1 id="rfc.section.4">
<a href="#rfc.section.4">4.</a> <a href="#wire-format" id="wire-format">Wire Format</a>
</h1>
<h2 id="rfc.section.4.1">
<a href="#rfc.section.4.1">4.1.</a> <a href="#primitives" id="primitives">Primitives</a>
</h2>
<h3 id="rfc.section.4.1.1">
<a href="#rfc.section.4.1.1">4.1.1.</a> <a href="#prefixed-integers" id="prefixed-integers">Prefixed Integers</a>
</h3>
<p id="rfc.section.4.1.1.p.1">The prefixed integer from Section 5.1 of <a href="#RFC7541" class="xref">[RFC7541]</a> is used heavily throughout this document. The format from <a href="#RFC7541" class="xref">[RFC7541]</a> is used unmodified. QPACK implementations MUST be able to decode integers up to 62 bits long.</p>
<h3 id="rfc.section.4.1.2">
<a href="#rfc.section.4.1.2">4.1.2.</a> <a href="#string-literals" id="string-literals">String Literals</a>
</h3>
<p id="rfc.section.4.1.2.p.1">The string literal defined by Section 5.2 of <a href="#RFC7541" class="xref">[RFC7541]</a> is also used throughout. This string format includes optional Huffman encoding.</p>
<p id="rfc.section.4.1.2.p.2">HPACK defines string literals to begin on a byte boundary. They begin with a single flag (indicating whether the string is Huffman-coded), followed by the Length encoded as a 7-bit prefix integer, and finally Length bytes of data. When Huffman encoding is enabled, the Huffman table from Appendix B of <a href="#RFC7541" class="xref">[RFC7541]</a> is used without modification.</p>
<p id="rfc.section.4.1.2.p.3">This document expands the definition of string literals and permits them to begin other than on a byte boundary. An “N-bit prefix string literal” begins with the same Huffman flag, followed by the length encoded as an (N-1)-bit prefix integer. The remainder of the string literal is unmodified.</p>
<p id="rfc.section.4.1.2.p.4">A string literal without a prefix length noted is an 8-bit prefix string literal and follows the definitions in <a href="#RFC7541" class="xref">[RFC7541]</a> without modification.</p>
<h2 id="rfc.section.4.2">
<a href="#rfc.section.4.2">4.2.</a> <a href="#instructions" id="instructions">Instructions</a>
</h2>
<p id="rfc.section.4.2.p.1">There are three separate QPACK instruction spaces. Encoder instructions (<a href="#encoder-instructions" class="xref">Section 4.3</a>) carry table updates, decoder instructions (<a href="#decoder-instructions" class="xref">Section 4.4</a>) carry acknowledgments of table modifications and header processing, and header block instructions (<a href="#header-block-instructions" class="xref">Section 4.5</a>) convey an encoded representation of a header list by referring to the QPACK table state.</p>
<p id="rfc.section.4.2.p.2">Encoder and decoder instructions appear on the unidirectional stream types described in this section. Header block instructions are contained in HEADERS and PUSH_PROMISE frames, which are conveyed on request or push streams as described in <a href="#HTTP3" class="xref">[HTTP3]</a>.</p>
<h3 id="rfc.section.4.2.1">
<a href="#rfc.section.4.2.1">4.2.1.</a> <a href="#enc-dec-stream-def" id="enc-dec-stream-def">Encoder and Decoder Streams</a>
</h3>
<p id="rfc.section.4.2.1.p.1">QPACK defines two unidirectional stream types:</p>
<p></p>
<ul>
<li>An encoder stream is a unidirectional stream of type <samp>0x02</samp>. It carries an unframed sequence of encoder instructions from encoder to decoder.</li>
<li>A decoder stream is a unidirectional stream of type <samp>0x03</samp>. It carries an unframed sequence of decoder instructions from decoder to encoder.</li>
</ul>
<p id="rfc.section.4.2.1.p.3">HTTP/3 endpoints contain a QPACK encoder and decoder. Each endpoint MUST initiate at most one encoder stream and at most one decoder stream. Receipt of a second instance of either stream type MUST be treated as a connection error of type HTTP_WRONG_STREAM_COUNT. These streams MUST NOT be closed. Closure of either unidirectional stream type MUST be treated as a connection error of type HTTP_CLOSED_CRITICAL_STREAM.</p>
<p id="rfc.section.4.2.1.p.4">An endpoint MAY avoid creating its own encoder stream if it’s not going to be used (for example if the endpoint doesn’t wish to use the dynamic table, or if the maximum size of the dynamic table permitted by the peer is zero).</p>
<p id="rfc.section.4.2.1.p.5">An endpoint MAY avoid creating its own decoder stream if the maximum size of its own dynamic table is zero.</p>
<p id="rfc.section.4.2.1.p.6">An endpoint MUST allow its peer to create both encoder and decoder streams even if the connection’s settings prevent their use.</p>
<h2 id="rfc.section.4.3">
<a href="#rfc.section.4.3">4.3.</a> <a href="#encoder-instructions" id="encoder-instructions">Encoder Instructions</a>
</h2>
<p id="rfc.section.4.3.p.1">Table updates can add a table entry, possibly using existing entries to avoid transmitting redundant information. The name can be transmitted as a reference to an existing entry in the static or the dynamic table or as a string literal. For entries which already exist in the dynamic table, the full entry can also be used by reference, creating a duplicate entry.</p>
<p id="rfc.section.4.3.p.2">This section specifies the following encoder instructions.</p>
<h3 id="rfc.section.4.3.1">
<a href="#rfc.section.4.3.1">4.3.1.</a> <a href="#insert-with-name-reference" id="insert-with-name-reference">Insert With Name Reference</a>
</h3>
<p id="rfc.section.4.3.1.p.1">An addition to the header table where the header field name matches the header field name of an entry stored in the static table or the dynamic table starts with the ‘1’ one-bit pattern. The <samp>S</samp> bit indicates whether the reference is to the static (S=1) or dynamic (S=0) table. The 6-bit prefix integer (see Section 5.1 of <a href="#RFC7541" class="xref">[RFC7541]</a>) that follows is used to locate the table entry for the header name. When S=1, the number represents the static table index; when S=0, the number is the relative index of the entry in the dynamic table.</p>
<p id="rfc.section.4.3.1.p.2">The header name reference is followed by the header field value represented as a string literal (see Section 5.2 of <a href="#RFC7541" class="xref">[RFC7541]</a>).</p>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | S | Name Index (6+) |
+---+---+-----------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length bytes) |
+-------------------------------+
</pre>
<p class="figure">Insert Header Field -- Indexed Name</p>
<h3 id="rfc.section.4.3.2">
<a href="#rfc.section.4.3.2">4.3.2.</a> <a href="#insert-without-name-reference" id="insert-without-name-reference">Insert Without Name Reference</a>
</h3>
<p id="rfc.section.4.3.2.p.1">An addition to the header table where both the header field name and the header field value are represented as string literals (see <a href="#primitives" class="xref">Section 4.1</a>) starts with the ‘01’ two-bit pattern.</p>
<p id="rfc.section.4.3.2.p.2">The name is represented as a 6-bit prefix string literal, while the value is represented as an 8-bit prefix string literal.</p>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | H | Name Length (5+) |
+---+---+---+-------------------+
| Name String (Length bytes) |
+---+---------------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length bytes) |
+-------------------------------+
</pre>
<p class="figure">Insert Header Field -- New Name</p>
<h3 id="rfc.section.4.3.3">
<a href="#rfc.section.4.3.3">4.3.3.</a> <a href="#duplicate" id="duplicate">Duplicate</a>
</h3>
<p id="rfc.section.4.3.3.p.1">Duplication of an existing entry in the dynamic table starts with the ‘000’ three-bit pattern. The relative index of the existing entry is represented as an integer with a 5-bit prefix.</p>
<div id="rfc.figure.2"></div>
<div id="fig-index-with-duplication"></div>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | Index (5+) |
+---+---+---+-------------------+
</pre>
<p class="figure">Figure 2: Duplicate</p>
<p id="rfc.section.4.3.3.p.2">The existing entry is re-inserted into the dynamic table without resending either the name or the value. This is useful to mitigate the eviction of older entries which are frequently referenced, both to avoid the need to resend the header and to avoid the entry in the table blocking the ability to insert new headers.</p>
<h3 id="rfc.section.4.3.4">
<a href="#rfc.section.4.3.4">4.3.4.</a> <a href="#set-dynamic-capacity" id="set-dynamic-capacity">Set Dynamic Table Capacity</a>
</h3>
<p id="rfc.section.4.3.4.p.1">An encoder informs the decoder of a change to the dynamic table capacity using an instruction which begins with the ‘001’ three-bit pattern. The new dynamic table capacity is represented as an integer with a 5-bit prefix (see Section 5.1 of <a href="#RFC7541" class="xref">[RFC7541]</a>).</p>
<div id="rfc.figure.3"></div>
<div id="fig-set-capacity"></div>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | Capacity (5+) |
+---+---+---+-------------------+
</pre>
<p class="figure">Figure 3: Set Dynamic Table Capacity</p>
<p id="rfc.section.4.3.4.p.2">The new capacity MUST be lower than or equal to the limit described in <a href="#maximum-dynamic-table-capacity" class="xref">Section 3.2.3</a>. In HTTP/3, this limit is the value of the SETTINGS_QPACK_MAX_TABLE_CAPACITY parameter (see <a href="#configuration" class="xref">Section 5</a>) received from the decoder. The decoder MUST treat a new dynamic table capacity value that exceeds this limit as a connection error of type <samp>HTTP_QPACK_ENCODER_STREAM_ERROR</samp>.</p>
<p id="rfc.section.4.3.4.p.3">Reducing the dynamic table capacity can cause entries to be evicted (see <a href="#eviction" class="xref">Section 3.2.2</a>). This MUST NOT cause the eviction of blocking entries (see <a href="#blocked-insertion" class="xref">Section 2.1.2</a>). Changing the capacity of the dynamic table is not acknowledged as this instruction does not insert an entry.</p>
<h2 id="rfc.section.4.4">
<a href="#rfc.section.4.4">4.4.</a> <a href="#decoder-instructions" id="decoder-instructions">Decoder Instructions</a>
</h2>
<p id="rfc.section.4.4.p.1">Decoder instructions provide information used to ensure consistency of the dynamic table. They are sent from the decoder to the encoder on a decoder stream; that is, the server informs the client about the processing of the client’s header blocks and table updates, and the client informs the server about the processing of the server’s header blocks and table updates.</p>
<p id="rfc.section.4.4.p.2">This section specifies the following decoder instructions.</p>
<h3 id="rfc.section.4.4.1">
<a href="#rfc.section.4.4.1">4.4.1.</a> <a href="#insert-count-increment" id="insert-count-increment">Insert Count Increment</a>
</h3>
<p id="rfc.section.4.4.1.p.1">The Insert Count Increment instruction begins with the ‘00’ two-bit pattern. The instruction specifies the total number of dynamic table inserts and duplications since the last Insert Count Increment or Header Acknowledgement that increased the Known Received Count for the dynamic table (see <a href="#known-received-count" class="xref">Section 2.1.4</a>). The Increment field is encoded as a 6-bit prefix integer. The encoder uses this value to determine which table entries might cause a stream to become blocked, as described in <a href="#state-synchronization" class="xref">Section 2.2.1</a>.</p>
<div id="rfc.figure.4"></div>
<div id="fig-size-sync"></div>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | Increment (6+) |
+---+---+-----------------------+
</pre>
<p class="figure">Figure 4: Insert Count Increment</p>
<p id="rfc.section.4.4.1.p.2">An encoder that receives an Increment field equal to zero or one that increases the Known Received Count beyond what the encoder has sent MUST treat this as a connection error of type <samp>HTTP_QPACK_DECODER_STREAM_ERROR</samp>.</p>
<h3 id="rfc.section.4.4.2">
<a href="#rfc.section.4.4.2">4.4.2.</a> <a href="#header-acknowledgement" id="header-acknowledgement">Header Acknowledgement</a>
</h3>
<p id="rfc.section.4.4.2.p.1">After processing a header block whose declared Required Insert Count is not zero, the decoder emits a Header Acknowledgement instruction on the decoder stream. The instruction begins with the ‘1’ one-bit pattern and includes the header block’s associated stream ID, encoded as a 7-bit prefix integer. It is used by the peer’s encoder to know when it is safe to evict an entry, and possibly update the Known Received Count.</p>
<div id="rfc.figure.5"></div>
<div id="fig-header-ack"></div>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | Stream ID (7+) |
+---+---------------------------+
</pre>
<p class="figure">Figure 5: Header Acknowledgement</p>
<p id="rfc.section.4.4.2.p.2">The same Stream ID can be identified multiple times, as multiple header blocks can be sent on a single stream in the case of intermediate responses, trailers, and pushed requests. Since HEADERS and PUSH_PROMISE frames on each stream are received and processed in order, this gives the encoder precise feedback on which header blocks within a stream have been fully processed.</p>
<p id="rfc.section.4.4.2.p.3">If an encoder receives a Header Acknowledgement instruction referring to a stream on which every header block with a non-zero Required Insert Count has already been acknowledged, that MUST be treated as a connection error of type <samp>HTTP_QPACK_DECODER_STREAM_ERROR</samp>.</p>
<p id="rfc.section.4.4.2.p.4">When blocking references are permitted, the encoder uses acknowledgement of header blocks to update the Known Received Count. If a header block was potentially blocking, the acknowledgement implies that the decoder has received all dynamic table state necessary to process the header block. If the Required Insert Count of an acknowledged header block was greater than the encoder’s current Known Received Count, the block’s Required Insert Count becomes the new Known Received Count.</p>
<h3 id="rfc.section.4.4.3">
<a href="#rfc.section.4.4.3">4.4.3.</a> <a href="#stream-cancellation" id="stream-cancellation">Stream Cancellation</a>
</h3>
<p id="rfc.section.4.4.3.p.1">The instruction begins with the ‘01’ two-bit pattern. The instruction includes the stream ID of the affected stream - a request or push stream - encoded as a 6-bit prefix integer.</p>
<div id="rfc.figure.6"></div>
<div id="fig-stream-cancel"></div>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | Stream ID (6+) |
+---+---+-----------------------+
</pre>
<p class="figure">Figure 6: Stream Cancellation</p>
<p id="rfc.section.4.4.3.p.2">A stream that is reset might have multiple outstanding header blocks with dynamic table references. When an endpoint receives a stream reset before the end of a stream, it generates a Stream Cancellation instruction on the decoder stream. Similarly, when an endpoint abandons reading of a stream it needs to signal this using the Stream Cancellation instruction. This signals to the encoder that all references to the dynamic table on that stream are no longer outstanding. A decoder with a maximum dynamic table capacity equal to zero (see <a href="#maximum-dynamic-table-capacity" class="xref">Section 3.2.3</a>) MAY omit sending Stream Cancellations, because the encoder cannot have any dynamic table references.</p>
<p id="rfc.section.4.4.3.p.3">An encoder cannot infer from this instruction that any updates to the dynamic table have been received.</p>
<h2 id="rfc.section.4.5">
<a href="#rfc.section.4.5">4.5.</a> <a href="#header-block-instructions" id="header-block-instructions">Header Block Instructions</a>
</h2>
<p id="rfc.section.4.5.p.1">HTTP/3 endpoints convert header lists to headers blocks and exchange them inside HEADERS and PUSH_PROMISE frames. A decoder interprets header block instructions in order to construct a header list. These instructions reference the static table, or dynamic table in a particular state without modifying it.</p>
<p id="rfc.section.4.5.p.2">This section specifies the following header block instructions.</p>
<h3 id="rfc.section.4.5.1">
<a href="#rfc.section.4.5.1">4.5.1.</a> <a href="#header-prefix" id="header-prefix">Header Block Prefix</a>
</h3>
<p id="rfc.section.4.5.1.p.1">Each header block is prefixed with two integers. The Required Insert Count is encoded as an integer with an 8-bit prefix after the encoding described in <a href="#ric" class="xref">Section 4.5.1.1</a>). The Base is encoded as sign-and-modulus integer, using a single sign bit and a value with a 7-bit prefix (see <a href="#base" class="xref">Section 4.5.1.2</a>).</p>
<p id="rfc.section.4.5.1.p.2">These two values are followed by instructions for compressed headers. The entire block is expected to be framed by the using protocol.</p>
<div id="rfc.figure.7"></div>
<div id="fig-base-index"></div>
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| Required Insert Count (8+) |
+---+---------------------------+
| S | Delta Base (7+) |
+---+---------------------------+
| Compressed Headers ...
+-------------------------------+
</pre>
<p class="figure">Figure 7: Frame Payload</p>
<h4 id="rfc.section.4.5.1.1">
<a href="#rfc.section.4.5.1.1">4.5.1.1.</a> <a href="#ric" id="ric">Required Insert Count</a>
</h4>
<p id="rfc.section.4.5.1.1.p.1">Required Insert Count identifies the state of the dynamic table needed to process the header block. Blocking decoders use the Required Insert Count to determine when it is safe to process the rest of the block.</p>
<p id="rfc.section.4.5.1.1.p.2">The encoder transforms the Required Insert Count as follows before encoding:</p>
<pre>
if ReqInsertCount == 0:
EncInsertCount = 0
else:
EncInsertCount = (ReqInsertCount mod (2 * MaxEntries)) + 1
</pre>
<p id="rfc.section.4.5.1.1.p.3">Here <samp>MaxEntries</samp> is the maximum number of entries that the dynamic table can have. The smallest entry has empty name and value strings and has the size of 32. Hence <samp>MaxEntries</samp> is calculated as</p>
<pre>
MaxEntries = floor( MaxTableCapacity / 32 )
</pre>
<p><samp>MaxTableCapacity</samp> is the maximum capacity of the dynamic table as specified by the decoder (see <a href="#maximum-dynamic-table-capacity" class="xref">Section 3.2.3</a>).</p>
<p id="rfc.section.4.5.1.1.p.5">This encoding limits the length of the prefix on long-lived connections.</p>
<p id="rfc.section.4.5.1.1.p.6">The decoder can reconstruct the Required Insert Count using an algorithm such as the following. If the decoder encounters a value of EncodedInsertCount that could not have been produced by a conformant encoder, it MUST treat this as a connection error of type <samp>HTTP_QPACK_DECOMPRESSION_FAILED</samp>.</p>
<p id="rfc.section.4.5.1.1.p.7">TotalNumberOfInserts is the total number of inserts into the decoder’s dynamic table.</p>
<pre>
FullRange = 2 * MaxEntries
if EncodedInsertCount == 0:
ReqInsertCount = 0
else:
if EncodedInsertCount > FullRange:
Error