Created
September 15, 2010 01:07
-
-
Save mnot/580078 to your computer and use it in GitHub Desktop.
double-cl.js - test how clients deal with two Content-Length headers
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
// 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