[undertow-dev] Nit: MAX_ENTITY_SIZE, Default -1 vs. 0

Bernd Eckenfels ecki at zusammenkunft.net
Mon Jun 2 20:52:28 EDT 2014


Hello,

(while researching some details for the pending documentation pull
request I noticed):

SpdyReceiveListener is using:

this.maxEntitySize =
        undertowOptions.get(UndertowOptions.MAX_ENTITY_SIZE,
        UndertowOptions.DEFAULT_MAX_ENTITY_SIZE);

While HTTPReadListener and AjpReadListener is using:

this.maxEntitySize =
        connection.getUndertowOptions().get(UndertowOptions.MAX_ENTITY_SIZE,
        0);

The DEFAULT_MAX_ENTITY_SIZE is defined as -1. I think it would be good
to use the constant in HTTP+AjpReadListener (and
HttpServerExchange(ServerConnection)) as well.

I think using -1 as the constant and in all places looks better, but
more backward compatible would be 0. In
HttpServerExchange#maxEntitySize for example it is documented as 0
means unlimited.

The limit is checked here, and all accept 0 and -1 as unlimited:
FixedLengthStreamSourceConduit#checkMaxSize()
AjpServerRequestConduit#soRead()
ChunkedStreamSourceConduit#updateRemainingAllowed()

Gruss
Bernd


More information about the undertow-dev mailing list