<commit_before>var http = require('http');
var fs = require('fs');
var path = require('path');
var qs = require('querystring');
var url = require('url');

var st = require('./st');
var curb = require('./curb');

var stAuthCode;

var server = http.createServer(function (request, response)
{

    if(request.method == "GET")
    {
        console.log("Get: " + request.url);
        
        var parsedRequest = url.parse(request.url,true);
        
        if(parsedRequest.pathname == "/authSuccess.html")
        {
            stAuthCode = parsedRequest.query.code;
            console.log("Got ST Auth Code: " + stAuthCode);
        }
        
        var filePath = '.' + parsedRequest.pathname;
        if (filePath == './') filePath = './index.html';

        var extname = path.extname(filePath);
        var contentType = 'text/html';
        switch (extname)
        {
            case '.js':
                contentType = 'text/javascript';
                break;
            case '.css':
                contentType = 'text/css';
                break;
            case '.json':
                contentType = 'application/json';
                break;
            case '.png':
                contentType = 'image/png';
                break;      
            case '.jpg':
                contentType = 'image/jpg';
                break;
            case '.wav':
                contentType = 'audio/wav';
                break;
        }

        fs.readFile(filePath, function(error, content)
        {
            if(error)
            {
                response.writeHead(501);
                response.end('Something went wrong: '+error.code+' ..\n');
                response.end(); 
            }
            else
            {
                response.writeHead(200, { 'Content-Type': contentType });
                response.end(content, 'utf-8');
            }
        });
            
    }
    else if(request.method == "POST")
    {
        console.log("Post");
        
        var body = '';
        
        request.on('data', function (data)
        {
            body += data;
        });
        
        request.on('end', function ()
        {
            //console.log("Body: " + body);
            
            var userInfo = qs.parse(body);
            
            console.log("Client ID: " + userInfo.client_id);
            console.log("Client Secret: " + userInfo.client_secret);
            console.log("Username: "+ userInfo.username);
            console.log("Password: " + userInfo.password);
            
            var onConnect = function()
            {
                console.log("Curb onConnect");
                curb.connect(userInfo.username, userInfo.password, st);
            }
            
            st.connect(stAuthCode, userInfo.client_id, userInfo.client_secret, onConnect);
            
        });
        
        response.writeHead(200, {"Content-Type": "text/plain"});
        response.write("Got it");
        response.end();
    }
    
});

server.listen(8000);<commit_msg>Remove console logging of credentials<commit_after>var http = require('http');
var fs = require('fs');
var path = require('path');
var qs = require('querystring');
var url = require('url');

var st = require('./st');
var curb = require('./curb');

var stAuthCode;

var server = http.createServer(function (request, response)
{

    if(request.method == "GET")
    {
        console.log("Get: " + request.url);
        
        var parsedRequest = url.parse(request.url,true);
        
        if(parsedRequest.pathname == "/authSuccess.html")
        {
            stAuthCode = parsedRequest.query.code;
            console.log("Got ST Auth Code: " + stAuthCode);
        }
        
        var filePath = '.' + parsedRequest.pathname;
        if (filePath == './') filePath = './index.html';

        var extname = path.extname(filePath);
        var contentType = 'text/html';
        switch (extname)
        {
            case '.js':
                contentType = 'text/javascript';
                break;
            case '.css':
                contentType = 'text/css';
                break;
            case '.json':
                contentType = 'application/json';
                break;
            case '.png':
                contentType = 'image/png';
                break;      
            case '.jpg':
                contentType = 'image/jpg';
                break;
            case '.wav':
                contentType = 'audio/wav';
                break;
        }

        fs.readFile(filePath, function(error, content)
        {
            if(error)
            {
                response.writeHead(501);
                response.end('Something went wrong: '+error.code+' ..\n');
                response.end(); 
            }
            else
            {
                response.writeHead(200, { 'Content-Type': contentType });
                response.end(content, 'utf-8');
            }
        });
            
    }
    else if(request.method == "POST")
    {
        console.log("Post");
        
        var body = '';
        
        request.on('data', function (data)
        {
            body += data;
        });
        
        request.on('end', function ()
        {
            //console.log("Body: " + body);
            
            var userInfo = qs.parse(body);
            
            //console.log("Client ID: " + userInfo.client_id);
            //console.log("Client Secret: " + userInfo.client_secret);
            //console.log("Username: "+ userInfo.username);
            //console.log("Password: " + <PASSWORD>);
            
            var onConnect = function()
            {
                console.log("Curb onConnect");
                curb.connect(userInfo.username, userInfo.password, st);
            }
            
            st.connect(stAuthCode, userInfo.client_id, userInfo.client_secret, onConnect);
            
        });
        
        response.writeHead(200, {"Content-Type": "text/plain"});
        response.write("Got it");
        response.end();
    }
    
});

server.listen(8000);
{'fraction_non_alphanumeric': 0.13654946852003272, 'fraction_numerical': 0.004578904333605887, 'mean_word_length': 1.348694316436252, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, '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': '2725345', 'n_tokens_mistral': 1681, 'n_tokens_neox': 1608, 'n_words': 309}