[undertow-dev] Max and Min content size predicates are implemented backwards

Brad Wood bdw429s at gmail.com
Wed Jul 8 02:04:52 EDT 2020


Pull request for UNDERTOW-1746
<https://issues.redhat.com/browse/UNDERTOW-1746> submitted here:

https://github.com/undertow-io/undertow/pull/907

Thanks!

~Brad

*Developer Advocate*
*Ortus Solutions, Corp *

E-mail: brad at coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com



On Tue, Jul 7, 2020 at 8:58 PM Brad Wood <bdw429s at gmail.com> wrote:

> https://issues.redhat.com/browse/UNDERTOW-1746
>
> Thanks!
>
> ~Brad
>
> *Developer Advocate*
> *Ortus Solutions, Corp *
>
> E-mail: brad at coldbox.org
> ColdBox Platform: http://www.coldbox.org
> Blog: http://www.codersrevolution.com
>
>
>
> On Tue, Jul 7, 2020 at 6:51 PM Brad Wood <bdw429s at gmail.com> wrote:
>
>> Thanks for confirming.  I was wondering myself about introducing a new
>> name in order to avoid the mess of the breaking change.  I would just
>> recommend we make sure to deprecate the old ones that are named poorly.
>> I'll enter a ticket in a bit.
>>
>> Thanks!
>>
>> ~Brad
>>
>> *Developer Advocate*
>> *Ortus Solutions, Corp *
>>
>> E-mail: brad at coldbox.org
>> ColdBox Platform: http://www.coldbox.org
>> Blog: http://www.codersrevolution.com
>>
>>
>>
>> On Tue, Jul 7, 2020 at 6:44 PM Stuart Douglas <sdouglas at redhat.com>
>> wrote:
>>
>>> Yea, this does not seem correct, but IMHO they are both named terribly.
>>> In order to avoid a breaking change how about we deprecate these, and
>>> replace them with 'request-larger-than' and 'request-smaller-than' to make
>>> it clearer exactly what is being tested?
>>>
>>> Stuart
>>>
>>> On Wed, 8 Jul 2020 at 04:39, Brad Wood <bdw429s at gmail.com> wrote:
>>>
>>>> These two predicates from undertow are named/implemented backwards.
>>>> The "max" should be ensuring the provided value is at least *as small
>>>> or smaller* and the "min" should be ensuring the provided value is at
>>>> least *as big or bigger*.  But here are the descriptions of each one.
>>>>
>>>> *MinContentSizePredicate*
>>>>
>>>>> Predicate that returns true if the Content-Size of a request is below
>>>>> a given value.
>>>>
>>>>
>>>>
>>>> *MaxContentSizePredicate*
>>>>
>>>>> Predicate that returns true if the Content-Size of a request is above
>>>>> a given value.
>>>>
>>>>
>>>> So to spell it out, if someone uses the following predicate:
>>>>
>>>> max-content-size(5)
>>>>
>>>>
>>>> That means they are saying the maximum content size is 5 bytes.  So,
>>>> here's a quick truth table:
>>>>
>>>>    - If content length is *4 bytes *-> should return *true *(under the
>>>>    max)
>>>>    - if content length is *5 bytes *-> should return *true *(at the
>>>>    max, but not over)
>>>>    - if content length is *6 bytes *-> should return *false *(over the
>>>>    max)
>>>>
>>>> But this is the exact opposite of how these predicates have been
>>>> implemented.  The javadoc matches the behavior, but not the name.
>>>>
>>>> Can I get a quick confirmation this is, in fact, backwards before I
>>>> enter a ticket and/or pull request.  Note, this will be a breaking change
>>>> to fix.
>>>>
>>>> Thanks!
>>>>
>>>> ~Brad
>>>>
>>>> *Developer Advocate*
>>>> *Ortus Solutions, Corp *
>>>>
>>>> E-mail: brad at coldbox.org
>>>> ColdBox Platform: http://www.coldbox.org
>>>> Blog: http://www.codersrevolution.com
>>>>
>>>> _______________________________________________
>>>> undertow-dev mailing list
>>>> undertow-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20200708/90ac7129/attachment.html 


More information about the undertow-dev mailing list