http,stream: remove usage of _readableState
Remove the usage of the restricted _readableState property and use the readableFlowing property instead.
Refs: https://github.com/nodejs/node/issues/445
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
This should work but doesn't. According to the original code:
// if the user never called req.read(), and didn't pipe() or
// .resume() or .on('data'), then we call req._dump() so that the
// bytes will be pulled off the wire.
if (!req._readableState.resumeScheduled)
req._dump();
Technically, it should be called whenever the stream isn't accessed.
According to the docs of Readable
at https://nodejs.org/api/stream.html#stream_readable_streams:
-
req
must be aReadable
stream. -
readable.readableFlowing = null
when the above condition is true (Ref: https://nodejs.org/api/stream.html#stream_three_states)
Therefore, substituting the above condition by if (req.readableFlowing === null)
must work.
But it doesn't.
@mcollina @mafintosh @nodejs/streams any idea why?