Allocate smaller dynamic buffer to read a line
- Also fixes some inspector warnings from the previous patch - Related: #992
This commit is contained in:
parent
9650cda163
commit
b38bde2d2b
@ -1219,17 +1219,17 @@ public class HttpPostRequestDecoder {
|
||||
private String readLineStandard() throws NotEnoughDataDecoderException {
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
try {
|
||||
ChannelBuffer line = ChannelBuffers.dynamicBuffer();
|
||||
ChannelBuffer line = ChannelBuffers.dynamicBuffer(64);
|
||||
|
||||
while (undecodedChunk.readable()) {
|
||||
byte nextByte = undecodedChunk.readByte();
|
||||
if (nextByte == HttpConstants.CR) {
|
||||
nextByte = undecodedChunk.readByte();
|
||||
if (nextByte == HttpConstants.LF) {
|
||||
return line.toString(this.charset);
|
||||
return line.toString(charset);
|
||||
}
|
||||
} else if (nextByte == HttpConstants.LF) {
|
||||
return line.toString(this.charset);
|
||||
return line.toString(charset);
|
||||
} else {
|
||||
line.writeByte(nextByte);
|
||||
}
|
||||
@ -1256,7 +1256,7 @@ public class HttpPostRequestDecoder {
|
||||
}
|
||||
int readerIndex = undecodedChunk.readerIndex();
|
||||
try {
|
||||
ChannelBuffer line = ChannelBuffers.dynamicBuffer();
|
||||
ChannelBuffer line = ChannelBuffers.dynamicBuffer(64);
|
||||
while (sao.pos < sao.limit) {
|
||||
byte nextByte = sao.bytes[sao.pos ++];
|
||||
if (nextByte == HttpConstants.CR) {
|
||||
@ -1264,14 +1264,14 @@ public class HttpPostRequestDecoder {
|
||||
nextByte = sao.bytes[sao.pos ++];
|
||||
if (nextByte == HttpConstants.LF) {
|
||||
sao.setReadPosition(0);
|
||||
return line.toString(this.charset);
|
||||
return line.toString(charset);
|
||||
}
|
||||
} else {
|
||||
line.writeByte(nextByte);
|
||||
}
|
||||
} else if (nextByte == HttpConstants.LF) {
|
||||
sao.setReadPosition(0);
|
||||
return line.toString(this.charset);
|
||||
return line.toString(charset);
|
||||
} else {
|
||||
line.writeByte(nextByte);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user