curl bbs
var http = require('http'); | |
var buf0 = new Buffer([0]); | |
var server = http.createServer(function (req, res) { | |
res.setHeader('content-type', 'multipart/octet-stream'); | |
res.write('Welcome to the Fun House\r\n'); | |
res.write('> '); | |
req.on('data', function (buf) { | |
res.write(buf); | |
res.write('> '); | |
}); | |
req.on('end', function () { | |
res.end(); | |
}); | |
console.log(req.headers['user-agent']); | |
var iv = setInterval(function () { | |
res.write(buf0); | |
}, 100); | |
res.connection.on('end', function () { | |
clearInterval(iv); | |
}); | |
}); | |
server.listen(8000); |
This comment has been minimized.
This comment has been minimized.
Very, very cool. Though it seems like there's no way to terminate the connection from the server-side. I mean, you can kill it, but the curl command stays open, waiting for user input. Not a huge deal but I can see why more people haven't tried messing around with this stuff (and/or just use Sweet stuff @substack! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
I'm surprised I hadn't seen this before. Pretty awesome!