Class HttpFiltersAdapter
- All Implemented Interfaces:
HttpFilters
HttpFilters.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChannelHandlerContextstatic final HttpFiltersAdapterA default, stateless, no-opHttpFiltersinstance.protected final HttpRequest -
Constructor Summary
ConstructorsConstructorDescriptionHttpFiltersAdapter(HttpRequest originalRequest) HttpFiltersAdapter(HttpRequest originalRequest, ChannelHandlerContext ctx) -
Method Summary
Modifier and TypeMethodDescriptionclientToProxyRequest(HttpObject httpObject) Filters requests on their way from the client to the proxy.proxyToClientResponse(HttpObject httpObject) Filters responses on their way from the proxy to the client.booleanAllow this proxy to act as an SSL man in the middle.voidInforms filter that proxy to server connection has failed.voidInforms filter that proxy to server connection is in queue.voidInforms filter that proxy to server ssl handshake is initiating.voidInforms filter that proxy to server connection is initiating.voidInforms filter that proxy to server connection has succeeded.proxyToServerRequest(HttpObject httpObject) Filters requests on their way from the proxy to the server.voidInforms filter that proxy to server request is being sent.voidInforms filter that the HTTP request, including any content, has been sent.voidproxyToServerResolutionFailed(String hostAndPort) Informs filter that proxy to server DNS resolution failed for the specified host and port.proxyToServerResolutionStarted(String resolvingServerHostAndPort) Filter DNS resolution from proxy to server.voidproxyToServerResolutionSucceeded(String serverHostAndPort, InetSocketAddress resolvedRemoteAddress) Informs filter that proxy to server DNS resolution has happened.serverToProxyResponse(HttpObject httpObject) Filters responses on their way from the server to the proxy.voidInforms filter that server to proxy response has been received.voidInforms filter that server to proxy response is being received.voidInforms filter that a timeout occurred before the server response was received by the client.
-
Field Details
-
NOOP_FILTER
A default, stateless, no-opHttpFiltersinstance. -
originalRequest
-
ctx
-
-
Constructor Details
-
HttpFiltersAdapter
-
HttpFiltersAdapter
-
-
Method Details
-
clientToProxyRequest
Description copied from interface:HttpFiltersFilters requests on their way from the client to the proxy. To interrupt processing of this request and return a response to the client immediately, return an HttpResponse here. Otherwise, return null to continue processing as usual.Important: When returning a response, you must include a mechanism to allow the client to determine the length of the message (see RFC 7230, section 3.3.3: https://tools.ietf.org/html/rfc7230#section-3.3.3 ). For messages that may contain a body, you may do this by setting the Transfer-Encoding to chunked, setting an appropriate Content-Length, or by adding a "Connection: close" header to the response (which will instruct LittleProxy to close the connection). If the short-circuit response contains body content, it is recommended that you return a FullHttpResponse.
- Specified by:
clientToProxyRequestin interfaceHttpFilters- Parameters:
httpObject- Client to Proxy HttpRequest (and HttpContent, if chunked)- Returns:
- a short-circuit response, or null to continue processing as usual
-
proxyToServerRequest
Description copied from interface:HttpFiltersFilters requests on their way from the proxy to the server. To interrupt processing of this request and return a response to the client immediately, return an HttpResponse here. Otherwise, return null to continue processing as usual.Important: When returning a response, you must include a mechanism to allow the client to determine the length of the message (see RFC 7230, section 3.3.3: https://tools.ietf.org/html/rfc7230#section-3.3.3 ). For messages that may contain a body, you may do this by setting the Transfer-Encoding to chunked, setting an appropriate Content-Length, or by adding a "Connection: close" header to the response. (which will instruct LittleProxy to close the connection). If the short-circuit response contains body content, it is recommended that you return a FullHttpResponse.
- Specified by:
proxyToServerRequestin interfaceHttpFilters- Parameters:
httpObject- Proxy to Server HttpRequest (and HttpContent, if chunked)- Returns:
- a short-circuit response, or null to continue processing as usual
-
proxyToServerRequestSending
public void proxyToServerRequestSending()Description copied from interface:HttpFiltersInforms filter that proxy to server request is being sent.- Specified by:
proxyToServerRequestSendingin interfaceHttpFilters
-
proxyToServerRequestSent
public void proxyToServerRequestSent()Description copied from interface:HttpFiltersInforms filter that the HTTP request, including any content, has been sent.- Specified by:
proxyToServerRequestSentin interfaceHttpFilters
-
serverToProxyResponse
Description copied from interface:HttpFiltersFilters responses on their way from the server to the proxy.- Specified by:
serverToProxyResponsein interfaceHttpFilters- Parameters:
httpObject- Server to Proxy HttpResponse (and HttpContent, if chunked)- Returns:
- the modified (or unmodified) HttpObject. Returning null will force a disconnect.
-
serverToProxyResponseTimedOut
public void serverToProxyResponseTimedOut()Description copied from interface:HttpFiltersInforms filter that a timeout occurred before the server response was received by the client. The timeout may have occurred while the client was sending the request, waiting for a response, or after the client started receiving a response (i.e. if the response from the server "stalls"). SeeHttpProxyServerBootstrap.withIdleConnectionTimeout(int)for information on setting the timeout.- Specified by:
serverToProxyResponseTimedOutin interfaceHttpFilters
-
serverToProxyResponseReceiving
public void serverToProxyResponseReceiving()Description copied from interface:HttpFiltersInforms filter that server to proxy response is being received.- Specified by:
serverToProxyResponseReceivingin interfaceHttpFilters
-
serverToProxyResponseReceived
public void serverToProxyResponseReceived()Description copied from interface:HttpFiltersInforms filter that server to proxy response has been received.- Specified by:
serverToProxyResponseReceivedin interfaceHttpFilters
-
proxyToClientResponse
Description copied from interface:HttpFiltersFilters responses on their way from the proxy to the client.- Specified by:
proxyToClientResponsein interfaceHttpFilters- Parameters:
httpObject- Proxy to Client HttpResponse (and HttpContent, if chunked)- Returns:
- the modified (or unmodified) HttpObject. Returning null will force a disconnect.
-
proxyToServerConnectionQueued
public void proxyToServerConnectionQueued()Description copied from interface:HttpFiltersInforms filter that proxy to server connection is in queue.- Specified by:
proxyToServerConnectionQueuedin interfaceHttpFilters
-
proxyToServerResolutionStarted
Description copied from interface:HttpFiltersFilter DNS resolution from proxy to server.- Specified by:
proxyToServerResolutionStartedin interfaceHttpFilters- Parameters:
resolvingServerHostAndPort- Server "HOST:PORT"- Returns:
- alternative address resolution. Returning null will let normal DNS resolution continue.
-
proxyToServerResolutionFailed
Description copied from interface:HttpFiltersInforms filter that proxy to server DNS resolution failed for the specified host and port.- Specified by:
proxyToServerResolutionFailedin interfaceHttpFilters- Parameters:
hostAndPort- hostname and port the proxy failed to resolve
-
proxyToServerResolutionSucceeded
public void proxyToServerResolutionSucceeded(String serverHostAndPort, InetSocketAddress resolvedRemoteAddress) Description copied from interface:HttpFiltersInforms filter that proxy to server DNS resolution has happened.- Specified by:
proxyToServerResolutionSucceededin interfaceHttpFilters- Parameters:
serverHostAndPort- Server "HOST:PORT"resolvedRemoteAddress- Address it was proxyToServerResolutionSucceeded to
-
proxyToServerConnectionStarted
public void proxyToServerConnectionStarted()Description copied from interface:HttpFiltersInforms filter that proxy to server connection is initiating.- Specified by:
proxyToServerConnectionStartedin interfaceHttpFilters
-
proxyToServerConnectionSSLHandshakeStarted
public void proxyToServerConnectionSSLHandshakeStarted()Description copied from interface:HttpFiltersInforms filter that proxy to server ssl handshake is initiating.- Specified by:
proxyToServerConnectionSSLHandshakeStartedin interfaceHttpFilters
-
proxyToServerConnectionFailed
public void proxyToServerConnectionFailed()Description copied from interface:HttpFiltersInforms filter that proxy to server connection has failed.- Specified by:
proxyToServerConnectionFailedin interfaceHttpFilters
-
proxyToServerConnectionSucceeded
Description copied from interface:HttpFiltersInforms filter that proxy to server connection has succeeded.- Specified by:
proxyToServerConnectionSucceededin interfaceHttpFilters- Parameters:
serverCtx- theChannelHandlerContextused to connect to the server
-
proxyToServerAllowMitm
public boolean proxyToServerAllowMitm()Description copied from interface:HttpFiltersAllow this proxy to act as an SSL man in the middle.Has no impact if man in the middle is not enabled.
- Specified by:
proxyToServerAllowMitmin interfaceHttpFilters- Returns:
- true to allow mitm, false to not mitm the proxy to server connection.
-