http request with header "constructor" results to a value of "function Object() { [native code] }, " #4456
Closed
Description
I'm using Node v5.3.0 on Windows 10. I was playing with http and found out that a request with a header name constructor
results to function Object() { [native code] },
Simple HTTP Server
const http = require('http');
http.createServer((request, response) => {
response.end(JSON.stringify(request.headers, null, '\t'));
})
.listen(8000);
Request
const net = require('net');
const client = new net.Socket();
client.connect(8000, '127.0.0.1', () => {
client.write('GET / HTTP/1.1\r\nconstructor:\r\n\r\n');
});
client.on('data', (data) => {
console.log(data.toString());
client.destroy();
});
client.on('close', function() {
console.log('Connection closed');
});
Output
HTTP/1.1 200 OK
Date: Mon, 28 Dec 2015 21:17:55 GMT
Connection: keep-alive
Content-Length: 59
{
"constructor": "function Object() { [native code] }, "
}
Connection closed
Activity