Version : v6.9.2
Platform : Linux david-Latitude-E6440 4.8.0-27-generic docs: added a the #29 -Ubuntu SMP Thu Oct 20 21:03:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Subsystem : http, stream
Here's a test program:
var http = require ( 'http' ) ,
PassThrough = require ( 'stream' ) . PassThrough ,
server = http . createServer ( ) ;
server . on ( 'request' , function ( req , res )
{
console . log ( 'REQUEST' ) ;
var pthru = new PassThrough ( ) ;
pthru . on ( 'end' , function ( )
{
console . log ( "PASSTHROUGH END" ) ;
} ) ;
pthru . pipe ( res ) ;
pthru . end ( new Buffer ( 1024 * 1024 ) ) ;
} ) ;
server . listen ( 8700 , function ( )
{
http . request (
{
port : 8700 ,
method : 'GET'
} , function ( res )
{
console . log ( 'RESPONSE' ) ;
res . on ( 'end' , function ( )
{
console . log ( "RESPONSE END" ) ;
} ) ;
} ) . end ( ) ;
} ) ;
I expected it to display:
because the client-side isn't reading from the response so back-pressure should be applied via res to pthru.
However, it actually displays:
REQUEST
PASSTHROUGH END
RESPONSE
I think maybe I'm missing something, or is this a bug?