Enum Class GeneratedResponses
- All Implemented Interfaces:
Serializable,Comparable<GeneratedResponses>,Constable
HttpFilters.proxyToClientResponse(org.microproxy.http.HttpObject) treats the responses the proxy answers with
itself, rather than relaying a server's: its own error responses (the 502 for a server
it cannot reach, the 504 for one that does not answer, a 400 for a bad request,
the FailureResponder's and HttpFilters.proxyToServerFailure(org.microproxy.ProxyFailure)'s answers, ...),
and the short-circuit responses a filter returned from an earlier hook (HttpFilters.clientToProxyRequest(org.microproxy.http.HttpObject), HttpFilters.proxyToServerRequest(org.microproxy.http.HttpObject)), the HttpCache's answers included. A field of a ProtocolPolicy
(ProtocolPolicy.generatedResponses()).
Those responses reach no other response hook: HttpFilters.serverToProxyResponse(org.microproxy.http.HttpObject)
sees only what comes from a server (and the 200 that opens a CONNECT tunnel).
No filter sees the 407 authentication challenge in any mode: it is sent before the
request's filters are made, as in LittleProxy. The 200 that opens a CONNECT
tunnel and the 101 that accepts a CONNECT-UDP flow are not answers in this sense but
the proxy's acceptance, which a filter may turn into a refusal (ProtocolPolicy.filterConnectAnswer() decides whether filters see the 200).
To change the proxy's own error pages, use a FailureResponder (or HttpFilters.proxyToServerFailure(org.microproxy.ProxyFailure)): it is asked for the answer to a failure, with the failure in
hand, whatever this setting says. Inside the hook, FlowContext.responseSource() tells
the proxy's and the filters' responses from the server's.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionproxyToClientResponsesees generated responses and may change them in place (headers, status, content), or returnnullto close the connection without an answer; a different object it returns is ignored (logged atDEBUG) and the generated response, with the changes made to it, is sent.proxyToClientResponsesees generated responses as it sees the server's, and may return another response to send instead, ornullto close the connection without an answer.Generated responses never reachproxyToClientResponse: they are sent as made. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeneratedResponsesThe value a configuration names:replaceable,in_placeorskip(any case,-for_).static GeneratedResponsesReturns the enum constant of this class with the specified name.static GeneratedResponses[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
REPLACEABLE
proxyToClientResponsesees generated responses as it sees the server's, and may return another response to send instead, ornullto close the connection without an answer. The default, and LittleProxy 2.x's behaviour:ClientToProxyConnection.respondWithShortCircuitResponsewrites the response the hook returns. Suits filters that brand every response the client gets: an error page of their own, a503withRetry-Afterin place of a502, CORS or request-id headers on every response. -
IN_PLACE
proxyToClientResponsesees generated responses and may change them in place (headers, status, content), or returnnullto close the connection without an answer; a different object it returns is ignored (logged atDEBUG) and the generated response, with the changes made to it, is sent. So a filter written for the server's responses (one that answers some of them with a400, say) cannot turn the proxy's own502for an unreachable server into something else. LittleProxy 1.x's behaviour, kept by forks descended from it: itsClientToProxyConnection.respondWithShortCircuitResponseruns the hook but writes the response it was given. -
SKIP
Generated responses never reachproxyToClientResponse: they are sent as made. Trackers (ActivityTracker.responseSentToClient(org.microproxy.FlowContext, org.microproxy.http.HttpResponse)) andHttpFilters.proxyToClientResponseSent(org.microproxy.http.HttpResponse, org.microproxy.ResponseSource)still see them. For filters that must only ever see the server's responses.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
parse
The value a configuration names:replaceable,in_placeorskip(any case,-for_).- Parameters:
value- the configuration value- Returns:
- the value it names
- Throws:
IllegalArgumentException- for any other value
-