Skip to content

Instantly share code, notes, and snippets.

@mnot
Created September 15, 2010 01:07
Show Gist options
  • Save mnot/580078 to your computer and use it in GitHub Desktop.
Save mnot/580078 to your computer and use it in GitHub Desktop.
double-cl.js - test how clients deal with two Content-Length headers
// simple & dirty node.js server to test how a client deals with two Content-Length headers.
function handle(req, res) {
res.writeHead(200, {
'Content-Length': '15',
});
m = res._header.split("\r\n");
console.log(m);
res._header = [m[0], "Content-Length: 10", ""].join("\r\n") +
m.slice(1).join("\r\n");
req.addListener('end', function() {
res.write("1234567890");
res.end();
})
}
var http = require('http');
server = http.createServer(handle);
server.listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment