<commit_before>// @see https://devcenter.heroku.com/articles/nodejs#write-your-app

var express = require('express')
  , fs      = require('fs') // node
  , gm      = require('gm')
  , http    = require('http') // node
  , https   = require('https') // node
  , mime    = require('mime')
  , url     = require('url') // node
  // @see http://aaronheckmann.posterous.com/graphicsmagick-on-heroku-with-nodejs
  , app = express()
  , imageMagick = gm.subClass({imageMagick: true})
  , whitelist = process.env.WHITELIST || [] // [/\.gov$/, /google\.com$/]
  , delay = parseInt(process.env.DELAY) || 5000
  , mimeTypes = [
    'image/gif',
    'image/jpeg',
    'image/png',
    // Common typos
    'image/jpg',
  ];

module.exports = function () {

  app.get('/:url/:width/:height.:extension?', function (req, res, next) {
    var width = req.params.width
      , height = req.params.height
      , extension = req.params.extension
      , retrieve = function (remote) {
        // @see http://nodejs.org/api/url.html#url_url
        var options = url.parse(remote);
        // @see https://github.com/substack/hyperquest
        options.agent = false;
        if (options.protocol !== 'http:' && options.protocol !== 'https:') {
          return res.status(404).send('Expected URI scheme to be HTTP or HTTPS');
        }
        if (!options.hostname) {
          return res.status(404).send('Expected URI host to be non-empty');
        }
        options.headers = {'User-Agent': 'image-proxy/0.0.6', 'Accept': 'image/*'};

        var agent = options.protocol === 'http:' ? http : https
          , timeout = false
          // @see http://nodejs.org/api/http.html#http_http_get_options_callback
          , request = agent.get(options, function (response) {
            if (timeout) {
              // Status code 504 already sent.
              return;
            }
<commit_msg>use Accept: */* instead of image/*<commit_after>// @see https://devcenter.heroku.com/articles/nodejs#write-your-app

var express = require('express')
  , fs      = require('fs') // node
  , gm      = require('gm')
  , http    = require('http') // node
  , https   = require('https') // node
  , mime    = require('mime')
  , url     = require('url') // node
  // @see http://aaronheckmann.posterous.com/graphicsmagick-on-heroku-with-nodejs
  , app = express()
  , imageMagick = gm.subClass({imageMagick: true})
  , whitelist = process.env.WHITELIST || [] // [/\.gov$/, /google\.com$/]
  , delay = parseInt(process.env.DELAY) || 5000
  , mimeTypes = [
    'image/gif',
    'image/jpeg',
    'image/png',
    // Common typos
    'image/jpg',
  ];

module.exports = function () {

  app.get('/:url/:width/:height.:extension?', function (req, res, next) {
    var width = req.params.width
      , height = req.params.height
      , extension = req.params.extension
      , retrieve = function (remote) {
        // @see http://nodejs.org/api/url.html#url_url
        var options = url.parse(remote);
        // @see https://github.com/substack/hyperquest
        options.agent = false;
        if (options.protocol !== 'http:' && options.protocol !== 'https:') {
          return res.status(404).send('Expected URI scheme to be HTTP or HTTPS');
        }
        if (!options.hostname) {
          return res.status(404).send('Expected URI host to be non-empty');
        }
        options.headers = {'User-Agent': 'image-proxy/0.0.6', 'Accept': '*/*'};

        var agent = options.protocol === 'http:' ? http : https
          , timeout = false
          // @see http://nodejs.org/api/http.html#http_http_get_options_callback
          , request = agent.get(options, function (response) {
            if (timeout) {
              // Status code 504 already sent.
              return;
            }

{'fraction_non_alphanumeric': 0.17077045274027006, 'fraction_numerical': 0.008472332539052158, 'mean_word_length': 2.2568965517241377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '66952', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1181, 'n_words': 241}