Fix typo
This commit is contained in:
parent
0baf359202
commit
e530ccaeb8
@ -64,11 +64,11 @@ public abstract class HttpMessageEncoder extends MessageToByteEncoder<Object> {
|
|||||||
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
|
public void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
|
||||||
if (msg instanceof HttpMessage) {
|
if (msg instanceof HttpMessage) {
|
||||||
HttpMessage m = (HttpMessage) msg;
|
HttpMessage m = (HttpMessage) msg;
|
||||||
boolean contentMustBeEmmpty;
|
boolean contentMustBeEmpty;
|
||||||
if (m.isChunked()) {
|
if (m.isChunked()) {
|
||||||
// if Content-Length is set then the message can't be HTTP chunked
|
// if Content-Length is set then the message can't be HTTP chunked
|
||||||
if (HttpCodecUtil.isContentLengthSet(m)) {
|
if (HttpCodecUtil.isContentLengthSet(m)) {
|
||||||
contentMustBeEmmpty = false;
|
contentMustBeEmpty = false;
|
||||||
transferEncodingChunked = false;
|
transferEncodingChunked = false;
|
||||||
} else {
|
} else {
|
||||||
// check if the Transfer-Encoding is set to chunked already.
|
// check if the Transfer-Encoding is set to chunked already.
|
||||||
@ -76,11 +76,11 @@ public abstract class HttpMessageEncoder extends MessageToByteEncoder<Object> {
|
|||||||
if (!HttpCodecUtil.isTransferEncodingChunked(m)) {
|
if (!HttpCodecUtil.isTransferEncodingChunked(m)) {
|
||||||
m.addHeader(Names.TRANSFER_ENCODING, Values.CHUNKED);
|
m.addHeader(Names.TRANSFER_ENCODING, Values.CHUNKED);
|
||||||
}
|
}
|
||||||
contentMustBeEmmpty = true;
|
contentMustBeEmpty = true;
|
||||||
transferEncodingChunked = true;
|
transferEncodingChunked = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
transferEncodingChunked = contentMustBeEmmpty = HttpCodecUtil.isTransferEncodingChunked(m);
|
transferEncodingChunked = contentMustBeEmpty = HttpCodecUtil.isTransferEncodingChunked(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
out.markWriterIndex();
|
out.markWriterIndex();
|
||||||
@ -91,7 +91,7 @@ public abstract class HttpMessageEncoder extends MessageToByteEncoder<Object> {
|
|||||||
|
|
||||||
ByteBuf content = m.getContent();
|
ByteBuf content = m.getContent();
|
||||||
if (content.readable()) {
|
if (content.readable()) {
|
||||||
if (contentMustBeEmmpty) {
|
if (contentMustBeEmpty) {
|
||||||
out.resetWriterIndex();
|
out.resetWriterIndex();
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"HttpMessage.content must be empty if Transfer-Encoding is chunked.");
|
"HttpMessage.content must be empty if Transfer-Encoding is chunked.");
|
||||||
|
Loading…
Reference in New Issue
Block a user