Also allow to disable header validation via HttpServerCodec and HttpClientCodec. Related to [#1981]

This commit is contained in:
Norman Maurer 2013-11-14 08:19:49 +01:00
parent c4130e0cf7
commit 8bfbf77b58
2 changed files with 23 additions and 3 deletions

View File

@ -76,9 +76,21 @@ public final class HttpClientCodec
this(maxInitialLineLength, maxHeaderSize, maxChunkSize, false);
}
/**
* Creates a new instance with the specified decoder options.
*/
public HttpClientCodec(
int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse) {
init(new Decoder(maxInitialLineLength, maxHeaderSize, maxChunkSize), new Encoder());
this(maxInitialLineLength, maxHeaderSize, maxChunkSize, failOnMissingResponse, true);
}
/**
* Creates a new instance with the specified decoder options.
*/
public HttpClientCodec(
int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse,
boolean validateHeaders) {
init(new Decoder(maxInitialLineLength, maxHeaderSize, maxChunkSize, validateHeaders), new Encoder());
this.failOnMissingResponse = failOnMissingResponse;
}
@ -104,8 +116,8 @@ public final class HttpClientCodec
}
private final class Decoder extends HttpResponseDecoder {
Decoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) {
super(maxInitialLineLength, maxHeaderSize, maxChunkSize);
Decoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders) {
super(maxInitialLineLength, maxHeaderSize, maxChunkSize, validateHeaders);
}
@Override

View File

@ -42,4 +42,12 @@ public final class HttpServerCodec
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) {
super(new HttpRequestDecoder(maxInitialLineLength, maxHeaderSize, maxChunkSize), new HttpResponseEncoder());
}
/**
* Creates a new instance with the specified decoder options.
*/
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders) {
super(new HttpRequestDecoder(maxInitialLineLength, maxHeaderSize, maxChunkSize, validateHeaders),
new HttpResponseEncoder());
}
}