Fix bug in max header calculation in DefaultPartHttpMessageReader
This commit fixes a bug in the DefaultPartHttpMessageReader, in the
check for exceeding the maximum header size. Before this commit, the
entire buffer size was considered, thus triggering an exception even
though the max header limit was not exceeded. After this commit, we only
consider the size up until the end-of-header mark (CRLFCRLF).
Furthermore, this commit increases the default maximum header size to
10k, the same default as Commons File upload.
Closes gh-27612
@ -63,7 +63,7 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements
@@ -63,7 +63,7 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements
@ -342,33 +342,23 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {
@@ -342,33 +342,23 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {
emitError(newDataBufferLimitException("Part headers exceeded the memory usage limit of "+
MultipartParser.this.maxHeadersSize+" bytes"));
emitComplete();
}
return;
}
@ -377,17 +367,23 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {
@@ -377,17 +367,23 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {
if(logger.isTraceEnabled()){
logger.trace("End of headers found @"+endIdx+" in "+buf);
@ -407,6 +403,21 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {
@@ -407,6 +403,21 @@ final class MultipartParser extends BaseSubscriber<DataBuffer> {