Skip to content

Instantly share code, notes, and snippets.

View harbhub's full-sized avatar

Michael Harbach harbhub

View GitHub Profile
{
"name": "harbhub",
"domain": "harbhub.com",
"subdomain": "harbhubssl",
"scripts": {
"start": "server.js"
},
"version": "0.0.0-21",
"engines": {
"node": "0.8.x"
var timestamp=(function(){return (new Date()).getTime()})();
var log=function(data){console.log('Servant : '+data+' : '+timestamp);};
//var cap=function(string){string=(string).toString();return string.charAt(0).toUpperCase()+string.slice(1);};
log('Activated');
var http = require('http')
, fs = require('fs')
, ugly = require('uglify-js')
, mime = require('mime')
, formidable = require('formidable')
var formidable = require('formidable');
//Listen for post request, then...
var form = new formidable.IncomingForm();
form.uploadDir = '/tmp';
form
.on('error', function(err) {
log('form error');
})
.on('field', function(field, value) {
log(field,value);
<form action='/post' method="post">
<label for="POST-name">Post Name:</label>
<input id="POST-name" type="text" name="name">
<input id='POST-filename-upload' type='file' multiple='multiple'>
<input type="submit" value="Save">
</form>
var form = new formidable.IncomingForm();
var fields = [];
var files = [];
form.uploadDir = __dirname+'/tmp';
form
.on('field', function(field, value) {
log(field,value);
})
Support for name-based virtual servers
From the application protocol point of view, TLS belongs to a lower layer, although the TCP/IP model is too coarse to show it. This means that the TLS handshake is usually (except in the STARTTLS case) performed before the application protocol can start. The name-based virtual server feature being provided by the application layer, all co-hosted virtual servers share the same certificate because the server has to select and send a certificate immediately after the ClientHello message. This is a big problem in hosting environments because it means either sharing the same certificate among all customers or using a different IP address for each of them.
There are two known workarounds provided by X.509:
If all virtual servers belong to the same domain, a wildcard certificate can be used. Besides the loose host name selection that might be a problem or not, there is no common agreement about how to match wildcard certificates. Different rules are applied depending on the ap
C:\Users\mike>cd harb
C:\Users\mike\harb>jitsu deploy
info: Welcome to Nodejitsu harbhub
info: jitsu v0.11.7, node v0.8.14
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in servant.js
WARN package.json harbhub@0.0.0-25 No README.md file found!
info: Creating snapshot 0.0.0-25
//server.js
var speech = require('google-speech-api');
speech({'file': '/test.wav'}, function (err, results) {
if (err) throw err;
console.log(results);
// [{status: 0, id: '...', hypotheses: [{utterance: 'this is a test', confidence: 0.9162679}]}]}]
});
//test.wav
var exec = require('child_process').exec,
child;
child = exec('ls',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
process.env.harbachi = {};
console.log(JSON.stringify(process.env.harbachi));//"[object Object]"
process.stdout.write(JSON.stringify(process.env.harbachi));//"[object Object]"