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
|
<pre>Internet Engineering Task Force (IETF) R. Peon
Request for Comments: 7541 Google, Inc
Category: Standards Track H. Ruellan
ISSN: 2070-1721 Canon CRF
May 2015
<span class="h1">HPACK: Header Compression for HTTP/2</span>
Abstract
This specification defines HPACK, a compression format for
efficiently representing HTTP header fields, to be used in HTTP/2.
Status of This Memo
This is an Internet Standards Track document.
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 <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="http://www.rfc-editor.org/info/rfc7541">http://www.rfc-editor.org/info/rfc7541</a>.
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">Peon & Ruellan Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Table of Contents
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-4">4</a>
<a href="#section-1.1">1.1</a>. Overview ...................................................<a href="#page-4">4</a>
<a href="#section-1.2">1.2</a>. Conventions ................................................<a href="#page-5">5</a>
<a href="#section-1.3">1.3</a>. Terminology ................................................<a href="#page-5">5</a>
<a href="#section-2">2</a>. Compression Process Overview ....................................<a href="#page-6">6</a>
<a href="#section-2.1">2.1</a>. Header List Ordering .......................................<a href="#page-6">6</a>
<a href="#section-2.2">2.2</a>. Encoding and Decoding Contexts .............................<a href="#page-6">6</a>
<a href="#section-2.3">2.3</a>. Indexing Tables ............................................<a href="#page-6">6</a>
<a href="#section-2.3.1">2.3.1</a>. Static Table ........................................<a href="#page-6">6</a>
<a href="#section-2.3.2">2.3.2</a>. Dynamic Table .......................................<a href="#page-6">6</a>
<a href="#section-2.3.3">2.3.3</a>. Index Address Space .................................<a href="#page-7">7</a>
<a href="#section-2.4">2.4</a>. Header Field Representation ................................<a href="#page-8">8</a>
<a href="#section-3">3</a>. Header Block Decoding ...........................................<a href="#page-8">8</a>
<a href="#section-3.1">3.1</a>. Header Block Processing ....................................<a href="#page-8">8</a>
<a href="#section-3.2">3.2</a>. Header Field Representation Processing .....................<a href="#page-9">9</a>
<a href="#section-4">4</a>. Dynamic Table Management ........................................<a href="#page-9">9</a>
<a href="#section-4.1">4.1</a>. Calculating Table Size ....................................<a href="#page-10">10</a>
<a href="#section-4.2">4.2</a>. Maximum Table Size ........................................<a href="#page-10">10</a>
<a href="#section-4.3">4.3</a>. Entry Eviction When Dynamic Table Size Changes ............<a href="#page-11">11</a>
<a href="#section-4.4">4.4</a>. Entry Eviction When Adding New Entries ....................<a href="#page-11">11</a>
<a href="#section-5">5</a>. Primitive Type Representations .................................<a href="#page-11">11</a>
<a href="#section-5.1">5.1</a>. Integer Representation ....................................<a href="#page-11">11</a>
<a href="#section-5.2">5.2</a>. String Literal Representation .............................<a href="#page-13">13</a>
<a href="#section-6">6</a>. Binary Format ..................................................<a href="#page-14">14</a>
<a href="#section-6.1">6.1</a>. Indexed Header Field Representation .......................<a href="#page-14">14</a>
<a href="#section-6.2">6.2</a>. Literal Header Field Representation .......................<a href="#page-15">15</a>
<a href="#section-6.2.1">6.2.1</a>. Literal Header Field with Incremental Indexing .....<a href="#page-15">15</a>
<a href="#section-6.2.2">6.2.2</a>. Literal Header Field without Indexing ..............<a href="#page-16">16</a>
<a href="#section-6.2.3">6.2.3</a>. Literal Header Field Never Indexed .................<a href="#page-17">17</a>
<a href="#section-6.3">6.3</a>. Dynamic Table Size Update .................................<a href="#page-18">18</a>
<a href="#section-7">7</a>. Security Considerations ........................................<a href="#page-19">19</a>
<a href="#section-7.1">7.1</a>. Probing Dynamic Table State ...............................<a href="#page-19">19</a>
<a href="#section-7.1.1">7.1.1</a>. Applicability to HPACK and HTTP ....................<a href="#page-20">20</a>
<a href="#section-7.1.2">7.1.2</a>. Mitigation .........................................<a href="#page-20">20</a>
<a href="#section-7.1.3">7.1.3</a>. Never-Indexed Literals .............................<a href="#page-21">21</a>
<a href="#section-7.2">7.2</a>. Static Huffman Encoding ...................................<a href="#page-22">22</a>
<a href="#section-7.3">7.3</a>. Memory Consumption ........................................<a href="#page-22">22</a>
<a href="#section-7.4">7.4</a>. Implementation Limits .....................................<a href="#page-23">23</a>
<a href="#section-8">8</a>. References .....................................................<a href="#page-23">23</a>
<a href="#section-8.1">8.1</a>. Normative References ......................................<a href="#page-23">23</a>
<a href="#section-8.2">8.2</a>. Informative References ....................................<a href="#page-24">24</a>
<a href="#appendix-A">Appendix A</a>. Static Table Definition ...............................<a href="#page-25">25</a>
<a href="#appendix-B">Appendix B</a>. Huffman Code ..........................................<a href="#page-27">27</a>
<span class="grey">Peon & Ruellan Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<a href="#appendix-C">Appendix C</a>. Examples ..............................................<a href="#page-33">33</a>
<a href="#appendix-C.1">C.1</a>. Integer Representation Examples ............................<a href="#page-33">33</a>
<a href="#appendix-C.1.1">C.1.1</a>. Example 1: Encoding 10 Using a 5-Bit Prefix ............<a href="#page-33">33</a>
<a href="#appendix-C.1.2">C.1.2</a>. Example 2: Encoding 1337 Using a 5-Bit Prefix ..........<a href="#page-33">33</a>
<a href="#appendix-C.1.3">C.1.3</a>. Example 3: Encoding 42 Starting at an Octet Boundary ...<a href="#page-34">34</a>
<a href="#appendix-C.2">C.2</a>. Header Field Representation Examples .......................<a href="#page-34">34</a>
<a href="#appendix-C.2.1">C.2.1</a>. Literal Header Field with Indexing .....................<a href="#page-34">34</a>
<a href="#appendix-C.2.2">C.2.2</a>. Literal Header Field without Indexing ..................<a href="#page-35">35</a>
<a href="#appendix-C.2.3">C.2.3</a>. Literal Header Field Never Indexed .....................<a href="#page-36">36</a>
<a href="#appendix-C.2.4">C.2.4</a>. Indexed Header Field ...................................<a href="#page-37">37</a>
<a href="#appendix-C.3">C.3</a>. Request Examples without Huffman Coding ....................<a href="#page-37">37</a>
<a href="#appendix-C.3.1">C.3.1</a>. First Request ..........................................<a href="#page-37">37</a>
<a href="#appendix-C.3.2">C.3.2</a>. Second Request .........................................<a href="#page-38">38</a>
<a href="#appendix-C.3.3">C.3.3</a>. Third Request ..........................................<a href="#page-39">39</a>
<a href="#appendix-C.4">C.4</a>. Request Examples with Huffman Coding .......................<a href="#page-41">41</a>
<a href="#appendix-C.4.1">C.4.1</a>. First Request ..........................................<a href="#page-41">41</a>
<a href="#appendix-C.4.2">C.4.2</a>. Second Request .........................................<a href="#page-42">42</a>
<a href="#appendix-C.4.3">C.4.3</a>. Third Request ..........................................<a href="#page-43">43</a>
<a href="#appendix-C.5">C.5</a>. Response Examples without Huffman Coding ...................<a href="#page-45">45</a>
<a href="#appendix-C.5.1">C.5.1</a>. First Response .........................................<a href="#page-45">45</a>
<a href="#appendix-C.5.2">C.5.2</a>. Second Response ........................................<a href="#page-46">46</a>
<a href="#appendix-C.5.3">C.5.3</a>. Third Response .........................................<a href="#page-47">47</a>
<a href="#appendix-C.6">C.6</a>. Response Examples with Huffman Coding ......................<a href="#page-49">49</a>
<a href="#appendix-C.6.1">C.6.1</a>. First Response .........................................<a href="#page-49">49</a>
<a href="#appendix-C.6.2">C.6.2</a>. Second Response ........................................<a href="#page-51">51</a>
<a href="#appendix-C.6.3">C.6.3</a>. Third Response .........................................<a href="#page-52">52</a>
Acknowledgments ...................................................<a href="#page-55">55</a>
Authors' Addresses ................................................<a href="#page-55">55</a>
<span class="grey">Peon & Ruellan Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
In HTTP/1.1 (see [<a href="./rfc7230" title=""Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing"">RFC7230</a>]), header fields are not compressed. As
web pages have grown to require dozens to hundreds of requests, the
redundant header fields in these requests unnecessarily consume
bandwidth, measurably increasing latency.
SPDY [<a href="#ref-SPDY" title=""SPDY Protocol"">SPDY</a>] initially addressed this redundancy by compressing header
fields using the DEFLATE [<a href="#ref-DEFLATE" title=""DEFLATE Compressed Data Format Specification version 1.3"">DEFLATE</a>] format, which proved very
effective at efficiently representing the redundant header fields.
However, that approach exposed a security risk as demonstrated by the
CRIME (Compression Ratio Info-leak Made Easy) attack (see [<a href="#ref-CRIME" title=""CRIME"">CRIME</a>]).
This specification defines HPACK, a new compressor that eliminates
redundant header fields, limits vulnerability to known security
attacks, and has a bounded memory requirement for use in constrained
environments. Potential security concerns for HPACK are described in
<a href="#section-7">Section 7</a>.
The HPACK format is intentionally simple and inflexible. Both
characteristics reduce the risk of interoperability or security
issues due to implementation error. No extensibility mechanisms are
defined; changes to the format are only possible by defining a
complete replacement.
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Overview</span>
The format defined in this specification treats a list of header
fields as an ordered collection of name-value pairs that can include
duplicate pairs. Names and values are considered to be opaque
sequences of octets, and the order of header fields is preserved
after being compressed and decompressed.
Encoding is informed by header field tables that map header fields to
indexed values. These header field tables can be incrementally
updated as new header fields are encoded or decoded.
In the encoded form, a header field is represented either literally
or as a reference to a header field in one of the header field
tables. Therefore, a list of header fields can be encoded using a
mixture of references and literal values.
Literal values are either encoded directly or use a static Huffman
code.
The encoder is responsible for deciding which header fields to insert
as new entries in the header field tables. The decoder executes the
modifications to the header field tables prescribed by the encoder,
<span class="grey">Peon & Ruellan Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
reconstructing the list of header fields in the process. This
enables decoders to remain simple and interoperate with a wide
variety of encoders.
Examples illustrating the use of these different mechanisms to
represent header fields are available in <a href="#appendix-C">Appendix C</a>.
<span class="h3"><a class="selflink" id="section-1.2" href="#section-1.2">1.2</a>. Conventions</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in <a href="./rfc2119">RFC 2119</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>].
All numeric values are in network byte order. Values are unsigned
unless otherwise indicated. Literal values are provided in decimal
or hexadecimal as appropriate.
<span class="h3"><a class="selflink" id="section-1.3" href="#section-1.3">1.3</a>. Terminology</span>
This specification uses the following terms:
Header Field: A name-value pair. Both the name and value are
treated as opaque sequences of octets.
Dynamic Table: The dynamic table (see <a href="#section-2.3.2">Section 2.3.2</a>) is a table that
associates stored header fields with index values. This table is
dynamic and specific to an encoding or decoding context.
Static Table: The static table (see <a href="#section-2.3.1">Section 2.3.1</a>) is a table that
statically associates header fields that occur frequently with
index values. This table is ordered, read-only, always
accessible, and it may be shared amongst all encoding or decoding
contexts.
Header List: A header list is an ordered collection of header fields
that are encoded jointly and can contain duplicate header fields.
A complete list of header fields contained in an HTTP/2 header
block is a header list.
Header Field Representation: A header field can be represented in
encoded form either as a literal or as an index (see <a href="#section-2.4">Section 2.4</a>).
Header Block: An ordered list of header field representations,
which, when decoded, yields a complete header list.
<span class="grey">Peon & Ruellan Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Compression Process Overview</span>
This specification does not describe a specific algorithm for an
encoder. Instead, it defines precisely how a decoder is expected to
operate, allowing encoders to produce any encoding that this
definition permits.
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. Header List Ordering</span>
HPACK preserves the ordering of header fields inside the header list.
An encoder MUST order header field representations in the header
block according to their ordering in the original header list. A
decoder MUST order header fields in the decoded header list according
to their ordering in the header block.
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Encoding and Decoding Contexts</span>
To decompress header blocks, a decoder only needs to maintain a
dynamic table (see <a href="#section-2.3.2">Section 2.3.2</a>) as a decoding context. No other
dynamic state is needed.
When used for bidirectional communication, such as in HTTP, the
encoding and decoding dynamic tables maintained by an endpoint are
completely independent, i.e., the request and response dynamic tables
are separate.
<span class="h3"><a class="selflink" id="section-2.3" href="#section-2.3">2.3</a>. Indexing Tables</span>
HPACK uses two tables for associating header fields to indexes. The
static table (see <a href="#section-2.3.1">Section 2.3.1</a>) is predefined and contains common
header fields (most of them with an empty value). The dynamic table
(see <a href="#section-2.3.2">Section 2.3.2</a>) is dynamic and can be used by the encoder to
index header fields repeated in the encoded header lists.
These two tables are combined into a single address space for
defining index values (see <a href="#section-2.3.3">Section 2.3.3</a>).
<span class="h4"><a class="selflink" id="section-2.3.1" href="#section-2.3.1">2.3.1</a>. Static Table</span>
The static table consists of a predefined static list of header
fields. Its entries are defined in <a href="#appendix-A">Appendix A</a>.
<span class="h4"><a class="selflink" id="section-2.3.2" href="#section-2.3.2">2.3.2</a>. Dynamic Table</span>
The dynamic table consists of a list of header fields maintained in
first-in, first-out order. The first and newest entry in a dynamic
table is at the lowest index, and the oldest entry of a dynamic table
is at the highest index.
<span class="grey">Peon & Ruellan Standards Track [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
The dynamic table is initially empty. Entries are added as each
header block is decompressed.
The dynamic table can contain duplicate entries (i.e., entries with
the same name and same value). Therefore, duplicate entries MUST NOT
be treated as an error by a decoder.
The encoder decides how to update the dynamic table and as such can
control how much memory is used by the dynamic table. To limit the
memory requirements of the decoder, the dynamic table size is
strictly bounded (see <a href="#section-4.2">Section 4.2</a>).
The decoder updates the dynamic table during the processing of a list
of header field representations (see <a href="#section-3.2">Section 3.2</a>).
<span class="h4"><a class="selflink" id="section-2.3.3" href="#section-2.3.3">2.3.3</a>. Index Address Space</span>
The static table and the dynamic table are combined into a single
index address space.
Indices between 1 and the length of the static table (inclusive)
refer to elements in the static table (see <a href="#section-2.3.1">Section 2.3.1</a>).
Indices strictly greater than the length of the static table refer to
elements in the dynamic table (see <a href="#section-2.3.2">Section 2.3.2</a>). The length of the
static table is subtracted to find the index into the dynamic table.
Indices strictly greater than the sum of the lengths of both tables
MUST be treated as a decoding error.
For a static table size of s and a dynamic table size of k, the
following diagram shows the entire valid index address space.
<---------- Index Address Space ---------->
<-- Static Table --> <-- Dynamic Table -->
+---+-----------+---+ +---+-----------+---+
| 1 | ... | s | |s+1| ... |s+k|
+---+-----------+---+ +---+-----------+---+
^ |
| V
Insertion Point Dropping Point
Figure 1: Index Address Space
<span class="grey">Peon & Ruellan Standards Track [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h3"><a class="selflink" id="section-2.4" href="#section-2.4">2.4</a>. Header Field Representation</span>
An encoded header field can be represented either as an index or as a
literal.
An indexed representation defines a header field as a reference to an
entry in either the static table or the dynamic table (see
<a href="#section-6.1">Section 6.1</a>).
A literal representation defines a header field by specifying its
name and value. The header field name can be represented literally
or as a reference to an entry in either the static table or the
dynamic table. The header field value is represented literally.
Three different literal representations are defined:
o A literal representation that adds the header field as a new entry
at the beginning of the dynamic table (see <a href="#section-6.2.1">Section 6.2.1</a>).
o A literal representation that does not add the header field to the
dynamic table (see <a href="#section-6.2.2">Section 6.2.2</a>).
o A literal representation that does not add the header field to the
dynamic table, with the additional stipulation that this header
field always use a literal representation, in particular when re-
encoded by an intermediary (see <a href="#section-6.2.3">Section 6.2.3</a>). This
representation is intended for protecting header field values that
are not to be put at risk by compressing them (see <a href="#section-7.1.3">Section 7.1.3</a>
for more details).
The selection of one of these literal representations can be guided
by security considerations, in order to protect sensitive header
field values (see <a href="#section-7.1">Section 7.1</a>).
The literal representation of a header field name or of a header
field value can encode the sequence of octets either directly or
using a static Huffman code (see <a href="#section-5.2">Section 5.2</a>).
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Header Block Decoding</span>
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Header Block Processing</span>
A decoder processes a header block sequentially to reconstruct the
original header list.
A header block is the concatenation of header field representations.
The different possible header field representations are described in
<a href="#section-6">Section 6</a>.
<span class="grey">Peon & Ruellan Standards Track [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Once a header field is decoded and added to the reconstructed header
list, the header field cannot be removed. A header field added to
the header list can be safely passed to the application.
By passing the resulting header fields to the application, a decoder
can be implemented with minimal transitory memory commitment in
addition to the memory required for the dynamic table.
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Header Field Representation Processing</span>
The processing of a header block to obtain a header list is defined
in this section. To ensure that the decoding will successfully
produce a header list, a decoder MUST obey the following rules.
All the header field representations contained in a header block are
processed in the order in which they appear, as specified below.
Details on the formatting of the various header field representations
and some additional processing instructions are found in <a href="#section-6">Section 6</a>.
An _indexed representation_ entails the following actions:
o The header field corresponding to the referenced entry in either
the static table or dynamic table is appended to the decoded
header list.
A _literal representation_ that is _not added_ to the dynamic table
entails the following action:
o The header field is appended to the decoded header list.
A _literal representation_ that is _added_ to the dynamic table
entails the following actions:
o The header field is appended to the decoded header list.
o The header field is inserted at the beginning of the dynamic
table. This insertion could result in the eviction of previous
entries in the dynamic table (see <a href="#section-4.4">Section 4.4</a>).
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Dynamic Table Management</span>
To limit the memory requirements on the decoder side, the dynamic
table is constrained in size.
<span class="grey">Peon & Ruellan Standards Track [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. Calculating Table Size</span>
The size of the dynamic table is the sum of the size of its entries.
The size of an entry is the sum of its name's length in octets (as
defined in <a href="#section-5.2">Section 5.2</a>), its value's length in octets, and 32.
The size of an entry is calculated using the length of its name and
value without any Huffman encoding applied.
Note: The additional 32 octets account for an estimated overhead
associated with an entry. For example, an entry structure using
two 64-bit pointers to reference the name and the value of the
entry and two 64-bit integers for counting the number of
references to the name and value would have 32 octets of overhead.
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. Maximum Table Size</span>
Protocols that use HPACK determine the maximum size that the encoder
is permitted to use for the dynamic table. In HTTP/2, this value is
determined by the SETTINGS_HEADER_TABLE_SIZE setting (see
Section 6.5.2 of [<a href="#ref-HTTP2" title=""Hypertext Transfer Protocol Version 2 (HTTP/2)"">HTTP2</a>]).
An encoder can choose to use less capacity than this maximum size
(see <a href="#section-6.3">Section 6.3</a>), but the chosen size MUST stay lower than or equal
to the maximum set by the protocol.
A change in the maximum size of the dynamic table is signaled via a
dynamic table size update (see <a href="#section-6.3">Section 6.3</a>). This dynamic table size
update MUST occur at the beginning of the first header block
following the change to the dynamic table size. In HTTP/2, this
follows a settings acknowledgment (see Section 6.5.3 of [<a href="#ref-HTTP2" title=""Hypertext Transfer Protocol Version 2 (HTTP/2)"">HTTP2</a>]).
Multiple updates to the maximum table size can occur between the
transmission of two header blocks. In the case that this size is
changed more than once in this interval, the smallest maximum table
size that occurs in that interval MUST be signaled in a dynamic table
size update. The final maximum size is always signaled, resulting in
at most two dynamic table size updates. This ensures that the
decoder is able to perform eviction based on reductions in dynamic
table size (see <a href="#section-4.3">Section 4.3</a>).
This mechanism can be used to completely clear entries from the
dynamic table by setting a maximum size of 0, which can subsequently
be restored.
<span class="grey">Peon & Ruellan Standards Track [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. Entry Eviction When Dynamic Table Size Changes</span>
Whenever the maximum size for the dynamic table is reduced, entries
are evicted from the end of the dynamic table until the size of the
dynamic table is less than or equal to the maximum size.
<span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. Entry Eviction When Adding New Entries</span>
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 (maximum size - new entry size) or until the
table is empty.
If the size of the new entry is less than or equal to the maximum
size, that entry is added to the table. It is not an error to
attempt to add an entry that is larger than the maximum size; an
attempt to add an entry larger than the maximum size causes the table
to be emptied of all existing entries and results in an empty table.
A new entry can reference the name of 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 if the referenced entry is evicted from the dynamic
table prior to inserting the new entry.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Primitive Type Representations</span>
HPACK encoding uses two primitive types: unsigned variable-length
integers and strings of octets.
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Integer Representation</span>
Integers are used to represent name indexes, header field indexes, or
string lengths. An integer representation can start anywhere within
an octet. To allow for optimized processing, an integer
representation always finishes at the end of an octet.
An integer is represented in two parts: a prefix that fills the
current octet and an optional list of octets that are used if the
integer value does not fit within the prefix. The number of bits of
the prefix (called N) is a parameter of the integer representation.
If the integer value is small enough, i.e., strictly less than 2^N-1,
it is encoded within the N-bit prefix.
<span class="grey">Peon & Ruellan Standards Track [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| ? | ? | ? | Value |
+---+---+---+-------------------+
Figure 2: Integer Value Encoded within the Prefix (Shown for N = 5)
Otherwise, all the bits of the prefix are set to 1, and the value,
decreased by 2^N-1, is encoded using a list of one or more octets.
The most significant bit of each octet is used as a continuation
flag: its value is set to 1 except for the last octet in the list.
The remaining bits of the octets are used to encode the decreased
value.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| ? | ? | ? | 1 1 1 1 1 |
+---+---+---+-------------------+
| 1 | Value-(2^N-1) LSB |
+---+---------------------------+
...
+---+---------------------------+
| 0 | Value-(2^N-1) MSB |
+---+---------------------------+
Figure 3: Integer Value Encoded after the Prefix (Shown for N = 5)
Decoding the integer value from the list of octets starts by
reversing the order of the octets in the list. Then, for each octet,
its most significant bit is removed. The remaining bits of the
octets are concatenated, and the resulting value is increased by
2^N-1 to obtain the integer value.
The prefix size, N, is always between 1 and 8 bits. An integer
starting at an octet boundary will have an 8-bit prefix.
Pseudocode to represent an integer I is as follows:
if I < 2^N - 1, encode I on N bits
else
encode (2^N - 1) on N bits
I = I - (2^N - 1)
while I >= 128
encode (I % 128 + 128) on 8 bits
I = I / 128
encode I on 8 bits
<span class="grey">Peon & Ruellan Standards Track [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Pseudocode to decode an integer I is as follows:
decode I from the next N bits
if I < 2^N - 1, return I
else
M = 0
repeat
B = next octet
I = I + (B & 127) * 2^M
M = M + 7
while B & 128 == 128
return I
Examples illustrating the encoding of integers are available in
<a href="#appendix-C.1">Appendix C.1</a>.
This integer representation allows for values of indefinite size. It
is also possible for an encoder to send a large number of zero
values, which can waste octets and could be used to overflow integer
values. Integer encodings that exceed implementation limits -- in
value or octet length -- MUST be treated as decoding errors.
Different limits can be set for each of the different uses of
integers, based on implementation constraints.
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. String Literal Representation</span>
Header field names and header field values can be represented as
string literals. A string literal is encoded as a sequence of
octets, either by directly encoding the string literal's octets or by
using a Huffman code (see [<a href="#ref-HUFFMAN" title=""A Method for the Construction of Minimum- Redundancy Codes"">HUFFMAN</a>]).
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| H | String Length (7+) |
+---+---------------------------+
| String Data (Length octets) |
+-------------------------------+
Figure 4: String Literal Representation
A string literal representation contains the following fields:
H: A one-bit flag, H, indicating whether or not the octets of the
string are Huffman encoded.
String Length: The number of octets used to encode the string
literal, encoded as an integer with a 7-bit prefix (see
<a href="#section-5.1">Section 5.1</a>).
<span class="grey">Peon & Ruellan Standards Track [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
String Data: The encoded data of the string literal. If H is '0',
then the encoded data is the raw octets of the string literal. If
H is '1', then the encoded data is the Huffman encoding of the
string literal.
String literals that use Huffman encoding are encoded with the
Huffman code defined in <a href="#appendix-B">Appendix B</a> (see examples for requests in
<a href="#appendix-C.4">Appendix C.4</a> and for responses in <a href="#appendix-C.6">Appendix C.6</a>). The encoded data is
the bitwise concatenation of the codes corresponding to each octet of
the string literal.
As the Huffman-encoded data doesn't always end at an octet boundary,
some padding is inserted after it, up to the next octet boundary. To
prevent this padding from being misinterpreted as part of the string
literal, the most significant bits of the code corresponding to the
EOS (end-of-string) symbol are used.
Upon decoding, an incomplete code at the end of the encoded data is
to be considered as padding and discarded. A padding strictly longer
than 7 bits MUST be treated as a decoding error. A padding not
corresponding to the most significant bits of the code for the EOS
symbol MUST be treated as a decoding error. A Huffman-encoded string
literal containing the EOS symbol MUST be treated as a decoding
error.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Binary Format</span>
This section describes the detailed format of each of the different
header field representations and the dynamic table size update
instruction.
<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. Indexed Header Field Representation</span>
An indexed header field representation identifies an entry in either
the static table or the dynamic table (see <a href="#section-2.3">Section 2.3</a>).
An indexed header field representation causes a header field to be
added to the decoded header list, as described in <a href="#section-3.2">Section 3.2</a>.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 1 | Index (7+) |
+---+---------------------------+
Figure 5: Indexed Header Field
<span class="grey">Peon & Ruellan Standards Track [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
An indexed header field starts with the '1' 1-bit pattern, followed
by the index of the matching header field, represented as an integer
with a 7-bit prefix (see <a href="#section-5.1">Section 5.1</a>).
The index value of 0 is not used. It MUST be treated as a decoding
error if found in an indexed header field representation.
<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>. Literal Header Field Representation</span>
A literal header field representation contains a literal header field
value. Header field names are provided either as a literal or by
reference to an existing table entry, either from the static table or
the dynamic table (see <a href="#section-2.3">Section 2.3</a>).
This specification defines three forms of literal header field
representations: with indexing, without indexing, and never indexed.
<span class="h4"><a class="selflink" id="section-6.2.1" href="#section-6.2.1">6.2.1</a>. Literal Header Field with Incremental Indexing</span>
A literal header field with incremental indexing representation
results in appending a header field to the decoded header list and
inserting it as a new entry into the dynamic table.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | Index (6+) |
+---+---+-----------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length octets) |
+-------------------------------+
Figure 6: Literal Header Field with Incremental Indexing -- Indexed
Name
<span class="grey">Peon & Ruellan Standards Track [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 1 | 0 |
+---+---+-----------------------+
| H | Name Length (7+) |
+---+---------------------------+
| Name String (Length octets) |
+---+---------------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length octets) |
+-------------------------------+
Figure 7: Literal Header Field with Incremental Indexing -- New Name
A literal header field with incremental indexing representation
starts with the '01' 2-bit pattern.
If the header field name matches the header field name of an entry
stored in the static table or the dynamic table, the header field
name can be represented using the index of that entry. In this case,
the index of the entry is represented as an integer with a 6-bit
prefix (see <a href="#section-5.1">Section 5.1</a>). This value is always non-zero.
Otherwise, the header field name is represented as a string literal
(see <a href="#section-5.2">Section 5.2</a>). A value 0 is used in place of the 6-bit index,
followed by the header field name.
Either form of header field name representation is followed by the
header field value represented as a string literal (see <a href="#section-5.2">Section 5.2</a>).
<span class="h4"><a class="selflink" id="section-6.2.2" href="#section-6.2.2">6.2.2</a>. Literal Header Field without Indexing</span>
A literal header field without indexing representation results in
appending a header field to the decoded header list without altering
the dynamic table.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | Index (4+) |
+---+---+-----------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length octets) |
+-------------------------------+
Figure 8: Literal Header Field without Indexing -- Indexed Name
<span class="grey">Peon & Ruellan Standards Track [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | 0 |
+---+---+-----------------------+
| H | Name Length (7+) |
+---+---------------------------+
| Name String (Length octets) |
+---+---------------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length octets) |
+-------------------------------+
Figure 9: Literal Header Field without Indexing -- New Name
A literal header field without indexing representation starts with
the '0000' 4-bit pattern.
If the header field name matches the header field name of an entry
stored in the static table or the dynamic table, the header field
name can be represented using the index of that entry. In this case,
the index of the entry is represented as an integer with a 4-bit
prefix (see <a href="#section-5.1">Section 5.1</a>). This value is always non-zero.
Otherwise, the header field name is represented as a string literal
(see <a href="#section-5.2">Section 5.2</a>). A value 0 is used in place of the 4-bit index,
followed by the header field name.
Either form of header field name representation is followed by the
header field value represented as a string literal (see <a href="#section-5.2">Section 5.2</a>).
<span class="h4"><a class="selflink" id="section-6.2.3" href="#section-6.2.3">6.2.3</a>. Literal Header Field Never Indexed</span>
A literal header field never-indexed representation results in
appending a header field to the decoded header list without altering
the dynamic table. Intermediaries MUST use the same representation
for encoding this header field.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 1 | Index (4+) |
+---+---+-----------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length octets) |
+-------------------------------+
Figure 10: Literal Header Field Never Indexed -- Indexed Name
<span class="grey">Peon & Ruellan Standards Track [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 1 | 0 |
+---+---+-----------------------+
| H | Name Length (7+) |
+---+---------------------------+
| Name String (Length octets) |
+---+---------------------------+
| H | Value Length (7+) |
+---+---------------------------+
| Value String (Length octets) |
+-------------------------------+
Figure 11: Literal Header Field Never Indexed -- New Name
A literal header field never-indexed representation starts with the
'0001' 4-bit pattern.
When a header field is represented as a literal header field never
indexed, it MUST always be encoded with this specific literal
representation. In particular, when a peer sends a header field that
it received represented as a literal header field never indexed, it
MUST use the same representation to forward this header field.
This representation is intended for protecting header field values
that are not to be put at risk by compressing them (see <a href="#section-7.1">Section 7.1</a>
for more details).
The encoding of the representation is identical to the literal header
field without indexing (see <a href="#section-6.2.2">Section 6.2.2</a>).
<span class="h3"><a class="selflink" id="section-6.3" href="#section-6.3">6.3</a>. Dynamic Table Size Update</span>
A dynamic table size update signals a change to the size of the
dynamic table.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | Max size (5+) |
+---+---------------------------+
Figure 12: Maximum Dynamic Table Size Change
A dynamic table size update starts with the '001' 3-bit pattern,
followed by the new maximum size, represented as an integer with a
5-bit prefix (see <a href="#section-5.1">Section 5.1</a>).
<span class="grey">Peon & Ruellan Standards Track [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
The new maximum size MUST be lower than or equal to the limit
determined by the protocol using HPACK. A value that exceeds this
limit MUST be treated as a decoding error. In HTTP/2, this limit is
the last value of the SETTINGS_HEADER_TABLE_SIZE parameter (see
Section 6.5.2 of [<a href="#ref-HTTP2" title=""Hypertext Transfer Protocol Version 2 (HTTP/2)"">HTTP2</a>]) received from the decoder and acknowledged
by the encoder (see Section 6.5.3 of [<a href="#ref-HTTP2" title=""Hypertext Transfer Protocol Version 2 (HTTP/2)"">HTTP2</a>]).
Reducing the maximum size of the dynamic table can cause entries to
be evicted (see <a href="#section-4.3">Section 4.3</a>).
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span>
This section describes potential areas of security concern with
HPACK:
o Use of compression as a length-based oracle for verifying guesses
about secrets that are compressed into a shared compression
context.
o Denial of service resulting from exhausting processing or memory
capacity at a decoder.
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Probing Dynamic Table State</span>
HPACK reduces the length of header field encodings 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.
The compression context used to encode header fields can be probed by
an attacker who can both define header 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.
This is possible even over the Transport Layer Security (TLS)
protocol (see [<a href="#ref-TLS12" title=""The Transport Layer Security (TLS) Protocol Version 1.2"">TLS12</a>]), because while TLS provides confidentiality
protection for content, it only provides a limited amount of
protection for the length of that content.
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.
<span class="grey">Peon & Ruellan Standards Track [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Attacks like CRIME [<a href="#ref-CRIME" title=""CRIME"">CRIME</a>] demonstrated the existence of these
general attacker capabilities. The specific attack exploited the
fact that DEFLATE [<a href="#ref-DEFLATE" title=""DEFLATE Compressed Data Format Specification version 1.3"">DEFLATE</a>] 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.
<span class="h4"><a class="selflink" id="section-7.1.1" href="#section-7.1.1">7.1.1</a>. Applicability to HPACK and HTTP</span>
HPACK mitigates but does not completely prevent attacks modeled on
CRIME [<a href="#ref-CRIME" title=""CRIME"">CRIME</a>] by forcing a guess to match an entire header field
value rather than individual characters. Attackers can only learn
whether a guess is correct or not, so they are reduced to brute-force
guesses for the header field values.
The viability of recovering specific header field values therefore
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.
Attacks of this nature are possible any time that two mutually
distrustful entities control requests or responses that are placed
onto a single HTTP/2 connection. If the shared HPACK compressor
permits one entity to add entries to the dynamic table and the other
to access those entries, then the state of the table can be learned.
Having requests or responses from mutually distrustful entities
occurs when an intermediary either:
o sends requests from multiple clients on a single connection toward
an origin server, or
o takes responses from multiple origin servers and places them on a
shared connection toward a client.
Web browsers also need to assume that requests made on the same
connection by different web origins [<a href="#ref-ORIGIN" title=""The Web Origin Concept"">ORIGIN</a>] are made by mutually
distrustful entities.
<span class="h4"><a class="selflink" id="section-7.1.2" href="#section-7.1.2">7.1.2</a>. Mitigation</span>
Users of HTTP that require confidentiality for header 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.
<span class="grey">Peon & Ruellan Standards Track [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Rather than impose constraints on users of HTTP, an implementation of
HPACK can instead constrain how compression is applied in order to
limit the potential for dynamic table probing.
An ideal solution segregates access to the dynamic table based on the
entity that is constructing header fields. Header 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.
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.
An encoder without good knowledge of the provenance of header fields
might instead introduce a penalty for a header field with many
different values, such that a large number of attempts to guess a
header field value results in the header field no longer being
compared to the dynamic table entries in future messages, effectively
preventing further guesses.
Note: Simply removing entries corresponding to the header 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 web sites can easily force an image to be
loaded, thereby refreshing the entry in the dynamic table.
This response might be made inversely proportional to the length of
the header field value. Marking a header field as not using the
dynamic table anymore might occur for shorter values more quickly or
with higher probability than for longer values.
<span class="h4"><a class="selflink" id="section-7.1.3" href="#section-7.1.3">7.1.3</a>. Never-Indexed Literals</span>
Implementations can also choose to protect sensitive header fields by
not compressing them and instead encoding their value as literals.
Refusing to generate an indexed representation for a header field is
only effective if compression is avoided on all hops. The never-
indexed literal (see <a href="#section-6.2.3">Section 6.2.3</a>) can be used to signal to
intermediaries that a particular value was intentionally sent as a
literal.
<span class="grey">Peon & Ruellan Standards Track [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
An intermediary MUST NOT re-encode a value that uses the never-
indexed literal representation with another representation that would
index it. If HPACK is used for re-encoding, the never-indexed
literal representation MUST be used.
The choice to use a never-indexed literal representation for a header
field depends on several factors. Since HPACK doesn't protect
against guessing an entire header 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.
An encoder might also choose not to index values for header fields
that are considered to be highly valuable or sensitive to recovery,
such as the Cookie or Authorization header fields.
On the contrary, an encoder might prefer indexing values for header
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.
Note that these criteria for deciding to use a never-indexed literal
representation will evolve over time as new attacks are discovered.
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Static Huffman Encoding</span>
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 [<a href="#ref-PETAL" title=""PETAL: Preset Encoding Table Information Leakage"">PETAL</a>]).
<span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. Memory Consumption</span>
An attacker can try to cause an endpoint to exhaust its memory.
HPACK is designed to limit both the peak and state amounts of memory
allocated by an endpoint.
The amount of memory used by the compressor is limited by the
protocol using HPACK through the definition of the maximum size of
the dynamic table. In HTTP/2, this value is controlled by the
decoder through the setting parameter SETTINGS_HEADER_TABLE_SIZE (see
Section 6.5.2 of [<a href="#ref-HTTP2" title=""Hypertext Transfer Protocol Version 2 (HTTP/2)"">HTTP2</a>]). This limit takes into account both the
size of the data stored in the dynamic table, plus a small allowance
for overhead.
<span class="grey">Peon & Ruellan Standards Track [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
A decoder can limit the amount of state memory used by setting an
appropriate value for the maximum size of the dynamic table. In
HTTP/2, this is realized by setting an appropriate value for the
SETTINGS_HEADER_TABLE_SIZE parameter. An encoder can limit the
amount of state memory it uses by signaling a lower dynamic table
size than the decoder allows (see <a href="#section-6.3">Section 6.3</a>).
The amount of temporary memory consumed by an encoder or decoder can
be limited by processing header fields sequentially. An
implementation does not need to retain a complete list of header
fields. Note, however, that it might be necessary for an application
to retain a complete header list for other reasons; even though HPACK
does not force this to occur, application constraints might make this
necessary.
<span class="h3"><a class="selflink" id="section-7.4" href="#section-7.4">7.4</a>. Implementation Limits</span>
An implementation of HPACK needs to ensure that large values for
integers, long encoding for integers, or long string literals do not
create security weaknesses.
An implementation has to set a limit for the values it accepts for
integers, as well as for the encoded length (see <a href="#section-5.1">Section 5.1</a>). In
the same way, it has to set a limit to the length it accepts for
string literals (see <a href="#section-5.2">Section 5.2</a>).
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. References</span>
<span class="h3"><a class="selflink" id="section-8.1" href="#section-8.1">8.1</a>. Normative References</span>
[<a id="ref-HTTP2">HTTP2</a>] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext
Transfer Protocol Version 2 (HTTP/2)", <a href="./rfc7540">RFC 7540</a>,
DOI 10.17487/RFC7540, May 2015,
<<a href="http://www.rfc-editor.org/info/rfc7540">http://www.rfc-editor.org/info/rfc7540</a>>.
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="http://www.rfc-editor.org/info/rfc2119">http://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC7230">RFC7230</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext
Transfer Protocol (HTTP/1.1): Message Syntax and
Routing", <a href="./rfc7230">RFC 7230</a>, DOI 10.17487/RFC7230, June 2014,
<<a href="http://www.rfc-editor.org/info/rfc7230">http://www.rfc-editor.org/info/rfc7230</a>>.
<span class="grey">Peon & Ruellan Standards Track [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h3"><a class="selflink" id="section-8.2" href="#section-8.2">8.2</a>. Informative References</span>
[<a id="ref-CANONICAL">CANONICAL</a>] Schwartz, E. and B. Kallick, "Generating a canonical
prefix encoding", Communications of the ACM, Volume 7
Issue 3, pp. 166-169, March 1964, <<a href="https://dl.acm.org/citation.cfm?id=363991">https://dl.acm.org/</a>
<a href="https://dl.acm.org/citation.cfm?id=363991">citation.cfm?id=363991</a>>.
[<a id="ref-CRIME">CRIME</a>] Wikipedia, "CRIME", May 2015, <<a href="http://en.wikipedia.org/w/index.php?title=CRIME&oldid=660948120">http://en.wikipedia.org/w/</a>
<a href="http://en.wikipedia.org/w/index.php?title=CRIME&oldid=660948120">index.php?title=CRIME&oldid=660948120</a>>.
[<a id="ref-DEFLATE">DEFLATE</a>] Deutsch, P., "DEFLATE Compressed Data Format
Specification version 1.3", <a href="./rfc1951">RFC 1951</a>,
DOI 10.17487/RFC1951, May 1996,
<<a href="http://www.rfc-editor.org/info/rfc1951">http://www.rfc-editor.org/info/rfc1951</a>>.
[<a id="ref-HUFFMAN">HUFFMAN</a>] Huffman, D., "A Method for the Construction of Minimum-
Redundancy Codes", Proceedings of the Institute of Radio
Engineers, Volume 40, Number 9, pp. 1098-1101, September
1952, <<a href="http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=4051119">http://ieeexplore.ieee.org/xpl/</a>
<a href="http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=4051119">articleDetails.jsp?arnumber=4051119</a>>.
[<a id="ref-ORIGIN">ORIGIN</a>] Barth, A., "The Web Origin Concept", <a href="./rfc6454">RFC 6454</a>,
DOI 10.17487/RFC6454, December 2011,
<<a href="http://www.rfc-editor.org/info/rfc6454">http://www.rfc-editor.org/info/rfc6454</a>>.
[<a id="ref-PETAL">PETAL</a>] Tan, J. and J. Nahata, "PETAL: Preset Encoding
Table Information Leakage", April 2013,
<<a href="http://www.pdl.cmu.edu/PDL-FTP/associated/CMU-PDL-13-106.pdf">http://www.pdl.cmu.edu/PDL-FTP/associated/</a>
<a href="http://www.pdl.cmu.edu/PDL-FTP/associated/CMU-PDL-13-106.pdf">CMU-PDL-13-106.pdf</a>>.
[<a id="ref-SPDY">SPDY</a>] Belshe, M. and R. Peon, <a style="text-decoration: none" href='https://www.google.com/search?sitesearch=datatracker.ietf.org%2Fdoc%2Fhtml%2F&q=inurl:draft-+%22SPDY+Protocol%22'>"SPDY Protocol"</a>, Work in
Progress, <a href="./draft-mbelshe-httpbis-spdy-00">draft-mbelshe-httpbis-spdy-00</a>, February 2012.
[<a id="ref-TLS12">TLS12</a>] Dierks, T. and E. Rescorla, "The Transport Layer Security
(TLS) Protocol Version 1.2", <a href="./rfc5246">RFC 5246</a>,
DOI 10.17487/RFC5246, August 2008,
<<a href="http://www.rfc-editor.org/info/rfc5246">http://www.rfc-editor.org/info/rfc5246</a>>.
<span class="grey">Peon & Ruellan Standards Track [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. Static Table Definition</span>
The static table (see <a href="#section-2.3.1">Section 2.3.1</a>) consists in a predefined and
unchangeable list of header fields.
The static table was created from the most frequent header fields
used by popular web sites, with the addition of HTTP/2-specific
pseudo-header fields (see Section 8.1.2.1 of [<a href="#ref-HTTP2" title=""Hypertext Transfer Protocol Version 2 (HTTP/2)"">HTTP2</a>]). For header
fields with a few frequent values, an entry was added for each of
these frequent values. For other header fields, an entry was added
with an empty value.
Table 1 lists the predefined header fields that make up the static
table and gives the index of each entry.
+-------+-----------------------------+---------------+
| Index | Header Name | Header Value |
+-------+-----------------------------+---------------+
| 1 | :authority | |
| 2 | :method | GET |
| 3 | :method | POST |
| 4 | :path | / |
| 5 | :path | /index.html |
| 6 | :scheme | http |
| 7 | :scheme | https |
| 8 | :status | 200 |
| 9 | :status | 204 |
| 10 | :status | 206 |
| 11 | :status | 304 |
| 12 | :status | 400 |
| 13 | :status | 404 |
| 14 | :status | 500 |
| 15 | accept-charset | |
| 16 | accept-encoding | gzip, deflate |
| 17 | accept-language | |
| 18 | accept-ranges | |
| 19 | accept | |
| 20 | access-control-allow-origin | |
| 21 | age | |
| 22 | allow | |
| 23 | authorization | |
| 24 | cache-control | |
| 25 | content-disposition | |
| 26 | content-encoding | |
| 27 | content-language | |
| 28 | content-length | |
| 29 | content-location | |
| 30 | content-range | |
<span class="grey">Peon & Ruellan Standards Track [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
| 31 | content-type | |
| 32 | cookie | |
| 33 | date | |
| 34 | etag | |
| 35 | expect | |
| 36 | expires | |
| 37 | from | |
| 38 | host | |
| 39 | if-match | |
| 40 | if-modified-since | |
| 41 | if-none-match | |
| 42 | if-range | |
| 43 | if-unmodified-since | |
| 44 | last-modified | |
| 45 | link | |
| 46 | location | |
| 47 | max-forwards | |
| 48 | proxy-authenticate | |
| 49 | proxy-authorization | |
| 50 | range | |
| 51 | referer | |
| 52 | refresh | |
| 53 | retry-after | |
| 54 | server | |
| 55 | set-cookie | |
| 56 | strict-transport-security | |
| 57 | transfer-encoding | |
| 58 | user-agent | |
| 59 | vary | |
| 60 | via | |
| 61 | www-authenticate | |
+-------+-----------------------------+---------------+
Table 1: Static Table Entries
<span class="grey">Peon & Ruellan Standards Track [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Huffman Code</span>
The following Huffman code is used when encoding string literals with
a Huffman coding (see <a href="#section-5.2">Section 5.2</a>).
This Huffman code was generated from statistics obtained on a large
sample of HTTP headers. It is a canonical Huffman code (see
[<a href="#ref-CANONICAL" title=""Generating a canonical prefix encoding"">CANONICAL</a>]) with some tweaking to ensure that no symbol has a unique
code length.
Each row in the table defines the code used to represent a symbol:
sym: The symbol to be represented. It is the decimal value of an
octet, possibly prepended with its ASCII representation. A
specific symbol, "EOS", is used to indicate the end of a string
literal.
code as bits: The Huffman code for the symbol represented as a
base-2 integer, aligned on the most significant bit (MSB).
code as hex: The Huffman code for the symbol, represented as a
hexadecimal integer, aligned on the least significant bit (LSB).
len: The number of bits for the code representing the symbol.
As an example, the code for the symbol 47 (corresponding to the ASCII
character "/") consists in the 6 bits "0", "1", "1", "0", "0", "0".
This corresponds to the value 0x18 (in hexadecimal) encoded in 6
bits.
code
code as bits as hex len
sym aligned to MSB aligned in
to LSB bits
( 0) |11111111|11000 1ff8 [13]
( 1) |11111111|11111111|1011000 7fffd8 [23]
( 2) |11111111|11111111|11111110|0010 fffffe2 [28]
( 3) |11111111|11111111|11111110|0011 fffffe3 [28]
( 4) |11111111|11111111|11111110|0100 fffffe4 [28]
( 5) |11111111|11111111|11111110|0101 fffffe5 [28]
( 6) |11111111|11111111|11111110|0110 fffffe6 [28]
( 7) |11111111|11111111|11111110|0111 fffffe7 [28]
( 8) |11111111|11111111|11111110|1000 fffffe8 [28]
( 9) |11111111|11111111|11101010 ffffea [24]
( 10) |11111111|11111111|11111111|111100 3ffffffc [30]
( 11) |11111111|11111111|11111110|1001 fffffe9 [28]
( 12) |11111111|11111111|11111110|1010 fffffea [28]
( 13) |11111111|11111111|11111111|111101 3ffffffd [30]
<span class="grey">Peon & Ruellan Standards Track [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
( 14) |11111111|11111111|11111110|1011 fffffeb [28]
( 15) |11111111|11111111|11111110|1100 fffffec [28]
( 16) |11111111|11111111|11111110|1101 fffffed [28]
( 17) |11111111|11111111|11111110|1110 fffffee [28]
( 18) |11111111|11111111|11111110|1111 fffffef [28]
( 19) |11111111|11111111|11111111|0000 ffffff0 [28]
( 20) |11111111|11111111|11111111|0001 ffffff1 [28]
( 21) |11111111|11111111|11111111|0010 ffffff2 [28]
( 22) |11111111|11111111|11111111|111110 3ffffffe [30]
( 23) |11111111|11111111|11111111|0011 ffffff3 [28]
( 24) |11111111|11111111|11111111|0100 ffffff4 [28]
( 25) |11111111|11111111|11111111|0101 ffffff5 [28]
( 26) |11111111|11111111|11111111|0110 ffffff6 [28]
( 27) |11111111|11111111|11111111|0111 ffffff7 [28]
( 28) |11111111|11111111|11111111|1000 ffffff8 [28]
( 29) |11111111|11111111|11111111|1001 ffffff9 [28]
( 30) |11111111|11111111|11111111|1010 ffffffa [28]
( 31) |11111111|11111111|11111111|1011 ffffffb [28]
' ' ( 32) |010100 14 [ 6]
'!' ( 33) |11111110|00 3f8 [10]
'"' ( 34) |11111110|01 3f9 [10]
'#' ( 35) |11111111|1010 ffa [12]
'$' ( 36) |11111111|11001 1ff9 [13]
'%' ( 37) |010101 15 [ 6]
'&' ( 38) |11111000 f8 [ 8]
''' ( 39) |11111111|010 7fa [11]
'(' ( 40) |11111110|10 3fa [10]
')' ( 41) |11111110|11 3fb [10]
'*' ( 42) |11111001 f9 [ 8]
'+' ( 43) |11111111|011 7fb [11]
',' ( 44) |11111010 fa [ 8]
'-' ( 45) |010110 16 [ 6]
'.' ( 46) |010111 17 [ 6]
'/' ( 47) |011000 18 [ 6]
'0' ( 48) |00000 0 [ 5]
'1' ( 49) |00001 1 [ 5]
'2' ( 50) |00010 2 [ 5]
'3' ( 51) |011001 19 [ 6]
'4' ( 52) |011010 1a [ 6]
'5' ( 53) |011011 1b [ 6]
'6' ( 54) |011100 1c [ 6]
'7' ( 55) |011101 1d [ 6]
'8' ( 56) |011110 1e [ 6]
'9' ( 57) |011111 1f [ 6]
':' ( 58) |1011100 5c [ 7]
';' ( 59) |11111011 fb [ 8]
'<' ( 60) |11111111|1111100 7ffc [15]
'=' ( 61) |100000 20 [ 6]
<span class="grey">Peon & Ruellan Standards Track [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
'>' ( 62) |11111111|1011 ffb [12]
'?' ( 63) |11111111|00 3fc [10]
'@' ( 64) |11111111|11010 1ffa [13]
'A' ( 65) |100001 21 [ 6]
'B' ( 66) |1011101 5d [ 7]
'C' ( 67) |1011110 5e [ 7]
'D' ( 68) |1011111 5f [ 7]
'E' ( 69) |1100000 60 [ 7]
'F' ( 70) |1100001 61 [ 7]
'G' ( 71) |1100010 62 [ 7]
'H' ( 72) |1100011 63 [ 7]
'I' ( 73) |1100100 64 [ 7]
'J' ( 74) |1100101 65 [ 7]
'K' ( 75) |1100110 66 [ 7]
'L' ( 76) |1100111 67 [ 7]
'M' ( 77) |1101000 68 [ 7]
'N' ( 78) |1101001 69 [ 7]
'O' ( 79) |1101010 6a [ 7]
'P' ( 80) |1101011 6b [ 7]
'Q' ( 81) |1101100 6c [ 7]
'R' ( 82) |1101101 6d [ 7]
'S' ( 83) |1101110 6e [ 7]
'T' ( 84) |1101111 6f [ 7]
'U' ( 85) |1110000 70 [ 7]
'V' ( 86) |1110001 71 [ 7]
'W' ( 87) |1110010 72 [ 7]
'X' ( 88) |11111100 fc [ 8]
'Y' ( 89) |1110011 73 [ 7]
'Z' ( 90) |11111101 fd [ 8]
'[' ( 91) |11111111|11011 1ffb [13]
'\' ( 92) |11111111|11111110|000 7fff0 [19]
']' ( 93) |11111111|11100 1ffc [13]
'^' ( 94) |11111111|111100 3ffc [14]
'_' ( 95) |100010 22 [ 6]
'`' ( 96) |11111111|1111101 7ffd [15]
'a' ( 97) |00011 3 [ 5]
'b' ( 98) |100011 23 [ 6]
'c' ( 99) |00100 4 [ 5]
'd' (100) |100100 24 [ 6]
'e' (101) |00101 5 [ 5]
'f' (102) |100101 25 [ 6]
'g' (103) |100110 26 [ 6]
'h' (104) |100111 27 [ 6]
'i' (105) |00110 6 [ 5]
'j' (106) |1110100 74 [ 7]
'k' (107) |1110101 75 [ 7]
'l' (108) |101000 28 [ 6]
'm' (109) |101001 29 [ 6]
<span class="grey">Peon & Ruellan Standards Track [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
'n' (110) |101010 2a [ 6]
'o' (111) |00111 7 [ 5]
'p' (112) |101011 2b [ 6]
'q' (113) |1110110 76 [ 7]
'r' (114) |101100 2c [ 6]
's' (115) |01000 8 [ 5]
't' (116) |01001 9 [ 5]
'u' (117) |101101 2d [ 6]
'v' (118) |1110111 77 [ 7]
'w' (119) |1111000 78 [ 7]
'x' (120) |1111001 79 [ 7]
'y' (121) |1111010 7a [ 7]
'z' (122) |1111011 7b [ 7]
'{' (123) |11111111|1111110 7ffe [15]
'|' (124) |11111111|100 7fc [11]
'}' (125) |11111111|111101 3ffd [14]
'~' (126) |11111111|11101 1ffd [13]
(127) |11111111|11111111|11111111|1100 ffffffc [28]
(128) |11111111|11111110|0110 fffe6 [20]
(129) |11111111|11111111|010010 3fffd2 [22]
(130) |11111111|11111110|0111 fffe7 [20]
(131) |11111111|11111110|1000 fffe8 [20]
(132) |11111111|11111111|010011 3fffd3 [22]
(133) |11111111|11111111|010100 3fffd4 [22]
(134) |11111111|11111111|010101 3fffd5 [22]
(135) |11111111|11111111|1011001 7fffd9 [23]
(136) |11111111|11111111|010110 3fffd6 [22]
(137) |11111111|11111111|1011010 7fffda [23]
(138) |11111111|11111111|1011011 7fffdb [23]
(139) |11111111|11111111|1011100 7fffdc [23]
(140) |11111111|11111111|1011101 7fffdd [23]
(141) |11111111|11111111|1011110 7fffde [23]
(142) |11111111|11111111|11101011 ffffeb [24]
(143) |11111111|11111111|1011111 7fffdf [23]
(144) |11111111|11111111|11101100 ffffec [24]
(145) |11111111|11111111|11101101 ffffed [24]
(146) |11111111|11111111|010111 3fffd7 [22]
(147) |11111111|11111111|1100000 7fffe0 [23]
(148) |11111111|11111111|11101110 ffffee [24]
(149) |11111111|11111111|1100001 7fffe1 [23]
(150) |11111111|11111111|1100010 7fffe2 [23]
(151) |11111111|11111111|1100011 7fffe3 [23]
(152) |11111111|11111111|1100100 7fffe4 [23]
(153) |11111111|11111110|11100 1fffdc [21]
(154) |11111111|11111111|011000 3fffd8 [22]
(155) |11111111|11111111|1100101 7fffe5 [23]
(156) |11111111|11111111|011001 3fffd9 [22]
(157) |11111111|11111111|1100110 7fffe6 [23]
<span class="grey">Peon & Ruellan Standards Track [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
(158) |11111111|11111111|1100111 7fffe7 [23]
(159) |11111111|11111111|11101111 ffffef [24]
(160) |11111111|11111111|011010 3fffda [22]
(161) |11111111|11111110|11101 1fffdd [21]
(162) |11111111|11111110|1001 fffe9 [20]
(163) |11111111|11111111|011011 3fffdb [22]
(164) |11111111|11111111|011100 3fffdc [22]
(165) |11111111|11111111|1101000 7fffe8 [23]
(166) |11111111|11111111|1101001 7fffe9 [23]
(167) |11111111|11111110|11110 1fffde [21]
(168) |11111111|11111111|1101010 7fffea [23]
(169) |11111111|11111111|011101 3fffdd [22]
(170) |11111111|11111111|011110 3fffde [22]
(171) |11111111|11111111|11110000 fffff0 [24]
(172) |11111111|11111110|11111 1fffdf [21]
(173) |11111111|11111111|011111 3fffdf [22]
(174) |11111111|11111111|1101011 7fffeb [23]
(175) |11111111|11111111|1101100 7fffec [23]
(176) |11111111|11111111|00000 1fffe0 [21]
(177) |11111111|11111111|00001 1fffe1 [21]
(178) |11111111|11111111|100000 3fffe0 [22]
(179) |11111111|11111111|00010 1fffe2 [21]
(180) |11111111|11111111|1101101 7fffed [23]
(181) |11111111|11111111|100001 3fffe1 [22]
(182) |11111111|11111111|1101110 7fffee [23]
(183) |11111111|11111111|1101111 7fffef [23]
(184) |11111111|11111110|1010 fffea [20]
(185) |11111111|11111111|100010 3fffe2 [22]
(186) |11111111|11111111|100011 3fffe3 [22]
(187) |11111111|11111111|100100 3fffe4 [22]
(188) |11111111|11111111|1110000 7ffff0 [23]
(189) |11111111|11111111|100101 3fffe5 [22]
(190) |11111111|11111111|100110 3fffe6 [22]
(191) |11111111|11111111|1110001 7ffff1 [23]
(192) |11111111|11111111|11111000|00 3ffffe0 [26]
(193) |11111111|11111111|11111000|01 3ffffe1 [26]
(194) |11111111|11111110|1011 fffeb [20]
(195) |11111111|11111110|001 7fff1 [19]
(196) |11111111|11111111|100111 3fffe7 [22]
(197) |11111111|11111111|1110010 7ffff2 [23]
(198) |11111111|11111111|101000 3fffe8 [22]
(199) |11111111|11111111|11110110|0 1ffffec [25]
(200) |11111111|11111111|11111000|10 3ffffe2 [26]
(201) |11111111|11111111|11111000|11 3ffffe3 [26]
(202) |11111111|11111111|11111001|00 3ffffe4 [26]
(203) |11111111|11111111|11111011|110 7ffffde [27]
(204) |11111111|11111111|11111011|111 7ffffdf [27]
(205) |11111111|11111111|11111001|01 3ffffe5 [26]
<span class="grey">Peon & Ruellan Standards Track [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
(206) |11111111|11111111|11110001 fffff1 [24]
(207) |11111111|11111111|11110110|1 1ffffed [25]
(208) |11111111|11111110|010 7fff2 [19]
(209) |11111111|11111111|00011 1fffe3 [21]
(210) |11111111|11111111|11111001|10 3ffffe6 [26]
(211) |11111111|11111111|11111100|000 7ffffe0 [27]
(212) |11111111|11111111|11111100|001 7ffffe1 [27]
(213) |11111111|11111111|11111001|11 3ffffe7 [26]
(214) |11111111|11111111|11111100|010 7ffffe2 [27]
(215) |11111111|11111111|11110010 fffff2 [24]
(216) |11111111|11111111|00100 1fffe4 [21]
(217) |11111111|11111111|00101 1fffe5 [21]
(218) |11111111|11111111|11111010|00 3ffffe8 [26]
(219) |11111111|11111111|11111010|01 3ffffe9 [26]
(220) |11111111|11111111|11111111|1101 ffffffd [28]
(221) |11111111|11111111|11111100|011 7ffffe3 [27]
(222) |11111111|11111111|11111100|100 7ffffe4 [27]
(223) |11111111|11111111|11111100|101 7ffffe5 [27]
(224) |11111111|11111110|1100 fffec [20]
(225) |11111111|11111111|11110011 fffff3 [24]
(226) |11111111|11111110|1101 fffed [20]
(227) |11111111|11111111|00110 1fffe6 [21]
(228) |11111111|11111111|101001 3fffe9 [22]
(229) |11111111|11111111|00111 1fffe7 [21]
(230) |11111111|11111111|01000 1fffe8 [21]
(231) |11111111|11111111|1110011 7ffff3 [23]
(232) |11111111|11111111|101010 3fffea [22]
(233) |11111111|11111111|101011 3fffeb [22]
(234) |11111111|11111111|11110111|0 1ffffee [25]
(235) |11111111|11111111|11110111|1 1ffffef [25]
(236) |11111111|11111111|11110100 fffff4 [24]
(237) |11111111|11111111|11110101 fffff5 [24]
(238) |11111111|11111111|11111010|10 3ffffea [26]
(239) |11111111|11111111|1110100 7ffff4 [23]
(240) |11111111|11111111|11111010|11 3ffffeb [26]
(241) |11111111|11111111|11111100|110 7ffffe6 [27]
(242) |11111111|11111111|11111011|00 3ffffec [26]
(243) |11111111|11111111|11111011|01 3ffffed [26]
(244) |11111111|11111111|11111100|111 7ffffe7 [27]
(245) |11111111|11111111|11111101|000 7ffffe8 [27]
(246) |11111111|11111111|11111101|001 7ffffe9 [27]
(247) |11111111|11111111|11111101|010 7ffffea [27]
(248) |11111111|11111111|11111101|011 7ffffeb [27]
(249) |11111111|11111111|11111111|1110 ffffffe [28]
(250) |11111111|11111111|11111101|100 7ffffec [27]
(251) |11111111|11111111|11111101|101 7ffffed [27]
(252) |11111111|11111111|11111101|110 7ffffee [27]
(253) |11111111|11111111|11111101|111 7ffffef [27]
<span class="grey">Peon & Ruellan Standards Track [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
(254) |11111111|11111111|11111110|000 7fffff0 [27]
(255) |11111111|11111111|11111011|10 3ffffee [26]
EOS (256) |11111111|11111111|11111111|111111 3fffffff [30]
<span class="h2"><a class="selflink" id="appendix-C" href="#appendix-C">Appendix C</a>. Examples</span>
This appendix contains examples covering integer encoding, header
field representation, and the encoding of whole lists of header
fields for both requests and responses, with and without Huffman
coding.
<span class="h3"><a class="selflink" id="appendix-C.1" href="#appendix-C.1">C.1</a>. Integer Representation Examples</span>
This section shows the representation of integer values in detail
(see <a href="#section-5.1">Section 5.1</a>).
<span class="h4"><a class="selflink" id="appendix-C.1.1" href="#appendix-C.1.1">C.1.1</a>. Example 1: Encoding 10 Using a 5-Bit Prefix</span>
The value 10 is to be encoded with a 5-bit prefix.
o 10 is less than 31 (2^5 - 1) and is represented using the 5-bit
prefix.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| X | X | X | 0 | 1 | 0 | 1 | 0 | 10 stored on 5 bits
+---+---+---+---+---+---+---+---+
<span class="h4"><a class="selflink" id="appendix-C.1.2" href="#appendix-C.1.2">C.1.2</a>. Example 2: Encoding 1337 Using a 5-Bit Prefix</span>
The value I=1337 is to be encoded with a 5-bit prefix.
1337 is greater than 31 (2^5 - 1).
The 5-bit prefix is filled with its max value (31).
I = 1337 - (2^5 - 1) = 1306.
I (1306) is greater than or equal to 128, so the while loop
body executes:
I % 128 == 26
26 + 128 == 154
154 is encoded in 8 bits as: 10011010
I is set to 10 (1306 / 128 == 10)
<span class="grey">Peon & Ruellan Standards Track [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
I is no longer greater than or equal to 128, so the while
loop terminates.
I, now 10, is encoded in 8 bits as: 00001010.
The process ends.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| X | X | X | 1 | 1 | 1 | 1 | 1 | Prefix = 31, I = 1306
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1306>=128, encode(154), I=1306/128
| 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 10<128, encode(10), done
+---+---+---+---+---+---+---+---+
<span class="h4"><a class="selflink" id="appendix-C.1.3" href="#appendix-C.1.3">C.1.3</a>. Example 3: Encoding 42 Starting at an Octet Boundary</span>
The value 42 is to be encoded starting at an octet boundary. This
implies that a 8-bit prefix is used.
o 42 is less than 255 (2^8 - 1) and is represented using the 8-bit
prefix.
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 42 stored on 8 bits
+---+---+---+---+---+---+---+---+
<span class="h3"><a class="selflink" id="appendix-C.2" href="#appendix-C.2">C.2</a>. Header Field Representation Examples</span>
This section shows several independent representation examples.
<span class="h4"><a class="selflink" id="appendix-C.2.1" href="#appendix-C.2.1">C.2.1</a>. Literal Header Field with Indexing</span>
The header field representation uses a literal name and a literal
value. The header field is added to the dynamic table.
Header list to encode:
custom-key: custom-header
Hex dump of encoded data:
400a 6375 7374 6f6d 2d6b 6579 0d63 7573 | @.custom-key.cus
746f 6d2d 6865 6164 6572 | tom-header
<span class="grey">Peon & Ruellan Standards Track [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoding process:
40 | == Literal indexed ==
0a | Literal name (len = 10)
6375 7374 6f6d 2d6b 6579 | custom-key
0d | Literal value (len = 13)
6375 7374 6f6d 2d68 6561 6465 72 | custom-header
| -> custom-key:
| custom-header
Dynamic Table (after decoding):
[ 1] (s = 55) custom-key: custom-header
Table size: 55
Decoded header list:
custom-key: custom-header
<span class="h4"><a class="selflink" id="appendix-C.2.2" href="#appendix-C.2.2">C.2.2</a>. Literal Header Field without Indexing</span>
The header field representation uses an indexed name and a literal
value. The header field is not added to the dynamic table.
Header list to encode:
:path: /sample/path
Hex dump of encoded data:
040c 2f73 616d 706c 652f 7061 7468 | ../sample/path
Decoding process:
04 | == Literal not indexed ==
| Indexed name (idx = 4)
| :path
0c | Literal value (len = 12)
2f73 616d 706c 652f 7061 7468 | /sample/path
| -> :path: /sample/path
Dynamic table (after decoding): empty.
Decoded header list:
:path: /sample/path
<span class="grey">Peon & Ruellan Standards Track [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h4"><a class="selflink" id="appendix-C.2.3" href="#appendix-C.2.3">C.2.3</a>. Literal Header Field Never Indexed</span>
The header field representation uses a literal name and a literal
value. The header field is not added to the dynamic table and must
use the same representation if re-encoded by an intermediary.
Header list to encode:
password: secret
Hex dump of encoded data:
1008 7061 7373 776f 7264 0673 6563 7265 | ..password.secre
74 | t
Decoding process:
10 | == Literal never indexed ==
08 | Literal name (len = 8)
7061 7373 776f 7264 | password
06 | Literal value (len = 6)
7365 6372 6574 | secret
| -> password: secret
Dynamic table (after decoding): empty.
Decoded header list:
password: secret
<span class="grey">Peon & Ruellan Standards Track [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h4"><a class="selflink" id="appendix-C.2.4" href="#appendix-C.2.4">C.2.4</a>. Indexed Header Field</span>
The header field representation uses an indexed header field from the
static table.
Header list to encode:
:method: GET
Hex dump of encoded data:
82 | .
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
Dynamic table (after decoding): empty.
Decoded header list:
:method: GET
<span class="h3"><a class="selflink" id="appendix-C.3" href="#appendix-C.3">C.3</a>. Request Examples without Huffman Coding</span>
This section shows several consecutive header lists, corresponding to
HTTP requests, on the same connection.
<span class="h4"><a class="selflink" id="appendix-C.3.1" href="#appendix-C.3.1">C.3.1</a>. First Request</span>
Header list to encode:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
Hex dump of encoded data:
8286 8441 0f77 7777 2e65 7861 6d70 6c65 | ...A.www.example
2e63 6f6d | .com
<span class="grey">Peon & Ruellan Standards Track [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
86 | == Indexed - Add ==
| idx = 6
| -> :scheme: http
84 | == Indexed - Add ==
| idx = 4
| -> :path: /
41 | == Literal indexed ==
| Indexed name (idx = 1)
| :authority
0f | Literal value (len = 15)
7777 772e 6578 616d 706c 652e 636f 6d | www.example.com
| -> :authority:
| www.example.com
Dynamic Table (after decoding):
[ 1] (s = 57) :authority: www.example.com
Table size: 57
Decoded header list:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
<span class="h4"><a class="selflink" id="appendix-C.3.2" href="#appendix-C.3.2">C.3.2</a>. Second Request</span>
Header list to encode:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
cache-control: no-cache
Hex dump of encoded data:
8286 84be 5808 6e6f 2d63 6163 6865 | ....X.no-cache
<span class="grey">Peon & Ruellan Standards Track [Page 38]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
86 | == Indexed - Add ==
| idx = 6
| -> :scheme: http
84 | == Indexed - Add ==
| idx = 4
| -> :path: /
be | == Indexed - Add ==
| idx = 62
| -> :authority:
| www.example.com
58 | == Literal indexed ==
| Indexed name (idx = 24)
| cache-control
08 | Literal value (len = 8)
6e6f 2d63 6163 6865 | no-cache
| -> cache-control: no-cache
Dynamic Table (after decoding):
[ 1] (s = 53) cache-control: no-cache
[ 2] (s = 57) :authority: www.example.com
Table size: 110
Decoded header list:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
cache-control: no-cache
<span class="h4"><a class="selflink" id="appendix-C.3.3" href="#appendix-C.3.3">C.3.3</a>. Third Request</span>
Header list to encode:
:method: GET
:scheme: https
:path: /index.html
:authority: www.example.com
custom-key: custom-value
<span class="grey">Peon & Ruellan Standards Track [Page 39]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Hex dump of encoded data:
8287 85bf 400a 6375 7374 6f6d 2d6b 6579 | ....@.custom-key
0c63 7573 746f 6d2d 7661 6c75 65 | .custom-value
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
87 | == Indexed - Add ==
| idx = 7
| -> :scheme: https
85 | == Indexed - Add ==
| idx = 5
| -> :path: /index.html
bf | == Indexed - Add ==
| idx = 63
| -> :authority:
| www.example.com
40 | == Literal indexed ==
0a | Literal name (len = 10)
6375 7374 6f6d 2d6b 6579 | custom-key
0c | Literal value (len = 12)
6375 7374 6f6d 2d76 616c 7565 | custom-value
| -> custom-key:
| custom-value
Dynamic Table (after decoding):
[ 1] (s = 54) custom-key: custom-value
[ 2] (s = 53) cache-control: no-cache
[ 3] (s = 57) :authority: www.example.com
Table size: 164
Decoded header list:
:method: GET
:scheme: https
:path: /index.html
:authority: www.example.com
custom-key: custom-value
<span class="grey">Peon & Ruellan Standards Track [Page 40]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h3"><a class="selflink" id="appendix-C.4" href="#appendix-C.4">C.4</a>. Request Examples with Huffman Coding</span>
This section shows the same examples as the previous section but uses
Huffman encoding for the literal values.
<span class="h4"><a class="selflink" id="appendix-C.4.1" href="#appendix-C.4.1">C.4.1</a>. First Request</span>
Header list to encode:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
Hex dump of encoded data:
8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4 | ...A......:k....
ff | .
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
86 | == Indexed - Add ==
| idx = 6
| -> :scheme: http
84 | == Indexed - Add ==
| idx = 4
| -> :path: /
41 | == Literal indexed ==
| Indexed name (idx = 1)
| :authority
8c | Literal value (len = 12)
| Huffman encoded:
f1e3 c2e5 f23a 6ba0 ab90 f4ff | .....:k.....
| Decoded:
| www.example.com
| -> :authority:
| www.example.com
Dynamic Table (after decoding):
[ 1] (s = 57) :authority: www.example.com
Table size: 57
<span class="grey">Peon & Ruellan Standards Track [Page 41]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoded header list:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
<span class="h4"><a class="selflink" id="appendix-C.4.2" href="#appendix-C.4.2">C.4.2</a>. Second Request</span>
Header list to encode:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
cache-control: no-cache
Hex dump of encoded data:
8286 84be 5886 a8eb 1064 9cbf | ....X....d..
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
86 | == Indexed - Add ==
| idx = 6
| -> :scheme: http
84 | == Indexed - Add ==
| idx = 4
| -> :path: /
be | == Indexed - Add ==
| idx = 62
| -> :authority:
| www.example.com
58 | == Literal indexed ==
| Indexed name (idx = 24)
| cache-control
86 | Literal value (len = 6)
| Huffman encoded:
a8eb 1064 9cbf | ...d..
| Decoded:
| no-cache
| -> cache-control: no-cache
<span class="grey">Peon & Ruellan Standards Track [Page 42]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Dynamic Table (after decoding):
[ 1] (s = 53) cache-control: no-cache
[ 2] (s = 57) :authority: www.example.com
Table size: 110
Decoded header list:
:method: GET
:scheme: http
:path: /
:authority: www.example.com
cache-control: no-cache
<span class="h4"><a class="selflink" id="appendix-C.4.3" href="#appendix-C.4.3">C.4.3</a>. Third Request</span>
Header list to encode:
:method: GET
:scheme: https
:path: /index.html
:authority: www.example.com
custom-key: custom-value
Hex dump of encoded data:
8287 85bf 4088 25a8 49e9 5ba9 7d7f 8925 | ....@.%.I.[.}..%
a849 e95b b8e8 b4bf | .I.[....
<span class="grey">Peon & Ruellan Standards Track [Page 43]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoding process:
82 | == Indexed - Add ==
| idx = 2
| -> :method: GET
87 | == Indexed - Add ==
| idx = 7
| -> :scheme: https
85 | == Indexed - Add ==
| idx = 5
| -> :path: /index.html
bf | == Indexed - Add ==
| idx = 63
| -> :authority:
| www.example.com
40 | == Literal indexed ==
88 | Literal name (len = 8)
| Huffman encoded:
25a8 49e9 5ba9 7d7f | %.I.[.}.
| Decoded:
| custom-key
89 | Literal value (len = 9)
| Huffman encoded:
25a8 49e9 5bb8 e8b4 bf | %.I.[....
| Decoded:
| custom-value
| -> custom-key:
| custom-value
Dynamic Table (after decoding):
[ 1] (s = 54) custom-key: custom-value
[ 2] (s = 53) cache-control: no-cache
[ 3] (s = 57) :authority: www.example.com
Table size: 164
Decoded header list:
:method: GET
:scheme: https
:path: /index.html
:authority: www.example.com
custom-key: custom-value
<span class="grey">Peon & Ruellan Standards Track [Page 44]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
<span class="h3"><a class="selflink" id="appendix-C.5" href="#appendix-C.5">C.5</a>. Response Examples without Huffman Coding</span>
This section shows several consecutive header lists, corresponding to
HTTP responses, on the same connection. The HTTP/2 setting parameter
SETTINGS_HEADER_TABLE_SIZE is set to the value of 256 octets, causing
some evictions to occur.
<span class="h4"><a class="selflink" id="appendix-C.5.1" href="#appendix-C.5.1">C.5.1</a>. First Response</span>
Header list to encode:
:status: 302
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
Hex dump of encoded data:
4803 3330 3258 0770 7269 7661 7465 611d | H.302X.privatea.
4d6f 6e2c 2032 3120 4f63 7420 3230 3133 | Mon, 21 Oct 2013
2032 303a 3133 3a32 3120 474d 546e 1768 | 20:13:21 GMTn.h
7474 7073 3a2f 2f77 7777 2e65 7861 6d70 | ttps://www.examp
6c65 2e63 6f6d | le.com
Decoding process:
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
03 | Literal value (len = 3)
3330 32 | 302
| -> :status: 302
58 | == Literal indexed ==
| Indexed name (idx = 24)
| cache-control
07 | Literal value (len = 7)
7072 6976 6174 65 | private
| -> cache-control: private
61 | == Literal indexed ==
| Indexed name (idx = 33)
| date
1d | Literal value (len = 29)
4d6f 6e2c 2032 3120 4f63 7420 3230 3133 | Mon, 21 Oct 2013
2032 303a 3133 3a32 3120 474d 54 | 20:13:21 GMT
| -> date: Mon, 21 Oct 2013
| 20:13:21 GMT
6e | == Literal indexed ==
| Indexed name (idx = 46)
<span class="grey">Peon & Ruellan Standards Track [Page 45]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
| location
17 | Literal value (len = 23)
6874 7470 733a 2f2f 7777 772e 6578 616d | <a href="https://www.exam">https://www.exam</a>
706c 652e 636f 6d | ple.com
| -> location:
| https://www.example.com
Dynamic Table (after decoding):
[ 1] (s = 63) location: https://www.example.com
[ 2] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT
[ 3] (s = 52) cache-control: private
[ 4] (s = 42) :status: 302
Table size: 222
Decoded header list:
:status: 302
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
<span class="h4"><a class="selflink" id="appendix-C.5.2" href="#appendix-C.5.2">C.5.2</a>. Second Response</span>
The (":status", "302") header field is evicted from the dynamic table
to free space to allow adding the (":status", "307") header field.
Header list to encode:
:status: 307
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
Hex dump of encoded data:
4803 3330 37c1 c0bf | H.307...
Decoding process:
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
03 | Literal value (len = 3)
3330 37 | 307
| - evict: :status: 302
| -> :status: 307
c1 | == Indexed - Add ==
<span class="grey">Peon & Ruellan Standards Track [Page 46]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
| idx = 65
| -> cache-control: private
c0 | == Indexed - Add ==
| idx = 64
| -> date: Mon, 21 Oct 2013
| 20:13:21 GMT
bf | == Indexed - Add ==
| idx = 63
| -> location:
| https://www.example.com
Dynamic Table (after decoding):
[ 1] (s = 42) :status: 307
[ 2] (s = 63) location: https://www.example.com
[ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT
[ 4] (s = 52) cache-control: private
Table size: 222
Decoded header list:
:status: 307
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
<span class="h4"><a class="selflink" id="appendix-C.5.3" href="#appendix-C.5.3">C.5.3</a>. Third Response</span>
Several header fields are evicted from the dynamic table during the
processing of this header list.
Header list to encode:
:status: 200
cache-control: private
date: Mon, 21 Oct 2013 20:13:22 GMT
location: https://www.example.com
content-encoding: gzip
set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1
<span class="grey">Peon & Ruellan Standards Track [Page 47]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Hex dump of encoded data:
88c1 611d 4d6f 6e2c 2032 3120 4f63 7420 | ..a.Mon, 21 Oct
3230 3133 2032 303a 3133 3a32 3220 474d | 2013 20:13:22 GM
54c0 5a04 677a 6970 7738 666f 6f3d 4153 | T.Z.gzipw8foo=AS
444a 4b48 514b 425a 584f 5157 454f 5049 | DJKHQKBZXOQWEOPI
5541 5851 5745 4f49 553b 206d 6178 2d61 | UAXQWEOIU; max-a
6765 3d33 3630 303b 2076 6572 7369 6f6e | ge=3600; version
3d31 | =1
Decoding process:
88 | == Indexed - Add ==
| idx = 8
| -> :status: 200
c1 | == Indexed - Add ==
| idx = 65
| -> cache-control: private
61 | == Literal indexed ==
| Indexed name (idx = 33)
| date
1d | Literal value (len = 29)
4d6f 6e2c 2032 3120 4f63 7420 3230 3133 | Mon, 21 Oct 2013
2032 303a 3133 3a32 3220 474d 54 | 20:13:22 GMT
| - evict: cache-control:
| private
| -> date: Mon, 21 Oct 2013
| 20:13:22 GMT
c0 | == Indexed - Add ==
| idx = 64
| -> location:
| https://www.example.com
5a | == Literal indexed ==
| Indexed name (idx = 26)
| content-encoding
04 | Literal value (len = 4)
677a 6970 | gzip
| - evict: date: Mon, 21 Oct
| 2013 20:13:21 GMT
| -> content-encoding: gzip
77 | == Literal indexed ==
| Indexed name (idx = 55)
| set-cookie
38 | Literal value (len = 56)
666f 6f3d 4153 444a 4b48 514b 425a 584f | foo=ASDJKHQKBZXO
5157 454f 5049 5541 5851 5745 4f49 553b | QWEOPIUAXQWEOIU;
206d 6178 2d61 6765 3d33 3630 303b 2076 | max-age=3600; v
6572 7369 6f6e 3d31 | ersion=1
<span class="grey">Peon & Ruellan Standards Track [Page 48]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
| - evict: location:
| https://www.example.com
| - evict: :status: 307
| -> set-cookie: foo=ASDJKHQ
| KBZXOQWEOPIUAXQWEOIU; ma
| x-age=3600; version=1
Dynamic Table (after decoding):
[ 1] (s = 98) set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;
max-age=3600; version=1
[ 2] (s = 52) content-encoding: gzip
[ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:22 GMT
Table size: 215
Decoded header list:
:status: 200
cache-control: private
date: Mon, 21 Oct 2013 20:13:22 GMT
location: https://www.example.com
content-encoding: gzip
set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1
<span class="h3"><a class="selflink" id="appendix-C.6" href="#appendix-C.6">C.6</a>. Response Examples with Huffman Coding</span>
This section shows the same examples as the previous section but uses
Huffman encoding for the literal values. The HTTP/2 setting
parameter SETTINGS_HEADER_TABLE_SIZE is set to the value of 256
octets, causing some evictions to occur. The eviction mechanism uses
the length of the decoded literal values, so the same evictions occur
as in the previous section.
<span class="h4"><a class="selflink" id="appendix-C.6.1" href="#appendix-C.6.1">C.6.1</a>. First Response</span>
Header list to encode:
:status: 302
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
Hex dump of encoded data:
4882 6402 5885 aec3 771a 4b61 96d0 7abe | H.d.X...w.Ka..z.
9410 54d4 44a8 2005 9504 0b81 66e0 82a6 | ..T.D. .....f...
2d1b ff6e 919d 29ad 1718 63c7 8f0b 97c8 | -..n..)...c.....
e9ae 82ae 43d3 | ....C.
<span class="grey">Peon & Ruellan Standards Track [Page 49]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoding process:
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
82 | Literal value (len = 2)
| Huffman encoded:
6402 | d.
| Decoded:
| 302
| -> :status: 302
58 | == Literal indexed ==
| Indexed name (idx = 24)
| cache-control
85 | Literal value (len = 5)
| Huffman encoded:
aec3 771a 4b | ..w.K
| Decoded:
| private
| -> cache-control: private
61 | == Literal indexed ==
| Indexed name (idx = 33)
| date
96 | Literal value (len = 22)
| Huffman encoded:
d07a be94 1054 d444 a820 0595 040b 8166 | .z...T.D. .....f
e082 a62d 1bff | ...-..
| Decoded:
| Mon, 21 Oct 2013 20:13:21
| GMT
| -> date: Mon, 21 Oct 2013
| 20:13:21 GMT
6e | == Literal indexed ==
| Indexed name (idx = 46)
| location
91 | Literal value (len = 17)
| Huffman encoded:
9d29 ad17 1863 c78f 0b97 c8e9 ae82 ae43 | .)...c.........<a href="#page-C">C</a>
d3 | .
| Decoded:
| https://www.example.com
| -> location:
| https://www.example.com
<span class="grey">Peon & Ruellan Standards Track [Page 50]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Dynamic Table (after decoding):
[ 1] (s = 63) location: https://www.example.com
[ 2] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT
[ 3] (s = 52) cache-control: private
[ 4] (s = 42) :status: 302
Table size: 222
Decoded header list:
:status: 302
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
<span class="h4"><a class="selflink" id="appendix-C.6.2" href="#appendix-C.6.2">C.6.2</a>. Second Response</span>
The (":status", "302") header field is evicted from the dynamic table
to free space to allow adding the (":status", "307") header field.
Header list to encode:
:status: 307
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
Hex dump of encoded data:
4883 640e ffc1 c0bf | H.d.....
Decoding process:
48 | == Literal indexed ==
| Indexed name (idx = 8)
| :status
83 | Literal value (len = 3)
| Huffman encoded:
640e ff | d..
| Decoded:
| 307
| - evict: :status: 302
| -> :status: 307
c1 | == Indexed - Add ==
| idx = 65
| -> cache-control: private
c0 | == Indexed - Add ==
| idx = 64
<span class="grey">Peon & Ruellan Standards Track [Page 51]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
| -> date: Mon, 21 Oct 2013
| 20:13:21 GMT
bf | == Indexed - Add ==
| idx = 63
| -> location:
| https://www.example.com
Dynamic Table (after decoding):
[ 1] (s = 42) :status: 307
[ 2] (s = 63) location: https://www.example.com
[ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:21 GMT
[ 4] (s = 52) cache-control: private
Table size: 222
Decoded header list:
:status: 307
cache-control: private
date: Mon, 21 Oct 2013 20:13:21 GMT
location: https://www.example.com
<span class="h4"><a class="selflink" id="appendix-C.6.3" href="#appendix-C.6.3">C.6.3</a>. Third Response</span>
Several header fields are evicted from the dynamic table during the
processing of this header list.
Header list to encode:
:status: 200
cache-control: private
date: Mon, 21 Oct 2013 20:13:22 GMT
location: https://www.example.com
content-encoding: gzip
set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1
Hex dump of encoded data:
88c1 6196 d07a be94 1054 d444 a820 0595 | ..a..z...T.D. ..
040b 8166 e084 a62d 1bff c05a 839b d9ab | ...f...-...Z....
77ad 94e7 821d d7f2 e6c7 b335 dfdf cd5b | w..........5...[
3960 d5af 2708 7f36 72c1 ab27 0fb5 291f | 9`..'..6r..'..).
9587 3160 65c0 03ed 4ee5 b106 3d50 07 | ..1`e...N...=P.
<span class="grey">Peon & Ruellan Standards Track [Page 52]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Decoding process:
88 | == Indexed - Add ==
| idx = 8
| -> :status: 200
c1 | == Indexed - Add ==
| idx = 65
| -> cache-control: private
61 | == Literal indexed ==
| Indexed name (idx = 33)
| date
96 | Literal value (len = 22)
| Huffman encoded:
d07a be94 1054 d444 a820 0595 040b 8166 | .z...T.D. .....f
e084 a62d 1bff | ...-..
| Decoded:
| Mon, 21 Oct 2013 20:13:22
| GMT
| - evict: cache-control:
| private
| -> date: Mon, 21 Oct 2013
| 20:13:22 GMT
c0 | == Indexed - Add ==
| idx = 64
| -> location:
| https://www.example.com
5a | == Literal indexed ==
| Indexed name (idx = 26)
| content-encoding
83 | Literal value (len = 3)
| Huffman encoded:
9bd9 ab | ...
| Decoded:
| gzip
| - evict: date: Mon, 21 Oct
| 2013 20:13:21 GMT
| -> content-encoding: gzip
77 | == Literal indexed ==
| Indexed name (idx = 55)
| set-cookie
ad | Literal value (len = 45)
| Huffman encoded:
94e7 821d d7f2 e6c7 b335 dfdf cd5b 3960 | .........5...[9`
d5af 2708 7f36 72c1 ab27 0fb5 291f 9587 | ..'..6r..'..)...
3160 65c0 03ed 4ee5 b106 3d50 07 | 1`e...N...=P.
| Decoded:
| foo=ASDJKHQKBZXOQWEOPIUAXQ
| WEOIU; max-age=3600; versi
<span class="grey">Peon & Ruellan Standards Track [Page 53]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
| on=1
| - evict: location:
| https://www.example.com
| - evict: :status: 307
| -> set-cookie: foo=ASDJKHQ
| KBZXOQWEOPIUAXQWEOIU; ma
| x-age=3600; version=1
Dynamic Table (after decoding):
[ 1] (s = 98) set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;
max-age=3600; version=1
[ 2] (s = 52) content-encoding: gzip
[ 3] (s = 65) date: Mon, 21 Oct 2013 20:13:22 GMT
Table size: 215
Decoded header list:
:status: 200
cache-control: private
date: Mon, 21 Oct 2013 20:13:22 GMT
location: https://www.example.com
content-encoding: gzip
set-cookie: foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1
<span class="grey">Peon & Ruellan Standards Track [Page 54]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
<span class="grey"><a href="./rfc7541">RFC 7541</a> HPACK May 2015</span>
Acknowledgments
This specification includes substantial input from the following
individuals:
o Mike Bishop, Jeff Pinner, Julian Reschke, and Martin Thomson
(substantial editorial contributions).
o Johnny Graettinger (Huffman code statistics).
Authors' Addresses
Roberto Peon
Google, Inc
EMail: fenix@google.com
Herve Ruellan
Canon CRF
EMail: herve.ruellan@crf.canon.fr
Peon & Ruellan Standards Track [Page 55]
</pre>
|