Hi,

When the Camel Netty Http component receives a header that exceeds it's
maxHeaderSize the
org.apache.camel.component.netty.http.handlers.HttpServerChannelHandler
simply logs that a message was received at DEBUG level:

2019-11-19T19:34:02,418 | DEBUG | Camel (camel-2) thread #189 -
NettyEventExecutorGroup | NettyHttpConsumer                | 95 -
org.apache.camel.camel-core - 2.22.3 | Message received:
HttpObjectAggregator$AggregatedFullHttpRequest(decodeResult:
failure(io.netty.handler.codec.TooLongFrameException: HTTP header is
larger than 8192 bytes.), version: HTTP/1.1, content: EmptyByteBufBE)

This the request is allowed to proceed to code upstream which
unfortunately leads the developer to believe that there is nothing wrong
with the request.  In my case the request failed when I went to
unmarshal the body which was unexpectedly empty.  I'd like to propose
one of the follow options:

1) Throw an exception

2) Log an Error

Both of the above would be possible if with some changes to the
HttpServerChannelHandler.channelRead0

Currently the code only performs the following.

LOG.debug("Message received: {}", request);

However there could be a check on the request.decoderResult().cause(); 
If this is not null we could just throw the exception or a minimum log
an error level.  My preference would be to throw an exception as this
will make unrecoverable failures more obvious to developers.  Let me
know if this direction works for the team.  Happy to help with a
patch/tests.

Sincerely,

Bob


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to