OK, fair enough.

On Thu, Oct 8, 2015 at 12:16 PM, Stefan Eissing
<stefan.eiss...@greenbytes.de> wrote:
> Valid question. The failure can only happen when a bucket of indeterminate 
> length fails the read.
>
> I think the prototype of h2_util_has_eos() needs to change to return 
> arp_status_t and have an int* for the flag. But that change I do not want to 
> do right now for the 2.4.17...
>
> //Stefan
>
>> Am 08.10.2015 um 12:11 schrieb Yann Ylavic <ylavic....@gmail.com>:
>>
>> Hi Stefan,
>>
>> On Thu, Oct 8, 2015 at 12:06 PM, Stefan Eissing
>> <stefan.eiss...@greenbytes.de> wrote:
>>>
>>> Index: modules/http2/h2_util.c
>>> ===================================================================
>>> --- modules/http2/h2_util.c     (revision 1707467)
>>> +++ modules/http2/h2_util.c     (revision 1707468)
>>> @@ -484,20 +484,39 @@
>>>
>>> int h2_util_has_eos(apr_bucket_brigade *bb, apr_size_t len)
>>> {
>>> -    apr_bucket *b, *end;
>>> +    apr_bucket *b;
>>>
>>> -    apr_status_t status = last_not_included(bb, len, 0, 0, &end);
>>> -    if (status != APR_SUCCESS) {
>>> -        return status;
>>> +    if (len == 0) {
>>> +        /* special case: this is only true, if there are only meta
>>> +         * and an eos bucket in the brigade head.
>>> +         */
>>> +        for (b = APR_BRIGADE_FIRST(bb);
>>> +             b != APR_BRIGADE_SENTINEL(bb);
>>> +             b = APR_BUCKET_NEXT(b))
>>> +        {
>>> +            if (!APR_BUCKET_IS_METADATA(b) && b->length != 0) {
>>> +                break;
>>> +            }
>>> +            else if (APR_BUCKET_IS_EOS(b)) {
>>> +                return 1;
>>> +            }
>>> +        }
>>>     }
>>> -
>>> -    for (b = APR_BRIGADE_FIRST(bb);
>>> -         b != APR_BRIGADE_SENTINEL(bb) && b != end;
>>> -         b = APR_BUCKET_NEXT(b))
>>> -    {
>>> -        if (APR_BUCKET_IS_EOS(b)) {
>>> -            return 1;
>>> +    else {
>>> +        apr_bucket *end;
>>> +        apr_status_t status = last_not_included(bb, len, 0, 0, &end);
>>> +        if (status != APR_SUCCESS) {
>>> +            return status;
>>
>> Do we want to assume EOS when last_not_included() fails?
>>
>>>         }
>>> +
>>> +        for (b = APR_BRIGADE_FIRST(bb);
>>> +             b != APR_BRIGADE_SENTINEL(bb) && b != end;
>>> +             b = APR_BUCKET_NEXT(b))
>>> +        {
>>> +            if (APR_BUCKET_IS_EOS(b)) {
>>> +                return 1;
>>> +            }
>>> +        }
>>>     }
>>>     return 0;
>>> }
>>
>> Regards,
>> Yann.
>

Reply via email to