Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | var utils = require('./utils');
|
---|
| 2 |
|
---|
| 3 | var table = `
|
---|
| 4 | 1 :authority
|
---|
| 5 | 2 :method GET
|
---|
| 6 | 3 :method POST
|
---|
| 7 | 4 :path /
|
---|
| 8 | 5 :path /index.html
|
---|
| 9 | 6 :scheme http
|
---|
| 10 | 7 :scheme https
|
---|
| 11 | 8 :status 200
|
---|
| 12 | 9 :status 204
|
---|
| 13 | 10 :status 206
|
---|
| 14 | 11 :status 304
|
---|
| 15 | 12 :status 400
|
---|
| 16 | 13 :status 404
|
---|
| 17 | 14 :status 500
|
---|
| 18 | 15 accept-charset
|
---|
| 19 | 16 accept-encoding gzip, deflate
|
---|
| 20 | 17 accept-language
|
---|
| 21 | 18 accept-ranges
|
---|
| 22 | 19 accept
|
---|
| 23 | 20 access-control-allow-origin
|
---|
| 24 | 21 age
|
---|
| 25 | 22 allow
|
---|
| 26 | 23 authorization
|
---|
| 27 | 24 cache-control
|
---|
| 28 | 25 content-disposition
|
---|
| 29 | 26 content-encoding
|
---|
| 30 | 27 content-language
|
---|
| 31 | 28 content-length
|
---|
| 32 | 29 content-location
|
---|
| 33 | 30 content-range
|
---|
| 34 | 31 content-type
|
---|
| 35 | 32 cookie
|
---|
| 36 | 33 date
|
---|
| 37 | 34 etag
|
---|
| 38 | 35 expect
|
---|
| 39 | 36 expires
|
---|
| 40 | 37 from
|
---|
| 41 | 38 host
|
---|
| 42 | 39 if-match
|
---|
| 43 | 40 if-modified-since
|
---|
| 44 | 41 if-none-match
|
---|
| 45 | 42 if-range
|
---|
| 46 | 43 if-unmodified-since
|
---|
| 47 | 44 last-modified
|
---|
| 48 | 45 link
|
---|
| 49 | 46 location
|
---|
| 50 | 47 max-forwards
|
---|
| 51 | 48 proxy-authenticate
|
---|
| 52 | 49 proxy-authorization
|
---|
| 53 | 50 range
|
---|
| 54 | 51 referer
|
---|
| 55 | 52 refresh
|
---|
| 56 | 53 retry-after
|
---|
| 57 | 54 server
|
---|
| 58 | 55 set-cookie
|
---|
| 59 | 56 strict-transport-security
|
---|
| 60 | 57 transfer-encoding
|
---|
| 61 | 58 user-agent
|
---|
| 62 | 59 vary
|
---|
| 63 | 60 via
|
---|
| 64 | 61 www-authenticate
|
---|
| 65 | `;
|
---|
| 66 |
|
---|
| 67 | var out = [];
|
---|
| 68 | table.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 |
|
---|
| 84 | console.log('exports.table = ' + JSON.stringify(out, false, 2) + ';');
|
---|
| 85 |
|
---|
| 86 | var map = {};
|
---|
| 87 | table.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 | });
|
---|
| 103 | console.log('exports.map = ' + JSON.stringify(map, false, 2) + ';');
|
---|
Note:
See
TracBrowser
for help on using the repository browser.