The Agent classes of http and https both have a createConnection() method which can be used to overwrite socket creation. http even supports createConnection as an option in request(). http2 does not support this part of the API and does not mention this difference in the API documentation.
It seems that implementing this for plain connections in http2 seems quite straight forward, but I have not fully understood the creation of connections for SSL in this library, yet.
PS: One use case for this is to tunnel the request through something like a VPN or SSH port forwarding by returning a socket-like object in createConnection
I can see the use case for this, but I'd rather spend what limited time I have for this module on fixing actual bugs. I'm going to leave this open, and will gladly accept patches to add this functionality.
The Agent classes of
http
andhttps
both have acreateConnection()
method which can be used to overwrite socket creation.http
even supportscreateConnection
as an option inrequest()
.http2
does not support this part of the API and does not mention this difference in the API documentation.It seems that implementing this for
plain
connections inhttp2
seems quite straight forward, but I have not fully understood the creation of connections for SSL in this library, yet.PS: One use case for this is to tunnel the request through something like a VPN or SSH port forwarding by returning a socket-like object in
createConnection