<commit_before>var express = require('express');
var app = express();

app.set('port', (process.env.PORT || 5000));

app.get("/api/whoami", function(req, res) {

    console.log('User-Agent: ' + req.headers);

    for(var propertyName in req.headers) {
        console.log(propertyName + ": " + req.headers[propertyName]);
    }

    console.log("USER AGENT");
    for(var propertyName in req.headers["User-Agent"]) {
        console.log(propertyName + ": " + req.headers["User-Agent"][propertyName]);
    }    

    /* ip */
    var ip = req.headers['x-forwarded-for'] || 
     req.connection.remoteAddress || 
     req.socket.remoteAddress ||
     req.connection.socket.remoteAddress;

     /*language*/
     var UALanguage = req.headers["accept-language"].substr(0,req.headers["accept-language"].indexOf(","));

     var os = req.headers["user-agent"].slice(req.headers["user-agent"].indexOf("(")+1,req.headers["user-agent"].indexOf(")"));

    res.writeHead(200, { 'Content-Type': 'application/json' });
    res.end(JSON.stringify({ipaddress:ip,language:UALanguage,software:os}));
});

app.get(/.*/, function(req, res) {
  res.redirect(301,'/api/whoami');
});
<commit_msg>Final tests passed.<commit_after>var express = require('express');
var app = express();

app.set('port', (process.env.PORT || 5000));

app.get("/api/whoami", function(req, res) {

    /* ip */
    var ip = req.headers['x-forwarded-for'] || 
     req.connection.remoteAddress || 
     req.socket.remoteAddress ||
     req.connection.socket.remoteAddress;

     /*language*/
     var UALanguage = req.headers["accept-language"].substr(0,req.headers["accept-language"].indexOf(","));

     var os = req.headers["user-agent"].slice(req.headers["user-agent"].indexOf("(")+1,req.headers["user-agent"].indexOf(")"));

    res.writeHead(200, { 'Content-Type': 'application/json' });
    res.end(JSON.stringify({ipaddress:ip,language:UALanguage,software:os}));
});

app.get(/.*/, function(req, res) {
  res.redirect(301,'/api/whoami');
});

{'fraction_non_alphanumeric': 0.21175884404583956, 'fraction_numerical': 0.01195814648729447, 'mean_word_length': 3.9826302729528535, 'pattern_counts': {'":': 2, '<': 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': '3411753', 'n_tokens_mistral': 670, 'n_tokens_neox': 636, 'n_words': 86}