[4.x] http: make socketPath work with no agent
This is a backport of https://github.com/nodejs/node/pull/19425.
Currently Agent.prototype.createConnection()
is called uncoditionally
if the socketPath
option is used. This throws an error if no agent is
used, preventing, for example, the socketPath
and createConnection
options to be used together.
This commit fixes the issue by falling back to the createConnection
option or net.createConnection()
.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines