1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/spdy/hpack_constants.h" 6 7 #include <vector> 8 9 #include "base/logging.h" 10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/singleton.h" 12 #include "net/spdy/hpack_huffman_table.h" 13 #include "net/spdy/hpack_static_table.h" 14 15 namespace net { 16 17 namespace { 18 19 20 // SharedHpackHuffmanTable is a Singleton wrapping a HpackHuffmanTable 21 // instance initialized with |kHpackHuffmanCode|. 22 struct SharedHpackHuffmanTable { 23 public: 24 SharedHpackHuffmanTable() { 25 std::vector<HpackHuffmanSymbol> code = HpackHuffmanCode(); 26 scoped_ptr<HpackHuffmanTable> mutable_table(new HpackHuffmanTable()); 27 CHECK(mutable_table->Initialize(&code[0], code.size())); 28 CHECK(mutable_table->IsInitialized()); 29 table.reset(mutable_table.release()); 30 } 31 32 static SharedHpackHuffmanTable* GetInstance() { 33 return Singleton<SharedHpackHuffmanTable>::get(); 34 } 35 36 scoped_ptr<const HpackHuffmanTable> table; 37 }; 38 39 // SharedHpackStaticTable is a Singleton wrapping a HpackStaticTable 40 // instance initialized with |kHpackStaticTable|. 41 struct SharedHpackStaticTable { 42 public: 43 SharedHpackStaticTable() { 44 std::vector<HpackStaticEntry> static_table = HpackStaticTableVector(); 45 scoped_ptr<HpackStaticTable> mutable_table(new HpackStaticTable()); 46 mutable_table->Initialize(&static_table[0], static_table.size()); 47 CHECK(mutable_table->IsInitialized()); 48 table.reset(mutable_table.release()); 49 } 50 51 static SharedHpackStaticTable* GetInstance() { 52 return Singleton<SharedHpackStaticTable>::get(); 53 } 54 55 scoped_ptr<const HpackStaticTable> table; 56 }; 57 58 } // namespace 59 60 // Produced by applying the python program [1] with tables 61 // provided by [2] (inserted into the source of the python program) 62 // and copy-paste them into this file. 63 // 64 // [1] net/tools/build_hpack_constants.py 65 // [2] http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08 66 67 // HpackHuffmanSymbol entries are initialized as {code, length, id}. 68 // Codes are specified in the |length| most-significant bits of |code|. 69 std::vector<HpackHuffmanSymbol> HpackHuffmanCode() { 70 static const HpackHuffmanSymbol kHpackHuffmanCode[] = { 71 {0xffc00000ul, 13, 0}, // 11111111|11000 72 {0xffffb000ul, 23, 1}, // 11111111|11111111|1011000 73 {0xfffffe20ul, 28, 2}, // 11111111|11111111|11111110|0010 74 {0xfffffe30ul, 28, 3}, // 11111111|11111111|11111110|0011 75 {0xfffffe40ul, 28, 4}, // 11111111|11111111|11111110|0100 76 {0xfffffe50ul, 28, 5}, // 11111111|11111111|11111110|0101 77 {0xfffffe60ul, 28, 6}, // 11111111|11111111|11111110|0110 78 {0xfffffe70ul, 28, 7}, // 11111111|11111111|11111110|0111 79 {0xfffffe80ul, 28, 8}, // 11111111|11111111|11111110|1000 80 {0xffffea00ul, 24, 9}, // 11111111|11111111|11101010 81 {0xfffffff0ul, 30, 10}, // 11111111|11111111|11111111|111100 82 {0xfffffe90ul, 28, 11}, // 11111111|11111111|11111110|1001 83 {0xfffffea0ul, 28, 12}, // 11111111|11111111|11111110|1010 84 {0xfffffff4ul, 30, 13}, // 11111111|11111111|11111111|111101 85 {0xfffffeb0ul, 28, 14}, // 11111111|11111111|11111110|1011 86 {0xfffffec0ul, 28, 15}, // 11111111|11111111|11111110|1100 87 {0xfffffed0ul, 28, 16}, // 11111111|11111111|11111110|1101 88 {0xfffffee0ul, 28, 17}, // 11111111|11111111|11111110|1110 89 {0xfffffef0ul, 28, 18}, // 11111111|11111111|11111110|1111 90 {0xffffff00ul, 28, 19}, // 11111111|11111111|11111111|0000 91 {0xffffff10ul, 28, 20}, // 11111111|11111111|11111111|0001 92 {0xffffff20ul, 28, 21}, // 11111111|11111111|11111111|0010 93 {0xfffffff8ul, 30, 22}, // 11111111|11111111|11111111|111110 94 {0xffffff30ul, 28, 23}, // 11111111|11111111|11111111|0011 95 {0xffffff40ul, 28, 24}, // 11111111|11111111|11111111|0100 96 {0xffffff50ul, 28, 25}, // 11111111|11111111|11111111|0101 97 {0xffffff60ul, 28, 26}, // 11111111|11111111|11111111|0110 98 {0xffffff70ul, 28, 27}, // 11111111|11111111|11111111|0111 99 {0xffffff80ul, 28, 28}, // 11111111|11111111|11111111|1000 100 {0xffffff90ul, 28, 29}, // 11111111|11111111|11111111|1001 101 {0xffffffa0ul, 28, 30}, // 11111111|11111111|11111111|1010 102 {0xffffffb0ul, 28, 31}, // 11111111|11111111|11111111|1011 103 {0x50000000ul, 6, 32}, // ' ' 010100 104 {0xfe000000ul, 10, 33}, // '!' 11111110|00 105 {0xfe400000ul, 10, 34}, // '"' 11111110|01 106 {0xffa00000ul, 12, 35}, // '#' 11111111|1010 107 {0xffc80000ul, 13, 36}, // '$' 11111111|11001 108 {0x54000000ul, 6, 37}, // '%' 010101 109 {0xf8000000ul, 8, 38}, // '&' 11111000 110 {0xff400000ul, 11, 39}, // ''' 11111111|010 111 {0xfe800000ul, 10, 40}, // '(' 11111110|10 112 {0xfec00000ul, 10, 41}, // ')' 11111110|11 113 {0xf9000000ul, 8, 42}, // '*' 11111001 114 {0xff600000ul, 11, 43}, // '+' 11111111|011 115 {0xfa000000ul, 8, 44}, // ',' 11111010 116 {0x58000000ul, 6, 45}, // '-' 010110 117 {0x5c000000ul, 6, 46}, // '.' 010111 118 {0x60000000ul, 6, 47}, // '/' 011000 119 {0x00000000ul, 5, 48}, // '0' 00000 120 {0x08000000ul, 5, 49}, // '1' 00001 121 {0x10000000ul, 5, 50}, // '2' 00010 122 {0x64000000ul, 6, 51}, // '3' 011001 123 {0x68000000ul, 6, 52}, // '4' 011010 124 {0x6c000000ul, 6, 53}, // '5' 011011 125 {0x70000000ul, 6, 54}, // '6' 011100 126 {0x74000000ul, 6, 55}, // '7' 011101 127 {0x78000000ul, 6, 56}, // '8' 011110 128 {0x7c000000ul, 6, 57}, // '9' 011111 129 {0xb8000000ul, 7, 58}, // ':' 1011100 130 {0xfb000000ul, 8, 59}, // ';' 11111011 131 {0xfff80000ul, 15, 60}, // '<' 11111111|1111100 132 {0x80000000ul, 6, 61}, // '=' 100000 133 {0xffb00000ul, 12, 62}, // '>' 11111111|1011 134 {0xff000000ul, 10, 63}, // '?' 11111111|00 135 {0xffd00000ul, 13, 64}, // '@' 11111111|11010 136 {0x84000000ul, 6, 65}, // 'A' 100001 137 {0xba000000ul, 7, 66}, // 'B' 1011101 138 {0xbc000000ul, 7, 67}, // 'C' 1011110 139 {0xbe000000ul, 7, 68}, // 'D' 1011111 140 {0xc0000000ul, 7, 69}, // 'E' 1100000 141 {0xc2000000ul, 7, 70}, // 'F' 1100001 142 {0xc4000000ul, 7, 71}, // 'G' 1100010 143 {0xc6000000ul, 7, 72}, // 'H' 1100011 144 {0xc8000000ul, 7, 73}, // 'I' 1100100 145 {0xca000000ul, 7, 74}, // 'J' 1100101 146 {0xcc000000ul, 7, 75}, // 'K' 1100110 147 {0xce000000ul, 7, 76}, // 'L' 1100111 148 {0xd0000000ul, 7, 77}, // 'M' 1101000 149 {0xd2000000ul, 7, 78}, // 'N' 1101001 150 {0xd4000000ul, 7, 79}, // 'O' 1101010 151 {0xd6000000ul, 7, 80}, // 'P' 1101011 152 {0xd8000000ul, 7, 81}, // 'Q' 1101100 153 {0xda000000ul, 7, 82}, // 'R' 1101101 154 {0xdc000000ul, 7, 83}, // 'S' 1101110 155 {0xde000000ul, 7, 84}, // 'T' 1101111 156 {0xe0000000ul, 7, 85}, // 'U' 1110000 157 {0xe2000000ul, 7, 86}, // 'V' 1110001 158 {0xe4000000ul, 7, 87}, // 'W' 1110010 159 {0xfc000000ul, 8, 88}, // 'X' 11111100 160 {0xe6000000ul, 7, 89}, // 'Y' 1110011 161 {0xfd000000ul, 8, 90}, // 'Z' 11111101 162 {0xffd80000ul, 13, 91}, // '[' 11111111|11011 163 {0xfffe0000ul, 19, 92}, // '\' 11111111|11111110|000 164 {0xffe00000ul, 13, 93}, // ']' 11111111|11100 165 {0xfff00000ul, 14, 94}, // '^' 11111111|111100 166 {0x88000000ul, 6, 95}, // '_' 100010 167 {0xfffa0000ul, 15, 96}, // '`' 11111111|1111101 168 {0x18000000ul, 5, 97}, // 'a' 00011 169 {0x8c000000ul, 6, 98}, // 'b' 100011 170 {0x20000000ul, 5, 99}, // 'c' 00100 171 {0x90000000ul, 6, 100}, // 'd' 100100 172 {0x28000000ul, 5, 101}, // 'e' 00101 173 {0x94000000ul, 6, 102}, // 'f' 100101 174 {0x98000000ul, 6, 103}, // 'g' 100110 175 {0x9c000000ul, 6, 104}, // 'h' 100111 176 {0x30000000ul, 5, 105}, // 'i' 00110 177 {0xe8000000ul, 7, 106}, // 'j' 1110100 178 {0xea000000ul, 7, 107}, // 'k' 1110101 179 {0xa0000000ul, 6, 108}, // 'l' 101000 180 {0xa4000000ul, 6, 109}, // 'm' 101001 181 {0xa8000000ul, 6, 110}, // 'n' 101010 182 {0x38000000ul, 5, 111}, // 'o' 00111 183 {0xac000000ul, 6, 112}, // 'p' 101011 184 {0xec000000ul, 7, 113}, // 'q' 1110110 185 {0xb0000000ul, 6, 114}, // 'r' 101100 186 {0x40000000ul, 5, 115}, // 's' 01000 187 {0x48000000ul, 5, 116}, // 't' 01001 188 {0xb4000000ul, 6, 117}, // 'u' 101101 189 {0xee000000ul, 7, 118}, // 'v' 1110111 190 {0xf0000000ul, 7, 119}, // 'w' 1111000 191 {0xf2000000ul, 7, 120}, // 'x' 1111001 192 {0xf4000000ul, 7, 121}, // 'y' 1111010 193 {0xf6000000ul, 7, 122}, // 'z' 1111011 194 {0xfffc0000ul, 15, 123}, // '{' 11111111|1111110 195 {0xff800000ul, 11, 124}, // '|' 11111111|100 196 {0xfff40000ul, 14, 125}, // '}' 11111111|111101 197 {0xffe80000ul, 13, 126}, // '~' 11111111|11101 198 {0xffffffc0ul, 28, 127}, // 11111111|11111111|11111111|1100 199 {0xfffe6000ul, 20, 128}, // 11111111|11111110|0110 200 {0xffff4800ul, 22, 129}, // 11111111|11111111|010010 201 {0xfffe7000ul, 20, 130}, // 11111111|11111110|0111 202 {0xfffe8000ul, 20, 131}, // 11111111|11111110|1000 203 {0xffff4c00ul, 22, 132}, // 11111111|11111111|010011 204 {0xffff5000ul, 22, 133}, // 11111111|11111111|010100 205 {0xffff5400ul, 22, 134}, // 11111111|11111111|010101 206 {0xffffb200ul, 23, 135}, // 11111111|11111111|1011001 207 {0xffff5800ul, 22, 136}, // 11111111|11111111|010110 208 {0xffffb400ul, 23, 137}, // 11111111|11111111|1011010 209 {0xffffb600ul, 23, 138}, // 11111111|11111111|1011011 210 {0xffffb800ul, 23, 139}, // 11111111|11111111|1011100 211 {0xffffba00ul, 23, 140}, // 11111111|11111111|1011101 212 {0xffffbc00ul, 23, 141}, // 11111111|11111111|1011110 213 {0xffffeb00ul, 24, 142}, // 11111111|11111111|11101011 214 {0xffffbe00ul, 23, 143}, // 11111111|11111111|1011111 215 {0xffffec00ul, 24, 144}, // 11111111|11111111|11101100 216 {0xffffed00ul, 24, 145}, // 11111111|11111111|11101101 217 {0xffff5c00ul, 22, 146}, // 11111111|11111111|010111 218 {0xffffc000ul, 23, 147}, // 11111111|11111111|1100000 219 {0xffffee00ul, 24, 148}, // 11111111|11111111|11101110 220 {0xffffc200ul, 23, 149}, // 11111111|11111111|1100001 221 {0xffffc400ul, 23, 150}, // 11111111|11111111|1100010 222 {0xffffc600ul, 23, 151}, // 11111111|11111111|1100011 223 {0xffffc800ul, 23, 152}, // 11111111|11111111|1100100 224 {0xfffee000ul, 21, 153}, // 11111111|11111110|11100 225 {0xffff6000ul, 22, 154}, // 11111111|11111111|011000 226 {0xffffca00ul, 23, 155}, // 11111111|11111111|1100101 227 {0xffff6400ul, 22, 156}, // 11111111|11111111|011001 228 {0xffffcc00ul, 23, 157}, // 11111111|11111111|1100110 229 {0xffffce00ul, 23, 158}, // 11111111|11111111|1100111 230 {0xffffef00ul, 24, 159}, // 11111111|11111111|11101111 231 {0xffff6800ul, 22, 160}, // 11111111|11111111|011010 232 {0xfffee800ul, 21, 161}, // 11111111|11111110|11101 233 {0xfffe9000ul, 20, 162}, // 11111111|11111110|1001 234 {0xffff6c00ul, 22, 163}, // 11111111|11111111|011011 235 {0xffff7000ul, 22, 164}, // 11111111|11111111|011100 236 {0xffffd000ul, 23, 165}, // 11111111|11111111|1101000 237 {0xffffd200ul, 23, 166}, // 11111111|11111111|1101001 238 {0xfffef000ul, 21, 167}, // 11111111|11111110|11110 239 {0xffffd400ul, 23, 168}, // 11111111|11111111|1101010 240 {0xffff7400ul, 22, 169}, // 11111111|11111111|011101 241 {0xffff7800ul, 22, 170}, // 11111111|11111111|011110 242 {0xfffff000ul, 24, 171}, // 11111111|11111111|11110000 243 {0xfffef800ul, 21, 172}, // 11111111|11111110|11111 244 {0xffff7c00ul, 22, 173}, // 11111111|11111111|011111 245 {0xffffd600ul, 23, 174}, // 11111111|11111111|1101011 246 {0xffffd800ul, 23, 175}, // 11111111|11111111|1101100 247 {0xffff0000ul, 21, 176}, // 11111111|11111111|00000 248 {0xffff0800ul, 21, 177}, // 11111111|11111111|00001 249 {0xffff8000ul, 22, 178}, // 11111111|11111111|100000 250 {0xffff1000ul, 21, 179}, // 11111111|11111111|00010 251 {0xffffda00ul, 23, 180}, // 11111111|11111111|1101101 252 {0xffff8400ul, 22, 181}, // 11111111|11111111|100001 253 {0xffffdc00ul, 23, 182}, // 11111111|11111111|1101110 254 {0xffffde00ul, 23, 183}, // 11111111|11111111|1101111 255 {0xfffea000ul, 20, 184}, // 11111111|11111110|1010 256 {0xffff8800ul, 22, 185}, // 11111111|11111111|100010 257 {0xffff8c00ul, 22, 186}, // 11111111|11111111|100011 258 {0xffff9000ul, 22, 187}, // 11111111|11111111|100100 259 {0xffffe000ul, 23, 188}, // 11111111|11111111|1110000 260 {0xffff9400ul, 22, 189}, // 11111111|11111111|100101 261 {0xffff9800ul, 22, 190}, // 11111111|11111111|100110 262 {0xffffe200ul, 23, 191}, // 11111111|11111111|1110001 263 {0xfffff800ul, 26, 192}, // 11111111|11111111|11111000|00 264 {0xfffff840ul, 26, 193}, // 11111111|11111111|11111000|01 265 {0xfffeb000ul, 20, 194}, // 11111111|11111110|1011 266 {0xfffe2000ul, 19, 195}, // 11111111|11111110|001 267 {0xffff9c00ul, 22, 196}, // 11111111|11111111|100111 268 {0xffffe400ul, 23, 197}, // 11111111|11111111|1110010 269 {0xffffa000ul, 22, 198}, // 11111111|11111111|101000 270 {0xfffff600ul, 25, 199}, // 11111111|11111111|11110110|0 271 {0xfffff880ul, 26, 200}, // 11111111|11111111|11111000|10 272 {0xfffff8c0ul, 26, 201}, // 11111111|11111111|11111000|11 273 {0xfffff900ul, 26, 202}, // 11111111|11111111|11111001|00 274 {0xfffffbc0ul, 27, 203}, // 11111111|11111111|11111011|110 275 {0xfffffbe0ul, 27, 204}, // 11111111|11111111|11111011|111 276 {0xfffff940ul, 26, 205}, // 11111111|11111111|11111001|01 277 {0xfffff100ul, 24, 206}, // 11111111|11111111|11110001 278 {0xfffff680ul, 25, 207}, // 11111111|11111111|11110110|1 279 {0xfffe4000ul, 19, 208}, // 11111111|11111110|010 280 {0xffff1800ul, 21, 209}, // 11111111|11111111|00011 281 {0xfffff980ul, 26, 210}, // 11111111|11111111|11111001|10 282 {0xfffffc00ul, 27, 211}, // 11111111|11111111|11111100|000 283 {0xfffffc20ul, 27, 212}, // 11111111|11111111|11111100|001 284 {0xfffff9c0ul, 26, 213}, // 11111111|11111111|11111001|11 285 {0xfffffc40ul, 27, 214}, // 11111111|11111111|11111100|010 286 {0xfffff200ul, 24, 215}, // 11111111|11111111|11110010 287 {0xffff2000ul, 21, 216}, // 11111111|11111111|00100 288 {0xffff2800ul, 21, 217}, // 11111111|11111111|00101 289 {0xfffffa00ul, 26, 218}, // 11111111|11111111|11111010|00 290 {0xfffffa40ul, 26, 219}, // 11111111|11111111|11111010|01 291 {0xffffffd0ul, 28, 220}, // 11111111|11111111|11111111|1101 292 {0xfffffc60ul, 27, 221}, // 11111111|11111111|11111100|011 293 {0xfffffc80ul, 27, 222}, // 11111111|11111111|11111100|100 294 {0xfffffca0ul, 27, 223}, // 11111111|11111111|11111100|101 295 {0xfffec000ul, 20, 224}, // 11111111|11111110|1100 296 {0xfffff300ul, 24, 225}, // 11111111|11111111|11110011 297 {0xfffed000ul, 20, 226}, // 11111111|11111110|1101 298 {0xffff3000ul, 21, 227}, // 11111111|11111111|00110 299 {0xffffa400ul, 22, 228}, // 11111111|11111111|101001 300 {0xffff3800ul, 21, 229}, // 11111111|11111111|00111 301 {0xffff4000ul, 21, 230}, // 11111111|11111111|01000 302 {0xffffe600ul, 23, 231}, // 11111111|11111111|1110011 303 {0xffffa800ul, 22, 232}, // 11111111|11111111|101010 304 {0xffffac00ul, 22, 233}, // 11111111|11111111|101011 305 {0xfffff700ul, 25, 234}, // 11111111|11111111|11110111|0 306 {0xfffff780ul, 25, 235}, // 11111111|11111111|11110111|1 307 {0xfffff400ul, 24, 236}, // 11111111|11111111|11110100 308 {0xfffff500ul, 24, 237}, // 11111111|11111111|11110101 309 {0xfffffa80ul, 26, 238}, // 11111111|11111111|11111010|10 310 {0xffffe800ul, 23, 239}, // 11111111|11111111|1110100 311 {0xfffffac0ul, 26, 240}, // 11111111|11111111|11111010|11 312 {0xfffffcc0ul, 27, 241}, // 11111111|11111111|11111100|110 313 {0xfffffb00ul, 26, 242}, // 11111111|11111111|11111011|00 314 {0xfffffb40ul, 26, 243}, // 11111111|11111111|11111011|01 315 {0xfffffce0ul, 27, 244}, // 11111111|11111111|11111100|111 316 {0xfffffd00ul, 27, 245}, // 11111111|11111111|11111101|000 317 {0xfffffd20ul, 27, 246}, // 11111111|11111111|11111101|001 318 {0xfffffd40ul, 27, 247}, // 11111111|11111111|11111101|010 319 {0xfffffd60ul, 27, 248}, // 11111111|11111111|11111101|011 320 {0xffffffe0ul, 28, 249}, // 11111111|11111111|11111111|1110 321 {0xfffffd80ul, 27, 250}, // 11111111|11111111|11111101|100 322 {0xfffffda0ul, 27, 251}, // 11111111|11111111|11111101|101 323 {0xfffffdc0ul, 27, 252}, // 11111111|11111111|11111101|110 324 {0xfffffde0ul, 27, 253}, // 11111111|11111111|11111101|111 325 {0xfffffe00ul, 27, 254}, // 11111111|11111111|11111110|000 326 {0xfffffb80ul, 26, 255}, // 11111111|11111111|11111011|10 327 {0xfffffffcul, 30, 256}, // EOS 11111111|11111111|11111111|111111 328 }; 329 return std::vector<HpackHuffmanSymbol>( 330 kHpackHuffmanCode, 331 kHpackHuffmanCode + arraysize(kHpackHuffmanCode)); 332 } 333 334 // The "constructor" for a HpackStaticEntry that computes the lengths at 335 // compile time. 336 #define STATIC_ENTRY(name, value) \ 337 { name, arraysize(name) - 1, value, arraysize(value) - 1 } 338 339 std::vector<HpackStaticEntry> HpackStaticTableVector() { 340 static const HpackStaticEntry kHpackStaticTable[] = { 341 STATIC_ENTRY(":authority", ""), // 1 342 STATIC_ENTRY(":method", "GET"), // 2 343 STATIC_ENTRY(":method", "POST"), // 3 344 STATIC_ENTRY(":path", "/"), // 4 345 STATIC_ENTRY(":path", "/index.html"), // 5 346 STATIC_ENTRY(":scheme", "http"), // 6 347 STATIC_ENTRY(":scheme", "https"), // 7 348 STATIC_ENTRY(":status", "200"), // 8 349 STATIC_ENTRY(":status", "204"), // 9 350 STATIC_ENTRY(":status", "206"), // 10 351 STATIC_ENTRY(":status", "304"), // 11 352 STATIC_ENTRY(":status", "400"), // 12 353 STATIC_ENTRY(":status", "404"), // 13 354 STATIC_ENTRY(":status", "500"), // 14 355 STATIC_ENTRY("accept-charset", ""), // 15 356 STATIC_ENTRY("accept-encoding", "gzip, deflate"), // 16 357 STATIC_ENTRY("accept-language", ""), // 17 358 STATIC_ENTRY("accept-ranges", ""), // 18 359 STATIC_ENTRY("accept", ""), // 19 360 STATIC_ENTRY("access-control-allow-origin", ""), // 20 361 STATIC_ENTRY("age", ""), // 21 362 STATIC_ENTRY("allow", ""), // 22 363 STATIC_ENTRY("authorization", ""), // 23 364 STATIC_ENTRY("cache-control", ""), // 24 365 STATIC_ENTRY("content-disposition", ""), // 25 366 STATIC_ENTRY("content-encoding", ""), // 26 367 STATIC_ENTRY("content-language", ""), // 27 368 STATIC_ENTRY("content-length", ""), // 28 369 STATIC_ENTRY("content-location", ""), // 29 370 STATIC_ENTRY("content-range", ""), // 30 371 STATIC_ENTRY("content-type", ""), // 31 372 STATIC_ENTRY("cookie", ""), // 32 373 STATIC_ENTRY("date", ""), // 33 374 STATIC_ENTRY("etag", ""), // 34 375 STATIC_ENTRY("expect", ""), // 35 376 STATIC_ENTRY("expires", ""), // 36 377 STATIC_ENTRY("from", ""), // 37 378 STATIC_ENTRY("host", ""), // 38 379 STATIC_ENTRY("if-match", ""), // 39 380 STATIC_ENTRY("if-modified-since", ""), // 40 381 STATIC_ENTRY("if-none-match", ""), // 41 382 STATIC_ENTRY("if-range", ""), // 42 383 STATIC_ENTRY("if-unmodified-since", ""), // 43 384 STATIC_ENTRY("last-modified", ""), // 44 385 STATIC_ENTRY("link", ""), // 45 386 STATIC_ENTRY("location", ""), // 46 387 STATIC_ENTRY("max-forwards", ""), // 47 388 STATIC_ENTRY("proxy-authenticate", ""), // 48 389 STATIC_ENTRY("proxy-authorization", ""), // 49 390 STATIC_ENTRY("range", ""), // 50 391 STATIC_ENTRY("referer", ""), // 51 392 STATIC_ENTRY("refresh", ""), // 52 393 STATIC_ENTRY("retry-after", ""), // 53 394 STATIC_ENTRY("server", ""), // 54 395 STATIC_ENTRY("set-cookie", ""), // 55 396 STATIC_ENTRY("strict-transport-security", ""), // 56 397 STATIC_ENTRY("transfer-encoding", ""), // 57 398 STATIC_ENTRY("user-agent", ""), // 58 399 STATIC_ENTRY("vary", ""), // 59 400 STATIC_ENTRY("via", ""), // 60 401 STATIC_ENTRY("www-authenticate", ""), // 61 402 }; 403 return std::vector<HpackStaticEntry>( 404 kHpackStaticTable, 405 kHpackStaticTable + arraysize(kHpackStaticTable)); 406 } 407 408 #undef STATIC_ENTRY 409 410 const HpackHuffmanTable& ObtainHpackHuffmanTable() { 411 return *SharedHpackHuffmanTable::GetInstance()->table; 412 } 413 414 const HpackStaticTable& ObtainHpackStaticTable() { 415 return *SharedHpackStaticTable::GetInstance()->table; 416 } 417 418 } // namespace net 419