| 
 | 1 | +diff --git a/node_modules/http-server/bin/http-server b/node_modules/http-server/bin/http-server  | 
 | 2 | +index 7c597fa..b397c72 100755  | 
 | 3 | +--- a/node_modules/http-server/bin/http-server  | 
 | 4 | ++++ b/node_modules/http-server/bin/http-server  | 
 | 5 | +@@ -33,6 +33,8 @@ if (argv.h || argv.help) {  | 
 | 6 | +     '               If both brotli and gzip are enabled, brotli takes precedence',  | 
 | 7 | +     '  -e --ext     Default file extension if none supplied [none]',  | 
 | 8 | +     '  -s --silent  Suppress log messages from output',  | 
 | 9 | ++    '  --coop[=mode]   Enable COOP via the "Cross-Origin-Opener-Policy" header',  | 
 | 10 | ++    '                  Optionally provide COOP mode.',  | 
 | 11 | +     '  --cors[=headers]   Enable CORS via the "Access-Control-Allow-Origin" header',  | 
 | 12 | +     '                     Optionally provide CORS headers list separated by commas',  | 
 | 13 | +     '  -o [path]    Open browser window after starting the server.',  | 
 | 14 | +@@ -98,16 +100,16 @@ if (!argv.s && !argv.silent) {  | 
 | 15 | +           : '';  | 
 | 16 | +       if (error) {  | 
 | 17 | +         logger.info(  | 
 | 18 | +-          '[%s] %s "%s %s" Error (%s): "%s"',  | 
 | 19 | +-          date, ip, chalk.red(req.method), chalk.red(req.url),  | 
 | 20 | +-          chalk.red(error.status.toString()), chalk.red(error.message)  | 
 | 21 | ++            '[%s] %s "%s %s" Error (%s): "%s"',  | 
 | 22 | ++            date, ip, chalk.red(req.method), chalk.red(req.url),  | 
 | 23 | ++            chalk.red(error.status.toString()), chalk.red(error.message)  | 
 | 24 | +         );  | 
 | 25 | +       }  | 
 | 26 | +       else {  | 
 | 27 | +         logger.info(  | 
 | 28 | +-          '[%s] %s "%s %s" "%s"',  | 
 | 29 | +-          date, ip, chalk.cyan(req.method), chalk.cyan(req.url),  | 
 | 30 | +-          req.headers['user-agent']  | 
 | 31 | ++            '[%s] %s "%s %s" "%s"',  | 
 | 32 | ++            date, ip, chalk.cyan(req.method), chalk.cyan(req.url),  | 
 | 33 | ++            req.headers['user-agent']  | 
 | 34 | +         );  | 
 | 35 | +       }  | 
 | 36 | +     }  | 
 | 37 | +@@ -156,6 +158,13 @@ function listen(port) {  | 
 | 38 | +     password: argv.password || process.env.NODE_HTTP_SERVER_PASSWORD  | 
 | 39 | +   };  | 
 | 40 | + | 
 | 41 | ++  if (argv.coop) {  | 
 | 42 | ++    options.coop = true;  | 
 | 43 | ++    if (typeof argv.coop === 'string') {  | 
 | 44 | ++      options.coopHeader = argv.coop;  | 
 | 45 | ++    }  | 
 | 46 | ++  }  | 
 | 47 | ++  | 
 | 48 | +   if (argv.cors) {  | 
 | 49 | +     options.cors = true;  | 
 | 50 | +     if (typeof argv.cors === 'string') {  | 
 | 51 | +@@ -209,6 +218,7 @@ function listen(port) {  | 
 | 52 | + | 
 | 53 | +     logger.info([  | 
 | 54 | +       chalk.yellow('\nhttp-server settings: '),  | 
 | 55 | ++      ([chalk.yellow('COOP: '), argv.coop ? chalk.cyan(argv.coop) : chalk.red('disabled')].join('')),  | 
 | 56 | +       ([chalk.yellow('CORS: '), argv.cors ? chalk.cyan(argv.cors) : chalk.red('disabled')].join('')),  | 
 | 57 | +       ([chalk.yellow('Cache: '), argv.c ? (argv.c === '-1' ? chalk.red('disabled') : chalk.cyan(argv.c + ' seconds')) : chalk.cyan('3600 seconds')].join('')),  | 
 | 58 | +       ([chalk.yellow('Connection Timeout: '), argv.t === '0' ? chalk.red('disabled') : (argv.t ? chalk.cyan(argv.t + ' seconds') : chalk.cyan('120 seconds'))].join('')),  | 
 | 59 | +diff --git a/node_modules/http-server/lib/core/aliases.json b/node_modules/http-server/lib/core/aliases.json  | 
 | 60 | +index 53a22a5..229a16d 100644  | 
 | 61 | +--- a/node_modules/http-server/lib/core/aliases.json  | 
 | 62 | ++++ b/node_modules/http-server/lib/core/aliases.json  | 
 | 63 | +@@ -6,6 +6,7 @@  | 
 | 64 | +   "hidePermissions": ["hidePermissions", "hidepermissions", "hide-permissions"],  | 
 | 65 | +   "si": [ "si", "index" ],  | 
 | 66 | +   "handleError": [ "handleError", "handleerror" ],  | 
 | 67 | ++  "coop": [ "coop", "COOP" ],  | 
 | 68 | +   "cors": [ "cors", "CORS" ],  | 
 | 69 | +   "headers": [ "H", "header", "headers" ],  | 
 | 70 | +   "contentType": [ "contentType", "contenttype", "content-type" ],  | 
 | 71 | +diff --git a/node_modules/http-server/lib/core/defaults.json b/node_modules/http-server/lib/core/defaults.json  | 
 | 72 | +index d919f29..63a1a9a 100644  | 
 | 73 | +--- a/node_modules/http-server/lib/core/defaults.json  | 
 | 74 | ++++ b/node_modules/http-server/lib/core/defaults.json  | 
 | 75 | +@@ -6,6 +6,7 @@  | 
 | 76 | +   "hidePermissions": false,  | 
 | 77 | +   "si": false,  | 
 | 78 | +   "cache": "max-age=3600",  | 
 | 79 | ++  "coop": false,  | 
 | 80 | +   "cors": false,  | 
 | 81 | +   "gzip": true,  | 
 | 82 | +   "brotli": false,  | 
 | 83 | +diff --git a/node_modules/http-server/lib/core/opts.js b/node_modules/http-server/lib/core/opts.js  | 
 | 84 | +index ec1b2cb..097ab18 100644  | 
 | 85 | +--- a/node_modules/http-server/lib/core/opts.js  | 
 | 86 | ++++ b/node_modules/http-server/lib/core/opts.js  | 
 | 87 | +@@ -117,6 +117,14 @@ module.exports = (opts) => {  | 
 | 88 | +       return false;  | 
 | 89 | +     });  | 
 | 90 | + | 
 | 91 | ++    aliases.coop.forEach((k) => {  | 
 | 92 | ++      if (isDeclared(k) && opts[k]) {  | 
 | 93 | ++        handleOptionsMethod = true;  | 
 | 94 | ++        headers['Cross-Origin-Opener-Policy'] = 'same-origin';  | 
 | 95 | ++        headers['Cross-Origin-Embedder-Policy'] = 'require-corp';  | 
 | 96 | ++      }  | 
 | 97 | ++    });  | 
 | 98 | ++  | 
 | 99 | +     aliases.cors.forEach((k) => {  | 
 | 100 | +       if (isDeclared(k) && opts[k]) {  | 
 | 101 | +         handleOptionsMethod = true;  | 
 | 102 | +diff --git a/node_modules/http-server/lib/http-server.js b/node_modules/http-server/lib/http-server.js  | 
 | 103 | +index dfe4c47..301fb0b 100644  | 
 | 104 | +--- a/node_modules/http-server/lib/http-server.js  | 
 | 105 | ++++ b/node_modules/http-server/lib/http-server.js  | 
 | 106 | +@@ -98,6 +98,11 @@ function HttpServer(options) {  | 
 | 107 | +     });  | 
 | 108 | +   }  | 
 | 109 | + | 
 | 110 | ++  if (options.coop) {  | 
 | 111 | ++    this.headers['Cross-Origin-Opener-Policy'] = options.coopHeader || 'same-origin';  | 
 | 112 | ++    this.headers['Cross-Origin-Embedder-Policy'] = 'require-corp';  | 
 | 113 | ++  }  | 
 | 114 | ++  | 
 | 115 | +   if (options.cors) {  | 
 | 116 | +     this.headers['Access-Control-Allow-Origin'] = '*';  | 
 | 117 | +     this.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Range';  | 
0 commit comments