<commit_before>var http = require('http');

var basicAuth = require('basic-auth');
var nodeStatic = require('node-static');


var internals = {
  node_env: process.env.NODE_ENVIRONMENT || 'development',
  host: process.env.MOZ_GAMES_HOST || process.env.HOST || '0.0.0.0',
  port: process.env.MOZ_GAMES_PORT || process.env.PORT || 3000,
  fileServer: new nodeStatic.Server('./public', {gzip: true}),
  cacheExpiryDates: {
    fonts: 31536000  // 1 year
  }
};

var server = http.createServer(function (req, res) {
  var credentials = basicAuth(req);
  var authChunks = (process.env.AUTH_GDC || ':').split(':');
  var authValid = (credentials &&
                   credentials.name === authChunks[0] &&
                   credentials.pass === authChunks[1]);

  // Protect only the `/gdc/` directory.
  function ipInRange(ip) {
    var blocks = (ip || '').split('.').map(function (num) {
      return parseInt(num, 10);
    });
    return (blocks[0] === 63 &&
            blocks[1] === 245 &&<commit_msg>keep gzip+cache disabled for local development<commit_after>var http = require('http');

var basicAuth = require('basic-auth');
var nodeStatic = require('node-static');


var internals = {
  node_env: process.env.NODE_ENVIRONMENT || 'development',
  host: process.env.MOZ_GAMES_HOST || process.env.HOST || '0.0.0.0',
  port: process.env.MOZ_GAMES_PORT || process.env.PORT || 3000,
  nodeStaticOptions: {gzip: false, cache: false},
  cacheExpiryDates: {
    fonts: 31536000  // 1 year
  }
};


if (internals.node_env === 'production') {
  internals.nodeStaticOptions = {gzip: true, cache: true};
}

internals.fileServer = new nodeStatic.Server('./public', internals.nodeStaticOptions);


var server = http.createServer(function (req, res) {
  var credentials = basicAuth(req);
  var authChunks = (process.env.AUTH_GDC || ':').split(':');
  var authValid = (credentials &&
                   credentials.name === authChunks[0] &&
                   credentials.pass === authChunks[1]);

  // Protect only the `/gdc/` directory.
  function ipInRange(ip) {
    var blocks = (ip || '').split('.').map(function (num) {
      return parseInt(num, 10);
    });
    return (blocks[0] === 63 &&
            blocks[1] === 245 &&
{'fraction_non_alphanumeric': 0.170797656602073, 'fraction_numerical': 0.025236593059936908, 'mean_word_length': 3.361493123772102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5020029', 'n_tokens_mistral': 777, 'n_tokens_neox': 724, 'n_words': 159}