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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235
|
<!DOCTYPE html>
<html lang="en" class="RFC">
<head>
<meta charset="utf-8">
<meta content="Common,Latin" name="scripts">
<meta content="initial-scale=1.0" name="viewport">
<title>RFC 9204: QPACK: Field Compression for HTTP/3</title>
<meta content="Charles 'Buck' Krasic" name="author">
<meta content="Mike Bishop" name="author">
<meta content="Alan Frindell" name="author">
<meta content="
This specification defines QPACK: a compression format for efficiently
representing HTTP fields that is to be used in HTTP/3. This is a variation of
HPACK compression that seeks to reduce head-of-line blocking.
" name="description">
<meta content="xml2rfc 3.12.10" name="generator">
<meta content="compression" name="keyword">
<meta content="HTTP/3" name="keyword">
<meta content="HPACK" name="keyword">
<meta content="header" name="keyword">
<meta content="field" name="keyword">
<meta content="trailer" name="keyword">
<meta content="9204" name="rfc.number">
<!-- Generator version information:
xml2rfc 3.12.10
Python 3.6.15
appdirs 1.4.4
ConfigArgParse 1.4.1
google-i18n-address 2.4.0
html5lib 1.0.1
intervaltree 3.0.2
Jinja2 2.11.3
kitchen 1.2.6
lxml 4.7.1
MarkupSafe 2.0.1
pycairo 1.15.1
pycountry 19.8.18
pyflakes 2.1.1
PyYAML 5.4.1
requests 2.24.0
setuptools 40.5.0
six 1.14.0
WeasyPrint 52.5
-->
<link href="rfc9204.xml" rel="alternate" type="application/rfc+xml">
<link href="#copyright" rel="license">
<style type="text/css">/*
NOTE: Changes at the bottom of this file overrides some earlier settings.
Once the style has stabilized and has been adopted as an official RFC style,
this can be consolidated so that style settings occur only in one place, but
for now the contents of this file consists first of the initial CSS work as
provided to the RFC Formatter (xml2rfc) work, followed by itemized and
commented changes found necssary during the development of the v3
formatters.
*/
/* fonts */
@import url('https://fonts.googleapis.com/css?family=Noto+Sans'); /* Sans-serif */
@import url('https://fonts.googleapis.com/css?family=Noto+Serif'); /* Serif (print) */
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono'); /* Monospace */
@viewport {
zoom: 1.0;
width: extend-to-zoom;
}
@-ms-viewport {
width: extend-to-zoom;
zoom: 1.0;
}
/* general and mobile first */
html {
}
body {
max-width: 90%;
margin: 1.5em auto;
color: #222;
background-color: #fff;
font-size: 14px;
font-family: 'Noto Sans', Arial, Helvetica, sans-serif;
line-height: 1.6;
scroll-behavior: smooth;
}
.ears {
display: none;
}
/* headings */
#title, h1, h2, h3, h4, h5, h6 {
margin: 1em 0 0.5em;
font-weight: bold;
line-height: 1.3;
}
#title {
clear: both;
border-bottom: 1px solid #ddd;
margin: 0 0 0.5em 0;
padding: 1em 0 0.5em;
}
.author {
padding-bottom: 4px;
}
h1 {
font-size: 26px;
margin: 1em 0;
}
h2 {
font-size: 22px;
margin-top: -20px; /* provide offset for in-page anchors */
padding-top: 33px;
}
h3 {
font-size: 18px;
margin-top: -36px; /* provide offset for in-page anchors */
padding-top: 42px;
}
h4 {
font-size: 16px;
margin-top: -36px; /* provide offset for in-page anchors */
padding-top: 42px;
}
h5, h6 {
font-size: 14px;
}
#n-copyright-notice {
border-bottom: 1px solid #ddd;
padding-bottom: 1em;
margin-bottom: 1em;
}
/* general structure */
p {
padding: 0;
margin: 0 0 1em 0;
text-align: left;
}
div, span {
position: relative;
}
div {
margin: 0;
}
.alignRight.art-text {
background-color: #f9f9f9;
border: 1px solid #eee;
border-radius: 3px;
padding: 1em 1em 0;
margin-bottom: 1.5em;
}
.alignRight.art-text pre {
padding: 0;
}
.alignRight {
margin: 1em 0;
}
.alignRight > *:first-child {
border: none;
margin: 0;
float: right;
clear: both;
}
.alignRight > *:nth-child(2) {
clear: both;
display: block;
border: none;
}
svg {
display: block;
}
.alignCenter.art-text {
background-color: #f9f9f9;
border: 1px solid #eee;
border-radius: 3px;
padding: 1em 1em 0;
margin-bottom: 1.5em;
}
.alignCenter.art-text pre {
padding: 0;
}
.alignCenter {
margin: 1em 0;
}
.alignCenter > *:first-child {
border: none;
margin: 0 auto;
}
/* lists */
ol, ul {
padding: 0;
margin: 0 0 1em 2em;
}
ol ol, ul ul, ol ul, ul ol {
margin-left: 1em;
}
li {
margin: 0 0 0.25em 0;
}
.ulCompact li {
margin: 0;
}
ul.empty, .ulEmpty {
list-style-type: none;
}
ul.empty li, .ulEmpty li {
margin-top: 0.5em;
}
ul.ulBare, li.ulBare {
margin-left: 0em !important;
}
ul.compact, .ulCompact,
ol.compact, .olCompact {
line-height: 100%;
margin: 0 0 0 2em;
}
/* definition lists */
dl {
}
dl > dt {
float: left;
margin-right: 1em;
}
/*
dl.nohang > dt {
float: none;
}
*/
dl > dd {
margin-bottom: .8em;
min-height: 1.3em;
}
dl.compact > dd, .dlCompact > dd {
margin-bottom: 0em;
}
dl > dd > dl {
margin-top: 0.5em;
margin-bottom: 0em;
}
/* links */
a {
text-decoration: none;
}
a[href] {
color: #22e; /* Arlen: WCAG 2019 */
}
a[href]:hover {
background-color: #f2f2f2;
}
figcaption a[href],
a[href].selfRef {
color: #222;
}
/* XXX probably not this:
a.selfRef:hover {
background-color: transparent;
cursor: default;
} */
/* Figures */
tt, code, pre, code {
background-color: #f9f9f9;
font-family: 'Roboto Mono', monospace;
}
pre {
border: 1px solid #eee;
margin: 0;
padding: 1em;
}
img {
max-width: 100%;
}
figure {
margin: 0;
}
figure blockquote {
margin: 0.8em 0.4em 0.4em;
}
figcaption {
font-style: italic;
margin: 0 0 1em 0;
}
@media screen {
pre {
overflow-x: auto;
max-width: 100%;
max-width: calc(100% - 22px);
}
}
/* aside, blockquote */
aside, blockquote {
margin-left: 0;
padding: 1.2em 2em;
}
blockquote {
background-color: #f9f9f9;
color: #111; /* Arlen: WCAG 2019 */
border: 1px solid #ddd;
border-radius: 3px;
margin: 1em 0;
}
cite {
display: block;
text-align: right;
font-style: italic;
}
/* tables */
table {
width: 100%;
margin: 0 0 1em;
border-collapse: collapse;
border: 1px solid #eee;
}
th, td {
text-align: left;
vertical-align: top;
padding: 0.5em 0.75em;
}
th {
text-align: left;
background-color: #e9e9e9;
}
tr:nth-child(2n+1) > td {
background-color: #f5f5f5;
}
table caption {
font-style: italic;
margin: 0;
padding: 0;
text-align: left;
}
table p {
/* XXX to avoid bottom margin on table row signifiers. If paragraphs should
be allowed within tables more generally, it would be far better to select on a class. */
margin: 0;
}
/* pilcrow */
a.pilcrow {
color: #666; /* Arlen: AHDJ 2019 */
text-decoration: none;
visibility: hidden;
user-select: none;
-ms-user-select: none;
-o-user-select:none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
@media screen {
aside:hover > a.pilcrow,
p:hover > a.pilcrow,
blockquote:hover > a.pilcrow,
div:hover > a.pilcrow,
li:hover > a.pilcrow,
pre:hover > a.pilcrow {
visibility: visible;
}
a.pilcrow:hover {
background-color: transparent;
}
}
/* misc */
hr {
border: 0;
border-top: 1px solid #eee;
}
.bcp14 {
font-variant: small-caps;
}
.role {
font-variant: all-small-caps;
}
/* info block */
#identifiers {
margin: 0;
font-size: 0.9em;
}
#identifiers dt {
width: 3em;
clear: left;
}
#identifiers dd {
float: left;
margin-bottom: 0;
}
/* Fix PDF info block run off issue */
@media print {
#identifiers dd {
float: none;
}
}
#identifiers .authors .author {
display: inline-block;
margin-right: 1.5em;
}
#identifiers .authors .org {
font-style: italic;
}
/* The prepared/rendered info at the very bottom of the page */
.docInfo {
color: #666; /* Arlen: WCAG 2019 */
font-size: 0.9em;
font-style: italic;
margin-top: 2em;
}
.docInfo .prepared {
float: left;
}
.docInfo .prepared {
float: right;
}
/* table of contents */
#toc {
padding: 0.75em 0 2em 0;
margin-bottom: 1em;
}
nav.toc ul {
margin: 0 0.5em 0 0;
padding: 0;
list-style: none;
}
nav.toc li {
line-height: 1.3em;
margin: 0.75em 0;
padding-left: 1.2em;
text-indent: -1.2em;
}
/* references */
.references dt {
text-align: right;
font-weight: bold;
min-width: 7em;
}
.references dd {
margin-left: 8em;
overflow: auto;
}
.refInstance {
margin-bottom: 1.25em;
}
.references .ascii {
margin-bottom: 0.25em;
}
/* index */
.index ul {
margin: 0 0 0 1em;
padding: 0;
list-style: none;
}
.index ul ul {
margin: 0;
}
.index li {
margin: 0;
text-indent: -2em;
padding-left: 2em;
padding-bottom: 5px;
}
.indexIndex {
margin: 0.5em 0 1em;
}
.index a {
font-weight: 700;
}
/* make the index two-column on all but the smallest screens */
@media (min-width: 600px) {
.index ul {
-moz-column-count: 2;
-moz-column-gap: 20px;
}
.index ul ul {
-moz-column-count: 1;
-moz-column-gap: 0;
}
}
/* authors */
address.vcard {
font-style: normal;
margin: 1em 0;
}
address.vcard .nameRole {
font-weight: 700;
margin-left: 0;
}
address.vcard .label {
font-family: "Noto Sans",Arial,Helvetica,sans-serif;
margin: 0.5em 0;
}
address.vcard .type {
display: none;
}
.alternative-contact {
margin: 1.5em 0 1em;
}
hr.addr {
border-top: 1px dashed;
margin: 0;
color: #ddd;
max-width: calc(100% - 16px);
}
/* temporary notes */
.rfcEditorRemove::before {
position: absolute;
top: 0.2em;
right: 0.2em;
padding: 0.2em;
content: "The RFC Editor will remove this note";
color: #9e2a00; /* Arlen: WCAG 2019 */
background-color: #ffd; /* Arlen: WCAG 2019 */
}
.rfcEditorRemove {
position: relative;
padding-top: 1.8em;
background-color: #ffd; /* Arlen: WCAG 2019 */
border-radius: 3px;
}
.cref {
background-color: #ffd; /* Arlen: WCAG 2019 */
padding: 2px 4px;
}
.crefSource {
font-style: italic;
}
/* alternative layout for smaller screens */
@media screen and (max-width: 1023px) {
body {
padding-top: 2em;
}
#title {
padding: 1em 0;
}
h1 {
font-size: 24px;
}
h2 {
font-size: 20px;
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 38px;
}
#identifiers dd {
max-width: 60%;
}
#toc {
position: fixed;
z-index: 2;
top: 0;
right: 0;
padding: 0;
margin: 0;
background-color: inherit;
border-bottom: 1px solid #ccc;
}
#toc h2 {
margin: -1px 0 0 0;
padding: 4px 0 4px 6px;
padding-right: 1em;
min-width: 190px;
font-size: 1.1em;
text-align: right;
background-color: #444;
color: white;
cursor: pointer;
}
#toc h2::before { /* css hamburger */
float: right;
position: relative;
width: 1em;
height: 1px;
left: -164px;
margin: 6px 0 0 0;
background: white none repeat scroll 0 0;
box-shadow: 0 4px 0 0 white, 0 8px 0 0 white;
content: "";
}
#toc nav {
display: none;
padding: 0.5em 1em 1em;
overflow: auto;
height: calc(100vh - 48px);
border-left: 1px solid #ddd;
}
}
/* alternative layout for wide screens */
@media screen and (min-width: 1024px) {
body {
max-width: 724px;
margin: 42px auto;
padding-left: 1.5em;
padding-right: 29em;
}
#toc {
position: fixed;
top: 42px;
right: 42px;
width: 25%;
margin: 0;
padding: 0 1em;
z-index: 1;
}
#toc h2 {
border-top: none;
border-bottom: 1px solid #ddd;
font-size: 1em;
font-weight: normal;
margin: 0;
padding: 0.25em 1em 1em 0;
}
#toc nav {
display: block;
height: calc(90vh - 84px);
bottom: 0;
padding: 0.5em 0 0;
overflow: auto;
}
img { /* future proofing */
max-width: 100%;
height: auto;
}
}
/* pagination */
@media print {
body {
width: 100%;
}
p {
orphans: 3;
widows: 3;
}
#n-copyright-notice {
border-bottom: none;
}
#toc, #n-introduction {
page-break-before: always;
}
#toc {
border-top: none;
padding-top: 0;
}
figure, pre {
page-break-inside: avoid;
}
figure {
overflow: scroll;
}
pre.breakable {
break-inside: auto;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid;
}
h2+*, h3+*, h4+*, h5+*, h6+* {
page-break-before: avoid;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
font-size: 10pt;
}
table {
border: 1px solid #ddd;
}
td {
border-top: 1px solid #ddd;
}
}
/* This is commented out here, as the string-set: doesn't
pass W3C validation currently */
/*
.ears thead .left {
string-set: ears-top-left content();
}
.ears thead .center {
string-set: ears-top-center content();
}
.ears thead .right {
string-set: ears-top-right content();
}
.ears tfoot .left {
string-set: ears-bottom-left content();
}
.ears tfoot .center {
string-set: ears-bottom-center content();
}
.ears tfoot .right {
string-set: ears-bottom-right content();
}
*/
@page :first {
padding-top: 0;
@top-left {
content: normal;
border: none;
}
@top-center {
content: normal;
border: none;
}
@top-right {
content: normal;
border: none;
}
}
@page {
size: A4;
margin-bottom: 45mm;
padding-top: 20px;
/* The follwing is commented out here, but set appropriately by in code, as
the content depends on the document */
/*
@top-left {
content: 'Internet-Draft';
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@top-left {
content: string(ears-top-left);
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@top-center {
content: string(ears-top-center);
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@top-right {
content: string(ears-top-right);
vertical-align: bottom;
border-bottom: solid 1px #ccc;
}
@bottom-left {
content: string(ears-bottom-left);
vertical-align: top;
border-top: solid 1px #ccc;
}
@bottom-center {
content: string(ears-bottom-center);
vertical-align: top;
border-top: solid 1px #ccc;
}
@bottom-right {
content: '[Page ' counter(page) ']';
vertical-align: top;
border-top: solid 1px #ccc;
}
*/
}
/* Changes introduced to fix issues found during implementation */
/* Make sure links are clickable even if overlapped by following H* */
a {
z-index: 2;
}
/* Separate body from document info even without intervening H1 */
section {
clear: both;
}
/* Top align author divs, to avoid names without organization dropping level with org names */
.author {
vertical-align: top;
}
/* Leave room in document info to show Internet-Draft on one line */
#identifiers dt {
width: 8em;
}
/* Don't waste quite as much whitespace between label and value in doc info */
#identifiers dd {
margin-left: 1em;
}
/* Give floating toc a background color (needed when it's a div inside section */
#toc {
background-color: white;
}
/* Make the collapsed ToC header render white on gray also when it's a link */
@media screen and (max-width: 1023px) {
#toc h2 a,
#toc h2 a:link,
#toc h2 a:focus,
#toc h2 a:hover,
#toc a.toplink,
#toc a.toplink:hover {
color: white;
background-color: #444;
text-decoration: none;
}
}
/* Give the bottom of the ToC some whitespace */
@media screen and (min-width: 1024px) {
#toc {
padding: 0 0 1em 1em;
}
}
/* Style section numbers with more space between number and title */
.section-number {
padding-right: 0.5em;
}
/* prevent monospace from becoming overly large */
tt, code, pre, code {
font-size: 95%;
}
/* Fix the height/width aspect for ascii art*/
pre.sourcecode,
.art-text pre {
line-height: 1.12;
}
/* Add styling for a link in the ToC that points to the top of the document */
a.toplink {
float: right;
margin-right: 0.5em;
}
/* Fix the dl styling to match the RFC 7992 attributes */
dl > dt,
dl.dlParallel > dt {
float: left;
margin-right: 1em;
}
dl.dlNewline > dt {
float: none;
}
/* Provide styling for table cell text alignment */
table td.text-left,
table th.text-left {
text-align: left;
}
table td.text-center,
table th.text-center {
text-align: center;
}
table td.text-right,
table th.text-right {
text-align: right;
}
/* Make the alternative author contact informatio look less like just another
author, and group it closer with the primary author contact information */
.alternative-contact {
margin: 0.5em 0 0.25em 0;
}
address .non-ascii {
margin: 0 0 0 2em;
}
/* With it being possible to set tables with alignment
left, center, and right, { width: 100%; } does not make sense */
table {
width: auto;
}
/* Avoid reference text that sits in a block with very wide left margin,
because of a long floating dt label.*/
.references dd {
overflow: visible;
}
/* Control caption placement */
caption {
caption-side: bottom;
}
/* Limit the width of the author address vcard, so names in right-to-left
script don't end up on the other side of the page. */
address.vcard {
max-width: 30em;
margin-right: auto;
}
/* For address alignment dependent on LTR or RTL scripts */
address div.left {
text-align: left;
}
address div.right {
text-align: right;
}
/* Provide table alignment support. We can't use the alignX classes above
since they do unwanted things with caption and other styling. */
table.right {
margin-left: auto;
margin-right: 0;
}
table.center {
margin-left: auto;
margin-right: auto;
}
table.left {
margin-left: 0;
margin-right: auto;
}
/* Give the table caption label the same styling as the figcaption */
caption a[href] {
color: #222;
}
@media print {
.toplink {
display: none;
}
/* avoid overwriting the top border line with the ToC header */
#toc {
padding-top: 1px;
}
/* Avoid page breaks inside dl and author address entries */
.vcard {
page-break-inside: avoid;
}
}
/* Tweak the bcp14 keyword presentation */
.bcp14 {
font-variant: small-caps;
font-weight: bold;
font-size: 0.9em;
}
/* Tweak the invisible space above H* in order not to overlay links in text above */
h2 {
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 31px;
}
h3 {
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 24px;
}
h4 {
margin-top: -18px; /* provide offset for in-page anchors */
padding-top: 24px;
}
/* Float artwork pilcrow to the right */
@media screen {
.artwork a.pilcrow {
display: block;
line-height: 0.7;
margin-top: 0.15em;
}
}
/* Make pilcrows on dd visible */
@media screen {
dd:hover > a.pilcrow {
visibility: visible;
}
}
/* Make the placement of figcaption match that of a table's caption
by removing the figure's added bottom margin */
.alignLeft.art-text,
.alignCenter.art-text,
.alignRight.art-text {
margin-bottom: 0;
}
.alignLeft,
.alignCenter,
.alignRight {
margin: 1em 0 0 0;
}
/* In print, the pilcrow won't show on hover, so prevent it from taking up space,
possibly even requiring a new line */
@media print {
a.pilcrow {
display: none;
}
}
/* Styling for the external metadata */
div#external-metadata {
background-color: #eee;
padding: 0.5em;
margin-bottom: 0.5em;
display: none;
}
div#internal-metadata {
padding: 0.5em; /* to match the external-metadata padding */
}
/* Styling for title RFC Number */
h1#rfcnum {
clear: both;
margin: 0 0 -1em;
padding: 1em 0 0 0;
}
/* Make .olPercent look the same as <ol><li> */
dl.olPercent > dd {
margin-bottom: 0.25em;
min-height: initial;
}
/* Give aside some styling to set it apart */
aside {
border-left: 1px solid #ddd;
margin: 1em 0 1em 2em;
padding: 0.2em 2em;
}
aside > dl,
aside > ol,
aside > ul,
aside > table,
aside > p {
margin-bottom: 0.5em;
}
/* Additional page break settings */
@media print {
figcaption, table caption {
page-break-before: avoid;
}
}
/* Font size adjustments for print */
@media print {
body { font-size: 10pt; line-height: normal; max-width: 96%; }
h1 { font-size: 1.72em; padding-top: 1.5em; } /* 1*1.2*1.2*1.2 */
h2 { font-size: 1.44em; padding-top: 1.5em; } /* 1*1.2*1.2 */
h3 { font-size: 1.2em; padding-top: 1.5em; } /* 1*1.2 */
h4 { font-size: 1em; padding-top: 1.5em; }
h5, h6 { font-size: 1em; margin: initial; padding: 0.5em 0 0.3em; }
}
/* Sourcecode margin in print, when there's no pilcrow */
@media print {
.artwork,
.sourcecode {
margin-bottom: 1em;
}
}
/* Avoid narrow tables forcing too narrow table captions, which may render badly */
table {
min-width: 20em;
}
/* ol type a */
ol.type-a { list-style-type: lower-alpha; }
ol.type-A { list-style-type: upper-alpha; }
ol.type-i { list-style-type: lower-roman; }
ol.type-I { list-style-type: lower-roman; }
/* Apply the print table and row borders in general, on request from the RPC,
and increase the contrast between border and odd row background sligthtly */
table {
border: 1px solid #ddd;
}
td {
border-top: 1px solid #ddd;
}
tr:nth-child(2n+1) > td {
background-color: #f8f8f8;
}
/* Use style rules to govern display of the TOC. */
@media screen and (max-width: 1023px) {
#toc nav { display: none; }
#toc.active nav { display: block; }
}
/* Add support for keepWithNext */
.keepWithNext {
break-after: avoid-page;
break-after: avoid-page;
}
/* Add support for keepWithPrevious */
.keepWithPrevious {
break-before: avoid-page;
}
/* Change the approach to avoiding breaks inside artwork etc. */
figure, pre, table, .artwork, .sourcecode {
break-before: auto;
break-after: auto;
}
/* Avoid breaks between <dt> and <dd> */
dl {
break-before: auto;
break-inside: auto;
}
dt {
break-before: auto;
break-after: avoid-page;
}
dd {
break-before: avoid-page;
break-after: auto;
orphans: 3;
widows: 3
}
span.break, dd.break {
margin-bottom: 0;
min-height: 0;
break-before: auto;
break-inside: auto;
break-after: auto;
}
/* Undo break-before ToC */
@media print {
#toc {
break-before: auto;
}
}
/* Text in compact lists should not get extra bottim margin space,
since that would makes the list not compact */
ul.compact p, .ulCompact p,
ol.compact p, .olCompact p {
margin: 0;
}
/* But the list as a whole needs the extra space at the end */
section ul.compact,
section .ulCompact,
section ol.compact,
section .olCompact {
margin-bottom: 1em; /* same as p not within ul.compact etc. */
}
/* The tt and code background above interferes with for instance table cell
backgrounds. Changed to something a bit more selective. */
tt, code {
background-color: transparent;
}
p tt, p code, li tt, li code {
background-color: #f8f8f8;
}
/* Tweak the pre margin -- 0px doesn't come out well */
pre {
margin-top: 0.5px;
}
/* Tweak the comact list text */
ul.compact, .ulCompact,
ol.compact, .olCompact,
dl.compact, .dlCompact {
line-height: normal;
}
/* Don't add top margin for nested lists */
li > ul, li > ol, li > dl,
dd > ul, dd > ol, dd > dl,
dl > dd > dl {
margin-top: initial;
}
/* Elements that should not be rendered on the same line as a <dt> */
/* This should match the element list in writer.text.TextWriter.render_dl() */
dd > div.artwork:first-child,
dd > aside:first-child,
dd > figure:first-child,
dd > ol:first-child,
dd > div:first-child > pre.sourcecode,
dd > table:first-child,
dd > ul:first-child {
clear: left;
}
/* fix for weird browser behaviour when <dd/> is empty */
dt+dd:empty::before{
content: "\00a0";
}
/* Make paragraph spacing inside <li> smaller than in body text, to fit better within the list */
li > p {
margin-bottom: 0.5em
}
/* Don't let p margin spill out from inside list items */
li > p:last-of-type {
margin-bottom: 0;
}
</style>
<link href="rfc-local.css" rel="stylesheet" type="text/css">
<link href="https://dx.doi.org/10.17487/rfc9204" rel="alternate">
<link href="urn:issn:2070-1721" rel="alternate">
<link href="https://datatracker.ietf.org/doc/draft-ietf-quic-qpack-latest" rel="prev">
</head>
<body>
<script src="https://www.rfc-editor.org/js/metadata.min.js"></script>
<table class="ears">
<thead><tr>
<td class="left">RFC 9204</td>
<td class="center">QPACK</td>
<td class="right">June 2022</td>
</tr></thead>
<tfoot><tr>
<td class="left">Krasic, et al.</td>
<td class="center">Standards Track</td>
<td class="right">[Page]</td>
</tr></tfoot>
</table>
<div id="external-metadata" class="document-information"></div>
<div id="internal-metadata" class="document-information">
<dl id="identifiers">
<dt class="label-stream">Stream:</dt>
<dd class="stream">Internet Engineering Task Force (IETF)</dd>
<dt class="label-rfc">RFC:</dt>
<dd class="rfc"><a href="https://www.rfc-editor.org/rfc/rfc9204" class="eref">9204</a></dd>
<dt class="label-category">Category:</dt>
<dd class="category">Standards Track</dd>
<dt class="label-published">Published:</dt>
<dd class="published">
<time datetime="2022-06" class="published">June 2022</time>
</dd>
<dt class="label-issn">ISSN:</dt>
<dd class="issn">2070-1721</dd>
<dt class="label-authors">Authors:</dt>
<dd class="authors">
<div class="author">
<div class="author-name">C. Krasic</div>
</div>
<div class="author">
<div class="author-name">M. Bishop</div>
<div class="org">Akamai Technologies</div>
</div>
<div class="author">
<div class="author-name">A. Frindell, <span class="editor">Ed.</span>
</div>
<div class="org">Facebook</div>
</div>
</dd>
</dl>
</div>
<h1 id="rfcnum">RFC 9204</h1>
<h1 id="title">QPACK: Field Compression for HTTP/3</h1>
<section id="section-abstract">
<h2 id="abstract"><a href="#abstract" class="selfRef">Abstract</a></h2>
<p id="section-abstract-1">This specification defines QPACK: a compression format for efficiently
representing HTTP fields that is to be used in HTTP/3. This is a variation of
HPACK compression that seeks to reduce head-of-line blocking.<a href="#section-abstract-1" class="pilcrow">¶</a></p>
</section>
<div id="status-of-memo">
<section id="section-boilerplate.1">
<h2 id="name-status-of-this-memo">
<a href="#name-status-of-this-memo" class="section-name selfRef">Status of This Memo</a>
</h2>
<p id="section-boilerplate.1-1">
This is an Internet Standards Track document.<a href="#section-boilerplate.1-1" class="pilcrow">¶</a></p>
<p id="section-boilerplate.1-2">
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.<a href="#section-boilerplate.1-2" class="pilcrow">¶</a></p>
<p id="section-boilerplate.1-3">
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
<span><a href="https://www.rfc-editor.org/info/rfc9204">https://www.rfc-editor.org/info/rfc9204</a></span>.<a href="#section-boilerplate.1-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="copyright">
<section id="section-boilerplate.2">
<h2 id="name-copyright-notice">
<a href="#name-copyright-notice" class="section-name selfRef">Copyright Notice</a>
</h2>
<p id="section-boilerplate.2-1">
Copyright (c) 2022 IETF Trust and the persons identified as the
document authors. All rights reserved.<a href="#section-boilerplate.2-1" class="pilcrow">¶</a></p>
<p id="section-boilerplate.2-2">
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<span><a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a></span>) 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 Revised BSD License text as described in
Section 4.e of the Trust Legal Provisions and are provided without
warranty as described in the Revised BSD License.<a href="#section-boilerplate.2-2" class="pilcrow">¶</a></p>
</section>
</div>
<div id="toc">
<section id="section-toc.1">
<a href="#" onclick="scroll(0,0)" class="toplink">▲</a><h2 id="name-table-of-contents">
<a href="#name-table-of-contents" class="section-name selfRef">Table of Contents</a>
</h2>
<nav class="toc"><ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1">
<p id="section-toc.1-1.1.1" class="keepWithNext"><a href="#section-1" class="xref">1</a>. <a href="#name-introduction" class="xref">Introduction</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1.2.1">
<p id="section-toc.1-1.1.2.1.1" class="keepWithNext"><a href="#section-1.1" class="xref">1.1</a>. <a href="#name-conventions-and-definitions" class="xref">Conventions and Definitions</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.1.2.2">
<p id="section-toc.1-1.1.2.2.1" class="keepWithNext"><a href="#section-1.2" class="xref">1.2</a>. <a href="#name-notational-conventions" class="xref">Notational Conventions</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2">
<p id="section-toc.1-1.2.1"><a href="#section-2" class="xref">2</a>. <a href="#name-compression-process-overvie" class="xref">Compression Process Overview</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.1">
<p id="section-toc.1-1.2.2.1.1"><a href="#section-2.1" class="xref">2.1</a>. <a href="#name-encoder" class="xref">Encoder</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.1.2.1">
<p id="section-toc.1-1.2.2.1.2.1.1"><a href="#section-2.1.1" class="xref">2.1.1</a>. <a href="#name-limits-on-dynamic-table-ins" class="xref">Limits on Dynamic Table Insertions</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.1.2.2">
<p id="section-toc.1-1.2.2.1.2.2.1"><a href="#section-2.1.2" class="xref">2.1.2</a>. <a href="#name-blocked-streams" class="xref">Blocked Streams</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.1.2.3">
<p id="section-toc.1-1.2.2.1.2.3.1"><a href="#section-2.1.3" class="xref">2.1.3</a>. <a href="#name-avoiding-flow-control-deadl" class="xref">Avoiding Flow-Control Deadlocks</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.1.2.4">
<p id="section-toc.1-1.2.2.1.2.4.1"><a href="#section-2.1.4" class="xref">2.1.4</a>. <a href="#name-known-received-count" class="xref">Known Received Count</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.2">
<p id="section-toc.1-1.2.2.2.1"><a href="#section-2.2" class="xref">2.2</a>. <a href="#name-decoder" class="xref">Decoder</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.2.2.1">
<p id="section-toc.1-1.2.2.2.2.1.1"><a href="#section-2.2.1" class="xref">2.2.1</a>. <a href="#name-blocked-decoding" class="xref">Blocked Decoding</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.2.2.2">
<p id="section-toc.1-1.2.2.2.2.2.1"><a href="#section-2.2.2" class="xref">2.2.2</a>. <a href="#name-state-synchronization" class="xref">State Synchronization</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.2.2.2.2.3">
<p id="section-toc.1-1.2.2.2.2.3.1"><a href="#section-2.2.3" class="xref">2.2.3</a>. <a href="#name-invalid-references" class="xref">Invalid References</a></p>
</li>
</ul>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3">
<p id="section-toc.1-1.3.1"><a href="#section-3" class="xref">3</a>. <a href="#name-reference-tables" class="xref">Reference Tables</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.1">
<p id="section-toc.1-1.3.2.1.1"><a href="#section-3.1" class="xref">3.1</a>. <a href="#name-static-table" class="xref">Static Table</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2">
<p id="section-toc.1-1.3.2.2.1"><a href="#section-3.2" class="xref">3.2</a>. <a href="#name-dynamic-table" class="xref">Dynamic Table</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2.2.1">
<p id="section-toc.1-1.3.2.2.2.1.1"><a href="#section-3.2.1" class="xref">3.2.1</a>. <a href="#name-dynamic-table-size" class="xref">Dynamic Table Size</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2.2.2">
<p id="section-toc.1-1.3.2.2.2.2.1"><a href="#section-3.2.2" class="xref">3.2.2</a>. <a href="#name-dynamic-table-capacity-and-" class="xref">Dynamic Table Capacity and Eviction</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2.2.3">
<p id="section-toc.1-1.3.2.2.2.3.1"><a href="#section-3.2.3" class="xref">3.2.3</a>. <a href="#name-maximum-dynamic-table-capac" class="xref">Maximum Dynamic Table Capacity</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2.2.4">
<p id="section-toc.1-1.3.2.2.2.4.1"><a href="#section-3.2.4" class="xref">3.2.4</a>. <a href="#name-absolute-indexing" class="xref">Absolute Indexing</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2.2.5">
<p id="section-toc.1-1.3.2.2.2.5.1"><a href="#section-3.2.5" class="xref">3.2.5</a>. <a href="#name-relative-indexing" class="xref">Relative Indexing</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.3.2.2.2.6">
<p id="section-toc.1-1.3.2.2.2.6.1"><a href="#section-3.2.6" class="xref">3.2.6</a>. <a href="#name-post-base-indexing" class="xref">Post-Base Indexing</a></p>
</li>
</ul>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4">
<p id="section-toc.1-1.4.1"><a href="#section-4" class="xref">4</a>. <a href="#name-wire-format" class="xref">Wire Format</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1">
<p id="section-toc.1-1.4.2.1.1"><a href="#section-4.1" class="xref">4.1</a>. <a href="#name-primitives" class="xref">Primitives</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1.2.1">
<p id="section-toc.1-1.4.2.1.2.1.1"><a href="#section-4.1.1" class="xref">4.1.1</a>. <a href="#name-prefixed-integers" class="xref">Prefixed Integers</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.1.2.2">
<p id="section-toc.1-1.4.2.1.2.2.1"><a href="#section-4.1.2" class="xref">4.1.2</a>. <a href="#name-string-literals" class="xref">String Literals</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.2">
<p id="section-toc.1-1.4.2.2.1"><a href="#section-4.2" class="xref">4.2</a>. <a href="#name-encoder-and-decoder-streams" class="xref">Encoder and Decoder Streams</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3">
<p id="section-toc.1-1.4.2.3.1"><a href="#section-4.3" class="xref">4.3</a>. <a href="#name-encoder-instructions" class="xref">Encoder Instructions</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.1">
<p id="section-toc.1-1.4.2.3.2.1.1"><a href="#section-4.3.1" class="xref">4.3.1</a>. <a href="#name-set-dynamic-table-capacity" class="xref">Set Dynamic Table Capacity</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.2">
<p id="section-toc.1-1.4.2.3.2.2.1"><a href="#section-4.3.2" class="xref">4.3.2</a>. <a href="#name-insert-with-name-reference" class="xref">Insert with Name Reference</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.3">
<p id="section-toc.1-1.4.2.3.2.3.1"><a href="#section-4.3.3" class="xref">4.3.3</a>. <a href="#name-insert-with-literal-name" class="xref">Insert with Literal Name</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.3.2.4">
<p id="section-toc.1-1.4.2.3.2.4.1"><a href="#section-4.3.4" class="xref">4.3.4</a>. <a href="#name-duplicate" class="xref">Duplicate</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4">
<p id="section-toc.1-1.4.2.4.1"><a href="#section-4.4" class="xref">4.4</a>. <a href="#name-decoder-instructions" class="xref">Decoder Instructions</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4.2.1">
<p id="section-toc.1-1.4.2.4.2.1.1"><a href="#section-4.4.1" class="xref">4.4.1</a>. <a href="#name-section-acknowledgment" class="xref">Section Acknowledgment</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4.2.2">
<p id="section-toc.1-1.4.2.4.2.2.1"><a href="#section-4.4.2" class="xref">4.4.2</a>. <a href="#name-stream-cancellation" class="xref">Stream Cancellation</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.4.2.3">
<p id="section-toc.1-1.4.2.4.2.3.1"><a href="#section-4.4.3" class="xref">4.4.3</a>. <a href="#name-insert-count-increment" class="xref">Insert Count Increment</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5">
<p id="section-toc.1-1.4.2.5.1"><a href="#section-4.5" class="xref">4.5</a>. <a href="#name-field-line-representations" class="xref">Field Line Representations</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.1">
<p id="section-toc.1-1.4.2.5.2.1.1"><a href="#section-4.5.1" class="xref">4.5.1</a>. <a href="#name-encoded-field-section-prefi" class="xref">Encoded Field Section Prefix</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.2">
<p id="section-toc.1-1.4.2.5.2.2.1"><a href="#section-4.5.2" class="xref">4.5.2</a>. <a href="#name-indexed-field-line" class="xref">Indexed Field Line</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.3">
<p id="section-toc.1-1.4.2.5.2.3.1"><a href="#section-4.5.3" class="xref">4.5.3</a>. <a href="#name-indexed-field-line-with-pos" class="xref">Indexed Field Line with Post-Base Index</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.4">
<p id="section-toc.1-1.4.2.5.2.4.1"><a href="#section-4.5.4" class="xref">4.5.4</a>. <a href="#name-literal-field-line-with-nam" class="xref">Literal Field Line with Name Reference</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.5">
<p id="section-toc.1-1.4.2.5.2.5.1"><a href="#section-4.5.5" class="xref">4.5.5</a>. <a href="#name-literal-field-line-with-pos" class="xref">Literal Field Line with Post-Base Name Reference</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.4.2.5.2.6">
<p id="section-toc.1-1.4.2.5.2.6.1"><a href="#section-4.5.6" class="xref">4.5.6</a>. <a href="#name-literal-field-line-with-lit" class="xref">Literal Field Line with Literal Name</a></p>
</li>
</ul>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.5">
<p id="section-toc.1-1.5.1"><a href="#section-5" class="xref">5</a>. <a href="#name-configuration" class="xref">Configuration</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.6">
<p id="section-toc.1-1.6.1"><a href="#section-6" class="xref">6</a>. <a href="#name-error-handling" class="xref">Error Handling</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7">
<p id="section-toc.1-1.7.1"><a href="#section-7" class="xref">7</a>. <a href="#name-security-considerations" class="xref">Security Considerations</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.1">
<p id="section-toc.1-1.7.2.1.1"><a href="#section-7.1" class="xref">7.1</a>. <a href="#name-probing-dynamic-table-state" class="xref">Probing Dynamic Table State</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.1.2.1">
<p id="section-toc.1-1.7.2.1.2.1.1"><a href="#section-7.1.1" class="xref">7.1.1</a>. <a href="#name-applicability-to-qpack-and-" class="xref">Applicability to QPACK and HTTP</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.1.2.2">
<p id="section-toc.1-1.7.2.1.2.2.1"><a href="#section-7.1.2" class="xref">7.1.2</a>. <a href="#name-mitigation" class="xref">Mitigation</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.1.2.3">
<p id="section-toc.1-1.7.2.1.2.3.1"><a href="#section-7.1.3" class="xref">7.1.3</a>. <a href="#name-never-indexed-literals" class="xref">Never-Indexed Literals</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.2">
<p id="section-toc.1-1.7.2.2.1"><a href="#section-7.2" class="xref">7.2</a>. <a href="#name-static-huffman-encoding" class="xref">Static Huffman Encoding</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.3">
<p id="section-toc.1-1.7.2.3.1"><a href="#section-7.3" class="xref">7.3</a>. <a href="#name-memory-consumption" class="xref">Memory Consumption</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.7.2.4">
<p id="section-toc.1-1.7.2.4.1"><a href="#section-7.4" class="xref">7.4</a>. <a href="#name-implementation-limits" class="xref">Implementation Limits</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8">
<p id="section-toc.1-1.8.1"><a href="#section-8" class="xref">8</a>. <a href="#name-iana-considerations" class="xref">IANA Considerations</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8.2.1">
<p id="section-toc.1-1.8.2.1.1"><a href="#section-8.1" class="xref">8.1</a>. <a href="#name-settings-registration" class="xref">Settings Registration</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8.2.2">
<p id="section-toc.1-1.8.2.2.1"><a href="#section-8.2" class="xref">8.2</a>. <a href="#name-stream-type-registration" class="xref">Stream Type Registration</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.8.2.3">
<p id="section-toc.1-1.8.2.3.1"><a href="#section-8.3" class="xref">8.3</a>. <a href="#name-error-code-registration" class="xref">Error Code Registration</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9">
<p id="section-toc.1-1.9.1"><a href="#section-9" class="xref">9</a>. <a href="#name-references" class="xref">References</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.1">
<p id="section-toc.1-1.9.2.1.1"><a href="#section-9.1" class="xref">9.1</a>. <a href="#name-normative-references" class="xref">Normative References</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.9.2.2">
<p id="section-toc.1-1.9.2.2.1"><a href="#section-9.2" class="xref">9.2</a>. <a href="#name-informative-references" class="xref">Informative References</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.10">
<p id="section-toc.1-1.10.1"><a href="#appendix-A" class="xref">Appendix A</a>. <a href="#name-static-table-2" class="xref">Static Table</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11">
<p id="section-toc.1-1.11.1"><a href="#appendix-B" class="xref">Appendix B</a>. <a href="#name-encoding-and-decoding-examp" class="xref">Encoding and Decoding Examples</a></p>
<ul class="compact toc ulBare ulEmpty">
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11.2.1">
<p id="section-toc.1-1.11.2.1.1"><a href="#appendix-B.1" class="xref">B.1</a>. <a href="#name-literal-field-line-with-name-" class="xref">Literal Field Line with Name Reference</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11.2.2">
<p id="section-toc.1-1.11.2.2.1"><a href="#appendix-B.2" class="xref">B.2</a>. <a href="#name-dynamic-table-2" class="xref">Dynamic Table</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11.2.3">
<p id="section-toc.1-1.11.2.3.1"><a href="#appendix-B.3" class="xref">B.3</a>. <a href="#name-speculative-insert" class="xref">Speculative Insert</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11.2.4">
<p id="section-toc.1-1.11.2.4.1"><a href="#appendix-B.4" class="xref">B.4</a>. <a href="#name-duplicate-instruction-strea" class="xref">Duplicate Instruction, Stream Cancellation</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.11.2.5">
<p id="section-toc.1-1.11.2.5.1"><a href="#appendix-B.5" class="xref">B.5</a>. <a href="#name-dynamic-table-insert-evicti" class="xref">Dynamic Table Insert, Eviction</a></p>
</li>
</ul>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.12">
<p id="section-toc.1-1.12.1"><a href="#appendix-C" class="xref">Appendix C</a>. <a href="#name-sample-single-pass-encoding" class="xref">Sample Single-Pass Encoding Algorithm</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.13">
<p id="section-toc.1-1.13.1"><a href="#appendix-D" class="xref"></a><a href="#name-acknowledgments" class="xref">Acknowledgments</a></p>
</li>
<li class="compact toc ulBare ulEmpty" id="section-toc.1-1.14">
<p id="section-toc.1-1.14.1"><a href="#appendix-E" class="xref"></a><a href="#name-authors-addresses" class="xref">Authors' Addresses</a></p>
</li>
</ul>
</nav>
</section>
</div>
<div id="introduction">
<section id="section-1">
<h2 id="name-introduction">
<a href="#section-1" class="section-number selfRef">1. </a><a href="#name-introduction" class="section-name selfRef">Introduction</a>
</h2>
<p id="section-1-1">The QUIC transport protocol (<span>[<a href="#QUIC-TRANSPORT" class="xref">QUIC-TRANSPORT</a>]</span>) is designed to support
HTTP semantics, and its design subsumes many of the features of HTTP/2
(<span>[<a href="#HTTP2" class="xref">HTTP/2</a>]</span>). HTTP/2 uses HPACK (<span>[<a href="#RFC7541" class="xref">RFC7541</a>]</span>) for compression of the header
and trailer sections. If HPACK were used for HTTP/3 (<span>[<a href="#HTTP3" class="xref">HTTP/3</a>]</span>), it would
induce head-of-line blocking for field sections due to built-in assumptions of a
total ordering across frames on all streams.<a href="#section-1-1" class="pilcrow">¶</a></p>
<p id="section-1-2">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.<a href="#section-1-2" class="pilcrow">¶</a></p>
<div id="conventions-and-definitions">
<section id="section-1.1">
<h3 id="name-conventions-and-definitions">
<a href="#section-1.1" class="section-number selfRef">1.1. </a><a href="#name-conventions-and-definitions" class="section-name selfRef">Conventions and Definitions</a>
</h3>
<p id="section-1.1-1">The key words "<span class="bcp14">MUST</span>", "<span class="bcp14">MUST NOT</span>", "<span class="bcp14">REQUIRED</span>", "<span class="bcp14">SHALL</span>", "<span class="bcp14">SHALL NOT</span>", "<span class="bcp14">SHOULD</span>",
"<span class="bcp14">SHOULD NOT</span>", "<span class="bcp14">RECOMMENDED</span>", "<span class="bcp14">NOT RECOMMENDED</span>", "<span class="bcp14">MAY</span>", and "<span class="bcp14">OPTIONAL</span>" in this
document are to be interpreted as described in BCP 14 <span>[<a href="#RFC2119" class="xref">RFC2119</a>]</span> <span>[<a href="#RFC8174" class="xref">RFC8174</a>]</span>
when, and only when, they appear in all capitals, as shown here.<a href="#section-1.1-1" class="pilcrow">¶</a></p>
<p id="section-1.1-2">The following terms are used in this document:<a href="#section-1.1-2" class="pilcrow">¶</a></p>
<span class="break"></span><dl class="dlParallel" id="section-1.1-3">
<dt id="section-1.1-3.1">HTTP fields:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.2">
<p id="section-1.1-3.2.1">Metadata sent as part of an HTTP message. The term encompasses both header
and trailer fields. Colloquially, the term "headers" has often been used to
refer to HTTP header fields and trailer fields; this document uses "fields"
for generality.<a href="#section-1.1-3.2.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.3">HTTP field line:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.4">
<p id="section-1.1-3.4.1">A name-value pair sent as part of an HTTP field section. See Sections <a href="https://www.rfc-editor.org/rfc/rfc9110#section-6.3" class="relref">6.3</a> and <a href="https://www.rfc-editor.org/rfc/rfc9110#section-6.5" class="relref">6.5</a> of <span>[<a href="#HTTP" class="xref">HTTP</a>]</span>.<a href="#section-1.1-3.4.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.5">HTTP field value:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.6">
<p id="section-1.1-3.6.1">Data associated with a field name, composed from all field line values with
that field name in that section, concatenated together with
comma separators.<a href="#section-1.1-3.6.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.7">Field section:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.8">
<p id="section-1.1-3.8.1">An ordered collection of HTTP field lines associated with an HTTP message. A
field section can contain multiple field lines with the same name. It can
also contain duplicate field lines. An HTTP message can include both header
and trailer sections.<a href="#section-1.1-3.8.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.9">Representation:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.10">
<p id="section-1.1-3.10.1">An instruction that represents a field line, possibly by reference to the
dynamic and static tables.<a href="#section-1.1-3.10.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.11">Encoder:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.12">
<p id="section-1.1-3.12.1">An implementation that encodes field sections.<a href="#section-1.1-3.12.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.13">Decoder:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.14">
<p id="section-1.1-3.14.1">An implementation that decodes encoded field sections.<a href="#section-1.1-3.14.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.15">Absolute Index:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.16">
<p id="section-1.1-3.16.1">A unique index for each entry in the dynamic table.<a href="#section-1.1-3.16.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.17">Base:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.18">
<p id="section-1.1-3.18.1">A reference point for relative and post-Base indices. Representations that
reference dynamic table entries are relative to a Base.<a href="#section-1.1-3.18.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.1-3.19">Insert Count:</dt>
<dd style="margin-left: 1.5em" id="section-1.1-3.20">
<p id="section-1.1-3.20.1">The total number of entries inserted in the dynamic table.<a href="#section-1.1-3.20.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
</dl>
<p id="section-1.1-4">Note that QPACK is a name, not an abbreviation.<a href="#section-1.1-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="notational-conventions">
<section id="section-1.2">
<h3 id="name-notational-conventions">
<a href="#section-1.2" class="section-number selfRef">1.2. </a><a href="#name-notational-conventions" class="section-name selfRef">Notational Conventions</a>
</h3>
<p id="section-1.2-1">Diagrams in this document use the format described in <span><a href="https://www.rfc-editor.org/rfc/rfc2360#section-3.1" class="relref">Section 3.1</a> of [<a href="#RFC2360" class="xref">RFC2360</a>]</span>, with the following additional conventions:<a href="#section-1.2-1" class="pilcrow">¶</a></p>
<span class="break"></span><dl class="dlParallel" id="section-1.2-2">
<dt id="section-1.2-2.1">x (A)</dt>
<dd style="margin-left: 1.5em" id="section-1.2-2.2">
<p id="section-1.2-2.2.1">Indicates that x is A bits long.<a href="#section-1.2-2.2.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.2-2.3">x (A+)</dt>
<dd style="margin-left: 1.5em" id="section-1.2-2.4">
<p id="section-1.2-2.4.1">Indicates that x uses the prefixed integer encoding defined in
<a href="#prefixed-integers" class="xref">Section 4.1.1</a>, beginning with an A-bit prefix.<a href="#section-1.2-2.4.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-1.2-2.5">x ...</dt>
<dd style="margin-left: 1.5em" id="section-1.2-2.6">
<p id="section-1.2-2.6.1">Indicates that x is variable length and extends to the end of the region.<a href="#section-1.2-2.6.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
</dl>
</section>
</div>
</section>
</div>
<div id="compression-process-overview">
<section id="section-2">
<h2 id="name-compression-process-overvie">
<a href="#section-2" class="section-number selfRef">2. </a><a href="#name-compression-process-overvie" class="section-name selfRef">Compression Process Overview</a>
</h2>
<p id="section-2-1">Like HPACK, QPACK uses two tables for associating field lines ("headers") to
indices. The static table (<a href="#header-table-static" class="xref">Section 3.1</a>) is predefined and contains
common header field lines (some of them with an empty value). The dynamic table
(<a href="#header-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 both header and trailer field lines in the
encoded field sections.<a href="#section-2-1" class="pilcrow">¶</a></p>
<p id="section-2-2">QPACK defines unidirectional streams for sending instructions from encoder to
decoder and vice versa.<a href="#section-2-2" class="pilcrow">¶</a></p>
<div id="encoder">
<section id="section-2.1">
<h3 id="name-encoder">
<a href="#section-2.1" class="section-number selfRef">2.1. </a><a href="#name-encoder" class="section-name selfRef">Encoder</a>
</h3>
<p id="section-2.1-1">An encoder converts a header or trailer section into a series of representations
by emitting either an indexed or a literal representation for each field line in
the list; see <a href="#field-line-representations" class="xref">Section 4.5</a>. Indexed representations achieve
high compression by replacing the literal name and possibly the value with an
index to either the static or dynamic table. 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 acknowledgment indicating the entry
is available at the decoder.<a href="#section-2.1-1" class="pilcrow">¶</a></p>
<p id="section-2.1-2">An encoder <span class="bcp14">MAY</span> insert any entry in the dynamic table it chooses; it is not
limited to field lines it is compressing.<a href="#section-2.1-2" class="pilcrow">¶</a></p>
<p id="section-2.1-3">QPACK preserves the ordering of field lines within each field section. An
encoder <span class="bcp14">MUST</span> emit field representations in the order they appear in the input
field section.<a href="#section-2.1-3" class="pilcrow">¶</a></p>
<p id="section-2.1-4">QPACK is designed to place the burden of optional state tracking on the encoder,
resulting in relatively simple decoders.<a href="#section-2.1-4" class="pilcrow">¶</a></p>
<div id="blocked-insertion">
<section id="section-2.1.1">
<h4 id="name-limits-on-dynamic-table-ins">
<a href="#section-2.1.1" class="section-number selfRef">2.1.1. </a><a href="#name-limits-on-dynamic-table-ins" class="section-name selfRef">Limits on Dynamic Table Insertions</a>
</h4>
<p id="section-2.1.1-1">Inserting entries into the dynamic table might not be possible if the table
contains entries that cannot be evicted.<a href="#section-2.1.1-1" class="pilcrow">¶</a></p>
<p id="section-2.1.1-2">A dynamic table entry cannot be evicted immediately after insertion, even if it
has never been referenced. Once the insertion of a dynamic table entry has been
acknowledged and there are no outstanding references to the entry in
unacknowledged representations, the entry becomes evictable. Note that
references on the encoder stream never preclude the eviction of an entry,
because those references are guaranteed to be processed before the instruction
evicting the entry.<a href="#section-2.1.1-2" class="pilcrow">¶</a></p>
<p id="section-2.1.1-3">If the dynamic table does not contain enough room for a new entry without
evicting other entries, and the entries that would be evicted are not
evictable, the encoder <span class="bcp14">MUST NOT</span> insert that entry into the dynamic table
(including duplicates of existing entries). In order to avoid this, an encoder
that uses the dynamic table has to keep track of each dynamic table entry
referenced by each field section until those representations are acknowledged by
the decoder; see <a href="#header-acknowledgment" class="xref">Section 4.4.1</a>.<a href="#section-2.1.1-3" class="pilcrow">¶</a></p>
<div id="avoiding-prohibited-insertions">
<section id="section-2.1.1.1">
<h5 id="name-avoiding-prohibited-inserti">
<a href="#section-2.1.1.1" class="section-number selfRef">2.1.1.1. </a><a href="#name-avoiding-prohibited-inserti" class="section-name selfRef">Avoiding Prohibited Insertions</a>
</h5>
<p id="section-2.1.1.1-1">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
(<a href="#duplicate" class="xref">Section 4.3.4</a>) and reference the duplicate instead.<a href="#section-2.1.1.1-1" class="pilcrow">¶</a></p>
<p id="section-2.1.1.1-2">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 (<a href="#indexing" class="xref">Section 3.2.4</a>) 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.<a href="#section-2.1.1.1-2" class="pilcrow">¶</a></p>
<span id="name-draining-dynamic-table-entr"></span><div id="fig-draining-index">
<figure id="figure-1">
<div class="alignLeft art-ascii-art art-text artwork" id="section-2.1.1.1-3.1">
<pre>
<-- Newer Entries Older Entries -->
(Larger Indices) (Smaller Indices)
+--------+---------------------------------+----------+
| Unused | Referenceable | Draining |
| Space | Entries | Entries |
+--------+---------------------------------+----------+
^ ^ ^
| | |
Insertion Point Draining Index Dropping
Point
</pre>
</div>
<figcaption><a href="#figure-1" class="selfRef">Figure 1</a>:
<a href="#name-draining-dynamic-table-entr" class="selfRef">Draining Dynamic Table Entries</a>
</figcaption></figure>
</div>
</section>
</div>
</section>
</div>
<div id="blocked-streams">
<section id="section-2.1.2">
<h4 id="name-blocked-streams">
<a href="#section-2.1.2" class="section-number selfRef">2.1.2. </a><a href="#name-blocked-streams" class="section-name selfRef">Blocked Streams</a>
</h4>
<p id="section-2.1.2-1">Because QUIC does not guarantee order between data on different streams, a
decoder might encounter a representation that references a dynamic table entry
that it has not yet received.<a href="#section-2.1.2-1" class="pilcrow">¶</a></p>
<p id="section-2.1.2-2">Each encoded field section contains a Required Insert Count (<a href="#header-prefix" class="xref">Section 4.5.1</a>),
the lowest possible value for the Insert Count with which the field section can
be decoded. For a field section encoded using 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 field section encoded with no references
to the dynamic table, the Required Insert Count is zero.<a href="#section-2.1.2-2" class="pilcrow">¶</a></p>
<p id="section-2.1.2-3">When the decoder receives an encoded field section with a Required Insert Count
greater than its own Insert Count, the stream cannot be processed immediately
and is considered "blocked"; see <a href="#blocked-decoding" class="xref">Section 2.2.1</a>.<a href="#section-2.1.2-3" class="pilcrow">¶</a></p>
<p id="section-2.1.2-4">The decoder specifies an upper bound on the number of streams that can be
blocked using the SETTINGS_QPACK_BLOCKED_STREAMS setting; see <a href="#configuration" class="xref">Section 5</a>.
An encoder <span class="bcp14">MUST</span> limit the number of streams that could become blocked to the
value of SETTINGS_QPACK_BLOCKED_STREAMS at all times. If a decoder encounters
more blocked streams than it promised to support, it <span class="bcp14">MUST</span> treat this as a
connection error of type QPACK_DECOMPRESSION_FAILED.<a href="#section-2.1.2-4" class="pilcrow">¶</a></p>
<p id="section-2.1.2-5">Note that the decoder might not become blocked on every stream that risks
becoming blocked.<a href="#section-2.1.2-5" class="pilcrow">¶</a></p>
<p id="section-2.1.2-6">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 can avoid the risk of blocking by only referencing
dynamic table entries that have been acknowledged, but this could mean using
literals. Since literals make the encoded field section larger, this can result
in the encoder becoming blocked on congestion or flow-control limits.<a href="#section-2.1.2-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="avoiding-flow-control-deadlocks">
<section id="section-2.1.3">
<h4 id="name-avoiding-flow-control-deadl">
<a href="#section-2.1.3" class="section-number selfRef">2.1.3. </a><a href="#name-avoiding-flow-control-deadl" class="section-name selfRef">Avoiding Flow-Control Deadlocks</a>
</h4>
<p id="section-2.1.3-1">Writing instructions on streams that are limited by flow control can produce
deadlocks.<a href="#section-2.1.3-1" class="pilcrow">¶</a></p>
<p id="section-2.1.3-2">A decoder might stop issuing flow-control credit on the stream that carries an
encoded field section until the necessary updates are received on the encoder
stream. If the granting of flow-control credit on the encoder stream (or the
connection as a whole) depends on the consumption and release of data on the
stream carrying the encoded field section, a deadlock might result.<a href="#section-2.1.3-2" class="pilcrow">¶</a></p>
<p id="section-2.1.3-3">More generally, a stream containing a large instruction can become deadlocked if
the decoder withholds flow-control credit until the instruction is completely
received.<a href="#section-2.1.3-3" class="pilcrow">¶</a></p>
<p id="section-2.1.3-4">To avoid these deadlocks, an encoder <span class="bcp14">SHOULD NOT</span> write an instruction unless
sufficient stream and connection flow-control credit is available for the entire
instruction.<a href="#section-2.1.3-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="known-received-count">
<section id="section-2.1.4">
<h4 id="name-known-received-count">
<a href="#section-2.1.4" class="section-number selfRef">2.1.4. </a><a href="#name-known-received-count" class="section-name selfRef">Known Received Count</a>
</h4>
<p id="section-2.1.4-1">The Known Received Count is the total number of dynamic table insertions and
duplications acknowledged by the decoder. The encoder tracks the Known Received
Count in order to identify which dynamic table entries can be referenced without
potentially blocking a stream. The decoder tracks the Known Received Count in
order to be able to send Insert Count Increment instructions.<a href="#section-2.1.4-1" class="pilcrow">¶</a></p>
<p id="section-2.1.4-2">A Section Acknowledgment instruction (<a href="#header-acknowledgment" class="xref">Section 4.4.1</a>) implies that
the decoder has received all dynamic table state necessary to decode the field
section. If the Required Insert Count of the acknowledged field section is
greater than the current Known Received Count, the Known Received Count is
updated to that Required Insert Count value.<a href="#section-2.1.4-2" class="pilcrow">¶</a></p>
<p id="section-2.1.4-3">An Insert Count Increment instruction (<a href="#insert-count-increment" class="xref">Section 4.4.3</a>) increases the
Known Received Count by its Increment parameter. See <a href="#new-table-entries" class="xref">Section 2.2.2.3</a> for
guidance.<a href="#section-2.1.4-3" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="decoder">
<section id="section-2.2">
<h3 id="name-decoder">
<a href="#section-2.2" class="section-number selfRef">2.2. </a><a href="#name-decoder" class="section-name selfRef">Decoder</a>
</h3>
<p id="section-2.2-1">As in HPACK, the decoder processes a series of representations and emits the
corresponding field sections. It also processes instructions received on the
encoder stream that modify the dynamic table. Note that encoded field sections
and encoder stream instructions arrive on separate streams. This is unlike
HPACK, where encoded field sections (header blocks) can contain instructions
that modify the dynamic table, and there is no dedicated stream of HPACK
instructions.<a href="#section-2.2-1" class="pilcrow">¶</a></p>
<p id="section-2.2-2">The decoder <span class="bcp14">MUST</span> emit field lines in the order their representations appear in
the encoded field section.<a href="#section-2.2-2" class="pilcrow">¶</a></p>
<div id="blocked-decoding">
<section id="section-2.2.1">
<h4 id="name-blocked-decoding">
<a href="#section-2.2.1" class="section-number selfRef">2.2.1. </a><a href="#name-blocked-decoding" class="section-name selfRef">Blocked Decoding</a>
</h4>
<p id="section-2.2.1-1">Upon receipt of an encoded field section, the decoder examines the Required
Insert Count. When the Required Insert Count is less than or equal to the
decoder's Insert Count, the field section can be processed immediately.
Otherwise, the stream on which the field section was received becomes blocked.<a href="#section-2.2.1-1" class="pilcrow">¶</a></p>
<p id="section-2.2.1-2">While blocked, encoded field section data <span class="bcp14">SHOULD</span> remain in the blocked stream's
flow-control window. This data is unusable until the stream becomes unblocked,
and releasing the flow control prematurely makes the decoder vulnerable to
memory exhaustion attacks. A stream becomes unblocked when the Insert Count
becomes greater than or equal to the Required Insert Count for all encoded
field sections the decoder has started reading from the stream.<a href="#section-2.2.1-2" class="pilcrow">¶</a></p>
<p id="section-2.2.1-3">When processing encoded field sections, the decoder expects the Required Insert
Count to equal the lowest possible value for the Insert Count with which the
field section can be decoded, as prescribed in <a href="#blocked-streams" class="xref">Section 2.1.2</a>. If it
encounters a Required Insert Count smaller than expected, it <span class="bcp14">MUST</span> treat this as
a connection error of type QPACK_DECOMPRESSION_FAILED; see
<a href="#invalid-references" class="xref">Section 2.2.3</a>. If it encounters a Required Insert Count larger than
expected, it <span class="bcp14">MAY</span> treat this as a connection error of type
QPACK_DECOMPRESSION_FAILED.<a href="#section-2.2.1-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="state-synchronization">
<section id="section-2.2.2">
<h4 id="name-state-synchronization">
<a href="#section-2.2.2" class="section-number selfRef">2.2.2. </a><a href="#name-state-synchronization" class="section-name selfRef">State Synchronization</a>
</h4>
<p id="section-2.2.2-1">The decoder signals the following events by emitting decoder instructions
(<a href="#decoder-instructions" class="xref">Section 4.4</a>) on the decoder stream.<a href="#section-2.2.2-1" class="pilcrow">¶</a></p>
<div id="completed-processing-of-a-field-section">
<section id="section-2.2.2.1">
<h5 id="name-completed-processing-of-a-f">
<a href="#section-2.2.2.1" class="section-number selfRef">2.2.2.1. </a><a href="#name-completed-processing-of-a-f" class="section-name selfRef">Completed Processing of a Field Section</a>
</h5>
<p id="section-2.2.2.1-1">After the decoder finishes decoding a field section encoded using
representations containing dynamic table references, it <span class="bcp14">MUST</span> emit a Section
Acknowledgment instruction (<a href="#header-acknowledgment" class="xref">Section 4.4.1</a>). A stream may carry
multiple field sections in the case of intermediate responses, trailers, and
pushed requests. The encoder interprets each Section Acknowledgment
instruction as acknowledging the earliest unacknowledged field section
containing dynamic table references sent on the given stream.<a href="#section-2.2.2.1-1" class="pilcrow">¶</a></p>
</section>
</div>
<div id="abandonment-of-a-stream">
<section id="section-2.2.2.2">
<h5 id="name-abandonment-of-a-stream">
<a href="#section-2.2.2.2" class="section-number selfRef">2.2.2.2. </a><a href="#name-abandonment-of-a-stream" class="section-name selfRef">Abandonment of a Stream</a>
</h5>
<p id="section-2.2.2.2-1">When an endpoint receives a stream reset before the end of a stream or before
all encoded field sections are processed on that stream, or when it abandons
reading of a stream, it generates a Stream Cancellation instruction; see
<a href="#stream-cancellation" class="xref">Section 4.4.2</a>. 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 (<a href="#maximum-dynamic-table-capacity" class="xref">Section 3.2.3</a>) equal to
zero <span class="bcp14">MAY</span> omit sending Stream Cancellations, because the encoder cannot have any
dynamic table references. An encoder cannot infer from this instruction that
any updates to the dynamic table have been received.<a href="#section-2.2.2.2-1" class="pilcrow">¶</a></p>
<p id="section-2.2.2.2-2">The Section Acknowledgment and Stream Cancellation instructions permit the
encoder to remove references to entries in the dynamic table. When an entry
with an absolute index lower than the Known Received Count has zero references,
then it is considered evictable; see <a href="#blocked-insertion" class="xref">Section 2.1.1</a>.<a href="#section-2.2.2.2-2" class="pilcrow">¶</a></p>
</section>
</div>
<div id="new-table-entries">
<section id="section-2.2.2.3">
<h5 id="name-new-table-entries">
<a href="#section-2.2.2.3" class="section-number selfRef">2.2.2.3. </a><a href="#name-new-table-entries" class="section-name selfRef">New Table Entries</a>
</h5>
<p id="section-2.2.2.3-1">After receiving new table entries on the encoder stream, the decoder chooses
when to emit Insert Count Increment instructions; see
<a href="#insert-count-increment" class="xref">Section 4.4.3</a>. Emitting this instruction after adding each new
dynamic table entry will provide the timeliest 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 Section
Acknowledgments; see <a href="#header-acknowledgment" class="xref">Section 4.4.1</a>. However, delaying too long
may lead to compression inefficiencies if the encoder waits for an entry to be
acknowledged before using it.<a href="#section-2.2.2.3-1" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="invalid-references">
<section id="section-2.2.3">
<h4 id="name-invalid-references">
<a href="#section-2.2.3" class="section-number selfRef">2.2.3. </a><a href="#name-invalid-references" class="section-name selfRef">Invalid References</a>
</h4>
<p id="section-2.2.3-1">If the decoder encounters a reference in a field line representation to a
dynamic table entry that has already been evicted or that has an absolute
index greater than or equal to the declared Required Insert Count
(<a href="#header-prefix" class="xref">Section 4.5.1</a>), it <span class="bcp14">MUST</span> treat this as a connection error of type
QPACK_DECOMPRESSION_FAILED.<a href="#section-2.2.3-1" class="pilcrow">¶</a></p>
<p id="section-2.2.3-2">If the decoder encounters a reference in an encoder instruction to a dynamic
table entry that has already been evicted, it <span class="bcp14">MUST</span> treat this as a connection
error of type QPACK_ENCODER_STREAM_ERROR.<a href="#section-2.2.3-2" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
</section>
</div>
<div id="reference-tables">
<section id="section-3">
<h2 id="name-reference-tables">
<a href="#section-3" class="section-number selfRef">3. </a><a href="#name-reference-tables" class="section-name selfRef">Reference Tables</a>
</h2>
<p id="section-3-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.<a href="#section-3-1" class="pilcrow">¶</a></p>
<div id="header-table-static">
<section id="section-3.1">
<h3 id="name-static-table">
<a href="#section-3.1" class="section-number selfRef">3.1. </a><a href="#name-static-table" class="section-name selfRef">Static Table</a>
</h3>
<p id="section-3.1-1">The static table consists of a predefined list of field lines, each of which has
a fixed index over time. Its entries are defined in <a href="#static-table" class="xref">Appendix A</a>.<a href="#section-3.1-1" class="pilcrow">¶</a></p>
<p id="section-3.1-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). Each entry is identified by a unique
index.<a href="#section-3.1-2" class="pilcrow">¶</a></p>
<p id="section-3.1-3">Note that the QPACK static table is indexed from 0, whereas the HPACK static
table is indexed from 1.<a href="#section-3.1-3" class="pilcrow">¶</a></p>
<p id="section-3.1-4">When the decoder encounters an invalid static table index in a field line
representation, it <span class="bcp14">MUST</span> treat this as a connection error of type
QPACK_DECOMPRESSION_FAILED. If this index is received on the encoder stream,
this <span class="bcp14">MUST</span> be treated as a connection error of type QPACK_ENCODER_STREAM_ERROR.<a href="#section-3.1-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="header-table-dynamic">
<section id="section-3.2">
<h3 id="name-dynamic-table">
<a href="#section-3.2" class="section-number selfRef">3.2. </a><a href="#name-dynamic-table" class="section-name selfRef">Dynamic Table</a>
</h3>
<p id="section-3.2-1">The dynamic table consists of a list of field lines maintained in first-in,
first-out order. A QPACK encoder and decoder share a dynamic table that is
initially empty. The encoder adds entries to the dynamic table and sends them
to the decoder via instructions on the encoder stream; see
<a href="#encoder-instructions" class="xref">Section 4.3</a>.<a href="#section-3.2-1" class="pilcrow">¶</a></p>
<p id="section-3.2-2">The dynamic table can contain duplicate entries (i.e., entries with the same
name and same value). Therefore, duplicate entries <span class="bcp14">MUST NOT</span> be treated as an
error by the decoder.<a href="#section-3.2-2" class="pilcrow">¶</a></p>
<p id="section-3.2-3">Dynamic table entries can have empty values.<a href="#section-3.2-3" class="pilcrow">¶</a></p>
<div id="dynamic-table-size">
<section id="section-3.2.1">
<h4 id="name-dynamic-table-size">
<a href="#section-3.2.1" class="section-number selfRef">3.2.1. </a><a href="#name-dynamic-table-size" class="section-name selfRef">Dynamic Table Size</a>
</h4>
<p id="section-3.2.1-1">The size of the dynamic table is the sum of the size of its entries.<a href="#section-3.2.1-1" class="pilcrow">¶</a></p>
<p id="section-3.2.1-2">The size of an entry is the sum of its name's length in bytes, its value's
length in bytes, and 32 additional bytes. The size of an entry is calculated
using the length of its name and value without Huffman encoding applied.<a href="#section-3.2.1-2" class="pilcrow">¶</a></p>
</section>
</div>
<div id="eviction">
<section id="section-3.2.2">
<h4 id="name-dynamic-table-capacity-and-">
<a href="#section-3.2.2" class="section-number selfRef">3.2.2. </a><a href="#name-dynamic-table-capacity-and-" class="section-name selfRef">Dynamic Table Capacity and Eviction</a>
</h4>
<p id="section-3.2.2-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. The
encoder sends a Set Dynamic Table Capacity instruction
(<a href="#set-dynamic-capacity" class="xref">Section 4.3.1</a>) with a non-zero capacity to begin using the dynamic
table.<a href="#section-3.2.2-1" class="pilcrow">¶</a></p>
<p id="section-3.2.2-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). The encoder <span class="bcp14">MUST NOT</span> cause a
dynamic table entry to be evicted unless that entry is evictable; see
<a href="#blocked-insertion" class="xref">Section 2.1.1</a>. The new entry is then 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 <span class="bcp14">MUST</span> treat this as a connection error of type
QPACK_ENCODER_STREAM_ERROR.<a href="#section-3.2.2-2" class="pilcrow">¶</a></p>
<p id="section-3.2.2-3">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.<a href="#section-3.2.2-3" class="pilcrow">¶</a></p>
<p id="section-3.2.2-4">Whenever the dynamic table capacity is reduced by the encoder
(<a href="#set-dynamic-capacity" class="xref">Section 4.3.1</a>), 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.<a href="#section-3.2.2-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="maximum-dynamic-table-capacity">
<section id="section-3.2.3">
<h4 id="name-maximum-dynamic-table-capac">
<a href="#section-3.2.3" class="section-number selfRef">3.2.3. </a><a href="#name-maximum-dynamic-table-capac" class="section-name selfRef">Maximum Dynamic Table Capacity</a>
</h4>
<p id="section-3.2.3-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 <span class="bcp14">MUST NOT</span> 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.1</a>.<a href="#section-3.2.3-1" class="pilcrow">¶</a></p>
<p id="section-3.2.3-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 zero, the server <span class="bcp14">MAY</span> set
it to a non-zero value in its SETTINGS frame. If the remembered value is
non-zero, the server <span class="bcp14">MUST</span> 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
QPACK_DECODER_STREAM_ERROR.<a href="#section-3.2.3-2" class="pilcrow">¶</a></p>
<p id="section-3.2.3-3">For clients not using 0-RTT data (whether 0-RTT is not attempted or is rejected)
and for all HTTP/3 servers, the maximum table capacity is 0 until the encoder
processes a SETTINGS frame with a non-zero value of
SETTINGS_QPACK_MAX_TABLE_CAPACITY.<a href="#section-3.2.3-3" class="pilcrow">¶</a></p>
<p id="section-3.2.3-4">When the maximum table capacity is zero, the encoder <span class="bcp14">MUST NOT</span> insert entries
into the dynamic table and <span class="bcp14">MUST NOT</span> send any encoder instructions on the encoder
stream.<a href="#section-3.2.3-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="indexing">
<section id="section-3.2.4">
<h4 id="name-absolute-indexing">
<a href="#section-3.2.4" class="section-number selfRef">3.2.4. </a><a href="#name-absolute-indexing" class="section-name selfRef">Absolute Indexing</a>
</h4>
<p id="section-3.2.4-1">Each entry possesses an absolute index that is fixed for the lifetime of that
entry. The first entry inserted has an absolute index of 0; indices increase
by one with each insertion.<a href="#section-3.2.4-1" class="pilcrow">¶</a></p>
</section>
</div>
<div id="relative-indexing">
<section id="section-3.2.5">
<h4 id="name-relative-indexing">
<a href="#section-3.2.5" class="section-number selfRef">3.2.5. </a><a href="#name-relative-indexing" class="section-name selfRef">Relative Indexing</a>
</h4>
<p id="section-3.2.5-1">Relative indices begin at zero and increase in the opposite direction from the
absolute index. Determining which entry has a relative index of 0 depends on
the context of the reference.<a href="#section-3.2.5-1" class="pilcrow">¶</a></p>
<p id="section-3.2.5-2">In encoder instructions (<a href="#encoder-instructions" class="xref">Section 4.3</a>), a relative index of 0
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.<a href="#section-3.2.5-2" class="pilcrow">¶</a></p>
<span id="name-example-dynamic-table-index"></span><figure id="figure-2">
<div class="alignLeft art-ascii-art art-text artwork" id="section-3.2.5-3.1">
<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>
</div>
<figcaption><a href="#figure-2" class="selfRef">Figure 2</a>:
<a href="#name-example-dynamic-table-index" class="selfRef">Example Dynamic Table Indexing - Encoder Stream</a>
</figcaption></figure>
<p id="section-3.2.5-4">Unlike in encoder instructions, relative indices in field line representations
are relative to the Base at the beginning of the encoded field section; see
<a href="#header-prefix" class="xref">Section 4.5.1</a>. This ensures that references are stable even if encoded field
sections and dynamic table updates are processed out of order.<a href="#section-3.2.5-4" class="pilcrow">¶</a></p>
<p id="section-3.2.5-5">In a field line representation, a relative index of 0 refers to the entry with
absolute index equal to Base - 1.<a href="#section-3.2.5-5" class="pilcrow">¶</a></p>
<span id="name-example-dynamic-table-indexi"></span><figure id="figure-3">
<div class="alignLeft art-ascii-art art-text artwork" id="section-3.2.5-6.1">
<pre>
Base
|
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
In this example, Base = n - 2
</pre>
</div>
<figcaption><a href="#figure-3" class="selfRef">Figure 3</a>:
<a href="#name-example-dynamic-table-indexi" class="selfRef">Example Dynamic Table Indexing - Relative Index in Representation</a>
</figcaption></figure>
</section>
</div>
<div id="post-base">
<section id="section-3.2.6">
<h4 id="name-post-base-indexing">
<a href="#section-3.2.6" class="section-number selfRef">3.2.6. </a><a href="#name-post-base-indexing" class="section-name selfRef">Post-Base Indexing</a>
</h4>
<p id="section-3.2.6-1">Post-Base indices are used in field line representations for entries with
absolute indices greater than or equal to Base, starting at 0 for the entry with
absolute index equal to Base and increasing in the same direction as the
absolute index.<a href="#section-3.2.6-1" class="pilcrow">¶</a></p>
<p id="section-3.2.6-2">Post-Base indices allow an encoder to process a field section in a single pass
and include references to entries added while processing this (or other) field
sections.<a href="#section-3.2.6-2" class="pilcrow">¶</a></p>
<span id="name-example-dynamic-table-indexin"></span><figure id="figure-4">
<div class="alignLeft art-ascii-art art-text artwork" id="section-3.2.6-3.1">
<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
In this example, Base = n - 2
</pre>
</div>
<figcaption><a href="#figure-4" class="selfRef">Figure 4</a>:
<a href="#name-example-dynamic-table-indexin" class="selfRef">Example Dynamic Table Indexing - Post-Base Index in Representation</a>
</figcaption></figure>
</section>
</div>
</section>
</div>
</section>
</div>
<div id="wire-format">
<section id="section-4">
<h2 id="name-wire-format">
<a href="#section-4" class="section-number selfRef">4. </a><a href="#name-wire-format" class="section-name selfRef">Wire Format</a>
</h2>
<div id="primitives">
<section id="section-4.1">
<h3 id="name-primitives">
<a href="#section-4.1" class="section-number selfRef">4.1. </a><a href="#name-primitives" class="section-name selfRef">Primitives</a>
</h3>
<div id="prefixed-integers">
<section id="section-4.1.1">
<h4 id="name-prefixed-integers">
<a href="#section-4.1.1" class="section-number selfRef">4.1.1. </a><a href="#name-prefixed-integers" class="section-name selfRef">Prefixed Integers</a>
</h4>
<p id="section-4.1.1-1">The prefixed integer from <span><a href="https://www.rfc-editor.org/rfc/rfc7541#section-5.1" class="relref">Section 5.1</a> of [<a href="#RFC7541" class="xref">RFC7541</a>]</span> is used heavily throughout
this document. The format from <span>[<a href="#RFC7541" class="xref">RFC7541</a>]</span> is used unmodified. Note, however,
that QPACK uses some prefix sizes not actually used in HPACK.<a href="#section-4.1.1-1" class="pilcrow">¶</a></p>
<p id="section-4.1.1-2">QPACK implementations <span class="bcp14">MUST</span> be able to decode integers up to and including 62
bits long.<a href="#section-4.1.1-2" class="pilcrow">¶</a></p>
</section>
</div>
<div id="string-literals">
<section id="section-4.1.2">
<h4 id="name-string-literals">
<a href="#section-4.1.2" class="section-number selfRef">4.1.2. </a><a href="#name-string-literals" class="section-name selfRef">String Literals</a>
</h4>
<p id="section-4.1.2-1">The string literal defined by <span><a href="https://www.rfc-editor.org/rfc/rfc7541#section-5.2" class="relref">Section 5.2</a> of [<a href="#RFC7541" class="xref">RFC7541</a>]</span> is also used
throughout. This string format includes optional Huffman encoding.<a href="#section-4.1.2-1" class="pilcrow">¶</a></p>
<p id="section-4.1.2-2">HPACK defines string literals to begin on a byte boundary. They begin with a
single bit flag, denoted as 'H' in this document (indicating whether the string
is Huffman encoded), followed by the string length encoded as a 7-bit prefix
integer, and finally the indicated number of bytes of data. When Huffman
encoding is enabled, the Huffman table from <span><a href="https://www.rfc-editor.org/rfc/rfc7541#appendix-B" class="relref">Appendix B</a> of [<a href="#RFC7541" class="xref">RFC7541</a>]</span> is used
without modification and the indicated length is the size of the string after
encoding.<a href="#section-4.1.2-2" class="pilcrow">¶</a></p>
<p id="section-4.1.2-3">This document expands the definition of string literals by permitting them to
begin other than on a byte boundary. An "N-bit prefix string literal" begins
mid-byte, with the first (8-N) bits allocated to a previous field. The string
uses one bit for the Huffman flag, followed by the length of the encoded string
as a (N-1)-bit prefix integer. The prefix size, N, can have a value between 2
and 8, inclusive. The remainder of the string literal is unmodified.<a href="#section-4.1.2-3" class="pilcrow">¶</a></p>
<p id="section-4.1.2-4">A string literal without a prefix length noted is an 8-bit prefix string literal
and follows the definitions in <span>[<a href="#RFC7541" class="xref">RFC7541</a>]</span> without modification.<a href="#section-4.1.2-4" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="enc-dec-stream-def">
<section id="section-4.2">
<h3 id="name-encoder-and-decoder-streams">
<a href="#section-4.2" class="section-number selfRef">4.2. </a><a href="#name-encoder-and-decoder-streams" class="section-name selfRef">Encoder and Decoder Streams</a>
</h3>
<p id="section-4.2-1">QPACK defines two unidirectional stream types:<a href="#section-4.2-1" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-4.2-2.1">An encoder stream is a unidirectional stream of type 0x02.
It carries an unframed sequence of encoder instructions from encoder
to decoder.<a href="#section-4.2-2.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-4.2-2.2">A decoder stream is a unidirectional stream of type 0x03.
It carries an unframed sequence of decoder instructions from decoder
to encoder.<a href="#section-4.2-2.2" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-4.2-3">HTTP/3 endpoints contain a QPACK encoder and decoder. Each endpoint <span class="bcp14">MUST</span>
initiate, at most, one encoder stream and, at most, one decoder stream. Receipt
of a second instance of either stream type <span class="bcp14">MUST</span> be treated as a connection error
of type H3_STREAM_CREATION_ERROR.<a href="#section-4.2-3" class="pilcrow">¶</a></p>
<p id="section-4.2-4">The sender <span class="bcp14">MUST NOT</span> close either of these streams, and the receiver <span class="bcp14">MUST NOT</span>
request that the sender close either of these streams. Closure of either
unidirectional stream type <span class="bcp14">MUST</span> be treated as a connection error of type
H3_CLOSED_CRITICAL_STREAM.<a href="#section-4.2-4" class="pilcrow">¶</a></p>
<p id="section-4.2-5">An endpoint <span class="bcp14">MAY</span> avoid creating an encoder stream if it will not be used (for
example, if its encoder does not wish to use the dynamic table or if the maximum
size of the dynamic table permitted by the peer is zero).<a href="#section-4.2-5" class="pilcrow">¶</a></p>
<p id="section-4.2-6">An endpoint <span class="bcp14">MAY</span> avoid creating a decoder stream if its decoder sets the maximum
capacity of the dynamic table to zero.<a href="#section-4.2-6" class="pilcrow">¶</a></p>
<p id="section-4.2-7">An endpoint <span class="bcp14">MUST</span> allow its peer to create an encoder stream and a decoder stream
even if the connection's settings prevent their use.<a href="#section-4.2-7" class="pilcrow">¶</a></p>
</section>
</div>
<div id="encoder-instructions">
<section id="section-4.3">
<h3 id="name-encoder-instructions">
<a href="#section-4.3" class="section-number selfRef">4.3. </a><a href="#name-encoder-instructions" class="section-name selfRef">Encoder Instructions</a>
</h3>
<p id="section-4.3-1">An encoder sends encoder instructions on the encoder stream to set the capacity
of the dynamic table and add dynamic table entries. Instructions adding table
entries can use 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 that already exist in
the dynamic table, the full entry can also be used by reference, creating a
duplicate entry.<a href="#section-4.3-1" class="pilcrow">¶</a></p>
<div id="set-dynamic-capacity">
<section id="section-4.3.1">
<h4 id="name-set-dynamic-table-capacity">
<a href="#section-4.3.1" class="section-number selfRef">4.3.1. </a><a href="#name-set-dynamic-table-capacity" class="section-name selfRef">Set Dynamic Table Capacity</a>
</h4>
<p id="section-4.3.1-1">An encoder informs the decoder of a change to the dynamic table capacity using
an instruction that starts with the '001' 3-bit pattern. This is followed
by the new dynamic table capacity represented as an integer with a 5-bit prefix;
see <a href="#prefixed-integers" class="xref">Section 4.1.1</a>.<a href="#section-4.3.1-1" class="pilcrow">¶</a></p>
<span id="name-set-dynamic-table-capacity-2"></span><div id="fig-set-capacity">
<figure id="figure-5">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.3.1-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | Capacity (5+) |
+---+---+---+-------------------+
</pre>
</div>
<figcaption><a href="#figure-5" class="selfRef">Figure 5</a>:
<a href="#name-set-dynamic-table-capacity-2" class="selfRef">Set Dynamic Table Capacity</a>
</figcaption></figure>
</div>
<p id="section-4.3.1-3">The new capacity <span class="bcp14">MUST</span> 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 (<a href="#configuration" class="xref">Section 5</a>) received from
the decoder. The decoder <span class="bcp14">MUST</span> treat a new dynamic table capacity value that
exceeds this limit as a connection error of type QPACK_ENCODER_STREAM_ERROR.<a href="#section-4.3.1-3" class="pilcrow">¶</a></p>
<p id="section-4.3.1-4">Reducing the dynamic table capacity can cause entries to be evicted; see
<a href="#eviction" class="xref">Section 3.2.2</a>. This <span class="bcp14">MUST NOT</span> cause the eviction of entries that are not
evictable; see <a href="#blocked-insertion" class="xref">Section 2.1.1</a>. Changing the capacity of the dynamic
table is not acknowledged as this instruction does not insert an entry.<a href="#section-4.3.1-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="insert-with-name-reference">
<section id="section-4.3.2">
<h4 id="name-insert-with-name-reference">
<a href="#section-4.3.2" class="section-number selfRef">4.3.2. </a><a href="#name-insert-with-name-reference" class="section-name selfRef">Insert with Name Reference</a>
</h4>
<p id="section-4.3.2-1">An encoder adds an entry to the dynamic table where the field name matches the
field name of an entry stored in the static or the dynamic table using an
instruction that starts with the '1' 1-bit pattern. The second ('T') bit
indicates whether the reference is to the static or dynamic table. The 6-bit
prefix integer (<a href="#prefixed-integers" class="xref">Section 4.1.1</a>) that follows is used to locate the table
entry for the field name. When T=1, the number represents the static table
index; when T=0, the number is the relative index of the entry in the dynamic
table.<a href="#section-4.3.2-1" class="pilcrow">¶</a></p>
<p id="section-4.3.2-2">The field name reference is followed by the field value represented as a string
literal; see <a href="#string-literals" class="xref">Section 4.1.2</a>.<a href="#section-4.3.2-2" class="pilcrow">¶</a></p>
<span id="name-insert-field-line-indexed-n"></span><figure id="figure-6">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.3.2-3.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | T | Name Index (6+) |
+---+---+-----------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length bytes) |
+-------------------------------+
</pre>
</div>
<figcaption><a href="#figure-6" class="selfRef">Figure 6</a>:
<a href="#name-insert-field-line-indexed-n" class="selfRef">Insert Field Line -- Indexed Name</a>
</figcaption></figure>
</section>
</div>
<div id="insert-with-literal-name">
<section id="section-4.3.3">
<h4 id="name-insert-with-literal-name">
<a href="#section-4.3.3" class="section-number selfRef">4.3.3. </a><a href="#name-insert-with-literal-name" class="section-name selfRef">Insert with Literal Name</a>
</h4>
<p id="section-4.3.3-1">An encoder adds an entry to the dynamic table where both the field name and the
field value are represented as string literals using an instruction that starts
with the '01' 2-bit pattern.<a href="#section-4.3.3-1" class="pilcrow">¶</a></p>
<p id="section-4.3.3-2">This is followed by the name represented as a 6-bit prefix string literal and
the value represented as an 8-bit prefix string literal; see
<a href="#string-literals" class="xref">Section 4.1.2</a>.<a href="#section-4.3.3-2" class="pilcrow">¶</a></p>
<span id="name-insert-field-line-new-name"></span><figure id="figure-7">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.3.3-3.1">
<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>
</div>
<figcaption><a href="#figure-7" class="selfRef">Figure 7</a>:
<a href="#name-insert-field-line-new-name" class="selfRef">Insert Field Line -- New Name</a>
</figcaption></figure>
</section>
</div>
<div id="duplicate">
<section id="section-4.3.4">
<h4 id="name-duplicate">
<a href="#section-4.3.4" class="section-number selfRef">4.3.4. </a><a href="#name-duplicate" class="section-name selfRef">Duplicate</a>
</h4>
<p id="section-4.3.4-1">An encoder duplicates an existing entry in the dynamic table using an
instruction that starts with the '000' 3-bit pattern. This is followed by
the relative index of the existing entry represented as an integer with a 5-bit
prefix; see <a href="#prefixed-integers" class="xref">Section 4.1.1</a>.<a href="#section-4.3.4-1" class="pilcrow">¶</a></p>
<span id="name-duplicate-2"></span><div id="fig-index-with-duplication">
<figure id="figure-8">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.3.4-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | Index (5+) |
+---+---+---+-------------------+
</pre>
</div>
<figcaption><a href="#figure-8" class="selfRef">Figure 8</a>:
<a href="#name-duplicate-2" class="selfRef">Duplicate</a>
</figcaption></figure>
</div>
<p id="section-4.3.4-3">The existing entry is reinserted into the dynamic table without resending
either the name or the value. This is useful to avoid adding a reference to an
older entry, which might block inserting new entries.<a href="#section-4.3.4-3" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="decoder-instructions">
<section id="section-4.4">
<h3 id="name-decoder-instructions">
<a href="#section-4.4" class="section-number selfRef">4.4. </a><a href="#name-decoder-instructions" class="section-name selfRef">Decoder Instructions</a>
</h3>
<p id="section-4.4-1">A decoder sends decoder instructions on the decoder stream to inform the encoder
about the processing of field sections and table updates to ensure consistency
of the dynamic table.<a href="#section-4.4-1" class="pilcrow">¶</a></p>
<div id="header-acknowledgment">
<section id="section-4.4.1">
<h4 id="name-section-acknowledgment">
<a href="#section-4.4.1" class="section-number selfRef">4.4.1. </a><a href="#name-section-acknowledgment" class="section-name selfRef">Section Acknowledgment</a>
</h4>
<p id="section-4.4.1-1">After processing an encoded field section whose declared Required Insert Count
is not zero, the decoder emits a Section Acknowledgment instruction. The
instruction starts with the '1' 1-bit pattern, followed by the field
section's associated stream ID encoded as a 7-bit prefix integer; see
<a href="#prefixed-integers" class="xref">Section 4.1.1</a>.<a href="#section-4.4.1-1" class="pilcrow">¶</a></p>
<p id="section-4.4.1-2">This instruction is used as described in Sections <a href="#known-received-count" class="xref">2.1.4</a> and
<a href="#state-synchronization" class="xref">2.2.2</a>.<a href="#section-4.4.1-2" class="pilcrow">¶</a></p>
<span id="name-section-acknowledgment-2"></span><div id="fig-header-ack">
<figure id="figure-9">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.4.1-3.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | Stream ID (7+) |
+---+---------------------------+
</pre>
</div>
<figcaption><a href="#figure-9" class="selfRef">Figure 9</a>:
<a href="#name-section-acknowledgment-2" class="selfRef">Section Acknowledgment</a>
</figcaption></figure>
</div>
<p id="section-4.4.1-4">If an encoder receives a Section Acknowledgment instruction referring to a
stream on which every encoded field section with a non-zero Required Insert
Count has already been acknowledged, this <span class="bcp14">MUST</span> be treated as a connection error
of type QPACK_DECODER_STREAM_ERROR.<a href="#section-4.4.1-4" class="pilcrow">¶</a></p>
<p id="section-4.4.1-5">The Section Acknowledgment instruction might increase the Known Received Count;
see <a href="#known-received-count" class="xref">Section 2.1.4</a>.<a href="#section-4.4.1-5" class="pilcrow">¶</a></p>
</section>
</div>
<div id="stream-cancellation">
<section id="section-4.4.2">
<h4 id="name-stream-cancellation">
<a href="#section-4.4.2" class="section-number selfRef">4.4.2. </a><a href="#name-stream-cancellation" class="section-name selfRef">Stream Cancellation</a>
</h4>
<p id="section-4.4.2-1">When a stream is reset or reading is abandoned, the decoder emits a Stream
Cancellation instruction. The instruction starts with the '01' 2-bit
pattern, followed by the stream ID of the affected stream encoded as a
6-bit prefix integer.<a href="#section-4.4.2-1" class="pilcrow">¶</a></p>
<p id="section-4.4.2-2">This instruction is used as described in <a href="#state-synchronization" class="xref">Section 2.2.2</a>.<a href="#section-4.4.2-2" class="pilcrow">¶</a></p>
<span id="name-stream-cancellation-2"></span><div id="fig-stream-cancel">
<figure id="figure-10">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.4.2-3.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | Stream ID (6+) |
+---+---+-----------------------+
</pre>
</div>
<figcaption><a href="#figure-10" class="selfRef">Figure 10</a>:
<a href="#name-stream-cancellation-2" class="selfRef">Stream Cancellation</a>
</figcaption></figure>
</div>
</section>
</div>
<div id="insert-count-increment">
<section id="section-4.4.3">
<h4 id="name-insert-count-increment">
<a href="#section-4.4.3" class="section-number selfRef">4.4.3. </a><a href="#name-insert-count-increment" class="section-name selfRef">Insert Count Increment</a>
</h4>
<p id="section-4.4.3-1">The Insert Count Increment instruction starts with the '00' 2-bit pattern,
followed by the Increment encoded as a 6-bit prefix integer. This instruction
increases the Known Received Count (<a href="#known-received-count" class="xref">Section 2.1.4</a>) by the value of
the Increment parameter. The decoder should send an Increment value that
increases the Known Received Count to the total number of dynamic table
insertions and duplications processed so far.<a href="#section-4.4.3-1" class="pilcrow">¶</a></p>
<span id="name-insert-count-increment-2"></span><div id="fig-size-sync">
<figure id="figure-11">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.4.3-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | Increment (6+) |
+---+---+-----------------------+
</pre>
</div>
<figcaption><a href="#figure-11" class="selfRef">Figure 11</a>:
<a href="#name-insert-count-increment-2" class="selfRef">Insert Count Increment</a>
</figcaption></figure>
</div>
<p id="section-4.4.3-3">An encoder that receives an Increment field equal to zero, or one that increases
the Known Received Count beyond what the encoder has sent, <span class="bcp14">MUST</span> treat this as a
connection error of type QPACK_DECODER_STREAM_ERROR.<a href="#section-4.4.3-3" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="field-line-representations">
<section id="section-4.5">
<h3 id="name-field-line-representations">
<a href="#section-4.5" class="section-number selfRef">4.5. </a><a href="#name-field-line-representations" class="section-name selfRef">Field Line Representations</a>
</h3>
<p id="section-4.5-1">An encoded field section consists of a prefix and a possibly empty sequence of
representations defined in this section. Each representation corresponds to a
single field line. These representations reference the static table or the
dynamic table in a particular state, but they do not modify that state.<a href="#section-4.5-1" class="pilcrow">¶</a></p>
<p id="section-4.5-2">Encoded field sections are carried in frames on streams defined by the enclosing
protocol.<a href="#section-4.5-2" class="pilcrow">¶</a></p>
<div id="header-prefix">
<section id="section-4.5.1">
<h4 id="name-encoded-field-section-prefi">
<a href="#section-4.5.1" class="section-number selfRef">4.5.1. </a><a href="#name-encoded-field-section-prefi" class="section-name selfRef">Encoded Field Section Prefix</a>
</h4>
<p id="section-4.5.1-1">Each encoded field section is prefixed with two integers. The Required Insert
Count is encoded as an integer with an 8-bit prefix using the encoding described
in <a href="#ric" class="xref">Section 4.5.1.1</a>. The Base is encoded as a Sign bit ('S') and a Delta Base value
with a 7-bit prefix; see <a href="#base" class="xref">Section 4.5.1.2</a>.<a href="#section-4.5.1-1" class="pilcrow">¶</a></p>
<span id="name-encoded-field-section"></span><div id="fig-base-index">
<figure id="figure-12">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.5.1-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| Required Insert Count (8+) |
+---+---------------------------+
| S | Delta Base (7+) |
+---+---------------------------+
| Encoded Field Lines ...
+-------------------------------+
</pre>
</div>
<figcaption><a href="#figure-12" class="selfRef">Figure 12</a>:
<a href="#name-encoded-field-section" class="selfRef">Encoded Field Section</a>
</figcaption></figure>
</div>
<div id="ric">
<section id="section-4.5.1.1">
<h5 id="name-required-insert-count">
<a href="#section-4.5.1.1" class="section-number selfRef">4.5.1.1. </a><a href="#name-required-insert-count" class="section-name selfRef">Required Insert Count</a>
</h5>
<p id="section-4.5.1.1-1">Required Insert Count identifies the state of the dynamic table needed to
process the encoded field section. Blocking decoders use the Required Insert
Count to determine when it is safe to process the rest of the field section.<a href="#section-4.5.1.1-1" class="pilcrow">¶</a></p>
<p id="section-4.5.1.1-2">The encoder transforms the Required Insert Count as follows before encoding:<a href="#section-4.5.1.1-2" class="pilcrow">¶</a></p>
<div id="section-4.5.1.1-3">
<pre class="lang-pseudocode sourcecode">
if ReqInsertCount == 0:
EncInsertCount = 0
else:
EncInsertCount = (ReqInsertCount mod (2 * MaxEntries)) + 1
</pre><a href="#section-4.5.1.1-3" class="pilcrow">¶</a>
</div>
<p id="section-4.5.1.1-4">Here <code>MaxEntries</code> 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, <code>MaxEntries</code> is calculated as:<a href="#section-4.5.1.1-4" class="pilcrow">¶</a></p>
<div id="section-4.5.1.1-5">
<pre class="lang-pseudocode sourcecode">
MaxEntries = floor( MaxTableCapacity / 32 )
</pre><a href="#section-4.5.1.1-5" class="pilcrow">¶</a>
</div>
<p id="section-4.5.1.1-6"><code>MaxTableCapacity</code> 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>.<a href="#section-4.5.1.1-6" class="pilcrow">¶</a></p>
<p id="section-4.5.1.1-7">This encoding limits the length of the prefix on long-lived connections.<a href="#section-4.5.1.1-7" class="pilcrow">¶</a></p>
<p id="section-4.5.1.1-8">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 <span class="bcp14">MUST</span> treat this as a
connection error of type QPACK_DECOMPRESSION_FAILED.<a href="#section-4.5.1.1-8" class="pilcrow">¶</a></p>
<p id="section-4.5.1.1-9"><code>TotalNumberOfInserts</code> is the total number of inserts into the decoder's dynamic
table.<a href="#section-4.5.1.1-9" class="pilcrow">¶</a></p>
<div id="section-4.5.1.1-10">
<pre class="lang-pseudocode sourcecode">
FullRange = 2 * MaxEntries
if EncodedInsertCount == 0:
ReqInsertCount = 0
else:
if EncodedInsertCount > FullRange:
Error
MaxValue = TotalNumberOfInserts + MaxEntries
# MaxWrapped is the largest possible value of
# ReqInsertCount that is 0 mod 2 * MaxEntries
MaxWrapped = floor(MaxValue / FullRange) * FullRange
ReqInsertCount = MaxWrapped + EncodedInsertCount - 1
# If ReqInsertCount exceeds MaxValue, the Encoder's value
# must have wrapped one fewer time
if ReqInsertCount > MaxValue:
if ReqInsertCount <= FullRange:
Error
ReqInsertCount -= FullRange
# Value of 0 must be encoded as 0.
if ReqInsertCount == 0:
Error
</pre><a href="#section-4.5.1.1-10" class="pilcrow">¶</a>
</div>
<p id="section-4.5.1.1-11">For example, if the dynamic table is 100 bytes, then the Required Insert Count
will be encoded modulo 6. If a decoder has received 10 inserts, then an encoded
value of 4 indicates that the Required Insert Count is 9 for the field section.<a href="#section-4.5.1.1-11" class="pilcrow">¶</a></p>
</section>
</div>
<div id="base">
<section id="section-4.5.1.2">
<h5 id="name-base">
<a href="#section-4.5.1.2" class="section-number selfRef">4.5.1.2. </a><a href="#name-base" class="section-name selfRef">Base</a>
</h5>
<p id="section-4.5.1.2-1">The Base is used to resolve references in the dynamic table as described in
<a href="#relative-indexing" class="xref">Section 3.2.5</a>.<a href="#section-4.5.1.2-1" class="pilcrow">¶</a></p>
<p id="section-4.5.1.2-2">To save space, the Base is encoded relative to the Required Insert Count using a
one-bit Sign ('S' in <a href="#fig-base-index" class="xref">Figure 12</a>) and the Delta Base value. A Sign bit
of 0 indicates that the Base is greater than or equal to the value of the
Required Insert Count; the decoder adds the value of Delta Base to the Required
Insert Count to determine the value of the Base. A Sign bit of 1 indicates that
the Base is less than the Required Insert Count; the decoder subtracts the value
of Delta Base from the Required Insert Count and also subtracts one to determine
the value of the Base. That is:<a href="#section-4.5.1.2-2" class="pilcrow">¶</a></p>
<div id="section-4.5.1.2-3">
<pre class="lang-pseudocode sourcecode">
if Sign == 0:
Base = ReqInsertCount + DeltaBase
else:
Base = ReqInsertCount - DeltaBase - 1
</pre><a href="#section-4.5.1.2-3" class="pilcrow">¶</a>
</div>
<p id="section-4.5.1.2-4">A single-pass encoder determines the Base before encoding a field section. If
the encoder inserted entries in the dynamic table while encoding the field
section and is referencing them, Required Insert Count will be greater than the
Base, so the encoded difference is negative and the Sign bit is set to 1. If
the field section was not encoded using representations that reference the most
recent entry in the table and did not insert any new entries, the Base will be
greater than the Required Insert Count, so the encoded difference will be
positive and the Sign bit is set to 0.<a href="#section-4.5.1.2-4" class="pilcrow">¶</a></p>
<p id="section-4.5.1.2-5">The value of Base <span class="bcp14">MUST NOT</span> be negative. Though the protocol might operate
correctly with a negative Base using post-Base indexing, it is unnecessary and
inefficient. An endpoint <span class="bcp14">MUST</span> treat a field block with a Sign bit of 1 as
invalid if the value of Required Insert Count is less than or equal to the value
of Delta Base.<a href="#section-4.5.1.2-5" class="pilcrow">¶</a></p>
<p id="section-4.5.1.2-6">An encoder that produces table updates before encoding a field section might set
Base to the value of Required Insert Count. In such a case, both the Sign bit
and the Delta Base will be set to zero.<a href="#section-4.5.1.2-6" class="pilcrow">¶</a></p>
<p id="section-4.5.1.2-7">A field section that was encoded without references to the dynamic table can use
any value for the Base; setting Delta Base to zero is one of the most efficient
encodings.<a href="#section-4.5.1.2-7" class="pilcrow">¶</a></p>
<p id="section-4.5.1.2-8">For example, with a Required Insert Count of 9, a decoder receives a Sign bit
of 1 and a Delta Base of 2. This sets the Base to 6 and enables post-Base
indexing for three entries. In this example, a relative index of 1 refers to
the fifth entry that was added to the table; a post-Base index of 1 refers to
the eighth entry.<a href="#section-4.5.1.2-8" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="indexed-field-line">
<section id="section-4.5.2">
<h4 id="name-indexed-field-line">
<a href="#section-4.5.2" class="section-number selfRef">4.5.2. </a><a href="#name-indexed-field-line" class="section-name selfRef">Indexed Field Line</a>
</h4>
<p id="section-4.5.2-1">An indexed field line representation identifies an entry in the static table
or an entry in the dynamic table with an absolute index less than the value of
the Base.<a href="#section-4.5.2-1" class="pilcrow">¶</a></p>
<span id="name-indexed-field-line-2"></span><figure id="figure-13">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.5.2-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | T | Index (6+) |
+---+---+-----------------------+
</pre>
</div>
<figcaption><a href="#figure-13" class="selfRef">Figure 13</a>:
<a href="#name-indexed-field-line-2" class="selfRef">Indexed Field Line</a>
</figcaption></figure>
<p id="section-4.5.2-3">This representation starts with the '1' 1-bit pattern, followed by the 'T' bit,
indicating whether the reference is into the static or dynamic table. The 6-bit
prefix integer (<a href="#prefixed-integers" class="xref">Section 4.1.1</a>) that follows is used to locate the
table entry for the field line. When T=1, the number represents the static
table index; when T=0, the number is the relative index of the entry in the
dynamic table.<a href="#section-4.5.2-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="indexed-field-line-with-post-base-index">
<section id="section-4.5.3">
<h4 id="name-indexed-field-line-with-pos">
<a href="#section-4.5.3" class="section-number selfRef">4.5.3. </a><a href="#name-indexed-field-line-with-pos" class="section-name selfRef">Indexed Field Line with Post-Base Index</a>
</h4>
<p id="section-4.5.3-1">An indexed field line with post-Base index representation identifies an entry
in the dynamic table with an absolute index greater than or equal to the value
of the Base.<a href="#section-4.5.3-1" class="pilcrow">¶</a></p>
<span id="name-indexed-field-line-with-post"></span><figure id="figure-14">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.5.3-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 1 | Index (4+) |
+---+---+---+---+---------------+
</pre>
</div>
<figcaption><a href="#figure-14" class="selfRef">Figure 14</a>:
<a href="#name-indexed-field-line-with-post" class="selfRef">Indexed Field Line with Post-Base Index</a>
</figcaption></figure>
<p id="section-4.5.3-3">This representation starts with the '0001' 4-bit pattern. This is followed
by the post-Base index (<a href="#post-base" class="xref">Section 3.2.6</a>) of the matching field line, represented
as an integer with a 4-bit prefix; see <a href="#prefixed-integers" class="xref">Section 4.1.1</a>.<a href="#section-4.5.3-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="literal-name-reference">
<section id="section-4.5.4">
<h4 id="name-literal-field-line-with-nam">
<a href="#section-4.5.4" class="section-number selfRef">4.5.4. </a><a href="#name-literal-field-line-with-nam" class="section-name selfRef">Literal Field Line with Name Reference</a>
</h4>
<p id="section-4.5.4-1">A literal field line with name reference representation encodes a field line
where the field name matches the field name of an entry in the static table or
the field name of an entry in the dynamic table with an absolute index less than
the value of the Base.<a href="#section-4.5.4-1" class="pilcrow">¶</a></p>
<span id="name-literal-field-line-with-name"></span><figure id="figure-15">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.5.4-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | N | T |Name Index (4+)|
+---+---+---+---+---------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length bytes) |
+-------------------------------+
</pre>
</div>
<figcaption><a href="#figure-15" class="selfRef">Figure 15</a>:
<a href="#name-literal-field-line-with-name" class="selfRef">Literal Field Line with Name Reference</a>
</figcaption></figure>
<p id="section-4.5.4-3">This representation starts with the '01' 2-bit pattern. The following bit,
'N', indicates whether an intermediary is permitted to add this field line to
the dynamic table on subsequent hops. When the 'N' bit is set, the encoded field
line <span class="bcp14">MUST</span> always be encoded with a literal representation. In particular, when a
peer sends a field line that it received represented as a literal field line
with the 'N' bit set, it <span class="bcp14">MUST</span> use a literal representation to forward this field
line. This bit is intended for protecting field values that are not to be put
at risk by compressing them; see <a href="#probing-dynamic-table-state" class="xref">Section 7.1</a> for more
details.<a href="#section-4.5.4-3" class="pilcrow">¶</a></p>
<p id="section-4.5.4-4">The fourth ('T') bit indicates whether the reference is to the static or dynamic
table. The 4-bit prefix integer (<a href="#prefixed-integers" class="xref">Section 4.1.1</a>) that follows is used to
locate the table entry for the field name. When T=1, the number represents the
static table index; when T=0, the number is the relative index of the entry in
the dynamic table.<a href="#section-4.5.4-4" class="pilcrow">¶</a></p>
<p id="section-4.5.4-5">Only the field name is taken from the dynamic table entry; the field value is
encoded as an 8-bit prefix string literal; see <a href="#string-literals" class="xref">Section 4.1.2</a>.<a href="#section-4.5.4-5" class="pilcrow">¶</a></p>
</section>
</div>
<div id="literal-field-line-with-post-base-name-reference">
<section id="section-4.5.5">
<h4 id="name-literal-field-line-with-pos">
<a href="#section-4.5.5" class="section-number selfRef">4.5.5. </a><a href="#name-literal-field-line-with-pos" class="section-name selfRef">Literal Field Line with Post-Base Name Reference</a>
</h4>
<p id="section-4.5.5-1">A literal field line with post-Base name reference representation encodes a
field line where the field name matches the field name of a dynamic table entry
with an absolute index greater than or equal to the value of the Base.<a href="#section-4.5.5-1" class="pilcrow">¶</a></p>
<span id="name-literal-field-line-with-post"></span><figure id="figure-16">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.5.5-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | N |NameIdx(3+)|
+---+---+---+---+---+-----------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length bytes) |
+-------------------------------+
</pre>
</div>
<figcaption><a href="#figure-16" class="selfRef">Figure 16</a>:
<a href="#name-literal-field-line-with-post" class="selfRef">Literal Field Line with Post-Base Name Reference</a>
</figcaption></figure>
<p id="section-4.5.5-3">This representation starts with the '0000' 4-bit pattern. The fifth bit is
the 'N' bit as described in <a href="#literal-name-reference" class="xref">Section 4.5.4</a>. This is followed by a
post-Base index of the dynamic table entry (<a href="#post-base" class="xref">Section 3.2.6</a>) encoded as an
integer with a 3-bit prefix; see <a href="#prefixed-integers" class="xref">Section 4.1.1</a>.<a href="#section-4.5.5-3" class="pilcrow">¶</a></p>
<p id="section-4.5.5-4">Only the field name is taken from the dynamic table entry; the field value is
encoded as an 8-bit prefix string literal; see <a href="#string-literals" class="xref">Section 4.1.2</a>.<a href="#section-4.5.5-4" class="pilcrow">¶</a></p>
</section>
</div>
<div id="literal-field-line-with-literal-name">
<section id="section-4.5.6">
<h4 id="name-literal-field-line-with-lit">
<a href="#section-4.5.6" class="section-number selfRef">4.5.6. </a><a href="#name-literal-field-line-with-lit" class="section-name selfRef">Literal Field Line with Literal Name</a>
</h4>
<p id="section-4.5.6-1">The literal field line with literal name representation encodes a
field name and a field value as string literals.<a href="#section-4.5.6-1" class="pilcrow">¶</a></p>
<span id="name-literal-field-line-with-lite"></span><figure id="figure-17">
<div class="alignLeft art-ascii-art art-text artwork" id="section-4.5.6-2.1">
<pre>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | N | H |NameLen(3+)|
+---+---+---+---+---+-----------+
| Name String (Length bytes) |
+---+---------------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length bytes) |
+-------------------------------+
</pre>
</div>
<figcaption><a href="#figure-17" class="selfRef">Figure 17</a>:
<a href="#name-literal-field-line-with-lite" class="selfRef">Literal Field Line with Literal Name</a>
</figcaption></figure>
<p id="section-4.5.6-3">This representation starts with the '001' 3-bit pattern. The fourth bit is
the 'N' bit as described in <a href="#literal-name-reference" class="xref">Section 4.5.4</a>. The name follows,
represented as a 4-bit prefix string literal, then the value, represented as an
8-bit prefix string literal; see <a href="#string-literals" class="xref">Section 4.1.2</a>.<a href="#section-4.5.6-3" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
</section>
</div>
<div id="configuration">
<section id="section-5">
<h2 id="name-configuration">
<a href="#section-5" class="section-number selfRef">5. </a><a href="#name-configuration" class="section-name selfRef">Configuration</a>
</h2>
<p id="section-5-1">QPACK defines two settings for the HTTP/3 SETTINGS frame:<a href="#section-5-1" class="pilcrow">¶</a></p>
<span class="break"></span><dl class="dlParallel" id="section-5-2">
<dt id="section-5-2.1">SETTINGS_QPACK_MAX_TABLE_CAPACITY (0x01):</dt>
<dd style="margin-left: 1.5em" id="section-5-2.2">
<p id="section-5-2.2.1">The default value is zero. See <a href="#header-table-dynamic" class="xref">Section 3.2</a> for usage. This is
the equivalent of the SETTINGS_HEADER_TABLE_SIZE from HTTP/2.<a href="#section-5-2.2.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-5-2.3">SETTINGS_QPACK_BLOCKED_STREAMS (0x07):</dt>
<dd style="margin-left: 1.5em" id="section-5-2.4">
<p id="section-5-2.4.1">The default value is zero. See <a href="#blocked-streams" class="xref">Section 2.1.2</a>.<a href="#section-5-2.4.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
</dl>
</section>
</div>
<div id="error-handling">
<section id="section-6">
<h2 id="name-error-handling">
<a href="#section-6" class="section-number selfRef">6. </a><a href="#name-error-handling" class="section-name selfRef">Error Handling</a>
</h2>
<p id="section-6-1">The following error codes are defined for HTTP/3 to indicate failures of
QPACK that prevent the stream or connection from continuing:<a href="#section-6-1" class="pilcrow">¶</a></p>
<span class="break"></span><dl class="dlParallel" id="section-6-2">
<dt id="section-6-2.1">QPACK_DECOMPRESSION_FAILED (0x0200):</dt>
<dd style="margin-left: 1.5em" id="section-6-2.2">
<p id="section-6-2.2.1">The decoder failed to interpret an encoded field section and is not able to
continue decoding that field section.<a href="#section-6-2.2.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-6-2.3">QPACK_ENCODER_STREAM_ERROR (0x0201):</dt>
<dd style="margin-left: 1.5em" id="section-6-2.4">
<p id="section-6-2.4.1">The decoder failed to interpret an encoder instruction received on the
encoder stream.<a href="#section-6-2.4.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
<dt id="section-6-2.5">QPACK_DECODER_STREAM_ERROR (0x0202):</dt>
<dd style="margin-left: 1.5em" id="section-6-2.6">
<p id="section-6-2.6.1">The encoder failed to interpret a decoder instruction received on the
decoder stream.<a href="#section-6-2.6.1" class="pilcrow">¶</a></p>
</dd>
<dd class="break"></dd>
</dl>
</section>
</div>
<div id="security-considerations">
<section id="section-7">
<h2 id="name-security-considerations">
<a href="#section-7" class="section-number selfRef">7. </a><a href="#name-security-considerations" class="section-name selfRef">Security Considerations</a>
</h2>
<p id="section-7-1">This section describes potential areas of security concern with QPACK:<a href="#section-7-1" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-7-2.1">Use of compression as a length-based oracle for verifying guesses about
secrets that are compressed into a shared compression context.<a href="#section-7-2.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-7-2.2">Denial of service resulting from exhausting processing or memory capacity at
a decoder.<a href="#section-7-2.2" class="pilcrow">¶</a>
</li>
</ul>
<div id="probing-dynamic-table-state">
<section id="section-7.1">
<h3 id="name-probing-dynamic-table-state">
<a href="#section-7.1" class="section-number selfRef">7.1. </a><a href="#name-probing-dynamic-table-state" class="section-name selfRef">Probing Dynamic Table State</a>
</h3>
<p id="section-7.1-1">QPACK reduces the encoded size of field sections by exploiting the redundancy
inherent in protocols like HTTP. The ultimate goal of this is to reduce the
amount of data that is required to send HTTP requests or responses.<a href="#section-7.1-1" class="pilcrow">¶</a></p>
<p id="section-7.1-2">The compression context used to encode header and trailer fields can be probed
by an attacker who can both define fields to be encoded and transmitted and
observe the length of those fields once they are encoded. When an attacker can
do both, they can adaptively modify requests in order to confirm guesses about
the dynamic table state. If a guess is compressed into a shorter length, the
attacker can observe the encoded length and infer that the guess was correct.<a href="#section-7.1-2" class="pilcrow">¶</a></p>
<p id="section-7.1-3">This is possible even over the Transport Layer Security Protocol
(<span>[<a href="#TLS" class="xref">TLS</a>]</span>) and the QUIC Transport Protocol (<span>[<a href="#QUIC-TRANSPORT" class="xref">QUIC-TRANSPORT</a>]</span>), because
while TLS and QUIC provide confidentiality protection for content, they only
provide a limited amount of protection for the length of that content.<a href="#section-7.1-3" class="pilcrow">¶</a></p>
<aside id="section-7.1-4">
<p id="section-7.1-4.1">Note: Padding schemes only provide limited protection against an attacker with
these capabilities, potentially only forcing an increased number of guesses to
learn the length associated with a given guess. Padding schemes also work
directly against compression by increasing the number of bits that are
transmitted.<a href="#section-7.1-4.1" class="pilcrow">¶</a></p>
</aside>
<p id="section-7.1-5">Attacks like CRIME (<span>[<a href="#CRIME" class="xref">CRIME</a>]</span>) demonstrated the existence of these general
attacker capabilities. The specific attack exploited the fact that DEFLATE
(<span>[<a href="#RFC1951" class="xref">RFC1951</a>]</span>) removes redundancy based on prefix matching. This permitted the
attacker to confirm guesses a character at a time, reducing an exponential-time
attack into a linear-time attack.<a href="#section-7.1-5" class="pilcrow">¶</a></p>
<div id="applicability-to-qpack-and-http">
<section id="section-7.1.1">
<h4 id="name-applicability-to-qpack-and-">
<a href="#section-7.1.1" class="section-number selfRef">7.1.1. </a><a href="#name-applicability-to-qpack-and-" class="section-name selfRef">Applicability to QPACK and HTTP</a>
</h4>
<p id="section-7.1.1-1">QPACK mitigates, but does not completely prevent, attacks modeled on CRIME
(<span>[<a href="#CRIME" class="xref">CRIME</a>]</span>) by forcing a guess to match an entire field line rather than
individual characters. An attacker can only learn whether a guess is correct or
not, so the attacker is reduced to a brute-force guess for the field values
associated with a given field name.<a href="#section-7.1.1-1" class="pilcrow">¶</a></p>
<p id="section-7.1.1-2">Therefore, the viability of recovering specific field values depends on the
entropy of values. As a result, values with high entropy are unlikely to be
recovered successfully. However, values with low entropy remain vulnerable.<a href="#section-7.1.1-2" class="pilcrow">¶</a></p>
<p id="section-7.1.1-3">Attacks of this nature are possible any time that two mutually distrustful
entities control requests or responses that are placed onto a single HTTP/3
connection. If the shared QPACK compressor permits one entity to add entries to
the dynamic table, and the other to refer to those entries while encoding
chosen field lines, then the attacker (the second entity) can learn the state
of the table by observing the length of the encoded output.<a href="#section-7.1.1-3" class="pilcrow">¶</a></p>
<p id="section-7.1.1-4">For example, requests or responses from mutually distrustful entities can occur
when an intermediary either:<a href="#section-7.1.1-4" class="pilcrow">¶</a></p>
<ul class="normal">
<li class="normal" id="section-7.1.1-5.1">sends requests from multiple clients on a single connection toward an origin
server, or<a href="#section-7.1.1-5.1" class="pilcrow">¶</a>
</li>
<li class="normal" id="section-7.1.1-5.2">takes responses from multiple origin servers and places them on a shared
connection toward a client.<a href="#section-7.1.1-5.2" class="pilcrow">¶</a>
</li>
</ul>
<p id="section-7.1.1-6">Web browsers also need to assume that requests made on the same connection by
different web origins (<span>[<a href="#RFC6454" class="xref">RFC6454</a>]</span>) are made by mutually distrustful entities.
Other scenarios involving mutually distrustful entities are also possible.<a href="#section-7.1.1-6" class="pilcrow">¶</a></p>
</section>
</div>
<div id="mitigation">
<section id="section-7.1.2">
<h4 id="name-mitigation">
<a href="#section-7.1.2" class="section-number selfRef">7.1.2. </a><a href="#name-mitigation" class="section-name selfRef">Mitigation</a>
</h4>
<p id="section-7.1.2-1">Users of HTTP that require confidentiality for header or trailer fields can use
values with entropy sufficient to make guessing infeasible. However, this is
impractical as a general solution because it forces all users of HTTP to take
steps to mitigate attacks. It would impose new constraints on how HTTP is used.<a href="#section-7.1.2-1" class="pilcrow">¶</a></p>
<p id="section-7.1.2-2">Rather than impose constraints on users of HTTP, an implementation of QPACK can
instead constrain how compression is applied in order to limit the potential for
dynamic table probing.<a href="#section-7.1.2-2" class="pilcrow">¶</a></p>
<p id="section-7.1.2-3">An ideal solution segregates access to the dynamic table based on the entity
that is constructing the message. Field values that are added to the table are
attributed to an entity, and only the entity that created a particular value can
extract that value.<a href="#section-7.1.2-3" class="pilcrow">¶</a></p>
<p id="section-7.1.2-4">To improve compression performance of this option, certain entries might be
tagged as being public. For example, a web browser might make the values of the
Accept-Encoding header field available in all requests.<a href="#section-7.1.2-4" class="pilcrow">¶</a></p>
<p id="section-7.1.2-5">An encoder without good knowledge of the provenance of field values might
instead introduce a penalty for many field lines with the same field name and
different values. This penalty could cause a large number of attempts to guess
a field value to result in the field not being compared to the dynamic table
entries in future messages, effectively preventing further guesses.<a href="#section-7.1.2-5" class="pilcrow">¶</a></p>
<p id="section-7.1.2-6">This response might be made inversely proportional to the length of the
field value. Disabling access to the dynamic table for a given field name might
occur for shorter values more quickly or with higher probability than for longer
values.<a href="#section-7.1.2-6" class="pilcrow">¶</a></p>
<p id="section-7.1.2-7">This mitigation is most effective between two endpoints. If messages are
re-encoded by an intermediary without knowledge of which entity constructed a
given message, the intermediary could inadvertently merge compression contexts
that the original encoder had specifically kept separate.<a href="#section-7.1.2-7" class="pilcrow">¶</a></p>
<aside id="section-7.1.2-8">
<p id="section-7.1.2-8.1">Note: Simply removing entries corresponding to the field from the dynamic table
can be ineffectual if the attacker has a reliable way of causing values to be
reinstalled. For example, a request to load an image in a web browser typically
includes the Cookie header field (a potentially highly valued target for this
sort of attack), and websites can easily force an image to be loaded, thereby
refreshing the entry in the dynamic table.<a href="#section-7.1.2-8.1" class="pilcrow">¶</a></p>
</aside>
</section>
</div>
<div id="never-indexed-literals">
<section id="section-7.1.3">
<h4 id="name-never-indexed-literals">
<a href="#section-7.1.3" class="section-number selfRef">7.1.3. </a><a href="#name-never-indexed-literals" class="section-name selfRef">Never-Indexed Literals</a>
</h4>
<p id="section-7.1.3-1">Implementations can also choose to protect sensitive fields by not compressing
them and instead encoding their value as literals.<a href="#section-7.1.3-1" class="pilcrow">¶</a></p>
<p id="section-7.1.3-2">Refusing to insert a field line into the dynamic table is only effective if
doing so is avoided on all hops. The never-indexed literal bit (see
<a href="#literal-name-reference" class="xref">Section 4.5.4</a>) can be used to signal to intermediaries that a
particular value was intentionally sent as a literal.<a href="#section-7.1.3-2" class="pilcrow">¶</a></p>
<p id="section-7.1.3-3">An intermediary <span class="bcp14">MUST NOT</span> re-encode a value that uses a literal representation
with the 'N' bit set with another representation that would index it. If QPACK
is used for re-encoding, a literal representation with the 'N' bit set <span class="bcp14">MUST</span> be
used. If HPACK is used for re-encoding, the never-indexed literal
representation (see <span><a href="https://www.rfc-editor.org/rfc/rfc7541#section-6.2.3" class="relref">Section 6.2.3</a> of [<a href="#RFC7541" class="xref">RFC7541</a>]</span>) <span class="bcp14">MUST</span> be used.<a href="#section-7.1.3-3" class="pilcrow">¶</a></p>
<p id="section-7.1.3-4">The choice to mark that a field value should never be indexed depends on several
factors. Since QPACK does not protect against guessing an entire field value,
short or low-entropy values are more readily recovered by an adversary.
Therefore, an encoder might choose not to index values with low entropy.<a href="#section-7.1.3-4" class="pilcrow">¶</a></p>
<p id="section-7.1.3-5">An encoder might also choose not to index values for fields that are considered
to be highly valuable or sensitive to recovery, such as the Cookie or
Authorization header fields.<a href="#section-7.1.3-5" class="pilcrow">¶</a></p>
<p id="section-7.1.3-6">On the contrary, an encoder might prefer indexing values for fields that have
little or no value if they were exposed. For instance, a User-Agent header field
does not commonly vary between requests and is sent to any server. In that case,
confirmation that a particular User-Agent value has been used provides little
value.<a href="#section-7.1.3-6" class="pilcrow">¶</a></p>
<p id="section-7.1.3-7">Note that these criteria for deciding to use a never-indexed literal
representation will evolve over time as new attacks are discovered.<a href="#section-7.1.3-7" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="static-huffman-encoding">
<section id="section-7.2">
<h3 id="name-static-huffman-encoding">
<a href="#section-7.2" class="section-number selfRef">7.2. </a><a href="#name-static-huffman-encoding" class="section-name selfRef">Static Huffman Encoding</a>
</h3>
<p id="section-7.2-1">There is no currently known attack against a static Huffman encoding. A study
has shown that using a static Huffman encoding table created an information
leakage; however, this same study concluded that an attacker could not take
advantage of this information leakage to recover any meaningful amount of
information (see <span>[<a href="#PETAL" class="xref">PETAL</a>]</span>).<a href="#section-7.2-1" class="pilcrow">¶</a></p>
</section>
</div>
<div id="memory-consumption">
<section id="section-7.3">
<h3 id="name-memory-consumption">
<a href="#section-7.3" class="section-number selfRef">7.3. </a><a href="#name-memory-consumption" class="section-name selfRef">Memory Consumption</a>
</h3>
<p id="section-7.3-1">An attacker can try to cause an endpoint to exhaust its memory. QPACK is
designed to limit both the peak and stable amounts of memory allocated by an
endpoint.<a href="#section-7.3-1" class="pilcrow">¶</a></p>
<p id="section-7.3-2">QPACK uses the definition of the maximum size of the dynamic table and the
maximum number of blocking streams to limit the amount of memory the encoder can
cause the decoder to consume. In HTTP/3, these values are controlled by the
decoder through the settings parameters SETTINGS_QPACK_MAX_TABLE_CAPACITY and
SETTINGS_QPACK_BLOCKED_STREAMS, respectively (see
<a href="#maximum-dynamic-table-capacity" class="xref">Section 3.2.3</a> and <a href="#blocked-streams" class="xref">Section 2.1.2</a>). The limit on the
size of the dynamic table takes into account the size of the data stored in the
dynamic table, plus a small allowance for overhead. The limit on the number of
blocked streams is only a proxy for the maximum amount of memory required by the
decoder. The actual maximum amount of memory will depend on how much memory the
decoder uses to track each blocked stream.<a href="#section-7.3-2" class="pilcrow">¶</a></p>
<p id="section-7.3-3">A decoder can limit the amount of state memory used for the dynamic table by
setting an appropriate value for the maximum size of the dynamic table. In
HTTP/3, this is realized by setting an appropriate value for the
SETTINGS_QPACK_MAX_TABLE_CAPACITY parameter. An encoder can limit the amount of
state memory it uses by choosing a smaller dynamic table size than the decoder
allows and signaling this to the decoder (see <a href="#set-dynamic-capacity" class="xref">Section 4.3.1</a>).<a href="#section-7.3-3" class="pilcrow">¶</a></p>
<p id="section-7.3-4">A decoder can limit the amount of state memory used for blocked streams by
setting an appropriate value for the maximum number of blocked streams. In
HTTP/3, this is realized by setting an appropriate value for the
SETTINGS_QPACK_BLOCKED_STREAMS parameter. Streams that risk becoming blocked
consume no additional state memory on the encoder.<a href="#section-7.3-4" class="pilcrow">¶</a></p>
<p id="section-7.3-5">An encoder allocates memory to track all dynamic table references in
unacknowledged field sections. An implementation can directly limit the amount
of state memory by only using as many references to the dynamic table as it
wishes to track; no signaling to the decoder is required. However, limiting
references to the dynamic table will reduce compression effectiveness.<a href="#section-7.3-5" class="pilcrow">¶</a></p>
<p id="section-7.3-6">The amount of temporary memory consumed by an encoder or decoder can be limited
by processing field lines sequentially. A decoder implementation does not need
to retain a complete list of field lines while decoding a field section. An
encoder implementation does not need to retain a complete list of field lines
while encoding a field section if it is using a single-pass algorithm. Note
that it might be necessary for an application to retain a complete list of field
lines for other reasons; even if QPACK does not force this to occur, application
constraints might make this necessary.<a href="#section-7.3-6" class="pilcrow">¶</a></p>
<p id="section-7.3-7">While the negotiated limit on the dynamic table size accounts for much of the
memory that can be consumed by a QPACK implementation, data that cannot be
immediately sent due to flow control is not affected by this limit.
Implementations should limit the size of unsent data, especially on the decoder
stream where flexibility to choose what to send is limited. Possible responses
to an excess of unsent data might include limiting the ability of the peer to
open new streams, reading only from the encoder stream, or closing the
connection.<a href="#section-7.3-7" class="pilcrow">¶</a></p>
</section>
</div>
<div id="implementation-limits">
<section id="section-7.4">
<h3 id="name-implementation-limits">
<a href="#section-7.4" class="section-number selfRef">7.4. </a><a href="#name-implementation-limits" class="section-name selfRef">Implementation Limits</a>
</h3>
<p id="section-7.4-1">An implementation of QPACK needs to ensure that large values for integers, long
encoding for integers, or long string literals do not create security
weaknesses.<a href="#section-7.4-1" class="pilcrow">¶</a></p>
<p id="section-7.4-2">An implementation has to set a limit for the values it accepts for integers, as
well as for the encoded length; see <a href="#prefixed-integers" class="xref">Section 4.1.1</a>. In the same way, it
has to set a limit to the length it accepts for string literals; see
<a href="#string-literals" class="xref">Section 4.1.2</a>. These limits <span class="bcp14">SHOULD</span> be large enough to process the
largest individual field the HTTP implementation can be configured to accept.<a href="#section-7.4-2" class="pilcrow">¶</a></p>
<p id="section-7.4-3">If an implementation encounters a value larger than it is able to decode, this
<span class="bcp14">MUST</span> be treated as a stream error of type QPACK_DECOMPRESSION_FAILED if on a
request stream or a connection error of the appropriate type if on the encoder
or decoder stream.<a href="#section-7.4-3" class="pilcrow">¶</a></p>
</section>
</div>
</section>
</div>
<div id="iana-considerations">
<section id="section-8">
<h2 id="name-iana-considerations">
<a href="#section-8" class="section-number selfRef">8. </a><a href="#name-iana-considerations" class="section-name selfRef">IANA Considerations</a>
</h2>
<p id="section-8-1">This document makes multiple registrations in the registries defined by
<span>[<a href="#HTTP3" class="xref">HTTP/3</a>]</span>. The allocations created by this document are all assigned permanent
status and list a change controller of the IETF and a contact of the HTTP
working group (ietf-http-wg@w3.org).<a href="#section-8-1" class="pilcrow">¶</a></p>
<div id="settings-registration">
<section id="section-8.1">
<h3 id="name-settings-registration">
<a href="#section-8.1" class="section-number selfRef">8.1. </a><a href="#name-settings-registration" class="section-name selfRef">Settings Registration</a>
</h3>
<p id="section-8.1-1">This document specifies two settings. The entries in the following table are
registered in the "HTTP/3 Settings" registry established in <span>[<a href="#HTTP3" class="xref">HTTP/3</a>]</span>.<a href="#section-8.1-1" class="pilcrow">¶</a></p>
<span id="name-additions-to-the-http-3-set"></span><table class="center" id="table-1">
<caption>
<a href="#table-1" class="selfRef">Table 1</a>:
<a href="#name-additions-to-the-http-3-set" class="selfRef">Additions to the HTTP/3 Settings Registry</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Setting Name</th>
<th class="text-center" rowspan="1" colspan="1">Code</th>
<th class="text-left" rowspan="1" colspan="1">Specification</th>
<th class="text-left" rowspan="1" colspan="1">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK_MAX_TABLE_CAPACITY</td>
<td class="text-center" rowspan="1" colspan="1">0x01</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#configuration" class="xref">Section 5</a>
</td>
<td class="text-left" rowspan="1" colspan="1">0</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK_BLOCKED_STREAMS</td>
<td class="text-center" rowspan="1" colspan="1">0x07</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#configuration" class="xref">Section 5</a>
</td>
<td class="text-left" rowspan="1" colspan="1">0</td>
</tr>
</tbody>
</table>
<p id="section-8.1-3">For formatting reasons, the setting names here are abbreviated by removing the
'SETTINGS_' prefix.<a href="#section-8.1-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="stream-type-registration">
<section id="section-8.2">
<h3 id="name-stream-type-registration">
<a href="#section-8.2" class="section-number selfRef">8.2. </a><a href="#name-stream-type-registration" class="section-name selfRef">Stream Type Registration</a>
</h3>
<p id="section-8.2-1">This document specifies two stream types. The entries in the following table are
registered in the "HTTP/3 Stream Types" registry established in <span>[<a href="#HTTP3" class="xref">HTTP/3</a>]</span>.<a href="#section-8.2-1" class="pilcrow">¶</a></p>
<span id="name-additions-to-the-http-3-str"></span><table class="center" id="table-2">
<caption>
<a href="#table-2" class="selfRef">Table 2</a>:
<a href="#name-additions-to-the-http-3-str" class="selfRef">Additions to the HTTP/3 Stream Types Registry</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Stream Type</th>
<th class="text-center" rowspan="1" colspan="1">Code</th>
<th class="text-left" rowspan="1" colspan="1">Specification</th>
<th class="text-left" rowspan="1" colspan="1">Sender</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK Encoder Stream</td>
<td class="text-center" rowspan="1" colspan="1">0x02</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#enc-dec-stream-def" class="xref">Section 4.2</a>
</td>
<td class="text-left" rowspan="1" colspan="1">Both</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK Decoder Stream</td>
<td class="text-center" rowspan="1" colspan="1">0x03</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#enc-dec-stream-def" class="xref">Section 4.2</a>
</td>
<td class="text-left" rowspan="1" colspan="1">Both</td>
</tr>
</tbody>
</table>
</section>
</div>
<div id="error-code-registration">
<section id="section-8.3">
<h3 id="name-error-code-registration">
<a href="#section-8.3" class="section-number selfRef">8.3. </a><a href="#name-error-code-registration" class="section-name selfRef">Error Code Registration</a>
</h3>
<p id="section-8.3-1">This document specifies three error codes. The entries in the following table
are registered in the "HTTP/3 Error Codes" registry established in <span>[<a href="#HTTP3" class="xref">HTTP/3</a>]</span>.<a href="#section-8.3-1" class="pilcrow">¶</a></p>
<span id="name-additions-to-the-http-3-err"></span><table class="center" id="table-3">
<caption>
<a href="#table-3" class="selfRef">Table 3</a>:
<a href="#name-additions-to-the-http-3-err" class="selfRef">Additions to the HTTP/3 Error Codes Registry</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Name</th>
<th class="text-left" rowspan="1" colspan="1">Code</th>
<th class="text-left" rowspan="1" colspan="1">Description</th>
<th class="text-left" rowspan="1" colspan="1">Specification</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK_DECOMPRESSION_FAILED</td>
<td class="text-left" rowspan="1" colspan="1">0x0200</td>
<td class="text-left" rowspan="1" colspan="1">Decoding of a field section failed</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#error-handling" class="xref">Section 6</a>
</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK_ENCODER_STREAM_ERROR</td>
<td class="text-left" rowspan="1" colspan="1">0x0201</td>
<td class="text-left" rowspan="1" colspan="1">Error on the encoder stream</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#error-handling" class="xref">Section 6</a>
</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">QPACK_DECODER_STREAM_ERROR</td>
<td class="text-left" rowspan="1" colspan="1">0x0202</td>
<td class="text-left" rowspan="1" colspan="1">Error on the decoder stream</td>
<td class="text-left" rowspan="1" colspan="1">
<a href="#error-handling" class="xref">Section 6</a>
</td>
</tr>
</tbody>
</table>
</section>
</div>
</section>
</div>
<section id="section-9">
<h2 id="name-references">
<a href="#section-9" class="section-number selfRef">9. </a><a href="#name-references" class="section-name selfRef">References</a>
</h2>
<section id="section-9.1">
<h3 id="name-normative-references">
<a href="#section-9.1" class="section-number selfRef">9.1. </a><a href="#name-normative-references" class="section-name selfRef">Normative References</a>
</h3>
<dl class="references">
<dt id="HTTP">[HTTP]</dt>
<dd>
<span class="refAuthor">Fielding, R., Ed.</span>, <span class="refAuthor">Nottingham, M., Ed.</span>, and <span class="refAuthor">J. Reschke, Ed.</span>, <span class="refTitle">"HTTP Semantics"</span>, <span class="seriesInfo">STD 97</span>, <span class="seriesInfo">RFC 9110</span>, <span class="seriesInfo">DOI 10.17487/RFC9110</span>, <time datetime="2022-06" class="refDate">June 2022</time>, <span><<a href="https://www.rfc-editor.org/info/rfc9110">https://www.rfc-editor.org/info/rfc9110</a>></span>. </dd>
<dd class="break"></dd>
<dt id="HTTP3">[HTTP/3]</dt>
<dd>
<span class="refAuthor">Bishop, M., Ed.</span>, <span class="refTitle">"HTTP/3"</span>, <span class="seriesInfo">RFC 9114</span>, <span class="seriesInfo">DOI 10.17487/RFC9114</span>, <time datetime="2022-06" class="refDate">June 2022</time>, <span><<a href="https://www.rfc-editor.org/info/rfc9114">https://www.rfc-editor.org/info/rfc9114</a>></span>. </dd>
<dd class="break"></dd>
<dt id="QUIC-TRANSPORT">[QUIC-TRANSPORT]</dt>
<dd>
<span class="refAuthor">Iyengar, J., Ed.</span> and <span class="refAuthor">M. Thomson, Ed.</span>, <span class="refTitle">"QUIC: A UDP-Based Multiplexed and Secure Transport"</span>, <span class="seriesInfo">RFC 9000</span>, <span class="seriesInfo">DOI 10.17487/RFC9000</span>, <time datetime="2021-05" class="refDate">May 2021</time>, <span><<a href="https://www.rfc-editor.org/info/rfc9000">https://www.rfc-editor.org/info/rfc9000</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC2119">[RFC2119]</dt>
<dd>
<span class="refAuthor">Bradner, S.</span>, <span class="refTitle">"Key words for use in RFCs to Indicate Requirement Levels"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 2119</span>, <span class="seriesInfo">DOI 10.17487/RFC2119</span>, <time datetime="1997-03" class="refDate">March 1997</time>, <span><<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC2360">[RFC2360]</dt>
<dd>
<span class="refAuthor">Scott, G.</span>, <span class="refTitle">"Guide for Internet Standards Writers"</span>, <span class="seriesInfo">BCP 22</span>, <span class="seriesInfo">RFC 2360</span>, <span class="seriesInfo">DOI 10.17487/RFC2360</span>, <time datetime="1998-06" class="refDate">June 1998</time>, <span><<a href="https://www.rfc-editor.org/info/rfc2360">https://www.rfc-editor.org/info/rfc2360</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC7541">[RFC7541]</dt>
<dd>
<span class="refAuthor">Peon, R.</span> and <span class="refAuthor">H. Ruellan</span>, <span class="refTitle">"HPACK: Header Compression for HTTP/2"</span>, <span class="seriesInfo">RFC 7541</span>, <span class="seriesInfo">DOI 10.17487/RFC7541</span>, <time datetime="2015-05" class="refDate">May 2015</time>, <span><<a href="https://www.rfc-editor.org/info/rfc7541">https://www.rfc-editor.org/info/rfc7541</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC8174">[RFC8174]</dt>
<dd>
<span class="refAuthor">Leiba, B.</span>, <span class="refTitle">"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 8174</span>, <span class="seriesInfo">DOI 10.17487/RFC8174</span>, <time datetime="2017-05" class="refDate">May 2017</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>></span>. </dd>
<dd class="break"></dd>
</dl>
</section>
<section id="section-9.2">
<h3 id="name-informative-references">
<a href="#section-9.2" class="section-number selfRef">9.2. </a><a href="#name-informative-references" class="section-name selfRef">Informative References</a>
</h3>
<dl class="references">
<dt id="CRIME">[CRIME]</dt>
<dd>
<span class="refAuthor">Wikipedia</span>, <span class="refTitle">"CRIME"</span>, <time datetime="2015-05" class="refDate">May 2015</time>, <span><<a href="http://en.wikipedia.org/w/index.php?title=CRIME&oldid=660948120">http://en.wikipedia.org/w/index.php?title=CRIME&oldid=660948120</a>></span>. </dd>
<dd class="break"></dd>
<dt id="HTTP2">[HTTP/2]</dt>
<dd>
<span class="refAuthor">Thomson, M., Ed.</span> and <span class="refAuthor">C. Benfield, Ed.</span>, <span class="refTitle">"HTTP/2"</span>, <span class="seriesInfo">RFC 9113</span>, <span class="seriesInfo">DOI 10.17487/RFC9113</span>, <time datetime="2022-06" class="refDate">June 2022</time>, <span><<a href="https://www.rfc-editor.org/info/rfc9113">https://www.rfc-editor.org/info/rfc9113</a>></span>. </dd>
<dd class="break"></dd>
<dt id="PETAL">[PETAL]</dt>
<dd>
<span class="refAuthor">Tan, J.</span> and <span class="refAuthor">J. Nahata</span>, <span class="refTitle">"PETAL: Preset Encoding Table Information Leakage"</span>, <time datetime="2013-04" class="refDate">April 2013</time>, <span><<a href="http://www.pdl.cmu.edu/PDL-FTP/associated/CMU-PDL-13-106.pdf">http://www.pdl.cmu.edu/PDL-FTP/associated/CMU-PDL-13-106.pdf</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC1951">[RFC1951]</dt>
<dd>
<span class="refAuthor">Deutsch, P.</span>, <span class="refTitle">"DEFLATE Compressed Data Format Specification version 1.3"</span>, <span class="seriesInfo">RFC 1951</span>, <span class="seriesInfo">DOI 10.17487/RFC1951</span>, <time datetime="1996-05" class="refDate">May 1996</time>, <span><<a href="https://www.rfc-editor.org/info/rfc1951">https://www.rfc-editor.org/info/rfc1951</a>></span>. </dd>
<dd class="break"></dd>
<dt id="RFC6454">[RFC6454]</dt>
<dd>
<span class="refAuthor">Barth, A.</span>, <span class="refTitle">"The Web Origin Concept"</span>, <span class="seriesInfo">RFC 6454</span>, <span class="seriesInfo">DOI 10.17487/RFC6454</span>, <time datetime="2011-12" class="refDate">December 2011</time>, <span><<a href="https://www.rfc-editor.org/info/rfc6454">https://www.rfc-editor.org/info/rfc6454</a>></span>. </dd>
<dd class="break"></dd>
<dt id="TLS">[TLS]</dt>
<dd>
<span class="refAuthor">Rescorla, E.</span>, <span class="refTitle">"The Transport Layer Security (TLS) Protocol Version 1.3"</span>, <span class="seriesInfo">RFC 8446</span>, <span class="seriesInfo">DOI 10.17487/RFC8446</span>, <time datetime="2018-08" class="refDate">August 2018</time>, <span><<a href="https://www.rfc-editor.org/info/rfc8446">https://www.rfc-editor.org/info/rfc8446</a>></span>. </dd>
<dd class="break"></dd>
</dl>
</section>
</section>
<div id="static-table">
<section id="appendix-A">
<h2 id="name-static-table-2">
<a href="#appendix-A" class="section-number selfRef">Appendix A. </a><a href="#name-static-table-2" class="section-name selfRef">Static Table</a>
</h2>
<p id="appendix-A-1">This table was generated by analyzing actual Internet traffic in 2018 and
including the most common header fields, after filtering out some unsupported
and non-standard values. Due to this methodology, some of the entries may be
inconsistent or appear multiple times with similar but not identical values. The
order of the entries is optimized to encode the most common header fields with
the smallest number of bytes.<a href="#appendix-A-1" class="pilcrow">¶</a></p>
<span id="name-static-table-3"></span><table class="center" id="table-4">
<caption>
<a href="#table-4" class="selfRef">Table 4</a>:
<a href="#name-static-table-3" class="selfRef">Static Table</a>
</caption>
<thead>
<tr>
<th class="text-left" rowspan="1" colspan="1">Index</th>
<th class="text-left" rowspan="1" colspan="1">Name</th>
<th class="text-left" rowspan="1" colspan="1">Value</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left" rowspan="1" colspan="1">0</td>
<td class="text-left" rowspan="1" colspan="1">:authority</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">1</td>
<td class="text-left" rowspan="1" colspan="1">:path</td>
<td class="text-left" rowspan="1" colspan="1">/</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">2</td>
<td class="text-left" rowspan="1" colspan="1">age</td>
<td class="text-left" rowspan="1" colspan="1">0</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">3</td>
<td class="text-left" rowspan="1" colspan="1">content-disposition</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">4</td>
<td class="text-left" rowspan="1" colspan="1">content-length</td>
<td class="text-left" rowspan="1" colspan="1">0</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">5</td>
<td class="text-left" rowspan="1" colspan="1">cookie</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">6</td>
<td class="text-left" rowspan="1" colspan="1">date</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">7</td>
<td class="text-left" rowspan="1" colspan="1">etag</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">8</td>
<td class="text-left" rowspan="1" colspan="1">if-modified-since</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">9</td>
<td class="text-left" rowspan="1" colspan="1">if-none-match</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">10</td>
<td class="text-left" rowspan="1" colspan="1">last-modified</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">11</td>
<td class="text-left" rowspan="1" colspan="1">link</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">12</td>
<td class="text-left" rowspan="1" colspan="1">location</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">13</td>
<td class="text-left" rowspan="1" colspan="1">referer</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">14</td>
<td class="text-left" rowspan="1" colspan="1">set-cookie</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">15</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">CONNECT</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">16</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">DELETE</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">17</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">GET</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">18</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">HEAD</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">19</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">OPTIONS</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">20</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">POST</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">21</td>
<td class="text-left" rowspan="1" colspan="1">:method</td>
<td class="text-left" rowspan="1" colspan="1">PUT</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">22</td>
<td class="text-left" rowspan="1" colspan="1">:scheme</td>
<td class="text-left" rowspan="1" colspan="1">http</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">23</td>
<td class="text-left" rowspan="1" colspan="1">:scheme</td>
<td class="text-left" rowspan="1" colspan="1">https</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">24</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">103</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">25</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">200</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">26</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">304</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">27</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">404</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">28</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">503</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">29</td>
<td class="text-left" rowspan="1" colspan="1">accept</td>
<td class="text-left" rowspan="1" colspan="1">*/*</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">30</td>
<td class="text-left" rowspan="1" colspan="1">accept</td>
<td class="text-left" rowspan="1" colspan="1">application/dns-message</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">31</td>
<td class="text-left" rowspan="1" colspan="1">accept-encoding</td>
<td class="text-left" rowspan="1" colspan="1">gzip, deflate, br</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">32</td>
<td class="text-left" rowspan="1" colspan="1">accept-ranges</td>
<td class="text-left" rowspan="1" colspan="1">bytes</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">33</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-headers</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">34</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-headers</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">35</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-origin</td>
<td class="text-left" rowspan="1" colspan="1">*</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">36</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
<td class="text-left" rowspan="1" colspan="1">max-age=0</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">37</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
<td class="text-left" rowspan="1" colspan="1">max-age=2592000</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">38</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
<td class="text-left" rowspan="1" colspan="1">max-age=604800</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">39</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
<td class="text-left" rowspan="1" colspan="1">no-cache</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">40</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
<td class="text-left" rowspan="1" colspan="1">no-store</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">41</td>
<td class="text-left" rowspan="1" colspan="1">cache-control</td>
<td class="text-left" rowspan="1" colspan="1">public, max-age=31536000</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">42</td>
<td class="text-left" rowspan="1" colspan="1">content-encoding</td>
<td class="text-left" rowspan="1" colspan="1">br</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">43</td>
<td class="text-left" rowspan="1" colspan="1">content-encoding</td>
<td class="text-left" rowspan="1" colspan="1">gzip</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">44</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">application/dns-message</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">45</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">application/javascript</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">46</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">application/json</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">47</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">application/x-www-form-urlencoded</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">48</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">image/gif</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">49</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">image/jpeg</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">50</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">image/png</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">51</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">text/css</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">52</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">text/html; charset=utf-8</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">53</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">text/plain</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">54</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
<td class="text-left" rowspan="1" colspan="1">text/plain;charset=utf-8</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">55</td>
<td class="text-left" rowspan="1" colspan="1">range</td>
<td class="text-left" rowspan="1" colspan="1">bytes=0-</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">56</td>
<td class="text-left" rowspan="1" colspan="1">strict-transport-security</td>
<td class="text-left" rowspan="1" colspan="1">max-age=31536000</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">57</td>
<td class="text-left" rowspan="1" colspan="1">strict-transport-security</td>
<td class="text-left" rowspan="1" colspan="1">max-age=31536000; includesubdomains</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">58</td>
<td class="text-left" rowspan="1" colspan="1">strict-transport-security</td>
<td class="text-left" rowspan="1" colspan="1">max-age=31536000; includesubdomains; preload</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">59</td>
<td class="text-left" rowspan="1" colspan="1">vary</td>
<td class="text-left" rowspan="1" colspan="1">accept-encoding</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">60</td>
<td class="text-left" rowspan="1" colspan="1">vary</td>
<td class="text-left" rowspan="1" colspan="1">origin</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">61</td>
<td class="text-left" rowspan="1" colspan="1">x-content-type-options</td>
<td class="text-left" rowspan="1" colspan="1">nosniff</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">62</td>
<td class="text-left" rowspan="1" colspan="1">x-xss-protection</td>
<td class="text-left" rowspan="1" colspan="1">1; mode=block</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">63</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">100</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">64</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">204</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">65</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">206</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">66</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">302</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">67</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">400</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">68</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">403</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">69</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">421</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">70</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">425</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">71</td>
<td class="text-left" rowspan="1" colspan="1">:status</td>
<td class="text-left" rowspan="1" colspan="1">500</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">72</td>
<td class="text-left" rowspan="1" colspan="1">accept-language</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">73</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-credentials</td>
<td class="text-left" rowspan="1" colspan="1">FALSE</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">74</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-credentials</td>
<td class="text-left" rowspan="1" colspan="1">TRUE</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">75</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-headers</td>
<td class="text-left" rowspan="1" colspan="1">*</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">76</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-methods</td>
<td class="text-left" rowspan="1" colspan="1">get</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">77</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-methods</td>
<td class="text-left" rowspan="1" colspan="1">get, post, options</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">78</td>
<td class="text-left" rowspan="1" colspan="1">access-control-allow-methods</td>
<td class="text-left" rowspan="1" colspan="1">options</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">79</td>
<td class="text-left" rowspan="1" colspan="1">access-control-expose-headers</td>
<td class="text-left" rowspan="1" colspan="1">content-length</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">80</td>
<td class="text-left" rowspan="1" colspan="1">access-control-request-headers</td>
<td class="text-left" rowspan="1" colspan="1">content-type</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">81</td>
<td class="text-left" rowspan="1" colspan="1">access-control-request-method</td>
<td class="text-left" rowspan="1" colspan="1">get</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">82</td>
<td class="text-left" rowspan="1" colspan="1">access-control-request-method</td>
<td class="text-left" rowspan="1" colspan="1">post</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">83</td>
<td class="text-left" rowspan="1" colspan="1">alt-svc</td>
<td class="text-left" rowspan="1" colspan="1">clear</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">84</td>
<td class="text-left" rowspan="1" colspan="1">authorization</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">85</td>
<td class="text-left" rowspan="1" colspan="1">content-security-policy</td>
<td class="text-left" rowspan="1" colspan="1">script-src 'none'; object-src 'none'; base-uri 'none'</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">86</td>
<td class="text-left" rowspan="1" colspan="1">early-data</td>
<td class="text-left" rowspan="1" colspan="1">1</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">87</td>
<td class="text-left" rowspan="1" colspan="1">expect-ct</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">88</td>
<td class="text-left" rowspan="1" colspan="1">forwarded</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">89</td>
<td class="text-left" rowspan="1" colspan="1">if-range</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">90</td>
<td class="text-left" rowspan="1" colspan="1">origin</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">91</td>
<td class="text-left" rowspan="1" colspan="1">purpose</td>
<td class="text-left" rowspan="1" colspan="1">prefetch</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">92</td>
<td class="text-left" rowspan="1" colspan="1">server</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">93</td>
<td class="text-left" rowspan="1" colspan="1">timing-allow-origin</td>
<td class="text-left" rowspan="1" colspan="1">*</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">94</td>
<td class="text-left" rowspan="1" colspan="1">upgrade-insecure-requests</td>
<td class="text-left" rowspan="1" colspan="1">1</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">95</td>
<td class="text-left" rowspan="1" colspan="1">user-agent</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">96</td>
<td class="text-left" rowspan="1" colspan="1">x-forwarded-for</td>
<td class="text-left" rowspan="1" colspan="1"></td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">97</td>
<td class="text-left" rowspan="1" colspan="1">x-frame-options</td>
<td class="text-left" rowspan="1" colspan="1">deny</td>
</tr>
<tr>
<td class="text-left" rowspan="1" colspan="1">98</td>
<td class="text-left" rowspan="1" colspan="1">x-frame-options</td>
<td class="text-left" rowspan="1" colspan="1">sameorigin</td>
</tr>
</tbody>
</table>
<p id="appendix-A-3">Any line breaks that appear within field names or values are due to formatting.<a href="#appendix-A-3" class="pilcrow">¶</a></p>
</section>
</div>
<div id="encoding-and-decoding-examples">
<section id="appendix-B">
<h2 id="name-encoding-and-decoding-examp">
<a href="#appendix-B" class="section-number selfRef">Appendix B. </a><a href="#name-encoding-and-decoding-examp" class="section-name selfRef">Encoding and Decoding Examples</a>
</h2>
<p id="appendix-B-1">The following examples represent a series of exchanges between an encoder and a
decoder. The exchanges are designed to exercise most QPACK instructions and
highlight potentially common patterns and their impact on dynamic table state.
The encoder sends three encoded field sections containing one field line each,
as well as two speculative inserts that are not referenced.<a href="#appendix-B-1" class="pilcrow">¶</a></p>
<p id="appendix-B-2">The state of the encoder's dynamic table is shown, along with its
current size. Each entry is shown with the Absolute Index of the entry (Abs),
the current number of outstanding encoded field sections with references to that
entry (Ref), along with the name and value. Entries above the 'acknowledged'
line have been acknowledged by the decoder.<a href="#appendix-B-2" class="pilcrow">¶</a></p>
<div id="literal-field-line-with-name-reference">
<section id="appendix-B.1">
<h3 id="name-literal-field-line-with-name-">
<a href="#appendix-B.1" class="section-number selfRef">B.1. </a><a href="#name-literal-field-line-with-name-" class="section-name selfRef">Literal Field Line with Name Reference</a>
</h3>
<p id="appendix-B.1-1">The encoder sends an encoded field section containing a literal representation
of a field with a static name reference.<a href="#appendix-B.1-1" class="pilcrow">¶</a></p>
<div class="alignLeft art-text artwork" id="appendix-B.1-2">
<pre>
Data | Interpretation
| Encoder's Dynamic Table
Stream: 0
0000 | Required Insert Count = 0, Base = 0
510b 2f69 6e64 6578 | Literal Field Line with Name Reference
2e68 746d 6c | Static Table, Index=1
| (:path=/index.html)
Abs Ref Name Value
^-- acknowledged --^
Size=0
</pre><a href="#appendix-B.1-2" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="dynamic-table">
<section id="appendix-B.2">
<h3 id="name-dynamic-table-2">
<a href="#appendix-B.2" class="section-number selfRef">B.2. </a><a href="#name-dynamic-table-2" class="section-name selfRef">Dynamic Table</a>
</h3>
<p id="appendix-B.2-1">The encoder sets the dynamic table capacity, inserts a header with a dynamic
name reference, then sends a potentially blocking, encoded field section
referencing this new entry. The decoder acknowledges processing the encoded
field section, which implicitly acknowledges all dynamic table insertions up to
the Required Insert Count.<a href="#appendix-B.2-1" class="pilcrow">¶</a></p>
<div class="alignLeft art-text artwork" id="appendix-B.2-2">
<pre>
Stream: Encoder
3fbd01 | Set Dynamic Table Capacity=220
c00f 7777 772e 6578 | Insert With Name Reference
616d 706c 652e 636f | Static Table, Index=0
6d | (:authority=www.example.com)
c10c 2f73 616d 706c | Insert With Name Reference
652f 7061 7468 | Static Table, Index=1
| (:path=/sample/path)
Abs Ref Name Value
^-- acknowledged --^
0 0 :authority www.example.com
1 0 :path /sample/path
Size=106
Stream: 4
0381 | Required Insert Count = 2, Base = 0
10 | Indexed Field Line With Post-Base Index
| Absolute Index = Base(0) + Index(0) = 0
| (:authority=www.example.com)
11 | Indexed Field Line With Post-Base Index
| Absolute Index = Base(0) + Index(1) = 1
| (:path=/sample/path)
Abs Ref Name Value
^-- acknowledged --^
0 1 :authority www.example.com
1 1 :path /sample/path
Size=106
Stream: Decoder
84 | Section Acknowledgment (stream=4)
Abs Ref Name Value
0 0 :authority www.example.com
1 0 :path /sample/path
^-- acknowledged --^
Size=106
</pre><a href="#appendix-B.2-2" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="speculative-insert">
<section id="appendix-B.3">
<h3 id="name-speculative-insert">
<a href="#appendix-B.3" class="section-number selfRef">B.3. </a><a href="#name-speculative-insert" class="section-name selfRef">Speculative Insert</a>
</h3>
<p id="appendix-B.3-1">The encoder inserts a header into the dynamic table with a literal name.
The decoder acknowledges receipt of the entry. The encoder does not send
any encoded field sections.<a href="#appendix-B.3-1" class="pilcrow">¶</a></p>
<div class="alignLeft art-text artwork" id="appendix-B.3-2">
<pre>
Stream: Encoder
4a63 7573 746f 6d2d | Insert With Literal Name
6b65 790c 6375 7374 | (custom-key=custom-value)
6f6d 2d76 616c 7565 |
Abs Ref Name Value
0 0 :authority www.example.com
1 0 :path /sample/path
^-- acknowledged --^
2 0 custom-key custom-value
Size=160
Stream: Decoder
01 | Insert Count Increment (1)
Abs Ref Name Value
0 0 :authority www.example.com
1 0 :path /sample/path
2 0 custom-key custom-value
^-- acknowledged --^
Size=160
</pre><a href="#appendix-B.3-2" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="duplicate-instruction-stream-cancellation">
<section id="appendix-B.4">
<h3 id="name-duplicate-instruction-strea">
<a href="#appendix-B.4" class="section-number selfRef">B.4. </a><a href="#name-duplicate-instruction-strea" class="section-name selfRef">Duplicate Instruction, Stream Cancellation</a>
</h3>
<p id="appendix-B.4-1">The encoder duplicates an existing entry in the dynamic table, then sends an
encoded field section referencing the dynamic table entries including the
duplicated entry. The packet containing the encoder stream data is delayed.
Before the packet arrives, the decoder cancels the stream and notifies the
encoder that the encoded field section was not processed.<a href="#appendix-B.4-1" class="pilcrow">¶</a></p>
<div class="alignLeft art-text artwork" id="appendix-B.4-2">
<pre>
Stream: Encoder
02 | Duplicate (Relative Index = 2)
| Absolute Index =
| Insert Count(3) - Index(2) - 1 = 0
Abs Ref Name Value
0 0 :authority www.example.com
1 0 :path /sample/path
2 0 custom-key custom-value
^-- acknowledged --^
3 0 :authority www.example.com
Size=217
Stream: 8
0500 | Required Insert Count = 4, Base = 4
80 | Indexed Field Line, Dynamic Table
| Absolute Index = Base(4) - Index(0) - 1 = 3
| (:authority=www.example.com)
c1 | Indexed Field Line, Static Table Index = 1
| (:path=/)
81 | Indexed Field Line, Dynamic Table
| Absolute Index = Base(4) - Index(1) - 1 = 2
| (custom-key=custom-value)
Abs Ref Name Value
0 0 :authority www.example.com
1 0 :path /sample/path
2 1 custom-key custom-value
^-- acknowledged --^
3 1 :authority www.example.com
Size=217
Stream: Decoder
48 | Stream Cancellation (Stream=8)
Abs Ref Name Value
0 0 :authority www.example.com
1 0 :path /sample/path
2 0 custom-key custom-value
^-- acknowledged --^
3 0 :authority www.example.com
Size=217
</pre><a href="#appendix-B.4-2" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="dynamic-table-insert-eviction">
<section id="appendix-B.5">
<h3 id="name-dynamic-table-insert-evicti">
<a href="#appendix-B.5" class="section-number selfRef">B.5. </a><a href="#name-dynamic-table-insert-evicti" class="section-name selfRef">Dynamic Table Insert, Eviction</a>
</h3>
<p id="appendix-B.5-1">The encoder inserts another header into the dynamic table, which evicts the
oldest entry. The encoder does not send any encoded field sections.<a href="#appendix-B.5-1" class="pilcrow">¶</a></p>
<div class="alignLeft art-text artwork" id="appendix-B.5-2">
<pre>
Stream: Encoder
810d 6375 7374 6f6d | Insert With Name Reference
2d76 616c 7565 32 | Dynamic Table, Relative Index = 1
| Absolute Index =
| Insert Count(4) - Index(1) - 1 = 2
| (custom-key=custom-value2)
Abs Ref Name Value
1 0 :path /sample/path
2 0 custom-key custom-value
^-- acknowledged --^
3 0 :authority www.example.com
4 0 custom-key custom-value2
Size=215
</pre><a href="#appendix-B.5-2" class="pilcrow">¶</a>
</div>
</section>
</div>
</section>
</div>
<div id="sample-single-pass-encoding-algorithm">
<section id="appendix-C">
<h2 id="name-sample-single-pass-encoding">
<a href="#appendix-C" class="section-number selfRef">Appendix C. </a><a href="#name-sample-single-pass-encoding" class="section-name selfRef">Sample Single-Pass Encoding Algorithm</a>
</h2>
<p id="appendix-C-1">Pseudocode for single-pass encoding, excluding handling of duplicates,
non-blocking mode, available encoder stream flow control and reference tracking.<a href="#appendix-C-1" class="pilcrow">¶</a></p>
<div id="appendix-C-2">
<pre class="breakable lang-pseudocode sourcecode">
# Helper functions:
# ====
# Encode an integer with the specified prefix and length
encodeInteger(buffer, prefix, value, prefixLength)
# Encode a dynamic table insert instruction with optional static
# or dynamic name index (but not both)
encodeInsert(buffer, staticNameIndex, dynamicNameIndex, fieldLine)
# Encode a static index reference
encodeStaticIndexReference(buffer, staticIndex)
# Encode a dynamic index reference relative to Base
encodeDynamicIndexReference(buffer, dynamicIndex, base)
# Encode a literal with an optional static name index
encodeLiteral(buffer, staticNameIndex, fieldLine)
# Encode a literal with a dynamic name index relative to Base
encodeDynamicLiteral(buffer, dynamicNameIndex, base, fieldLine)
# Encoding Algorithm
# ====
base = dynamicTable.getInsertCount()
requiredInsertCount = 0
for line in fieldLines:
staticIndex = staticTable.findIndex(line)
if staticIndex is not None:
encodeStaticIndexReference(streamBuffer, staticIndex)
continue
dynamicIndex = dynamicTable.findIndex(line)
if dynamicIndex is None:
# No matching entry. Either insert+index or encode literal
staticNameIndex = staticTable.findName(line.name)
if staticNameIndex is None:
dynamicNameIndex = dynamicTable.findName(line.name)
if shouldIndex(line) and dynamicTable.canIndex(line):
encodeInsert(encoderBuffer, staticNameIndex,
dynamicNameIndex, line)
dynamicIndex = dynamicTable.add(line)
if dynamicIndex is None:
# Could not index it, literal
if dynamicNameIndex is not None:
# Encode literal with dynamic name, possibly above Base
encodeDynamicLiteral(streamBuffer, dynamicNameIndex,
base, line)
requiredInsertCount = max(requiredInsertCount,
dynamicNameIndex)
else:
# Encodes a literal with a static name or literal name
encodeLiteral(streamBuffer, staticNameIndex, line)
else:
# Dynamic index reference
assert(dynamicIndex is not None)
requiredInsertCount = max(requiredInsertCount, dynamicIndex)
# Encode dynamicIndex, possibly above Base
encodeDynamicIndexReference(streamBuffer, dynamicIndex, base)
# encode the prefix
if requiredInsertCount == 0:
encodeInteger(prefixBuffer, 0x00, 0, 8)
encodeInteger(prefixBuffer, 0x00, 0, 7)
else:
wireRIC = (
requiredInsertCount
% (2 * getMaxEntries(maxTableCapacity))
) + 1;
encodeInteger(prefixBuffer, 0x00, wireRIC, 8)
if base >= requiredInsertCount:
encodeInteger(prefixBuffer, 0x00,
base - requiredInsertCount, 7)
else:
encodeInteger(prefixBuffer, 0x80,
requiredInsertCount - base - 1, 7)
return encoderBuffer, prefixBuffer + streamBuffer
</pre><a href="#appendix-C-2" class="pilcrow">¶</a>
</div>
</section>
</div>
<div id="acknowledgments">
<section id="appendix-D">
<h2 id="name-acknowledgments">
<a href="#name-acknowledgments" class="section-name selfRef">Acknowledgments</a>
</h2>
<p id="appendix-D-1">The IETF QUIC Working Group received an enormous amount of support from many
people.<a href="#appendix-D-1" class="pilcrow">¶</a></p>
<p id="appendix-D-2">The compression design team did substantial work exploring the problem space and
influencing the initial draft version of this document. The contributions of
design team members <span class="contact-name">Roberto Peon</span>, <span class="contact-name">Martin Thomson</span>, and
<span class="contact-name">Dmitri Tikhonov</span> are gratefully acknowledged.<a href="#appendix-D-2" class="pilcrow">¶</a></p>
<p id="appendix-D-3">The following people also provided substantial contributions to this document:<a href="#appendix-D-3" class="pilcrow">¶</a></p>
<ul class="compact">
<li class="compact" id="appendix-D-4.1">
<p id="appendix-D-4.1.1"><span class="contact-name">Bence Beky</span><a href="#appendix-D-4.1.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.2">
<p id="appendix-D-4.2.1"><span class="contact-name">Alessandro Ghedini</span><a href="#appendix-D-4.2.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.3">
<p id="appendix-D-4.3.1"><span class="contact-name">Ryan Hamilton</span><a href="#appendix-D-4.3.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.4">
<p id="appendix-D-4.4.1"><span class="contact-name">Robin Marx</span><a href="#appendix-D-4.4.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.5">
<p id="appendix-D-4.5.1"><span class="contact-name">Patrick McManus</span><a href="#appendix-D-4.5.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.6">
<p id="appendix-D-4.6.1"><span class="contact-name"><span class="non-ascii">奥 一穂</span> (<span class="ascii">Kazuho Oku</span>)</span><a href="#appendix-D-4.6.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.7">
<p id="appendix-D-4.7.1"><span class="contact-name">Lucas Pardue</span><a href="#appendix-D-4.7.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.8">
<p id="appendix-D-4.8.1"><span class="contact-name">Biren Roy</span><a href="#appendix-D-4.8.1" class="pilcrow">¶</a></p>
</li>
<li class="compact" id="appendix-D-4.9">
<p id="appendix-D-4.9.1"><span class="contact-name">Ian Swett</span><a href="#appendix-D-4.9.1" class="pilcrow">¶</a></p>
</li>
</ul>
<p id="appendix-D-5">This document draws heavily on the text of <span>[<a href="#RFC7541" class="xref">RFC7541</a>]</span>. The indirect input of
those authors is also gratefully acknowledged.<a href="#appendix-D-5" class="pilcrow">¶</a></p>
<p id="appendix-D-6"><span class="contact-name">Buck Krasic</span>'s contribution was supported by Google during his employment
there.<a href="#appendix-D-6" class="pilcrow">¶</a></p>
<p id="appendix-D-7">A portion of <span class="contact-name">Mike Bishop</span>'s contribution was supported by Microsoft during
his employment there.<a href="#appendix-D-7" class="pilcrow">¶</a></p>
</section>
</div>
<div id="authors-addresses">
<section id="appendix-E">
<h2 id="name-authors-addresses">
<a href="#name-authors-addresses" class="section-name selfRef">Authors' Addresses</a>
</h2>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Charles 'Buck' Krasic</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:krasic@acm.org" class="email">krasic@acm.org</a>
</div>
</address>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Mike Bishop</span></div>
<div dir="auto" class="left"><span class="org">Akamai Technologies</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:mbishop@evequefou.be" class="email">mbishop@evequefou.be</a>
</div>
</address>
<address class="vcard">
<div dir="auto" class="left"><span class="fn nameRole">Alan Frindell (<span class="role">editor</span>)</span></div>
<div dir="auto" class="left"><span class="org">Facebook</span></div>
<div class="email">
<span>Email:</span>
<a href="mailto:afrind@fb.com" class="email">afrind@fb.com</a>
</div>
</address>
</section>
</div>
<script>const toc = document.getElementById("toc");
toc.querySelector("h2").addEventListener("click", e => {
toc.classList.toggle("active");
});
toc.querySelector("nav").addEventListener("click", e => {
toc.classList.remove("active");
});
</script>
</body>
</html>
|