diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-10-17 22:19:27 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-10-23 17:11:57 +0200 |
commit | 3e25e4d00f382641af1c78a28b02296bef686c1e (patch) | |
tree | 8db28c0265694d200e1564b215d05a9126e20060 /lib/_http_client.js | |
parent | ab16eec4369f60f14014933886f84a926488f368 (diff) | |
download | android-node-v8-3e25e4d00f382641af1c78a28b02296bef686c1e.tar.gz android-node-v8-3e25e4d00f382641af1c78a28b02296bef686c1e.tar.bz2 android-node-v8-3e25e4d00f382641af1c78a28b02296bef686c1e.zip |
http: support generic `Duplex` streams
Support generic `Duplex` streams through more duck typing
on the server and client sides.
Since HTTP is, as a protocol, independent of its underlying transport
layer, Node.js should not enforce any restrictions on what streams
its HTTP parser may use.
Ref: https://github.com/nodejs/node/issues/16256
PR-URL: https://github.com/nodejs/node/pull/16267
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'lib/_http_client.js')
-rw-r--r-- | lib/_http_client.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js index e036522d7b..da98f2669c 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -565,7 +565,10 @@ function responseKeepAlive(res, req) { if (!req.shouldKeepAlive) { if (socket.writable) { debug('AGENT socket.destroySoon()'); - socket.destroySoon(); + if (typeof socket.destroySoon === 'function') + socket.destroySoon(); + else + socket.end(); } assert(!socket.writable); } else { |