Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

messed around with SSL. not working yet.

  • Loading branch information...
commit bbee5e41beed976e30749aabf795aebac0ceab06 1 parent 3e89b84
@Brucer Brucer authored
Showing with 17 additions and 2 deletions.
  1. +1 −0  .gitignore
  2. +12 −1 bin/jsgamebench
  3. +4 −1 lib/server.js
View
1  .gitignore
@@ -1,3 +1,4 @@
+cert/*
*.log
*.swp
a.out
View
13 bin/jsgamebench
@@ -52,4 +52,15 @@ for(var i=0;i<process.argv.length;i++) {
sys.puts("reading log file");
LogProc.start('logs/stats.log',null);
-Server.init(Server.serverCallback,production_mode ? 80 : 8081);
+if (production_mode) {
+ if (0) { // one glorious day nodejs will stop rewriting ssl
+ var privateKey = '' + fs.readFileSync('cert/privatekey.pem');
+ var certificate = '' + fs.readFileSync('cert/certificate.pem');
+ var credentials = crypto.createCredentials({key: privateKey, cert: certificate});
+ Server.init(Server.serverCallback,443,credentials);
+ }
+ Server.init(Server.serverCallback,80,0);
+} else {
+ Server.init(Server.serverCallback,8081,0);
+}
+
View
5 lib/server.js
@@ -38,7 +38,7 @@ function tick() {
}
}
-function init(cb, port) {
+function init(cb, port, credentials) {
fs.readFile('app_secret', 'binary', function(err, data) {
if (err) {
console.log('no app_secret file found, so no fb app login')
@@ -52,6 +52,9 @@ function init(cb, port) {
}
});
var svr = http.createServer(cb);
+ if (credentials) {
+ svr.setSecure();
+ }
svr.listen(port);
Socket.init(svr);
setInterval(function() { tick(); }, 1000 / tick_fps);
Please sign in to comment.
Something went wrong with that request. Please try again.