Package org.microproxy
Class Http1PolicyBuilder
java.lang.Object
org.microproxy.ProtocolPolicy.Builder
org.microproxy.Http1PolicyBuilder
Builds the
ProtocolPolicy of HTTP/1.x clients (HttpProxyServerBootstrap.onHttp1(java.util.function.Consumer<org.microproxy.Http1PolicyBuilder>)):
the fields every protocol has, and HTTP/1-specific fields such as requestHeadTimeout(java.time.Duration)
and allowChunkedLength(boolean).-
Constructor Summary
ConstructorsConstructorDescriptionAn empty builder: every field left to what applies below the policy. -
Method Summary
Modifier and TypeMethodDescriptionallowChunkedLength(boolean allow) SetsProtocolPolicy.allowChunkedLength(): whether an HTTP/1.1 request with bothTransfer-EncodingandContent-Lengthis accepted, itsContent-Lengthdropped and the connection closed after the response, asHttpProxyServerBootstrap.withAllowChunkedLength(boolean)says for the whole server.filterConnectAnswer(boolean filter) preset(ProtocolPolicy preset) Sets every field thatpresetsets (such asProtocolPolicy.littleProxy()), overwriting what was set before; setters called after it overwrite it in turn.proxyProtocolDestination(ProxyProtocolDestination destination) requestHeadTimeout(Duration timeout) resolveBeforeProxyToServerRequest(boolean resolveFirst) servePlainHttpAfterConnect(boolean serve) Sets a field by its configuration name, asProtocolPolicy.Builder.set(java.lang.String, java.lang.String)does, and alsoallow_chunked_length.tlsRetryWithoutSni(boolean retry) Methods inherited from class org.microproxy.ProtocolPolicy.Builder
build
-
Constructor Details
-
Http1PolicyBuilder
public Http1PolicyBuilder()An empty builder: every field left to what applies below the policy.
-
-
Method Details
-
preset
Description copied from class:ProtocolPolicy.BuilderSets every field thatpresetsets (such asProtocolPolicy.littleProxy()), overwriting what was set before; setters called after it overwrite it in turn. A builder for other protocols than HTTP/1 leaves the HTTP/1-only fields alone.- Overrides:
presetin classProtocolPolicy.Builder- Parameters:
preset- the policy whose fields to copy- Returns:
- this builder
-
resolveBeforeProxyToServerRequest
Description copied from class:ProtocolPolicy.Builder- Overrides:
resolveBeforeProxyToServerRequestin classProtocolPolicy.Builder- Parameters:
resolveFirst- whether the server is resolved beforeproxyToServerRequest- Returns:
- this builder
-
filterConnectAnswer
Description copied from class:ProtocolPolicy.Builder- Overrides:
filterConnectAnswerin classProtocolPolicy.Builder- Parameters:
filter- whether theCONNECT's200goes through response filters- Returns:
- this builder
-
servePlainHttpAfterConnect
Description copied from class:ProtocolPolicy.Builder- Overrides:
servePlainHttpAfterConnectin classProtocolPolicy.Builder- Parameters:
serve- whether plain HTTP after aCONNECTis served as HTTP- Returns:
- this builder
-
proxyProtocolDestination
Description copied from class:ProtocolPolicy.Builder- Overrides:
proxyProtocolDestinationin classProtocolPolicy.Builder- Parameters:
destination- the destination a sent PROXY header names- Returns:
- this builder
-
tlsRetryWithoutSni
Description copied from class:ProtocolPolicy.Builder- Overrides:
tlsRetryWithoutSniin classProtocolPolicy.Builder- Parameters:
retry- whether to retry without SNI after anunrecognized_namealert- Returns:
- this builder
-
requestHeadTimeout
Description copied from class:ProtocolPolicy.Builder- Overrides:
requestHeadTimeoutin classProtocolPolicy.Builder- Parameters:
timeout- the maximum time for an HTTP/1 request head; zero disables the deadline- Returns:
- this builder
-
generatedResponses
Description copied from class:ProtocolPolicy.Builder- Overrides:
generatedResponsesin classProtocolPolicy.Builder- Parameters:
value- howproxyToClientResponsetreats generated responses- Returns:
- this builder
-
mitmServerHandshake
Description copied from class:ProtocolPolicy.Builder- Overrides:
mitmServerHandshakein classProtocolPolicy.Builder- Parameters:
value- when the server's handshake runs- Returns:
- this builder
-
allowChunkedLength
SetsProtocolPolicy.allowChunkedLength(): whether an HTTP/1.1 request with bothTransfer-EncodingandContent-Lengthis accepted, itsContent-Lengthdropped and the connection closed after the response, asHttpProxyServerBootstrap.withAllowChunkedLength(boolean)says for the whole server.- Parameters:
allow- whether such requests are accepted- Returns:
- this builder
-
set
Sets a field by its configuration name, asProtocolPolicy.Builder.set(java.lang.String, java.lang.String)does, and alsoallow_chunked_length.- Overrides:
setin classProtocolPolicy.Builder- Parameters:
name- the field's namevalue- its value- Returns:
- this builder
- Throws:
IllegalArgumentException- for an unknown field, or a value the field does not take
-