Update: I posted this code here, after I added all (to 99%) possibilities one by one, and it still gave me a 120sec timeout...buffled.
So, ok, I figured it takes exactly 120sec (ok, 122sec) on my Windows 7 machine, until the FIN handshake is started. I want to do it immediately. HTTP RFC793 says
FIN: No more data from sender
Looks to me I do not send any data anymore. I tried all this bloated code, still a Hello World server...
var http = require('http')
var server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'})
res.write('HELLO WORLD!\n')
res.end()
res.setTimeout(0)
req.abort() // 1) TypeError: Object #<IncomingMessage> has no method 'abort'
req.on('socket', function (socket) {
socket.setTimeout(0)
socket.on('timeout', function() {
req.abort()
})
})
})
server.timeout = 0
server.setTimeout(0)
server.listen(1337, '192.168.0.101')
- So how to do 1) ? (Actually sends a
RSTlike this...) And how to do the whole thing
HTTPconform?
Of course in the end I will be lucky to usenodejsas inwebsocketstuff and all this, but if conversion on my website means a thing of two minutes, and I have a million concurrent users (huh?), sending aFINimmediately could mean I have two million concurrent users (do the math). ;) Ok, to be on the sure side: Sending aFINmeans the socket is closed?Ah, eah, ok, since you are on, how do I
console.log(res)orconsole.log(req)? It gives me[object Object]. (Update: I triedconsole.log(res.toSource()), gives me aTypeError?
Edit: Found the answer here.