<commit_before>var http = require('http')
var fs = require('fs')
var path = require('path')

var parseForm = function (data) {
    var reg = /-----------------------------.{12}(\r\n|\r|\n)Content-Disposition: form-data; name="/
    var sections = data.split(reg)
    var result = {}
    for (sec in sections) {
        var values = sections[sec].split(/\b"(\r\n|\r|\n)(\r\n|\r|\n)/)
        if (/certificate"; filename/.test(values[0])) {
            var key = values[0].replace(/"; filename=".*/i, '')
            var value = values[3].replace(/Content-Type: application\/x-pkcs12(\r\n|\n|\r)+/i, '').replace(/-----------------------------.{12}--(\r\n|\r|\n)/, '')
            result[key] = new Buffer(value).toString('base64')
        } else if (values[3]) {
            var key = values[0]
            var value = values[3].replace(/(\r\n|\r|\n)/, '')
            result[key] = value
        }
    }
    return result
}

var server = http.createServer(function (req, res) {
    console.log(req.method)
    if (req.method == 'GET') {
        res.writeHead(200, { "content-type": "text/html" })
        res.end(fs.readFileSync(path.join(__dirname, 'install.html')))
    } else if (req.method == 'POST') {
        var body = ''
        req.on('data', function (data) {
            body += data
        })
        req.on('end', function (data) {
            if (data) {
                body += data
            }
            var parameter = parseForm(body)
            var startbat = ''
            
            for (var p in parameter) {
                if (p == 'certificate') {
                    fs.writeFile(path.join(__dirname, 'server.p12'), parameter[p], function (err) {<commit_msg>the start.bat is wirtten properly<commit_after>var http = require('http')
var fs = require('fs')
var path = require('path')

var parseForm = function (data) {
    var reg = /-----------------------------.+(\r\n|\r|\n)Content-Disposition: form-data; name="/
    var sections = data.split(reg)
    var result = {}
    for (sec in sections) {
        var values = sections[sec].split(/\b"(\r\n|\r|\n)(\r\n|\r|\n)/)
        if (/certificate"; filename/.test(values[0])) {
            var key = values[0].replace(/"; filename=".*/i, '')
            var value = values[3].replace(/Content-Type: application\/x-pkcs12(\r\n|\n|\r)+/i, '').replace(/-----------------------------.+--(\r\n|\r|\n)/, '')
            result[key] = new Buffer(value, 'ascii').toString()
        } else if (values[3]) {
            var key = values[0]
            var value = values[3].replace(/(\r\n|\r|\n)/, '')
            result[key] = value
        }
    }
    return result
}

var server = http.createServer(function (req, res) {
    console.log(req.method)
    if (req.method == 'GET') {
        res.writeHead(200, { "content-type": "text/html" })
        res.end(fs.readFileSync(path.join(__dirname, 'install.html')))
    } else if (req.method == 'POST') {
        req.setEncoding('base64')
        var body = ''
        req.on('data', function (data) {
            body += data
        })
        req.on('end', function (data) {
            if (data) {
                body += data
            }
            var parameter = parseForm(new Buffer(body, 'base64').toString('ascii'))
            var startbat = ''
            
            for (var p in parameter) {
                if (p == 'certificate') {
                    fs.writeFile(path.join(__dirname, 'server.p12'), parameter[p], function (err) {
{'fraction_non_alphanumeric': 0.21751656583117257, 'fraction_numerical': 0.010371650821089023, 'mean_word_length': 1.7643312101910829, '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': '6359979', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1062, 'n_words': 224}