<commit_before>/*!
 * Ext JS Connect
 * Copyright(c) 2010 Ext JS, Inc.
 * MIT Licensed
 */

/**
 * Accepts a custom log stream, defaults to stdout.
 */
exports.setup = function(env){
    this.stream = this.stream || process.stdout;
};

/**
 * Log requests in common log format.
 */
exports.handle = function handle(err, req, res, next) {
    var stream = this.stream,
        statusCode,
        resHeaders,
        writeHead = res.writeHead,
        end = res.end;

    // Proxy for statusCode.
    res.writeHead = function(code, headers){
        res.writeHead = writeHead;
        res.writeHead(code, headers);
        
        statusCode = code;
        resHeaders = headers;
    };

    // Proxy end to output a line to the provided logger.
    res.end = function (chunk, encoding) {
        res.end = end;
        res.end(chunk, encoding);
        
        stream.write((req.socket && req.socket.remoteAddress)
         + ' - - [' + (new Date).toUTCString() + ']'
         + ' "' + req.method + ' ' + req.url
         + ' HTTP/' + req.httpVersionMajor + '.' + req.httpVersionMinor + '" '
         + statusCode + ' ' + (resHeaders['Content-Length'] || '-')
         + ' "' + (req.headers['referer'] || req.headers['referrer'] || '')
         + '" "' + (req.headers['user-agent'] || '') + '"\n', 'ascii');
    };

    // Fall through to the next layer.
    next();
};<commit_msg>Log the original url, not the modified one.<commit_after>/*!
 * Ext JS Connect
 * Copyright(c) 2010 Ext JS, Inc.
 * MIT Licensed
 */

/**
 * Accepts a custom log stream, defaults to stdout.
 */
exports.setup = function(env){
    this.stream = this.stream || process.stdout;
};

/**
 * Log requests in common log format.
 */
exports.handle = function handle(err, req, res, next) {
    var stream = this.stream,
        statusCode,
        resHeaders,
        writeHead = res.writeHead,
        end = res.end,
        url = req.url;

    // Proxy for statusCode.
    res.writeHead = function(code, headers){
        res.writeHead = writeHead;
        res.writeHead(code, headers);
        
        statusCode = code;
        resHeaders = headers;
    };

    // Proxy end to output a line to the provided logger.
    res.end = function (chunk, encoding) {
        res.end = end;
        res.end(chunk, encoding);
        
        stream.write((req.socket && req.socket.remoteAddress)
         + ' - - [' + (new Date).toUTCString() + ']'
         + ' "' + req.method + ' ' + url
         + ' HTTP/' + req.httpVersionMajor + '.' + req.httpVersionMinor + '" '
         + statusCode + ' ' + (resHeaders['Content-Length'] || '-')
         + ' "' + (req.headers['referer'] || req.headers['referrer'] || '')
         + '" "' + (req.headers['user-agent'] || '') + '"\n', 'ascii');
    };

    // Fall through to the next layer.
    next();
};
{'fraction_non_alphanumeric': 0.1669626998223801, 'fraction_numerical': 0.002841918294849023, 'mean_word_length': 2.108167770419426, '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': '1974039', 'n_tokens_mistral': 873, 'n_tokens_neox': 856, 'n_words': 209}