<commit_before>//Initialize the Express library, used to create a web server
var express = require("express");
var https = require("https");
var app = express();

// API endpoint to send email from the form

var mailgun = require('mailgun-js')( { apiKey: process.env.MAILGUN_API_KEY, domain: process.env.MAILGUN_DOMAIN } );
var bodyParser = require( 'body-parser' );
app.use( bodyParser.json() ); // for parsing application/json
app.use( bodyParser.urlencoded( { extended: true } )) ; // for parsing application/x-www-form-urlencoded

/* At the top, with other redirect methods before other routes */
app.all('*',function(req,res,next){
  console.log(req.headers.host);
  if( process.env.PRODUCTION == 'TRUE' && req.headers['x-forwarded-proto'] != 'https')
    res.redirect( 'https://' + req.headers.host + req.url )
  else
    next() /* Continue to other routes if we're not redirecting */
})

app.post('/mail', function(req,res) {
  req.body.to = process.env.EMAIL;
  mailgun.messages().send(req.body, function (error, body) {
    console.log( "Response from mailgun: " + body.toString() );
    console.log( "Error from mailgun: " + error.toString() );
    if ( !error && body.message == 'Queued. Thank you.' ) {
      res.sendStatus(200);
    } else {
      res.sendStatus(400);
    }
  });
});

//Tell the server to serve the contents of the client folder
app.use( express.static('client') );

//Turn on the web server listening on a specific port
app.listen( process.env.PORT );
<commit_msg>Back out all https related changes<commit_after>//Initialize the Express library, used to create a web server
var express = require("express");
var https = require("https");
var app = express();

// API endpoint to send email from the form

var mailgun = require('mailgun-js')( { apiKey: process.env.MAILGUN_API_KEY, domain: process.env.MAILGUN_DOMAIN } );
var bodyParser = require( 'body-parser' );
app.use( bodyParser.json() ); // for parsing application/json
app.use( bodyParser.urlencoded( { extended: true } )) ; // for parsing application/x-www-form-urlencoded

/* At the top, with other redirect methods before other routes */
/*
app.all('*',function(req,res,next){
  console.log(req.headers.host);
  if( process.env.PRODUCTION == 'TRUE' && req.headers['x-forwarded-proto'] != 'https')
    res.redirect( 'https://' + req.headers.host + req.url )
  else
    next() /* Continue to other routes if we're not redirecting */
})
*/

app.post('/mail', function(req,res) {
  req.body.to = process.env.EMAIL;
  mailgun.messages().send(req.body, function (error, body) {
    console.log( "Response from mailgun: " + body.toString() );
    console.log( "Error from mailgun: " + error.toString() );
    if ( !error && body.message == 'Queued. Thank you.' ) {
      res.sendStatus(200);
    } else {
      res.sendStatus(400);
    }
  });
});

//Tell the server to serve the contents of the client folder
app.use( express.static('client') );

//Turn on the web server listening on a specific port
app.listen( process.env.PORT );

{'fraction_non_alphanumeric': 0.15899304405432263, 'fraction_numerical': 0.003974826101358066, 'mean_word_length': 3.8089171974522293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '160887', 'n_tokens_mistral': 952, 'n_tokens_neox': 939, 'n_words': 271}