Version: 7.4
Platform: Linux DEV-PC 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Subsystem: http
This happens from node 4.x to 7.x as far as I've tested on MacOS and Ubuntu/Arch Linux with older/newer stack and software.
Example attached, shows that using domain name for HTTP request results in invalid socket _handle.fd
Usine createConnection directly gives a valid fd in both cases
I know that file descriptors in node are like black sheeps but is there something else that needs to be done to get a valid socket file descriptor or is this a genuine bug?
consthttp=require('http')constnet=require('net')// this doesn't give valid fd handleconstr1=http.get({hostname: 'www.google.hr',port: 80})r1.on('socket',function(s){console.log("socket fd invalid",s._handle.fd)})// this does give valid fd handle, notice that ip is used instead of domain nameconstr2=http.get({hostname: '213.202.89.187',port: 80})r2.on('socket',function(s){console.log("socket fd valid",s._handle.fd)})// this gives valid handleconsts1=net.createConnection({host: "www.google.com",port:80},function(){console.log("socket fd valid:",s1._handle.fd)})// this gives valid handleconsts2=net.createConnection({host: "213.202.89.187",port:80},function(){console.log("socket fd valid:",s2._handle.fd)})
Version: 7.4
Platform: Linux DEV-PC 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Subsystem: http
This happens from node 4.x to 7.x as far as I've tested on MacOS and Ubuntu/Arch Linux with older/newer stack and software.
Example attached, shows that using domain name for HTTP request results in invalid socket _handle.fd
Usine createConnection directly gives a valid fd in both cases
I know that file descriptors in node are like black sheeps but is there something else that needs to be done to get a valid socket file descriptor or is this a genuine bug?