source: trip-planner-front/node_modules/hpack.js/tools/gen-static-table.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.9 KB
Line 
1var utils = require('./utils');
2
3var table = `
41 :authority
52 :method GET
63 :method POST
74 :path /
85 :path /index.html
96 :scheme http
107 :scheme https
118 :status 200
129 :status 204
1310 :status 206
1411 :status 304
1512 :status 400
1613 :status 404
1714 :status 500
1815 accept-charset
1916 accept-encoding gzip, deflate
2017 accept-language
2118 accept-ranges
2219 accept
2320 access-control-allow-origin
2421 age
2522 allow
2623 authorization
2724 cache-control
2825 content-disposition
2926 content-encoding
3027 content-language
3128 content-length
3229 content-location
3330 content-range
3431 content-type
3532 cookie
3633 date
3734 etag
3835 expect
3936 expires
4037 from
4138 host
4239 if-match
4340 if-modified-since
4441 if-none-match
4542 if-range
4643 if-unmodified-since
4744 last-modified
4845 link
4946 location
5047 max-forwards
5148 proxy-authenticate
5249 proxy-authorization
5350 range
5451 referer
5552 refresh
5653 retry-after
5754 server
5855 set-cookie
5956 strict-transport-security
6057 transfer-encoding
6158 user-agent
6259 vary
6360 via
6461 www-authenticate
65`;
66
67var out = [];
68table.split('\n').filter(function(line) {
69 return line;
70}).forEach(function(line) {
71 var columns = line.split(/\t/g);
72 var name = columns[1];
73 var value = columns[2];
74 var nameSize = Buffer.byteLength(name);
75 var valueSize = Buffer.byteLength(value);
76 out.push({
77 name: name,
78 value: value,
79 nameSize: nameSize,
80 totalSize: nameSize + valueSize + 32
81 });
82});
83
84console.log('exports.table = ' + JSON.stringify(out, false, 2) + ';');
85
86var map = {};
87table.split('\n').filter(function(line) {
88 return line;
89}).forEach(function(line) {
90 var columns = line.split(/\t/g);
91 var name = columns[1];
92 var value = columns[2];
93
94 var index = columns[0] | 0;
95 if (!map[name]) {
96 map[name] = {
97 index: index,
98 values: {}
99 };
100 }
101 map[name].values[value] = index;
102});
103console.log('exports.map = ' + JSON.stringify(map, false, 2) + ';');
Note: See TracBrowser for help on using the repository browser.