Configuration.connectHTTPTunnel()
Description
Appends a connectHTTPTunnel filter to the current pipeline layout.
A connectHTTPTunnel filter implements HTTP tunnel on the client side.
- INPUT - Data stream to send to the server via HTTP tunnel.
- OUTPUT - Data stream received from the server via HTTP tunnel.
- SUB-INPUT - Data stream to send to the server with a leading HTTP CONNECT request Message.
- SUB-OUTPUT - Data stream received from the server with a leading HTTP CONNECT response Message.
A connectHTTPTunnel filter pumps its input Data stream into a newly created sub-pipeline, prepended by an HTTP CONNECT request Message. Its output is the Data stream coming out of the sub-pipeline, with the leading HTTP Message in response to the CONNECT request removed.
Syntax
pipy().pipeline().connectHTTPTunnel(target).to(subPipelineLayout)pipy().pipeline().connectHTTPTunnel(() => getTarget()).to(subPipelineLayout)
Parameters
connectHTTPTunnel(handshake)
handshake
The starting CONNECT request, or a function that returns the target.
Return Value
The same Configuration object.
Example
pipy().listen(8443).connectHTTPTunnel('example.com:443', // the target address we intend to connect to).to($=>$.muxHTTP().to( // encode CONNECT requests into an HTTP stream$=>$.connect('localhost:8000' // suppose we have a local HTTP proxy on port 8000)))