index
ehpi - Enhanced HTTP Proxy Implementation module.
index
zlib
Used for Gzip stream compression of the response.
zlib
http
Used to access internal HTTP APIs.
http
net
Used to access internal Socket APIs.
net
url
Used to parse host information.
url
Cache
Used for caching response stream from the target.
Cache
ehpiConsole
Enable debug logging by passing DEBUG=ehpi.
ehpiConsole
ehpi
Constructs an ehpi instance.
Parameters
options (Object)
The configuration options for the proxy server.
Static Members
Starts the Proxy Server.
start()
▸
requestHandler(req, res)
Server's global request handler.
Parameters
req (Object)
The request stream object literal.
res (Object)
The response stream object literal.
▸
connectHandler(req, socket)
Handles SYN operation back to socket after connection is established, else throws.
Parameters
req (Object)
The request stream object literal.
socket (Object)
The socket used for SYN operation.
Instance Members
Server's port number.
port
Server's internal error event handler.
onServerError
Server's before request event handler.
onBeforeRequest
Server's before response event handler.
onBeforeResponse
Server's request error event handler.
onRequestError
requestRemote
Initiates request from the Proxy server for the requested resource.
Parameters
requestOptions (Object)
The host, port, path, method, and header values.
req (Object)
The request stream object literal.
res (Object)
The response stream object literal.
proxy (Object)
The instantiated ehpi instance.
ontargeterror
Acknowledges Tunnel errors and attempts to gracefully close the socket, else throw.
Parameters
e (Object)
The error object literal.
connectRemote
Attempts to connect to target URI and establish a tunnel.
Parameters
requestOptions (Object)
The host, port, path, method, and header values.
socket (Object)
The socket used for SYN operation.
_synReply
Utility function that writes input to socket.
Parameters
socket (Object)
The socket used for SYN operation.
code (number)
The HTTP status code.
reason (string)
The event that resulted in this SYN operation.
headers (Object)
The HTTP headers.
cb (Object)
The error handler callback.