Created
February 20, 2013 00:06
-
-
Save blakmatrix/4991469 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substack : http-bbs $ curl -sSNT. localhost:8000 | |
Welcome to the Fun House | |
> beep | |
beep | |
> boop | |
boop | |
> ^C | |
substack : http-bbs $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment