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.

ehpi(options: Object)
Parameters
options (Object) The configuration options for the proxy server.
Static Members
start()
requestHandler(req, res)
connectHandler(req, socket)
Instance Members
port
port
onServerError
onBeforeRequest
onBeforeResponse
onRequestError

requestRemote

Initiates request from the Proxy server for the requested resource.

requestRemote(requestOptions: Object, req: Object, res: Object, proxy: Object)
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.

ontargeterror(e: Object)
Parameters
e (Object) The error object literal.

connectRemote

Attempts to connect to target URI and establish a tunnel.

connectRemote(requestOptions: Object, socket: Object)
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.

_synReply(socket: Object, code: number, reason: string, headers: Object, cb: Object)
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.