<commit_before>/**
 * Web resolution
 * @module webr
 */
var request = require('request')
var config = require('config')

/**
 * generate statistics to sent back to the API.
 * @param {Object} res - response from the HTTP request.
 * @returns {Object} stats to be sent to the API.
 */
function genStats (res) {
  return {
    statusCode: res.statusCode,
    proxy: res.request.proxy,
    port: res.request.port,
    host: res.request.host,
    httpVersion: res.httpVersion,
    headers: res.headers
  }
}

/**
 * get a website and say if it loaded or not
 * @param {Object} opts -
 * @param {module:web-resolution~WebCallback} callback -
 * @returns {void}
 */
function get (opts, callback) {
  var local = {}

  local.method = 'GET'
  local.uri = opts.url || opts.uri
  local.timeout = opts.timeout || config.timeout
  local.strictSSL = true

  request(local, function resolution (err, res, body) {
    if (!err && res.statusCode === opts.statusCode) {
      return callback(null, true, genStats(res))
    }

    if (err) {
      return callback(err)<commit_msg>webr: fix timeout source on config<commit_after>/**
 * Web resolution
 * @module webr
 */
var request = require('request')
var config = require('config')

/**
 * generate statistics to sent back to the API.
 * @param {Object} res - response from the HTTP request.
 * @returns {Object} stats to be sent to the API.
 */
function genStats (res) {
  return {
    statusCode: res.statusCode,
    proxy: res.request.proxy,
    port: res.request.port,
    host: res.request.host,
    httpVersion: res.httpVersion,
    headers: res.headers
  }
}

/**
 * get a website and say if it loaded or not
 * @param {Object} opts -
 * @param {module:web-resolution~WebCallback} callback -
 * @returns {void}
 */
function get (opts, callback) {
  var local = {}

  local.method = 'GET'
  local.uri = opts.url || opts.uri
  local.timeout = opts.timeout || config.webr.timeout
  local.strictSSL = true

  request(local, function resolution (err, res, body) {
    if (!err && res.statusCode === opts.statusCode) {
      return callback(null, true, genStats(res))
    }

    if (err) {
      return callback(err)
{'fraction_non_alphanumeric': 0.13382899628252787, 'fraction_numerical': 0.0, 'mean_word_length': 3.180582524271845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3688881', 'n_tokens_mistral': 675, 'n_tokens_neox': 665, 'n_words': 212}