Hi Bob

Yeah we can make better logging, not sure if throwing an exception is
the right course as then your server logs can get spammed if http
clients send data with long headers.
So maybe there should be an option to set the logging level etc.

You are welcome to create a JIRA and work on a PR
https://camel.apache.org/manual/latest/contributing.html

On Tue, Nov 19, 2019 at 9:39 PM Bob Paulin <b...@bobpaulin.com> wrote:
>
> 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
>
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to